feat: add subnet add-validator + align P-Chain command names with avalanchego tx types#33
Open
owenwahlgren wants to merge 3 commits into
Open
feat: add subnet add-validator + align P-Chain command names with avalanchego tx types#33owenwahlgren wants to merge 3 commits into
subnet add-validator + align P-Chain command names with avalanchego tx types#33owenwahlgren wants to merge 3 commits into
Conversation
Adds a validator to a permissioned subnet via AddSubnetValidatorTx, the classic path for managing validators on a permissioned subnet (distinct from `l1 register-validator`, which targets converted L1s). - pkg/pchain: AddSubnetValidator + issuer seam/config, mirroring the existing interface-based issue*Tx helpers - cmd/subnet: `subnet add-validator` with --subnet-id/--node-id/--weight /--start/--duration; subnet owner authorizes via subnet auth, so the wallet is loaded tracking the subnet - tests: pchain unit test + e2e help/missing-args coverage - docs: usage.md and pchain-operations.md
Rename commands so each maps 1:1 to the avalanchego transaction it issues, keeping the previous names as deprecated aliases (a warning is printed when an alias is used). pchain function names already matched the tx types. Renames (old name kept as alias): - validator add -> validator add-permissionless - validator delegate -> validator add-permissionless-delegator - subnet convert-l1 -> subnet convert-to-l1 - l1 set-weight -> l1 set-validator-weight - l1 add-balance -> l1 increase-validator-balance Also annotates each command's Short help with its tx type, adds a shared warnIfDeprecatedAlias helper, an e2e alias-deprecation test, and updates docs (usage.md, pchain-operations.md) and CLAUDE.md.
subnet add-validator command (AddSubnetValidatorTx)subnet add-validator + align P-Chain command names with avalanchego tx types
federiconardelli7
previously approved these changes
Jun 16, 2026
BREAKING CHANGE: the previous command names are removed entirely (no aliases). Old names now error with "unknown command". Migrate: - validator add -> validator add-permissionless - validator delegate -> validator add-permissionless-delegator - subnet convert-l1 -> subnet convert-to-l1 - l1 set-weight -> l1 set-validator-weight - l1 add-balance -> l1 increase-validator-balance - drop Aliases + warnIfDeprecatedAlias helper - command groups (validator/subnet/l1) now reject unknown subcommands via requireSubcommand so removed names fail loudly (exit 1) - e2e: assert old names are rejected; docs reframed as v2.0.0 migration
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Two related changes:
1. New command:
subnet add-validatorAdds a validator to a permissioned subnet via
AddSubnetValidatorTx— the gap where the CLI could add primary-network validators and L1 validators but not permissioned-subnet validators.--weightis sampling weight, not a stake amount.2. Align command names with avalanchego tx types
Every P-Chain command now maps 1:1 to the avalanchego transaction it issues. Old names are kept as deprecated aliases that still work and print a warning pointing at the canonical name.
validator addvalidator add-permissionlessAddPermissionlessValidatorTxvalidator delegatevalidator add-permissionless-delegatorAddPermissionlessDelegatorTxsubnet convert-l1subnet convert-to-l1ConvertSubnetToL1Txl1 set-weightl1 set-validator-weightSetL1ValidatorWeightTxl1 add-balancel1 increase-validator-balanceIncreaseL1ValidatorBalanceTxUnchanged (already canonical):
subnet create,subnet transfer-ownership,subnet add-validator,l1 register-validator,l1 disable-validator,chain create.transfer send/export/importmap to the genericBaseTx/ExportTx/ImportTxand are left as-is.Each command's
--helpnow also names the tx it issues, e.g.:Deprecation warning example:
Changes
pkg/pchain:AddSubnetValidator+AddSubnetValidatorConfig+addSubnetValidatorTxIssuerseam (matches the existing interface-basedissue*Txpattern). pchain function names already mirrored the tx types.cmd/: command renames +Aliases+warnIfDeprecatedAliashelper (inroot.go); tx-type annotations inShorthelp.TestIssueAddSubnetValidatorTx(unit); e2e coverage for the new command, the renamed help lists, andTestCLIDeprecatedAliasWarns.docs/usage.md,docs/pchain-operations.md,CLAUDE.md.Backward compatibility
No breaking changes — all old command names continue to work via aliases (with a deprecation warning).
Testing
go build,go vet ./...,staticcheck ./...,gofmt— cleango test ./pkg/...— passgo test -tags clie2e ./e2e/... -run "Help|MissingArgs|Params|DeprecatedAlias|EmptyValidators"— pass