refactor: replace func-typed injection seams in pkg/pchain with interfaces#30
Merged
Conversation
…faces The issue*Tx helpers took the wallet call as a function-typed parameter so unit tests could stub it. With multi-parameter builders the inline function types grew longer than the helper bodies (and the pattern was recently copied into an even larger 10-parameter signature in #28). Replace each seam with a single-method issuer interface mirroring the corresponding avalanchego wallet/chain/p method, so w.PWallet() satisfies them directly and tests stub a small struct instead of a closure. No behavior change: exported API, error messages, and wrapping are identical. Also gofmt's five files that were unformatted on main (same whitespace fixes as #29).
…lnerabilities govulncheck fails CI on main: GO-2026-5037 (crypto/x509), GO-2026-4971 (net), GO-2026-4918 (net/http + golang.org/x/net) are reachable from keystore key generation, wallet dialing, and network ID lookup. All are fixed in go1.25.10/1.25.11 and x/net v0.53.0. - go.mod: go 1.25.9 -> 1.25.11; x/net v0.47.0 -> v0.53.0 (pulls x/crypto, x/sys, x/term, x/text et al. forward) - ci.yml: bump setup-go and GOTOOLCHAIN pins to 1.25.11 govulncheck now reports 0 reachable vulnerabilities.
federiconardelli7
approved these changes
Jun 10, 2026
martineckardt
approved these changes
Jun 10, 2026
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.
Summary
The nine
issue*Txhelpers inpkg/pchain/pchain.gotook the avalanchego wallet call as a function-typed parameter so unit tests could stub it. With multi-parameter builders the inline function types grew longer than the helper bodies — and the pattern was recently copied in #28 into a 10-parameter version that drew, let's say, feedback from upstream.This replaces each seam with a single-method issuer interface mirroring the corresponding
wallet/chain/pwallet method, sow.PWallet()satisfies them directly:pkg/pchain(grep-verified)Send,AddValidator,CreateSubnet, …), error messages, and%wwrapping identicalAddAutoRenewedValidatorTxNote: includes the same whitespace-only gofmt fixes as #29 (five files unformatted on main) — whichever merges second rebases trivially.
Validation
gofmt -l .clean,go vet ./...clean, staticcheck v0.6.1 clean (plain + e2e tags)go test -race ./pkg/... ./cmd/...all pass;-tags=integrationcompile check passesgo test -tags=clie2e ./e2e/... -run "Help|Params|MissingArgs"passes