diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 3f0cef5..1aea823 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -16,7 +16,7 @@ jobs: - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: - go-version: "1.26.10" + go-version-file: go.mod - name: Verify go.mod is tidy run: | @@ -37,17 +37,17 @@ jobs: - name: Run staticcheck env: - GOTOOLCHAIN: go1.26.10 + GOTOOLCHAIN: local run: go run honnef.co/go/tools/cmd/staticcheck@v0.8.2 ./... - name: Run staticcheck (tagged e2e) env: - GOTOOLCHAIN: go1.26.10 + GOTOOLCHAIN: local run: go run honnef.co/go/tools/cmd/staticcheck@v0.8.2 -tags=clie2e,networke2e ./e2e/... - name: Run govulncheck env: - GOTOOLCHAIN: go1.26.10 + GOTOOLCHAIN: local run: go run golang.org/x/vuln/cmd/govulncheck@v1.2.0 ./... - name: Run tests @@ -56,6 +56,13 @@ jobs: - name: Run CLI e2e smoke tests run: go test -tags=clie2e -v ./e2e/... -run "Help|Params|MissingArgs|RemovedOldNames|UnknownSubcommand" + # Go 1.27+ enables encoding/json v2 by default. Run the smoke tests with + # it so JSON decoding regressions surface without a newer toolchain. + - name: Run CLI e2e smoke tests (encoding/json v2) + env: + GOEXPERIMENT: jsonv2 + run: go test -tags=clie2e ./e2e/... -run "Help|Params|MissingArgs|RemovedOldNames|UnknownSubcommand" + - name: Compile integration tests run: go test -tags=integration -run '^$' ./pkg/pchain/... diff --git a/.github/workflows/nightly-network-e2e.yml b/.github/workflows/nightly-network-e2e.yml index ba7b866..d1af173 100644 --- a/.github/workflows/nightly-network-e2e.yml +++ b/.github/workflows/nightly-network-e2e.yml @@ -20,7 +20,7 @@ jobs: - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: - go-version: "1.26.10" + go-version-file: go.mod - name: Verify Fuji key secret is configured env: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 182a405..b0ae3c8 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -27,10 +27,6 @@ jobs: goos: darwin goarch: arm64 cc: cc - - runner: macos-latest - goos: darwin - goarch: amd64 - cc: cc runs-on: ${{ matrix.runner }} steps: - uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4 @@ -38,7 +34,7 @@ jobs: - name: Set up Go uses: actions/setup-go@40f1582b2485089dde7abd97c1529aa768e1baff # v5 with: - go-version: "1.26.10" + go-version-file: go.mod - name: Install cross-compiler if: matrix.cross_deps != '' diff --git a/.goreleaser.yaml b/.goreleaser.yaml index 2917084..d6e91e7 100644 --- a/.goreleaser.yaml +++ b/.goreleaser.yaml @@ -17,6 +17,11 @@ builds: goarch: - amd64 - arm64 + ignore: + # avalanchego does not support darwin/amd64: its firewood FFI ships no + # x86_64-apple-darwin library. + - goos: darwin + goarch: amd64 ldflags: - -s -w -X github.com/ava-labs/platform-cli/cmd.version={{.Version}} overrides: diff --git a/README.md b/README.md index 92a5933..94981e8 100644 --- a/README.md +++ b/README.md @@ -5,7 +5,9 @@ Minimal CLI for Avalanche P-Chain operations. ## Installation Requirements: -- Go 1.24.13+ +- Go 1.26.11+ +- A cgo toolchain (C compiler) +- Linux (amd64, arm64) or macOS (arm64); macOS on Intel (darwin/amd64) is not supported ```bash go install github.com/ava-labs/platform-cli@main diff --git a/cmd/subnet.go b/cmd/subnet.go index 282931d..45c2799 100644 --- a/cmd/subnet.go +++ b/cmd/subnet.go @@ -5,7 +5,7 @@ import ( "strings" "github.com/ava-labs/avalanchego/ids" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" ethcommon "github.com/ava-labs/libevm/common" "github.com/ava-labs/platform-cli/pkg/network" "github.com/ava-labs/platform-cli/pkg/pchain" @@ -198,7 +198,7 @@ remaining balance. The command refuses to issue an empty owner unless you set } // Gather validator info from IPs or generate mock - var validators []*txs.ConvertSubnetToL1Validator + var validators []*platform.ConvertSubnetToL1Validator if subnetMockVal { // For mock, use the first weight if provided, otherwise 0 (default) var mockWeight uint64 @@ -212,7 +212,7 @@ remaining balance. The command refuses to issue an empty owner unless you set if err != nil { return fmt.Errorf("failed to generate mock validator: %w", err) } - validators = []*txs.ConvertSubnetToL1Validator{mockVal} + validators = []*platform.ConvertSubnetToL1Validator{mockVal} fmt.Printf("Using mock validator (NodeID: %x)\n", mockVal.NodeID) } else if hasManualValidators { validators, err = buildManualL1Validators( diff --git a/cmd/validators_spec.go b/cmd/validators_spec.go index 316faee..d269142 100644 --- a/cmd/validators_spec.go +++ b/cmd/validators_spec.go @@ -23,8 +23,8 @@ import ( "github.com/ava-labs/avalanchego/utils/crypto/bls" "github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner" "github.com/ava-labs/avalanchego/utils/formatting/address" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" nodeutil "github.com/ava-labs/platform-cli/pkg/node" "github.com/ava-labs/platform-cli/pkg/wallet" @@ -34,7 +34,7 @@ const defaultValidatorWeight uint64 = 100 // gatherL1Validators queries validator nodes and builds conversion validators. // If weights is non-nil, it must have the same length as validatorAddrs. -func gatherL1Validators(ctx context.Context, validatorAddrs []string, balance float64, weights []uint64) ([]*txs.ConvertSubnetToL1Validator, error) { +func gatherL1Validators(ctx context.Context, validatorAddrs []string, balance float64, weights []uint64) ([]*platform.ConvertSubnetToL1Validator, error) { if len(validatorAddrs) == 0 { return nil, fmt.Errorf("no validator addresses provided") } @@ -48,7 +48,7 @@ func gatherL1Validators(ctx context.Context, validatorAddrs []string, balance fl return nil, fmt.Errorf("invalid validator balance: %w", err) } - validators := make([]*txs.ConvertSubnetToL1Validator, 0, len(validatorAddrs)) + validators := make([]*platform.ConvertSubnetToL1Validator, 0, len(validatorAddrs)) for i, addr := range validatorAddrs { uri, err := normalizeNodeURI(addr) if err != nil { @@ -69,7 +69,7 @@ func gatherL1Validators(ctx context.Context, validatorAddrs []string, balance fl weight = weights[i] } - validators = append(validators, &txs.ConvertSubnetToL1Validator{ + validators = append(validators, &platform.ConvertSubnetToL1Validator{ NodeID: nodeID.Bytes(), Weight: weight, Balance: balanceNAVAX, @@ -83,7 +83,7 @@ func gatherL1Validators(ctx context.Context, validatorAddrs []string, balance fl // buildManualL1Validators builds conversion validators from manually provided data. // All inputs are comma-separated lists and must be aligned by index. // If weights is non-nil, it must have the same length as the other lists. -func buildManualL1Validators(nodeIDs, blsPubKeys, blsPoPs string, balance float64, weights []uint64) ([]*txs.ConvertSubnetToL1Validator, error) { +func buildManualL1Validators(nodeIDs, blsPubKeys, blsPoPs string, balance float64, weights []uint64) ([]*platform.ConvertSubnetToL1Validator, error) { if strings.TrimSpace(nodeIDs) == "" || strings.TrimSpace(blsPubKeys) == "" || strings.TrimSpace(blsPoPs) == "" { return nil, fmt.Errorf("manual validator mode requires --validator-node-ids, --validator-bls-public-keys, and --validator-bls-pops") } @@ -109,7 +109,7 @@ func buildManualL1Validators(nodeIDs, blsPubKeys, blsPoPs string, balance float6 return nil, fmt.Errorf("invalid validator balance: %w", err) } - validators := make([]*txs.ConvertSubnetToL1Validator, 0, len(idsList)) + validators := make([]*platform.ConvertSubnetToL1Validator, 0, len(idsList)) for i := range idsList { nodeID, err := ids.NodeIDFromString(idsList[i]) if err != nil { @@ -125,7 +125,7 @@ func buildManualL1Validators(nodeIDs, blsPubKeys, blsPoPs string, balance float6 weight = weights[i] } - validators = append(validators, &txs.ConvertSubnetToL1Validator{ + validators = append(validators, &platform.ConvertSubnetToL1Validator{ NodeID: nodeID.Bytes(), Weight: weight, Balance: balanceNAVAX, @@ -137,7 +137,7 @@ func buildManualL1Validators(nodeIDs, blsPubKeys, blsPoPs string, balance float6 } // sortAndValidateL1Validators sorts validators by NodeID bytes and rejects duplicates. -func sortAndValidateL1Validators(validators []*txs.ConvertSubnetToL1Validator) error { +func sortAndValidateL1Validators(validators []*platform.ConvertSubnetToL1Validator) error { sort.Slice(validators, func(i, j int) bool { return bytes.Compare(validators[i].NodeID, validators[j].NodeID) < 0 }) @@ -232,7 +232,7 @@ func parsePChainAddress(addr, hrp string) (ids.ShortID, error) { // any P-Chain key can disable the validator and spend its remaining balance. // Unless allowEmpty is set, an empty owner returns errEmptyValidatorOwner. func setL1ValidatorOwners( - validators []*txs.ConvertSubnetToL1Validator, + validators []*platform.ConvertSubnetToL1Validator, remainingBalanceOwners []ids.ShortID, deactivationOwners []ids.ShortID, defaultOwner ids.ShortID, @@ -262,7 +262,7 @@ func setL1ValidatorOwners( // align with validators in input order, so the owners must be set before the // sort. func finalizeL1Validators( - validators []*txs.ConvertSubnetToL1Validator, + validators []*platform.ConvertSubnetToL1Validator, remainingBalanceOwners []ids.ShortID, deactivationOwners []ids.ShortID, defaultOwner ids.ShortID, @@ -364,7 +364,7 @@ func normalizeNodeURI(addr string) (string, error) { // generateMockValidator creates a mock validator with valid BLS credentials for testing. // If weight is 0, defaultValidatorWeight (100) is used as the default. -func generateMockValidator(balance float64, weight uint64) (*txs.ConvertSubnetToL1Validator, error) { +func generateMockValidator(balance float64, weight uint64) (*platform.ConvertSubnetToL1Validator, error) { // Validate balance to prevent overflow balanceNAVAX, err := avaxToNAVAX(balance) if err != nil { @@ -392,7 +392,7 @@ func generateMockValidator(balance float64, weight uint64) (*txs.ConvertSubnetTo return nil, fmt.Errorf("failed to generate proof of possession: %w", err) } - return &txs.ConvertSubnetToL1Validator{ + return &platform.ConvertSubnetToL1Validator{ NodeID: nodeID, Weight: weight, Balance: balanceNAVAX, diff --git a/cmd/validators_spec_test.go b/cmd/validators_spec_test.go index ec10943..73f8763 100644 --- a/cmd/validators_spec_test.go +++ b/cmd/validators_spec_test.go @@ -14,8 +14,8 @@ import ( "github.com/ava-labs/avalanchego/utils/crypto/bls" "github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner" "github.com/ava-labs/avalanchego/utils/formatting/address" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" ) @@ -428,9 +428,9 @@ func TestGatherL1Validators_InputValidation(t *testing.T) { } func TestSortAndValidateL1Validators_SortsByNodeID(t *testing.T) { - v1 := &txs.ConvertSubnetToL1Validator{NodeID: []byte{0x02}, Weight: 1} - v2 := &txs.ConvertSubnetToL1Validator{NodeID: []byte{0x01}, Weight: 1} - validators := []*txs.ConvertSubnetToL1Validator{v1, v2} + v1 := &platform.ConvertSubnetToL1Validator{NodeID: []byte{0x02}, Weight: 1} + v2 := &platform.ConvertSubnetToL1Validator{NodeID: []byte{0x01}, Weight: 1} + validators := []*platform.ConvertSubnetToL1Validator{v1, v2} if err := sortAndValidateL1Validators(validators); err != nil { t.Fatalf("sortAndValidateL1Validators() error = %v", err) @@ -441,7 +441,7 @@ func TestSortAndValidateL1Validators_SortsByNodeID(t *testing.T) { } func TestSortAndValidateL1Validators_DuplicateNodeID(t *testing.T) { - validators := []*txs.ConvertSubnetToL1Validator{ + validators := []*platform.ConvertSubnetToL1Validator{ {NodeID: []byte{0x01}, Weight: 1}, {NodeID: []byte{0x01}, Weight: 1}, } @@ -646,7 +646,7 @@ func TestSetL1ValidatorOwners(t *testing.T) { } for _, tt := range tests { t.Run(tt.name, func(t *testing.T) { - validators := []*txs.ConvertSubnetToL1Validator{ + validators := []*platform.ConvertSubnetToL1Validator{ {NodeID: []byte{0x01}}, {NodeID: []byte{0x02}}, } @@ -680,7 +680,7 @@ func TestSetL1ValidatorOwners(t *testing.T) { func TestFinalizeL1ValidatorsKeepsOwnersWithValidators(t *testing.T) { addr1 := ids.GenerateTestShortID() addr2 := ids.GenerateTestShortID() - validators := []*txs.ConvertSubnetToL1Validator{ + validators := []*platform.ConvertSubnetToL1Validator{ {NodeID: []byte{0x02}}, {NodeID: []byte{0x01}}, } diff --git a/e2e/pchain_test.go b/e2e/pchain_test.go index 6fe68a3..717bc33 100644 --- a/e2e/pchain_test.go +++ b/e2e/pchain_test.go @@ -25,8 +25,8 @@ import ( "github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner" "github.com/ava-labs/avalanchego/utils/units" "github.com/ava-labs/avalanchego/vms/platformvm" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/platform-cli/pkg/crosschain" "github.com/ava-labs/platform-cli/pkg/network" "github.com/ava-labs/platform-cli/pkg/pchain" @@ -173,7 +173,7 @@ func getTestFullWallet(t *testing.T) (*wallet.FullWallet, network.Config) { // generateMockValidator creates a mock validator with valid BLS credentials. // The validator won't be a real node, but has cryptographically valid PoP. -func generateMockValidator(t *testing.T, balance uint64) *txs.ConvertSubnetToL1Validator { +func generateMockValidator(t *testing.T, balance uint64) *platform.ConvertSubnetToL1Validator { t.Helper() // Generate random NodeID (20 bytes) @@ -193,7 +193,7 @@ func generateMockValidator(t *testing.T, balance uint64) *txs.ConvertSubnetToL1V t.Fatalf("failed to generate proof of possession: %v", err) } - return &txs.ConvertSubnetToL1Validator{ + return &platform.ConvertSubnetToL1Validator{ NodeID: nodeID, Weight: units.Schmeckle, // 1 weight unit Balance: balance, @@ -783,7 +783,7 @@ func TestL1Lifecycle(t *testing.T) { // Generate mock validator with valid BLS credentials // Balance: 1 AVAX for the validator mockValidator := generateMockValidator(t, 1*units.Avax) - validators := []*txs.ConvertSubnetToL1Validator{mockValidator} + validators := []*platform.ConvertSubnetToL1Validator{mockValidator} t.Logf(" Mock validator NodeID: %x", mockValidator.NodeID) diff --git a/go.mod b/go.mod index 1cf6dbc..3e9c023 100644 --- a/go.mod +++ b/go.mod @@ -1,13 +1,11 @@ module github.com/ava-labs/platform-cli -go 1.26.0 - -toolchain go1.26.10 +go 1.26.11 require ( - github.com/ava-labs/avalanchego v1.14.3-0.20260717165702-e57c7914a68e + github.com/ava-labs/avalanchego v1.15.3 github.com/ava-labs/ledger-avalanche-go v1.1.0 - github.com/ava-labs/libevm v1.13.15-0.20260716180230-f887fa4393ca + github.com/ava-labs/libevm v1.13.15-0.20261028200218-d398bc4dbe41 github.com/spf13/cobra v1.9.1 golang.org/x/crypto v0.57.0 golang.org/x/term v0.46.0 @@ -18,10 +16,11 @@ require ( connectrpc.com/grpcreflect v1.3.0 // indirect github.com/DataDog/zstd v1.5.2 // indirect github.com/Microsoft/go-winio v0.6.2 // indirect - github.com/StephenButtolph/canoto v0.18.0 // indirect + github.com/StephenButtolph/canoto v0.19.0 // indirect github.com/VictoriaMetrics/fastcache v1.12.1 // indirect - github.com/ava-labs/avalanchego/graft/coreth v1.14.3-0.20260602193739-919446e8501f // indirect - github.com/ava-labs/avalanchego/graft/evm v1.14.3-0.20260602193739-919446e8501f // indirect + github.com/ava-labs/avalanchego/graft/coreth v1.15.3 // indirect + github.com/ava-labs/avalanchego/graft/evm v1.15.3 // indirect + github.com/ava-labs/firewood-go/ffi v0.9.1 // indirect github.com/beorn7/perks v1.0.1 // indirect github.com/bits-and-blooms/bitset v1.20.0 // indirect github.com/btcsuite/btcd/btcec/v2 v2.3.5 // indirect @@ -34,14 +33,18 @@ require ( github.com/cockroachdb/redact v1.1.3 // indirect github.com/cockroachdb/tokenbucket v0.0.0-20230807174530-cc333fc44b06 // indirect github.com/consensys/gnark-crypto v0.18.1 // indirect + github.com/cpuguy83/go-md2man/v2 v2.0.6 // indirect github.com/crate-crypto/go-ipa v0.0.0-20231025140028-3c0104f4b233 // indirect github.com/crate-crypto/go-kzg-4844 v1.1.0 // indirect github.com/davecgh/go-spew v1.1.2-0.20180830191138-d8f796af33cc // indirect github.com/deckarep/golang-set/v2 v2.1.0 // indirect github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0 // indirect + github.com/dlclark/regexp2 v1.11.5 // indirect + github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 // indirect github.com/emicklei/go-restful/v3 v3.11.0 // indirect github.com/ethereum/c-kzg-4844 v1.0.0 // indirect github.com/fsnotify/fsnotify v1.9.0 // indirect + github.com/gballet/go-libpcsclite v0.0.0-20191108122812-4678299bea08 // indirect github.com/gballet/go-verkle v0.1.1-0.20231031103413-a67434b50f46 // indirect github.com/getsentry/sentry-go v0.35.0 // indirect github.com/go-logr/logr v1.4.4 // indirect @@ -50,31 +53,43 @@ require ( github.com/go-openapi/jsonpointer v0.19.6 // indirect github.com/go-openapi/jsonreference v0.20.2 // indirect github.com/go-openapi/swag v0.22.3 // indirect + github.com/go-sourcemap/sourcemap v2.1.3+incompatible // indirect github.com/go-viper/mapstructure/v2 v2.4.0 // indirect github.com/gofrs/flock v0.12.1 // indirect github.com/gogo/protobuf v1.3.2 // indirect + github.com/golang-jwt/jwt/v4 v4.5.2 // indirect github.com/golang/protobuf v1.5.4 // indirect github.com/golang/snappy v0.0.5-0.20220116011046-fa5810519dcb // indirect github.com/google/btree v1.1.3 // indirect github.com/google/gnostic-models v0.6.8 // indirect + github.com/google/go-cmp v0.7.0 // indirect github.com/google/gofuzz v1.2.0 // indirect + github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 // indirect github.com/google/renameio/v2 v2.0.0 // indirect github.com/google/uuid v1.6.0 // indirect github.com/gorilla/mux v1.8.0 // indirect github.com/gorilla/rpc v1.2.0 // indirect github.com/gorilla/websocket v1.5.3 // indirect github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0 // indirect + github.com/hashicorp/go-bexpr v0.1.10 // indirect + github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 // indirect github.com/holiman/bloomfilter/v2 v2.0.3 // indirect github.com/holiman/uint256 v1.2.4 // indirect + github.com/huin/goupnp v1.3.0 // indirect github.com/imdario/mergo v0.3.16 // indirect github.com/inconshreveable/mousetrap v1.1.0 // indirect + github.com/jackpal/go-nat-pmp v1.0.2 // indirect github.com/josharian/intern v1.0.0 // indirect github.com/json-iterator/go v1.1.12 // indirect - github.com/klauspost/compress v1.18.0 // indirect + github.com/klauspost/compress v1.20.2 // indirect github.com/kr/pretty v0.3.1 // indirect github.com/kr/text v0.2.0 // indirect github.com/mailru/easyjson v0.7.7 // indirect + github.com/mattn/go-colorable v0.1.14 // indirect + github.com/mattn/go-isatty v0.0.20 // indirect github.com/mattn/go-runewidth v0.0.16 // indirect + github.com/mitchellh/mapstructure v1.5.0 // indirect + github.com/mitchellh/pointerstructure v1.2.0 // indirect github.com/moby/spdystream v0.5.1 // indirect github.com/modern-go/concurrent v0.0.0-20180306012644-bacd9c7ef1dd // indirect github.com/modern-go/reflect2 v1.0.2 // indirect @@ -92,6 +107,7 @@ require ( github.com/rivo/uniseg v0.4.7 // indirect github.com/rogpeppe/go-internal v1.14.1 // indirect github.com/rs/cors v1.7.0 // indirect + github.com/russross/blackfriday/v2 v2.1.0 // indirect github.com/sagikazarmark/locafero v0.9.0 // indirect github.com/shirou/gopsutil v3.21.11+incompatible // indirect github.com/sourcegraph/conc v0.3.0 // indirect @@ -99,11 +115,15 @@ require ( github.com/spf13/cast v1.9.2 // indirect github.com/spf13/pflag v1.0.10 // indirect github.com/spf13/viper v1.20.1 // indirect + github.com/status-im/keycard-go v0.2.0 // indirect github.com/subosito/gotenv v1.6.0 // indirect github.com/supranational/blst v0.3.14 // indirect github.com/syndtr/goleveldb v1.0.1-0.20220614013038-64ee5596c38a // indirect github.com/tklauser/go-sysconf v0.3.15 // indirect github.com/tklauser/numcpus v0.10.0 // indirect + github.com/tyler-smith/go-bip39 v1.1.0 // indirect + github.com/urfave/cli/v2 v2.25.7 // indirect + github.com/xrash/smetrics v0.0.0-20201216005158-039620a65673 // indirect github.com/yusufpapurcu/wmi v1.2.4 // indirect github.com/zondax/golem v0.27.0 // indirect github.com/zondax/hid v0.9.2 // indirect @@ -130,7 +150,7 @@ require ( gonum.org/v1/gonum v0.17.0 // indirect google.golang.org/genproto/googleapis/api v0.0.0-20260803160001-6ac0973c030d // indirect google.golang.org/genproto/googleapis/rpc v0.0.0-20260803160001-6ac0973c030d // indirect - google.golang.org/grpc v1.83.1 // indirect + google.golang.org/grpc v1.83.2 // indirect google.golang.org/protobuf v1.36.11 // indirect gopkg.in/inf.v0 v0.9.1 // indirect gopkg.in/natefinch/lumberjack.v2 v2.0.0 // indirect diff --git a/go.sum b/go.sum index 7d8751a..1262ce5 100644 --- a/go.sum +++ b/go.sum @@ -15,8 +15,8 @@ github.com/Joker/hpp v1.0.0/go.mod h1:8x5n+M1Hp5hC0g8okX3sR3vFQwynaX/UgSOM9MeBKz github.com/Microsoft/go-winio v0.6.2 h1:F2VQgta7ecxGYO8k3ZZz3RS8fVIXVxONVUPlNERoyfY= github.com/Microsoft/go-winio v0.6.2/go.mod h1:yd8OoFMLzJbo9gZq8j5qaps8bJ9aShtEA8Ipt1oGCvU= github.com/Shopify/goreferrer v0.0.0-20181106222321-ec9c9a553398/go.mod h1:a1uqRtAwp2Xwc6WNPJEufxJ7fx3npB4UV/JOLmbu5I0= -github.com/StephenButtolph/canoto v0.18.0 h1:czLis9aEly5R/ExPwB5X0PJLhXi7Sv4PpffaAJV3KnE= -github.com/StephenButtolph/canoto v0.18.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o= +github.com/StephenButtolph/canoto v0.19.0 h1:a28jijQ4gyaSW920h69nX1E/o9WilHlx6L9PVuLkB/Y= +github.com/StephenButtolph/canoto v0.19.0/go.mod h1:01RsiQp1gnV1eJ6LwygP6buPCLUoAz7jKadQSB0FI0o= github.com/VictoriaMetrics/fastcache v1.12.1 h1:i0mICQuojGDL3KblA7wUNlY5lOK6a4bwt3uRKnkZU40= github.com/VictoriaMetrics/fastcache v1.12.1/go.mod h1:tX04vaqcNoQeGLD+ra5pU5sWkuxnzWhEzLwhP9w653o= github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII= @@ -26,18 +26,20 @@ github.com/allegro/bigcache v1.2.1-0.20190218064605-e24eb225f156/go.mod h1:Cb/ax github.com/armon/consul-api v0.0.0-20180202201655-eb2c6b5be1b6/go.mod h1:grANhF5doyWs3UAsr3K4I6qtAmlQcZDesFNEHPZAzj8= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5 h1:0CwZNZbxp69SHPdPJAN/hZIm0C4OItdklCFmMRWYpio= github.com/armon/go-socks5 v0.0.0-20160902184237-e75332964ef5/go.mod h1:wHh0iHkYZB8zMSxRWpUBQtwG5a7fFgvEO+odwuTv2gs= -github.com/ava-labs/avalanchego v1.14.3-0.20260717165702-e57c7914a68e h1:anVfNDdokuI6z+P0HymfTMK6gpKDqED+C/pJ335pOc0= -github.com/ava-labs/avalanchego v1.14.3-0.20260717165702-e57c7914a68e/go.mod h1:kgPKmOq0ik86g6Vq9Cvqd2wT0UZEkQZiqPxPF7jBwnc= -github.com/ava-labs/avalanchego/graft/coreth v1.14.3-0.20260602193739-919446e8501f h1:BJ96PwQIvi+ZVpgLAbSsCyGvtDMBvDhDNrinEUPbS4o= -github.com/ava-labs/avalanchego/graft/coreth v1.14.3-0.20260602193739-919446e8501f/go.mod h1:26DyfT1dixgAro93kATSn0IwMsClMLhdhyfG/wn1ggg= -github.com/ava-labs/avalanchego/graft/evm v1.14.3-0.20260602193739-919446e8501f h1:1X6Vx7YtLBc2y5HqG3u5cXF7w8HNHwtW6jGUCXCHYOg= -github.com/ava-labs/avalanchego/graft/evm v1.14.3-0.20260602193739-919446e8501f/go.mod h1:26znzSsbvyDdC8gt8pzQNdANjD5xaEXYkJsaUQl28O4= -github.com/ava-labs/firewood-go-ethhash/ffi v0.8.0 h1:EDhwnUb6Fy/88cqUCcuj0R5u8isB+Vv++v/r2mawp2g= -github.com/ava-labs/firewood-go-ethhash/ffi v0.8.0/go.mod h1:3pf8KGfCmqegWoY5/pZ1NHUcyuRkfl/vHQuOjsdUtbI= +github.com/arr4n/shed v0.0.0-20260908170710-35e123a98127 h1:TU5hfzfrqHuGepNJCL3Y3mZi/DmDDiM6RKITFtpTVTc= +github.com/arr4n/shed v0.0.0-20260908170710-35e123a98127/go.mod h1:eD5UkxiWTdbkqM7mg2Xf981SAeWQ/Q80js/1rFcKpfg= +github.com/ava-labs/avalanchego v1.15.3 h1:Q2pkLbwm7KTA4rhZITvYfn8dj1TAdtAM5BVCWp7p9Lk= +github.com/ava-labs/avalanchego v1.15.3/go.mod h1:p3mwE6GpEQ7okIwgUZohRrUdu/yGiYus8nm9HhIlc9Q= +github.com/ava-labs/avalanchego/graft/coreth v1.15.3 h1:OXFoLL++i04aN8ow7vhgTcmoHPJnrjsAO++2sj3Ma1Q= +github.com/ava-labs/avalanchego/graft/coreth v1.15.3/go.mod h1:Xsu29XRncV1bakymfkV5iHKlAmaxQxB3nAuGUS+LvBY= +github.com/ava-labs/avalanchego/graft/evm v1.15.3 h1:T2edij3cxbIyhfx1FJrzs2OKeQrDtNREzYIziasZEQM= +github.com/ava-labs/avalanchego/graft/evm v1.15.3/go.mod h1:Vfdz0x3l+ZPeJp2HJsK8uCBkYZh9ODZQZLQzGvkxX0g= +github.com/ava-labs/firewood-go/ffi v0.9.1 h1:VBHTZDidBoBxkzfLeXYh3Wby5kQyU9DImCc1sxbCCAM= +github.com/ava-labs/firewood-go/ffi v0.9.1/go.mod h1:DsiOCyHGiwiwuqQxbSY6T5HkTHT8uGHbM+f0CJQIRfw= github.com/ava-labs/ledger-avalanche-go v1.1.0 h1:OkscKtb/gX20HBt8RyAtwXLrQnCEls5SzWGieE7NoNM= github.com/ava-labs/ledger-avalanche-go v1.1.0/go.mod h1:mAlG9ptnPjvNoLGLHXnM3slGY8ewvBJtJNVTEjG8KvI= -github.com/ava-labs/libevm v1.13.15-0.20260716180230-f887fa4393ca h1:VEjyvhWTn6FR/tr3wzHnAgAMpVIAu4P5kDQKycbWGWQ= -github.com/ava-labs/libevm v1.13.15-0.20260716180230-f887fa4393ca/go.mod h1:6NxGoR1aLABnfLy+fncXRj0W6rUoUrXghnAWZ+Rhr4o= +github.com/ava-labs/libevm v1.13.15-0.20261028200218-d398bc4dbe41 h1:dP7gPw/saBgzyvqQyNeZhPtq3CvDGY68Qeejoe1Y2Mk= +github.com/ava-labs/libevm v1.13.15-0.20261028200218-d398bc4dbe41/go.mod h1:8yAUPU6+VsyTW2vhZ6J6dDO8Z3fCkg2ulAYfRCbtVTQ= github.com/aymerick/raymond v2.0.3-0.20180322193309-b565731e1464+incompatible/go.mod h1:osfaiScAUVup+UC9Nfq76eWqDhXlp+4UYaA8uhTBO6g= github.com/beorn7/perks v1.0.1 h1:VlbKKnNfV8bJzeqoa4cOKqO6bYr3WgKZxO8Z16+hsOM= github.com/beorn7/perks v1.0.1/go.mod h1:G2ZrVWU2WbWT9wwq4/hrbKbnv/1ERSJQ0ibhJ6rlkpw= @@ -77,8 +79,11 @@ github.com/cespare/xxhash/v2 v2.2.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XL github.com/cespare/xxhash/v2 v2.3.0 h1:UL815xU9SqsFlibzuggzjXhog7bL6oX9BbNZnL2UFvs= github.com/cespare/xxhash/v2 v2.3.0/go.mod h1:VGX0DQ3Q6kWi7AoAeZDth3/j3BFtOZR5XLFGgcrjCOs= github.com/chzyer/logex v1.1.10/go.mod h1:+Ywpsq7O8HXn0nuIou7OrIPyXbp3wmkHB+jjWRnGsAI= +github.com/chzyer/logex v1.2.0/go.mod h1:9+9sk7u7pGNWYMkh0hdiL++6OeibzJccyQU4p4MedaY= github.com/chzyer/readline v0.0.0-20180603132655-2972be24d48e/go.mod h1:nSuG5e5PlCu98SY8svDHJxuZscDgtXS6KTTbou5AhLI= +github.com/chzyer/readline v1.5.0/go.mod h1:x22KAscuvRqlLoK9CsoYsmxoXZMMFVyOl86cAH8qUic= github.com/chzyer/test v0.0.0-20180213035817-a1ea475d72b1/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= +github.com/chzyer/test v0.0.0-20210722231415-061457976a23/go.mod h1:Q3SI9o4m/ZMnBNeIyt5eFwwo7qiLfzFZmjNmxjkiQlU= github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw= github.com/cncf/udpa/go v0.0.0-20201120205902-5459f2c99403/go.mod h1:WmhPx2Nbnhtbo57+VJT5O0JRkEi1Wbu0z5j0R8u5Hbk= github.com/cockroachdb/datadriven v1.0.2/go.mod h1:a9RdTaap04u637JoCzcUoIcDmvwSUtcUFtT/C3kJlTU= @@ -101,7 +106,6 @@ github.com/consensys/gnark-crypto v0.18.1/go.mod h1:L3mXGFTe1ZN+RSJ+CLjUt9x7PNdx github.com/coreos/etcd v3.3.10+incompatible/go.mod h1:uF7uidLiAD3TWHmW31ZFd/JWoc32PjwdhPthX9715RE= github.com/coreos/go-etcd v2.0.0+incompatible/go.mod h1:Jez6KQU2B/sWsbdaef3ED8NzMklzPG4d5KIOhIy30Tk= github.com/coreos/go-semver v0.2.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk= -github.com/cpuguy83/go-md2man v1.0.10 h1:BSKMNlYxDvnunlTymqtgONjNnaRV1sTpcovwwjF22jk= github.com/cpuguy83/go-md2man v1.0.10/go.mod h1:SmD6nW6nTyfqj6ABTjUi3V3JVMnlJmwcJI5acqYI6dE= github.com/cpuguy83/go-md2man/v2 v2.0.6 h1:XJtiaUW6dEEqVuZiMTn1ldk455QWwEIsMIJlo5vtkx0= github.com/cpuguy83/go-md2man/v2 v2.0.6/go.mod h1:oOW0eioCTA6cOiMLiUPZOpcVxMig6NIQQ7OS05n1F4g= @@ -126,6 +130,15 @@ github.com/decred/dcrd/dcrec/secp256k1/v4 v4.4.0/go.mod h1:ZXNYxsqcloTdSy/rNShjY github.com/decred/dcrd/lru v1.0.0/go.mod h1:mxKOwFd7lFjN2GZYsiz/ecgqR6kkYAl+0pz0tEMk218= github.com/dgraph-io/badger v1.6.0/go.mod h1:zwt7syl517jmP8s94KqSxTlM6IMsdhYy6psNgSztDR4= github.com/dgryski/go-farm v0.0.0-20190423205320-6a90982ecee2/go.mod h1:SqUrOPUnsFjfmXRMNPybcSiG0BgUW2AuFH8PAnS2iTw= +github.com/dlclark/regexp2 v1.4.1-0.20201116162257-a2a8dda75c91/go.mod h1:2pZnwuY/m+8K6iRw6wQdMtk+rH5tNGR1i55kozfMjCc= +github.com/dlclark/regexp2 v1.7.0/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dlclark/regexp2 v1.11.5 h1:Q/sSnsKerHeCkc/jSTNq1oCm7KiVgUMZRDUoRu0JQZQ= +github.com/dlclark/regexp2 v1.11.5/go.mod h1:DHkYz0B9wPfa6wondMfaivmHpzrQ3v9q8cnmRbL6yW8= +github.com/dop251/goja v0.0.0-20211022113120-dc8c55024d06/go.mod h1:R9ET47fwRVRPZnOGvHxxhuZcbrMCuiqOz3Rlrh4KSnk= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127 h1:qwcF+vdFrvPSEUDSX5RVoRccG8a5DhOdWdQ4zN62zzo= +github.com/dop251/goja v0.0.0-20230806174421-c933cf95e127/go.mod h1:QMWlm50DNe14hD7t24KEqZuUdC9sOTy8W6XbCU1mlw4= +github.com/dop251/goja_nodejs v0.0.0-20210225215109-d91c329300e7/go.mod h1:hn7BA7c8pLvoGndExHudxTDKZ84Pyvv+90pbBjbTz0Y= +github.com/dop251/goja_nodejs v0.0.0-20211022123610-8dd9abb0616d/go.mod h1:DngW8aVqWbuLRMHItjPUyqdj+HWPvnQe8V8y1nDpIbM= github.com/dustin/go-humanize v1.0.0/go.mod h1:HtrtbFcZ19U5GC7JDqmcUSB87Iq5E25KnS6fMYU6eOk= github.com/eknkc/amber v0.0.0-20171010120322-cdade1c07385/go.mod h1:0vRUJqYpeSZifjYj7uP3BG/gKcuzL9xWVV/Y+cK33KM= github.com/emicklei/go-restful/v3 v3.11.0 h1:rAQeMHw1c7zTmncogyy8VvRZwtkmkZ4FxERmMY4rD+g= @@ -176,6 +189,8 @@ github.com/go-openapi/jsonreference v0.20.2 h1:3sVjiK66+uXK/6oQ8xgcRKcFgQ5KXa2Kv github.com/go-openapi/jsonreference v0.20.2/go.mod h1:Bl1zwGIM8/wsvqjsOQLJ/SH+En5Ap4rVB5KVcIDZG2k= github.com/go-openapi/swag v0.22.3 h1:yMBqmnQ0gyZvEb/+KzuWZOXgllrXT4SADYbvDaXHv/g= github.com/go-openapi/swag v0.22.3/go.mod h1:UzaqsxGiab7freDnrUUra0MwWfN/q7tE4j+VcZ0yl14= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible h1:W1iEw64niKVGogNgBN3ePyLFfuisuzeidWPMPWmECqU= +github.com/go-sourcemap/sourcemap v2.1.3+incompatible/go.mod h1:F8jJfvm2KbVjc5NqelyYJmf/v5J0dwNLS2mL4sNA1Jg= github.com/go-task/slim-sprig v0.0.0-20210107165309-348f09dbbbc0/go.mod h1:fyg7847qk6SyHyPtNmDHnmrv/HOrqktSC+C9fM+CJOE= github.com/go-task/slim-sprig v0.0.0-20230315185526-52ccab3ef572 h1:tfuBGBXKqDEevZMzYi5KSi8KkcZtzBcTgAUUtapy0OI= github.com/go-task/slim-sprig/v3 v3.0.0 h1:sUs3vkvUymDpBKi3qH1YSqBQk9+9D/8M2mN1vB6EwHI= @@ -194,6 +209,8 @@ github.com/gogo/protobuf v1.3.2 h1:Ov1cvc58UF3b5XjBnZv7+opcTcQFZebYjWzi34vdm4Q= github.com/gogo/protobuf v1.3.2/go.mod h1:P1XiOD3dCwIKUDQYPy72D8LYyHL2YPYrpS2s69NZV8Q= github.com/gogo/status v1.1.0/go.mod h1:BFv9nrluPLmrS0EmGVvLaPNmRosr9KapBYd5/hpY1WM= github.com/golang-jwt/jwt v3.2.2+incompatible/go.mod h1:8pz2t5EyA70fFQQSrl6XZXzqecmYZeUEB8OUGHkxJ+I= +github.com/golang-jwt/jwt/v4 v4.5.2 h1:YtQM7lnr8iZ+j5q71MGKkNw9Mn7AjHM68uc9g5fXeUI= +github.com/golang-jwt/jwt/v4 v4.5.2/go.mod h1:m21LjoU+eqJr34lmDMbreY2eSTRJ1cv77w39/MY0Ch0= github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q= github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A= github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= @@ -232,6 +249,7 @@ github.com/google/gofuzz v1.0.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/ github.com/google/gofuzz v1.2.0 h1:xRy4A+RhZaiKjJ1bPfwQ8sedCA+YS2YcCHW6ec7JMi0= github.com/google/gofuzz v1.2.0/go.mod h1:dBl0BpW6vV/+mYPU4Po3pmUjxk6FQPldtuIdl/M65Eg= github.com/google/pprof v0.0.0-20210407192527-94a9f03dee38/go.mod h1:kpwsk12EmLew5upagYY7GY0pfYCcupk39gWOCRROcvE= +github.com/google/pprof v0.0.0-20230207041349-798e818bf904/go.mod h1:uglQLonpP8qtYCYyzA+8c/9qtqgA3qsXGYqCPKARAFg= github.com/google/pprof v0.0.0-20250403155104-27863c87afa6 h1:BHT72Gu3keYf3ZEu2J0b1vyeLSOYI8bm5wbJM/8yDe8= github.com/google/pprof v0.0.0-20250403155104-27863c87afa6/go.mod h1:boTsfXsheKC2y+lKOCMpSfarhxDeIzfZG1jqGcPl3cA= github.com/google/renameio/v2 v2.0.0 h1:UifI23ZTGY8Tt29JbYFiuyIU3eX+RNFtUwefq9qAhxg= @@ -252,8 +270,6 @@ github.com/grpc-ecosystem/grpc-gateway/v2 v2.29.0/go.mod h1:Hyl3n6Twe1hvtd9XUXDe github.com/hashicorp/go-bexpr v0.1.10 h1:9kuI5PFotCboP3dkDYFr/wi0gg0QVbSNz5oFRpxn4uE= github.com/hashicorp/go-bexpr v0.1.10/go.mod h1:oxlubA2vC/gFVfX1A6JGp7ls7uCDlfJn732ehYYg+g0= github.com/hashicorp/go-version v1.2.0/go.mod h1:fltr4n8CU8Ke44wwGCBoEymUuxUHl09ZGVZPK5anwXA= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d h1:dg1dEPuWpEqDnvIw251EVy4zlP8gWbsGj4BsUKCRpYs= -github.com/hashicorp/golang-lru v0.5.5-0.20210104140557-80c98217689d/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4= github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4 h1:X4egAf/gcS1zATw6wn4Ej8vjuVGxeHdan+bRb2ebyv4= github.com/holiman/billy v0.0.0-20240216141850-2abb0c79d3c4/go.mod h1:5GuXa7vkL8u9FkFuWdVvfR5ix8hRB7DbOAaYULamFpc= @@ -266,6 +282,7 @@ github.com/huin/goupnp v1.3.0 h1:UvLUlWDNpoUdYzb2TCn+MuTWtcjXKSza2n6CBdQ0xXc= github.com/huin/goupnp v1.3.0/go.mod h1:gnGPsThkYa7bFi/KWmEysQRf48l2dvR5bxr2OFckNX8= github.com/hydrogen18/memlistener v0.0.0-20200120041712-dcc25e7acd91/go.mod h1:qEIFzExnS6016fRpRfxrExeVn2gbClQA99gQhnIcdhE= github.com/ianlancetaylor/demangle v0.0.0-20200824232613-28f6c0f3b639/go.mod h1:aSSvb/t6k1mPoxDqO4vJh6VOCGPwU4O0C2/Eqndh1Sc= +github.com/ianlancetaylor/demangle v0.0.0-20220319035150-800ac71e25c2/go.mod h1:aYm2/VgdVmcIU8iMfdMvDMsRAQjcfZSKFby6HOFvi/w= github.com/imdario/mergo v0.3.16 h1:wwQJbIsHYGMUyLSPrEq1CT16AhnhNJQ51+4fdHUnCl4= github.com/imdario/mergo v0.3.16/go.mod h1:WBLT9ZmE3lPoWsEzCh9LPo3TiwVN+ZKEjmz+hD27ysY= github.com/imkira/go-interpol v1.1.0/go.mod h1:z0h2/2T3XF8kyEPpRgJ3kmNv+C43p+I/CoI+jC3w2iA= @@ -302,8 +319,8 @@ github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+o github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4= github.com/klauspost/compress v1.8.2/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= github.com/klauspost/compress v1.9.7/go.mod h1:RyIbtBH6LamlWaDj8nUwkbUhJ87Yi3uG0guNDohfE1A= -github.com/klauspost/compress v1.18.0 h1:c/Cqfb0r+Yi+JtIEq73FWXVkRonBlf0CRNYc8Zttxdo= -github.com/klauspost/compress v1.18.0/go.mod h1:2Pp+KzxcywXVXMr50+X0Q/Lsb43OQHYWRCY2AiWywWQ= +github.com/klauspost/compress v1.20.2 h1:v5tiZvm1KGLyg5d5oXdXe3lsSPrbEUiKoXGia//I7Qo= +github.com/klauspost/compress v1.20.2/go.mod h1:LUdAzn7YLVvxLpc7y3V1m40wESHTgc1422pwwBSKYuI= github.com/klauspost/cpuid v1.2.1/go.mod h1:Pj4uuM528wm8OyEC2QMXAi2YiTZ96dNQPGgoMS4s3ek= github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo= github.com/kr/pretty v0.2.1/go.mod h1:ipq/a2n7PKx3OHsz4KJII5eveXtPO4qwEXGdVfWzfnI= @@ -343,6 +360,7 @@ github.com/mediocregopher/radix/v3 v3.4.2/go.mod h1:8FL3F6UQRXHXIBSPUs5h0RybMF8i github.com/microcosm-cc/bluemonday v1.0.2/go.mod h1:iVP4YcDBq+n/5fb23BhYFvIMq/leAFZyRl6bYmGDlGc= github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0= github.com/mitchellh/mapstructure v1.1.2/go.mod h1:FVVH3fgwuzCH5S8UJGiWEs2h04kUh9fWfEaFds41c1Y= +github.com/mitchellh/mapstructure v1.4.1/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/mapstructure v1.5.0 h1:jeMsZIYE/09sWLaz43PL7Gy6RuMjD2eJVyuac5Z2hdY= github.com/mitchellh/mapstructure v1.5.0/go.mod h1:bFUtVrKA4DC2yAKiSyO/QUcy7e+RRV2QTWOzhPopBRo= github.com/mitchellh/pointerstructure v1.2.0 h1:O+i9nHnXS3l/9Wu7r4NrEdwA2VFTicjUEN1uBnDo34A= @@ -426,7 +444,6 @@ github.com/rogpeppe/go-internal v1.14.1 h1:UQB4HGPB6osV0SQTLymcB4TgvyWu6ZyliaW0t github.com/rogpeppe/go-internal v1.14.1/go.mod h1:MaRKkUm5W0goXpeCfT7UZI6fk/L7L7so1lCWt35ZSgc= github.com/rs/cors v1.7.0 h1:+88SsELBHx5r+hZ8TCkggzSstaWNbDvThkVK8H6f9ik= github.com/rs/cors v1.7.0/go.mod h1:gFx+x8UowdsKA9AchylcLynDq+nNFfI8FkUZdN/jGCU= -github.com/russross/blackfriday v1.5.2 h1:HyvC0ARfnZBqnXwABFeSZHpKvJHJJfPz81GNueLj0oo= github.com/russross/blackfriday v1.5.2/go.mod h1:JO/DiYxRf+HjHt06OyowR9PTA263kcR/rfWxYHBV53g= github.com/russross/blackfriday/v2 v2.1.0 h1:JIOH55/0cWyOuilr9/qlrm0BSXldqnqwMsf35Ld67mk= github.com/russross/blackfriday/v2 v2.1.0/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM= @@ -504,6 +521,10 @@ github.com/valyala/fasthttp v1.6.0/go.mod h1:FstJa9V+Pj9vQ7OJie2qMHdwemEDaDiSdBn github.com/valyala/fasttemplate v1.0.1/go.mod h1:UQGH1tvbgY+Nz5t2n7tXsz52dQxojPUpymEIMZ47gx8= github.com/valyala/fasttemplate v1.2.1/go.mod h1:KHLXt3tVN2HBp8eijSv/kGJopbvo7S+qRAEEKiv+SiQ= github.com/valyala/tcplisten v0.0.0-20161114210144-ceec8f93295a/go.mod h1:v3UYOV9WzVtRmSR+PDvWpU/qWl4Wa5LApYYX4ZtKbio= +github.com/vmihailenco/msgpack/v5 v5.4.1 h1:cQriyiUvjTwOHg8QZaPihLWeRAAVoCpE00IUPn0Bjt8= +github.com/vmihailenco/msgpack/v5 v5.4.1/go.mod h1:GaZTsDaehaPpQVyxrf5mtQlH+pc21PIudVV/E3rRQok= +github.com/vmihailenco/tagparser/v2 v2.0.0 h1:y09buUbR+b5aycVFQs/g70pqKVZNBmxwAhO7/IwNM9g= +github.com/vmihailenco/tagparser/v2 v2.0.0/go.mod h1:Wri+At7QHww0WTrCBeu4J6bNtoV6mEfg5OIWRZA9qds= github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU= github.com/xeipuuv/gojsonreference v0.0.0-20180127040603-bd5ef7bd5415/go.mod h1:GwrjFmJcFw6At/Gs6z4yjiIwzuJ1/+UwLxMQDVQXShQ= github.com/xeipuuv/gojsonschema v1.2.0/go.mod h1:anYRn/JVcOK2ZgGU+IjEV4nwlhoK5sQluxsYJ78Id3Y= @@ -517,6 +538,7 @@ github.com/yudai/pp v2.0.1+incompatible/go.mod h1:PuxR/8QJ7cyCkFp/aUDS+JY727OFEZ github.com/yuin/goldmark v1.1.27/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.2.1/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74= github.com/yuin/goldmark v1.3.5/go.mod h1:mwnBkeHKe2W/ZEtQ+71ViKU8L12m81fl3OWwC1Zlc8k= +github.com/yuin/goldmark v1.4.13/go.mod h1:6yULJ656Px+3vBD8DxQVa3kxgyrAnzto9xy5taEt/CY= github.com/yusufpapurcu/wmi v1.2.4 h1:zFUKzehAFReQwLys1b/iSMl+JQGSCSjtVqQn9bBrPo0= github.com/yusufpapurcu/wmi v1.2.4/go.mod h1:SBZ9tNy3G9/m5Oi98Zks0QjeHVDvuK0qfxQmPyzfmi0= github.com/zondax/golem v0.27.0 h1:IbBjGIXF3SoGOZHsILJvIM/F/ylwJzMcHAcggiqniPw= @@ -575,6 +597,7 @@ golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzB golang.org/x/mod v0.2.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= golang.org/x/mod v0.4.2/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA= +golang.org/x/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4/go.mod h1:jJ57K6gSWd91VN4djpZkiMVwK6gcyfeH4XE8wZrZaV4= golang.org/x/mod v0.41.0 h1:qJmnOUb4YB+FsEuM3HcWucdZASCPGhsX6uljO6pog0c= golang.org/x/mod v0.41.0/go.mod h1:Ek9pY8RKWXwsWvd3rQiHYtMqkjSUV+s1Rj7j4H5Ur6o= golang.org/x/net v0.0.0-20180719180050-a680a1efc54d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4= @@ -600,6 +623,7 @@ golang.org/x/net v0.0.0-20210428140749-89ef3d95e781/go.mod h1:OJAsFXCWl8Ukc7SiCT golang.org/x/net v0.0.0-20211008194852-3b03d305991f/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y= golang.org/x/net v0.0.0-20220225172249-27dd8689420f/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk= golang.org/x/net v0.0.0-20220607020251-c690dde0001d/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= +golang.org/x/net v0.0.0-20220722155237-a158d28d115b/go.mod h1:XRhObCWvk6IyKnWLug+ECip1KBveYUHfp+8e9klMJ9c= golang.org/x/net v0.60.0 h1:79p50tfZlm0J9YfoDsSi639qSXNGVwEzOPLCxM2FsYU= golang.org/x/net v0.60.0/go.mod h1:2DA/G1UfVbCpQPeWTmMPGY7Cs2PkBkwu743bVX5PIVg= golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U= @@ -612,6 +636,7 @@ golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJ golang.org/x/sync v0.0.0-20190911185100-cd5d95a43a6e/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20201020160332-67f06af15bc9/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.0.0-20210220032951-036812b2e83c/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= +golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM= golang.org/x/sync v0.23.0 h1:KameEIfc1IkluZyXWLn39Wd4tURc6GbCiISGiZm2bQk= golang.org/x/sync v0.23.0/go.mod h1:sUUOizhqBxiL6pEWpqNLUiaJn1ShEbZ6BBqskPbjZm0= golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY= @@ -645,10 +670,13 @@ golang.org/x/sys v0.0.0-20210927094055-39ccf1dd6fa6/go.mod h1:oPkhp1MJrh7nUepCBc golang.org/x/sys v0.0.0-20211007075335-d3039528d8ac/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220209214540-3681064d5158/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220310020820-b874c991c1a5/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220412211240-33da011f77ad/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.0.0-20220520151302-bc2c85ada10a/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.0.0-20220722155257-8c9f86f7a55f/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.1.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.5.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= +golang.org/x/sys v0.6.0/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg= golang.org/x/sys v0.48.0 h1:bbX/i/6MgT9BVLM9RT1thmxL04yeTAhbEz4SyadbXoo= golang.org/x/sys v0.48.0/go.mod h1:hNLxWAXmnKAxqDtdwIYC4bM9oQPEecfsnNMuSxOs3og= golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo= @@ -661,6 +689,7 @@ golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.5/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ= golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ= +golang.org/x/text v0.3.8/go.mod h1:E6s5w1FMmriuDzIBO73fBruAKo1PCIq6d2Q6DHfQ8WQ= golang.org/x/text v0.42.0 h1:JbOZXgfeCPU9gacVtYliJqOhD+zhrEqK4LfdpmlUZqI= golang.org/x/text v0.42.0/go.mod h1:ojzP1Z+2QtioaF8DTtO8K5q7JWVVYwZKenzujK0Zd0E= golang.org/x/time v0.0.0-20201208040808-7e3f01d25324/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ= @@ -680,6 +709,7 @@ golang.org/x/tools v0.0.0-20200619180055-7c47624df98f/go.mod h1:EkVYQZoAsY45+roY golang.org/x/tools v0.0.0-20201224043029-2b0845dc783e/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.0.0-20210106214847-113979e3529a/go.mod h1:emZCQorbCU4vsT4fOWvOPXz4eW1wZW4PmDk9uLelYpA= golang.org/x/tools v0.1.3/go.mod h1:o0xws9oXOQQZyjljx8fwUC0k7L1pTE6eaCbjGeHmOkk= +golang.org/x/tools v0.1.12/go.mod h1:hNGJHUnrk76NpqgfD5Aqm5Crs+Hm0VOH/i9J2+nxYbc= golang.org/x/tools v0.49.0 h1:3NI7VXzL9+1WZD52Dx2ttoPwD5DWrFGpl9mFZDlmisI= golang.org/x/tools v0.49.0/go.mod h1:SJNXV9DBKT0UbdttsQjbfJlAE/q+y36++zo3uL3N0Oo= golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0= @@ -706,8 +736,8 @@ google.golang.org/grpc v1.23.0/go.mod h1:Y5yQAOtifL1yxbo5wqy6BxZv8vAUGQwXBOALyac google.golang.org/grpc v1.25.1/go.mod h1:c3i+UQWmh7LiEpx4sFZnkU36qjEYZ0imhYfXVyQciAY= google.golang.org/grpc v1.27.0/go.mod h1:qbnxyOmOxrQa7FizSgH+ReBfzJrCY1pSN7KXBS8abTk= google.golang.org/grpc v1.38.0/go.mod h1:NREThFqKR1f3iQ6oBuvc5LadQuXVGo9rkm5ZGrQdJfM= -google.golang.org/grpc v1.83.1 h1:HIO0+BEtBP6soyqvqC8sNUjZ7bTs+0hFQuFF+RAy++Y= -google.golang.org/grpc v1.83.1/go.mod h1:kDyl6SKsiHKt0uylY5gtn5cEjkrIOhQOGDgIc4JGwzQ= +google.golang.org/grpc v1.83.2 h1:EManeRomTObA0BU7I8vXgg/78uE5MJ9M8B39EX2WscU= +google.golang.org/grpc v1.83.2/go.mod h1:YPI1hK3kDked6iHvgX3tR0y+nX/qpMFKhPgFsokw1S8= google.golang.org/protobuf v0.0.0-20200109180630-ec00e32a8dfd/go.mod h1:DFci5gLYBciE7Vtevhsrf46CRTquxDuWsQurQQe4oz8= google.golang.org/protobuf v0.0.0-20200221191635-4d8936d0db64/go.mod h1:kwYJMbMJ01Woi6D6+Kah6886xMZcty6N08ah7+eCXa0= google.golang.org/protobuf v0.0.0-20200228230310-ab0ca4ff8a60/go.mod h1:cfTl7dwQJ+fmap5saPgwCLgHXTUD7jkjRqWcaiX5VyM= diff --git a/install.sh b/install.sh index 59c1605..bd2f562 100755 --- a/install.sh +++ b/install.sh @@ -49,6 +49,12 @@ detect_os() { detect_arch() { arch="$(uname -m)" + # Under Rosetta 2, uname -m reports x86_64 on Apple Silicon; use the + # native arm64 build instead. + if [ "$(uname -s)" = "Darwin" ] && [ "$arch" = "x86_64" ] && + [ "$(sysctl -in sysctl.proc_translated 2>/dev/null)" = "1" ]; then + arch="arm64" + fi case "$arch" in x86_64|amd64) echo "amd64" ;; aarch64|arm64) echo "arm64" ;; @@ -142,7 +148,12 @@ main() { # Download tarball echo "Downloading ${download_url}..." - download "$download_url" "${tmp}/${tarball}" + if ! download "$download_url" "${tmp}/${tarball}"; then + echo "Error: failed to download ${tarball}." >&2 + echo "Check that ${VERSION} exists and publishes a ${os}/${arch} build" >&2 + echo "(darwin/amd64 is not supported): ${GITHUB}/${REPO}/releases" >&2 + exit 1 + fi # Download and verify checksums if available if download "$checksums_url" "${tmp}/${checksums}" 2>/dev/null; then diff --git a/pkg/crosschain/await.go b/pkg/crosschain/await.go index 48c30bb..4a483b9 100644 --- a/pkg/crosschain/await.go +++ b/pkg/crosschain/await.go @@ -30,10 +30,11 @@ type getAtomicTxReply struct { // awaitCChainAtomicTx polls avax.getAtomicTx until txID is accepted on the C-Chain. // -// The avalanchego C-Chain wallet waits with avax.getAtomicTxStatus. The SAE -// C-Chain deprecates that method and public API endpoints do not serve it, so -// the wallet returns an error after the tx is already issued. We issue with -// common.WithAssumeDecided() and wait here instead. +// The avalanchego C-Chain wallet's own wait (cchain.Client.AwaitTxAccepted) +// treats any successful avax.getAtomicTx reply as accepted, without checking +// blockHeight, and retries on every error until ctx is done. We issue with +// common.WithAssumeDecided() and wait here instead: success requires a block +// height, and non-transient errors fail fast. func awaitCChainAtomicTx(ctx context.Context, rpcURL string, txID ids.ID) error { requester := rpc.NewEndpointRequester(rpcURL + "/ext/bc/C/avax") return awaitAtomicTx(ctx, requester, txID, cChainAtomicPollFrequency) diff --git a/pkg/crosschain/transfer.go b/pkg/crosschain/transfer.go index 2d024a1..66a5de1 100644 --- a/pkg/crosschain/transfer.go +++ b/pkg/crosschain/transfer.go @@ -60,8 +60,8 @@ func ImportToCChain(ctx context.Context, w *wallet.FullWallet) (ids.ID, error) { cWallet := w.CWallet() ethAddr := w.EthAddress() - // Issue the import transaction. The wallet's own acceptance wait uses - // avax.getAtomicTxStatus, which Helicon C-Chain endpoints do not serve. + // Issue the import transaction and wait with awaitCChainAtomicTx rather + // than the wallet's own acceptance wait (see awaitCChainAtomicTx). importTx, err := cWallet.IssueImportTx(constants.PlatformChainID, ethAddr, common.WithContext(ctx), common.WithAssumeDecided()) if err != nil { return ids.Empty, fmt.Errorf("failed to issue C-Chain import tx: %w", err) diff --git a/pkg/pchain/acp236_devnetcompat_test.go b/pkg/pchain/acp236_devnetcompat_test.go index fd1ec2b..9c51079 100644 --- a/pkg/pchain/acp236_devnetcompat_test.go +++ b/pkg/pchain/acp236_devnetcompat_test.go @@ -15,26 +15,26 @@ import ( "github.com/ava-labs/avalanchego/utils/constants" blslocalsigner "github.com/ava-labs/avalanchego/utils/crypto/bls/signer/localsigner" "github.com/ava-labs/avalanchego/vms/components/avax" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/reward" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" ) // devnetAutoRenewedValidatorTxIssuer adapts a func to autoRenewedValidatorTxIssuer // so each test can build, verify and serialize a real ACP-236 tx inline. -type devnetAutoRenewedValidatorTxIssuer func(validatorNodeID ids.NodeID, weight uint64, sig signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) +type devnetAutoRenewedValidatorTxIssuer func(validatorNodeID ids.NodeID, weight uint64, sig signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) -func (f devnetAutoRenewedValidatorTxIssuer) IssueAddAutoRenewedValidatorTx(validatorNodeID ids.NodeID, weight uint64, sig signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) { +func (f devnetAutoRenewedValidatorTxIssuer) IssueAddAutoRenewedValidatorTx(validatorNodeID ids.NodeID, weight uint64, sig signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) { return f(validatorNodeID, weight, sig, validationRewardsOwner, delegationRewardsOwner, validatorAuthority, delegationShares, autoCompoundRewardShares, period, options...) } // devnetSetAutoRenewedValidatorConfigTxIssuer adapts a func to // setAutoRenewedValidatorConfigTxIssuer. -type devnetSetAutoRenewedValidatorConfigTxIssuer func(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) +type devnetSetAutoRenewedValidatorConfigTxIssuer func(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) -func (f devnetSetAutoRenewedValidatorConfigTxIssuer) IssueSetAutoRenewedValidatorConfigTx(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) { +func (f devnetSetAutoRenewedValidatorConfigTxIssuer) IssueSetAutoRenewedValidatorConfigTx(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) { return f(txID, autoCompoundRewardShares, period, options...) } @@ -59,7 +59,7 @@ func TestDevnetCompatAddAutoRenewedValidatorTx(t *testing.T) { } callCtx := context.WithValue(context.Background(), testContextKey("devnetcompat"), "add") - var issuedTx *txs.Tx + var issuedTx *platform.Tx issuer := devnetAutoRenewedValidatorTxIssuer(func( validatorNodeID ids.NodeID, weight uint64, @@ -71,7 +71,7 @@ func TestDevnetCompatAddAutoRenewedValidatorTx(t *testing.T) { autoCompoundRewardShares uint32, period time.Duration, options ...common.Option, - ) (*txs.Tx, error) { + ) (*platform.Tx, error) { if common.NewOptions(options).Context().Value(testContextKey("devnetcompat")) != "add" { t.Fatal("context option was not passed to add-auto-renewed issuer") } @@ -103,7 +103,7 @@ func TestDevnetCompatAddAutoRenewedValidatorTx(t *testing.T) { t.Fatalf("issuer period = %s, want %s", period, cfg.Period) } - autoTx := &txs.AddAutoRenewedValidatorTx{ + autoTx := &platform.AddAutoRenewedValidatorTx{ BaseTx: devnetCompatBaseTx(ctx), ValidatorNodeID: validatorNodeID[:], Signer: gotSigner, @@ -124,12 +124,12 @@ func TestDevnetCompatAddAutoRenewedValidatorTx(t *testing.T) { } issuedTx = initializeDevnetCompatTx(t, autoTx) - parsed, err := txs.Parse(txs.Codec, issuedTx.Bytes()) + parsed, err := platform.Parse(platform.Codec, issuedTx.Bytes()) if err != nil { t.Fatalf("failed to parse serialized AddAutoRenewedValidatorTx: %v", err) } - if _, ok := parsed.Unsigned.(*txs.AddAutoRenewedValidatorTx); !ok { - t.Fatalf("parsed unsigned tx type = %T, want *txs.AddAutoRenewedValidatorTx", parsed.Unsigned) + if _, ok := parsed.Unsigned.(*platform.AddAutoRenewedValidatorTx); !ok { + t.Fatalf("parsed unsigned tx type = %T, want *platform.AddAutoRenewedValidatorTx", parsed.Unsigned) } return issuedTx, nil }) @@ -154,8 +154,8 @@ func TestDevnetCompatSetAutoRenewedValidatorConfigTx(t *testing.T) { } callCtx := context.WithValue(context.Background(), testContextKey("devnetcompat"), "set") - var issuedTx *txs.Tx - issuer := devnetSetAutoRenewedValidatorConfigTxIssuer(func(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) { + var issuedTx *platform.Tx + issuer := devnetSetAutoRenewedValidatorConfigTxIssuer(func(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) { if common.NewOptions(options).Context().Value(testContextKey("devnetcompat")) != "set" { t.Fatal("context option was not passed to set-auto-config issuer") } @@ -169,7 +169,7 @@ func TestDevnetCompatSetAutoRenewedValidatorConfigTx(t *testing.T) { t.Fatalf("issuer period = %s, want %s", period, cfg.Period) } - setTx := &txs.SetAutoRenewedValidatorConfigTx{ + setTx := &platform.SetAutoRenewedValidatorConfigTx{ BaseTx: devnetCompatBaseTx(ctx), TxID: txID, Auth: auth, @@ -182,12 +182,12 @@ func TestDevnetCompatSetAutoRenewedValidatorConfigTx(t *testing.T) { } issuedTx = initializeDevnetCompatTx(t, setTx) - parsed, err := txs.Parse(txs.Codec, issuedTx.Bytes()) + parsed, err := platform.Parse(platform.Codec, issuedTx.Bytes()) if err != nil { t.Fatalf("failed to parse serialized SetAutoRenewedValidatorConfigTx: %v", err) } - if _, ok := parsed.Unsigned.(*txs.SetAutoRenewedValidatorConfigTx); !ok { - t.Fatalf("parsed unsigned tx type = %T, want *txs.SetAutoRenewedValidatorConfigTx", parsed.Unsigned) + if _, ok := parsed.Unsigned.(*platform.SetAutoRenewedValidatorConfigTx); !ok { + t.Fatalf("parsed unsigned tx type = %T, want *platform.SetAutoRenewedValidatorConfigTx", parsed.Unsigned) } return issuedTx, nil }) @@ -209,11 +209,11 @@ func TestDevnetCompatSetAutoRenewedValidatorConfigTxExitCycle(t *testing.T) { Period: 0, } - issuer := devnetSetAutoRenewedValidatorConfigTxIssuer(func(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, _ ...common.Option) (*txs.Tx, error) { + issuer := devnetSetAutoRenewedValidatorConfigTxIssuer(func(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, _ ...common.Option) (*platform.Tx, error) { if period != 0 { t.Fatalf("exit-cycle period = %s, want 0", period) } - setTx := &txs.SetAutoRenewedValidatorConfigTx{ + setTx := &platform.SetAutoRenewedValidatorConfigTx{ BaseTx: devnetCompatBaseTx(ctx), TxID: txID, Auth: &secp256k1fx.Input{SigIndices: []uint32{0}}, @@ -235,13 +235,13 @@ func TestDevnetCompatSetAutoRenewedValidatorConfigTxExitCycle(t *testing.T) { func TestDevnetCompatACP236ErrorWrapping(t *testing.T) { expectedErr := errors.New("devnet compat failure") - addIssuer := devnetAutoRenewedValidatorTxIssuer(func(ids.NodeID, uint64, signer.Signer, *secp256k1fx.OutputOwners, *secp256k1fx.OutputOwners, *secp256k1fx.OutputOwners, uint32, uint32, time.Duration, ...common.Option) (*txs.Tx, error) { + addIssuer := devnetAutoRenewedValidatorTxIssuer(func(ids.NodeID, uint64, signer.Signer, *secp256k1fx.OutputOwners, *secp256k1fx.OutputOwners, *secp256k1fx.OutputOwners, uint32, uint32, time.Duration, ...common.Option) (*platform.Tx, error) { return nil, expectedErr }) _, err := issueAddAutoRenewedValidatorTx(addIssuer, AddAutoRenewedValidatorConfig{Period: time.Second}) assertWrapped(t, err, expectedErr, "failed to issue AddAutoRenewedValidatorTx") - setIssuer := devnetSetAutoRenewedValidatorConfigTxIssuer(func(ids.ID, uint32, time.Duration, ...common.Option) (*txs.Tx, error) { + setIssuer := devnetSetAutoRenewedValidatorConfigTxIssuer(func(ids.ID, uint32, time.Duration, ...common.Option) (*platform.Tx, error) { return nil, expectedErr }) _, err = issueSetAutoRenewedValidatorConfigTx(setIssuer, SetAutoRenewedValidatorConfigTxConfig{TxID: ids.GenerateTestID(), Period: time.Second}) @@ -251,7 +251,7 @@ func TestDevnetCompatACP236ErrorWrapping(t *testing.T) { func TestDevnetCompatACP236DevnetSyntacticRejections(t *testing.T) { ctx := devnetCompatContext() - tooManySharesTx := &txs.AddAutoRenewedValidatorTx{ + tooManySharesTx := &platform.AddAutoRenewedValidatorTx{ BaseTx: devnetCompatBaseTx(ctx), ValidatorNodeID: ids.GenerateTestNodeID().Bytes(), Signer: newDevnetCompatPoP(t), @@ -282,8 +282,8 @@ func newDevnetCompatPoP(t *testing.T) *signer.ProofOfPossession { return pop } -func devnetCompatBaseTx(ctx *snow.Context) txs.BaseTx { - return txs.BaseTx{BaseTx: avax.BaseTx{ +func devnetCompatBaseTx(ctx *snow.Context) platform.BaseTx { + return platform.BaseTx{BaseTx: avax.BaseTx{ NetworkID: ctx.NetworkID, BlockchainID: ctx.ChainID, }} @@ -321,11 +321,11 @@ func ownerHasOnly(owner *secp256k1fx.OutputOwners, addr ids.ShortID) bool { owner.Addrs[0] == addr } -func initializeDevnetCompatTx(t *testing.T, utx txs.UnsignedTx) *txs.Tx { +func initializeDevnetCompatTx(t *testing.T, utx platform.UnsignedTx) *platform.Tx { t.Helper() - tx := &txs.Tx{Unsigned: utx} - if err := tx.Initialize(txs.Codec); err != nil { + tx := &platform.Tx{Unsigned: utx} + if err := tx.Initialize(platform.Codec); err != nil { t.Fatalf("failed to initialize tx: %v", err) } return tx diff --git a/pkg/pchain/acp236_test.go b/pkg/pchain/acp236_test.go index 0d92932..786cea2 100644 --- a/pkg/pchain/acp236_test.go +++ b/pkg/pchain/acp236_test.go @@ -13,8 +13,8 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/utils/constants" "github.com/ava-labs/avalanchego/utils/formatting/address" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" ) @@ -27,7 +27,7 @@ var errAssertable = errors.New("assertable failure") // stubAutoRenewedValidatorTxIssuer implements autoRenewedValidatorTxIssuer. type stubAutoRenewedValidatorTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error called bool @@ -43,7 +43,7 @@ type stubAutoRenewedValidatorTxIssuer struct { gotOpts []common.Option } -func (s *stubAutoRenewedValidatorTxIssuer) IssueAddAutoRenewedValidatorTx(validatorNodeID ids.NodeID, weight uint64, sig signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) { +func (s *stubAutoRenewedValidatorTxIssuer) IssueAddAutoRenewedValidatorTx(validatorNodeID ids.NodeID, weight uint64, sig signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) { s.called = true s.gotNodeID = validatorNodeID s.gotWeight = weight @@ -60,7 +60,7 @@ func (s *stubAutoRenewedValidatorTxIssuer) IssueAddAutoRenewedValidatorTx(valida // stubSetAutoRenewedValidatorConfigTxIssuer implements setAutoRenewedValidatorConfigTxIssuer. type stubSetAutoRenewedValidatorConfigTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error called bool @@ -69,7 +69,7 @@ type stubSetAutoRenewedValidatorConfigTxIssuer struct { gotPeriod time.Duration } -func (s *stubSetAutoRenewedValidatorConfigTxIssuer) IssueSetAutoRenewedValidatorConfigTx(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, _ ...common.Option) (*txs.Tx, error) { +func (s *stubSetAutoRenewedValidatorConfigTxIssuer) IssueSetAutoRenewedValidatorConfigTx(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, _ ...common.Option) (*platform.Tx, error) { s.called = true s.gotTxID = txID s.gotAutoCompoundShares = autoCompoundRewardShares @@ -98,7 +98,7 @@ func TestIssueAddAutoRenewedValidatorTx(t *testing.T) { } txID := ids.GenerateTestID() - stub := &stubAutoRenewedValidatorTxIssuer{tx: &txs.Tx{TxID: txID}} + stub := &stubAutoRenewedValidatorTxIssuer{tx: &platform.Tx{TxID: txID}} ctxKey := testContextKey("auto") gotTxID, err := issueAddAutoRenewedValidatorTx(stub, cfg, common.WithContext(context.WithValue(context.Background(), ctxKey, "v"))) if err != nil { @@ -138,7 +138,7 @@ func TestIssueAddAutoRenewedValidatorTx(t *testing.T) { } func TestIssueAddAutoRenewedValidatorTxRejectsInvalidPeriod(t *testing.T) { - stub := &stubAutoRenewedValidatorTxIssuer{tx: &txs.Tx{TxID: ids.GenerateTestID()}} + stub := &stubAutoRenewedValidatorTxIssuer{tx: &platform.Tx{TxID: ids.GenerateTestID()}} _, err := issueAddAutoRenewedValidatorTx(stub, AddAutoRenewedValidatorConfig{Period: 1500 * time.Millisecond}) if err == nil || !strings.Contains(err.Error(), "period must be a whole number of seconds") { t.Fatalf("error = %v, want whole-seconds error", err) @@ -174,7 +174,7 @@ func TestIssueSetAutoRenewedValidatorConfigTx(t *testing.T) { Period: 7 * 24 * time.Hour, } - stub := &stubSetAutoRenewedValidatorConfigTxIssuer{tx: &txs.Tx{TxID: issuedTxID}} + stub := &stubSetAutoRenewedValidatorConfigTxIssuer{tx: &platform.Tx{TxID: issuedTxID}} gotTxID, err := issueSetAutoRenewedValidatorConfigTx(stub, cfg) if err != nil { t.Fatalf("issueSetAutoRenewedValidatorConfigTx() returned error: %v", err) @@ -194,7 +194,7 @@ func TestIssueSetAutoRenewedValidatorConfigTx(t *testing.T) { } func TestIssueSetAutoRenewedValidatorConfigTxAllowsZeroPeriod(t *testing.T) { - stub := &stubSetAutoRenewedValidatorConfigTxIssuer{tx: &txs.Tx{TxID: ids.GenerateTestID()}} + stub := &stubSetAutoRenewedValidatorConfigTxIssuer{tx: &platform.Tx{TxID: ids.GenerateTestID()}} cfg := SetAutoRenewedValidatorConfigTxConfig{ TxID: ids.GenerateTestID(), Period: 0, @@ -211,7 +211,7 @@ func TestIssueSetAutoRenewedValidatorConfigTxAllowsZeroPeriod(t *testing.T) { } func TestIssueSetAutoRenewedValidatorConfigTxRejectsNegativePeriod(t *testing.T) { - stub := &stubSetAutoRenewedValidatorConfigTxIssuer{tx: &txs.Tx{TxID: ids.GenerateTestID()}} + stub := &stubSetAutoRenewedValidatorConfigTxIssuer{tx: &platform.Tx{TxID: ids.GenerateTestID()}} _, err := issueSetAutoRenewedValidatorConfigTx(stub, SetAutoRenewedValidatorConfigTxConfig{ TxID: ids.GenerateTestID(), Period: -time.Second, diff --git a/pkg/pchain/pchain.go b/pkg/pchain/pchain.go index 98617a2..727d7f5 100644 --- a/pkg/pchain/pchain.go +++ b/pkg/pchain/pchain.go @@ -12,8 +12,8 @@ import ( "github.com/ava-labs/avalanchego/utils/formatting/address" "github.com/ava-labs/avalanchego/vms/components/avax" "github.com/ava-labs/avalanchego/vms/platformvm" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" "github.com/ava-labs/platform-cli/pkg/wallet" @@ -30,67 +30,67 @@ import ( // baseTxIssuer issues a P-Chain BaseTx. type baseTxIssuer interface { - IssueBaseTx(outputs []*avax.TransferableOutput, options ...common.Option) (*txs.Tx, error) + IssueBaseTx(outputs []*avax.TransferableOutput, options ...common.Option) (*platform.Tx, error) } // exportTxIssuer issues a P-Chain ExportTx. type exportTxIssuer interface { - IssueExportTx(chainID ids.ID, outputs []*avax.TransferableOutput, options ...common.Option) (*txs.Tx, error) + IssueExportTx(chainID ids.ID, outputs []*avax.TransferableOutput, options ...common.Option) (*platform.Tx, error) } // importTxIssuer issues a P-Chain ImportTx. type importTxIssuer interface { - IssueImportTx(chainID ids.ID, to *secp256k1fx.OutputOwners, options ...common.Option) (*txs.Tx, error) + IssueImportTx(chainID ids.ID, to *secp256k1fx.OutputOwners, options ...common.Option) (*platform.Tx, error) } // permissionlessValidatorTxIssuer issues an AddPermissionlessValidatorTx. type permissionlessValidatorTxIssuer interface { - IssueAddPermissionlessValidatorTx(vdr *txs.SubnetValidator, signer signer.Signer, assetID ids.ID, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, shares uint32, options ...common.Option) (*txs.Tx, error) + IssueAddPermissionlessValidatorTx(vdr *platform.SubnetValidator, signer signer.Signer, assetID ids.ID, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, shares uint32, options ...common.Option) (*platform.Tx, error) } // permissionlessDelegatorTxIssuer issues an AddPermissionlessDelegatorTx. type permissionlessDelegatorTxIssuer interface { - IssueAddPermissionlessDelegatorTx(vdr *txs.SubnetValidator, assetID ids.ID, rewardsOwner *secp256k1fx.OutputOwners, options ...common.Option) (*txs.Tx, error) + IssueAddPermissionlessDelegatorTx(vdr *platform.SubnetValidator, assetID ids.ID, rewardsOwner *secp256k1fx.OutputOwners, options ...common.Option) (*platform.Tx, error) } // autoRenewedValidatorTxIssuer issues an AddAutoRenewedValidatorTx (ACP-236). type autoRenewedValidatorTxIssuer interface { - IssueAddAutoRenewedValidatorTx(validatorNodeID ids.NodeID, weight uint64, signer signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) + IssueAddAutoRenewedValidatorTx(validatorNodeID ids.NodeID, weight uint64, signer signer.Signer, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, validatorAuthority *secp256k1fx.OutputOwners, delegationShares uint32, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) } // setAutoRenewedValidatorConfigTxIssuer issues a SetAutoRenewedValidatorConfigTx (ACP-236). type setAutoRenewedValidatorConfigTxIssuer interface { - IssueSetAutoRenewedValidatorConfigTx(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*txs.Tx, error) + IssueSetAutoRenewedValidatorConfigTx(txID ids.ID, autoCompoundRewardShares uint32, period time.Duration, options ...common.Option) (*platform.Tx, error) } // createSubnetTxIssuer issues a CreateSubnetTx. type createSubnetTxIssuer interface { - IssueCreateSubnetTx(owner *secp256k1fx.OutputOwners, options ...common.Option) (*txs.Tx, error) + IssueCreateSubnetTx(owner *secp256k1fx.OutputOwners, options ...common.Option) (*platform.Tx, error) } // transferSubnetOwnershipTxIssuer issues a TransferSubnetOwnershipTx. type transferSubnetOwnershipTxIssuer interface { - IssueTransferSubnetOwnershipTx(subnetID ids.ID, owner *secp256k1fx.OutputOwners, options ...common.Option) (*txs.Tx, error) + IssueTransferSubnetOwnershipTx(subnetID ids.ID, owner *secp256k1fx.OutputOwners, options ...common.Option) (*platform.Tx, error) } // convertSubnetToL1TxIssuer issues a ConvertSubnetToL1Tx. type convertSubnetToL1TxIssuer interface { - IssueConvertSubnetToL1Tx(subnetID ids.ID, chainID ids.ID, address []byte, validators []*txs.ConvertSubnetToL1Validator, options ...common.Option) (*txs.Tx, error) + IssueConvertSubnetToL1Tx(subnetID ids.ID, chainID ids.ID, address []byte, validators []*platform.ConvertSubnetToL1Validator, options ...common.Option) (*platform.Tx, error) } // addSubnetValidatorTxIssuer issues an AddSubnetValidatorTx. type addSubnetValidatorTxIssuer interface { - IssueAddSubnetValidatorTx(vdr *txs.SubnetValidator, options ...common.Option) (*txs.Tx, error) + IssueAddSubnetValidatorTx(vdr *platform.SubnetValidator, options ...common.Option) (*platform.Tx, error) } // removeSubnetValidatorTxIssuer issues a RemoveSubnetValidatorTx. type removeSubnetValidatorTxIssuer interface { - IssueRemoveSubnetValidatorTx(nodeID ids.NodeID, subnetID ids.ID, options ...common.Option) (*txs.Tx, error) + IssueRemoveSubnetValidatorTx(nodeID ids.NodeID, subnetID ids.ID, options ...common.Option) (*platform.Tx, error) } // createChainTxIssuer issues a CreateChainTx. type createChainTxIssuer interface { - IssueCreateChainTx(subnetID ids.ID, genesis []byte, vmID ids.ID, fxIDs []ids.ID, chainName string, options ...common.Option) (*txs.Tx, error) + IssueCreateChainTx(subnetID ids.ID, genesis []byte, vmID ids.ID, fxIDs []ids.ID, chainName string, options ...common.Option) (*platform.Tx, error) } // ============================================================================= @@ -205,7 +205,7 @@ func AddValidator(ctx context.Context, w *wallet.Wallet, cfg AddValidatorConfig) } tx, err := w.PWallet().IssueAddValidatorTx( - &txs.Validator{ + &platform.Validator{ NodeID: cfg.NodeID, Start: uint64(cfg.Start.Unix()), End: uint64(cfg.End.Unix()), @@ -256,8 +256,8 @@ func issueAddPermissionlessValidatorTx( } tx, err := issuer.IssueAddPermissionlessValidatorTx( - &txs.SubnetValidator{ - Validator: txs.Validator{ + &platform.SubnetValidator{ + Validator: platform.Validator{ NodeID: cfg.NodeID, Start: uint64(cfg.Start.Unix()), End: uint64(cfg.End.Unix()), @@ -473,7 +473,7 @@ func AddDelegator(ctx context.Context, w *wallet.Wallet, cfg AddDelegatorConfig) } tx, err := w.PWallet().IssueAddDelegatorTx( - &txs.Validator{ + &platform.Validator{ NodeID: cfg.NodeID, Start: uint64(cfg.Start.Unix()), End: uint64(cfg.End.Unix()), @@ -521,8 +521,8 @@ func issueAddPermissionlessDelegatorTx( } tx, err := issuer.IssueAddPermissionlessDelegatorTx( - &txs.SubnetValidator{ - Validator: txs.Validator{ + &platform.SubnetValidator{ + Validator: platform.Validator{ NodeID: cfg.NodeID, Start: uint64(cfg.Start.Unix()), End: uint64(cfg.End.Unix()), @@ -590,7 +590,7 @@ func issueTransferSubnetOwnershipTx( } // ConvertSubnetToL1 converts a subnet to L1 (IssueConvertSubnetToL1Tx). -func ConvertSubnetToL1(ctx context.Context, w *wallet.Wallet, subnetID, chainID ids.ID, managerAddr []byte, validators []*txs.ConvertSubnetToL1Validator) (ids.ID, error) { +func ConvertSubnetToL1(ctx context.Context, w *wallet.Wallet, subnetID, chainID ids.ID, managerAddr []byte, validators []*platform.ConvertSubnetToL1Validator) (ids.ID, error) { return issueConvertSubnetToL1Tx(w.PWallet(), subnetID, chainID, managerAddr, validators, common.WithContext(ctx)) } @@ -599,7 +599,7 @@ func issueConvertSubnetToL1Tx( subnetID ids.ID, chainID ids.ID, managerAddr []byte, - validators []*txs.ConvertSubnetToL1Validator, + validators []*platform.ConvertSubnetToL1Validator, options ...common.Option, ) (ids.ID, error) { tx, err := issuer.IssueConvertSubnetToL1Tx(subnetID, chainID, managerAddr, validators, options...) @@ -633,8 +633,8 @@ func issueAddSubnetValidatorTx( options ...common.Option, ) (ids.ID, error) { tx, err := issuer.IssueAddSubnetValidatorTx( - &txs.SubnetValidator{ - Validator: txs.Validator{ + &platform.SubnetValidator{ + Validator: platform.Validator{ NodeID: cfg.NodeID, Start: uint64(cfg.Start.Unix()), End: uint64(cfg.End.Unix()), diff --git a/pkg/pchain/pchain_test.go b/pkg/pchain/pchain_test.go index 95f4a21..c75a674 100644 --- a/pkg/pchain/pchain_test.go +++ b/pkg/pchain/pchain_test.go @@ -9,8 +9,8 @@ import ( "github.com/ava-labs/avalanchego/ids" "github.com/ava-labs/avalanchego/vms/components/avax" + "github.com/ava-labs/avalanchego/vms/platformvm/platform" "github.com/ava-labs/avalanchego/vms/platformvm/signer" - "github.com/ava-labs/avalanchego/vms/platformvm/txs" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/subnet/primary/common" ) @@ -24,14 +24,14 @@ type testContextKey string // stubBaseTxIssuer implements baseTxIssuer, recording the arguments it was // called with and returning the configured tx/err. type stubBaseTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotOutputs []*avax.TransferableOutput gotOpts []common.Option } -func (s *stubBaseTxIssuer) IssueBaseTx(outputs []*avax.TransferableOutput, options ...common.Option) (*txs.Tx, error) { +func (s *stubBaseTxIssuer) IssueBaseTx(outputs []*avax.TransferableOutput, options ...common.Option) (*platform.Tx, error) { s.gotOutputs = outputs s.gotOpts = options return s.tx, s.err @@ -39,14 +39,14 @@ func (s *stubBaseTxIssuer) IssueBaseTx(outputs []*avax.TransferableOutput, optio // stubExportTxIssuer implements exportTxIssuer. type stubExportTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotChainID ids.ID gotOutputs []*avax.TransferableOutput } -func (s *stubExportTxIssuer) IssueExportTx(chainID ids.ID, outputs []*avax.TransferableOutput, _ ...common.Option) (*txs.Tx, error) { +func (s *stubExportTxIssuer) IssueExportTx(chainID ids.ID, outputs []*avax.TransferableOutput, _ ...common.Option) (*platform.Tx, error) { s.gotChainID = chainID s.gotOutputs = outputs return s.tx, s.err @@ -54,14 +54,14 @@ func (s *stubExportTxIssuer) IssueExportTx(chainID ids.ID, outputs []*avax.Trans // stubImportTxIssuer implements importTxIssuer. type stubImportTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotChainID ids.ID gotOwners *secp256k1fx.OutputOwners } -func (s *stubImportTxIssuer) IssueImportTx(chainID ids.ID, to *secp256k1fx.OutputOwners, _ ...common.Option) (*txs.Tx, error) { +func (s *stubImportTxIssuer) IssueImportTx(chainID ids.ID, to *secp256k1fx.OutputOwners, _ ...common.Option) (*platform.Tx, error) { s.gotChainID = chainID s.gotOwners = to return s.tx, s.err @@ -69,10 +69,10 @@ func (s *stubImportTxIssuer) IssueImportTx(chainID ids.ID, to *secp256k1fx.Outpu // stubValidatorTxIssuer implements permissionlessValidatorTxIssuer. type stubValidatorTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error - gotVdr *txs.SubnetValidator + gotVdr *platform.SubnetValidator gotSigner signer.Signer gotAssetID ids.ID gotValidationRewardsOwner *secp256k1fx.OutputOwners @@ -80,7 +80,7 @@ type stubValidatorTxIssuer struct { gotShares uint32 } -func (s *stubValidatorTxIssuer) IssueAddPermissionlessValidatorTx(vdr *txs.SubnetValidator, sig signer.Signer, assetID ids.ID, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, shares uint32, _ ...common.Option) (*txs.Tx, error) { +func (s *stubValidatorTxIssuer) IssueAddPermissionlessValidatorTx(vdr *platform.SubnetValidator, sig signer.Signer, assetID ids.ID, validationRewardsOwner *secp256k1fx.OutputOwners, delegationRewardsOwner *secp256k1fx.OutputOwners, shares uint32, _ ...common.Option) (*platform.Tx, error) { s.gotVdr = vdr s.gotSigner = sig s.gotAssetID = assetID @@ -92,15 +92,15 @@ func (s *stubValidatorTxIssuer) IssueAddPermissionlessValidatorTx(vdr *txs.Subne // stubDelegatorTxIssuer implements permissionlessDelegatorTxIssuer. type stubDelegatorTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error - gotVdr *txs.SubnetValidator + gotVdr *platform.SubnetValidator gotAssetID ids.ID gotRewardsOwner *secp256k1fx.OutputOwners } -func (s *stubDelegatorTxIssuer) IssueAddPermissionlessDelegatorTx(vdr *txs.SubnetValidator, assetID ids.ID, rewardsOwner *secp256k1fx.OutputOwners, _ ...common.Option) (*txs.Tx, error) { +func (s *stubDelegatorTxIssuer) IssueAddPermissionlessDelegatorTx(vdr *platform.SubnetValidator, assetID ids.ID, rewardsOwner *secp256k1fx.OutputOwners, _ ...common.Option) (*platform.Tx, error) { s.gotVdr = vdr s.gotAssetID = assetID s.gotRewardsOwner = rewardsOwner @@ -109,27 +109,27 @@ func (s *stubDelegatorTxIssuer) IssueAddPermissionlessDelegatorTx(vdr *txs.Subne // stubCreateSubnetTxIssuer implements createSubnetTxIssuer. type stubCreateSubnetTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotOwner *secp256k1fx.OutputOwners } -func (s *stubCreateSubnetTxIssuer) IssueCreateSubnetTx(owner *secp256k1fx.OutputOwners, _ ...common.Option) (*txs.Tx, error) { +func (s *stubCreateSubnetTxIssuer) IssueCreateSubnetTx(owner *secp256k1fx.OutputOwners, _ ...common.Option) (*platform.Tx, error) { s.gotOwner = owner return s.tx, s.err } // stubTransferSubnetOwnershipTxIssuer implements transferSubnetOwnershipTxIssuer. type stubTransferSubnetOwnershipTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotSubnetID ids.ID gotOwner *secp256k1fx.OutputOwners } -func (s *stubTransferSubnetOwnershipTxIssuer) IssueTransferSubnetOwnershipTx(subnetID ids.ID, owner *secp256k1fx.OutputOwners, _ ...common.Option) (*txs.Tx, error) { +func (s *stubTransferSubnetOwnershipTxIssuer) IssueTransferSubnetOwnershipTx(subnetID ids.ID, owner *secp256k1fx.OutputOwners, _ ...common.Option) (*platform.Tx, error) { s.gotSubnetID = subnetID s.gotOwner = owner return s.tx, s.err @@ -137,16 +137,16 @@ func (s *stubTransferSubnetOwnershipTxIssuer) IssueTransferSubnetOwnershipTx(sub // stubConvertSubnetToL1TxIssuer implements convertSubnetToL1TxIssuer. type stubConvertSubnetToL1TxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotSubnetID ids.ID gotChainID ids.ID gotManagerAddr []byte - gotValidators []*txs.ConvertSubnetToL1Validator + gotValidators []*platform.ConvertSubnetToL1Validator } -func (s *stubConvertSubnetToL1TxIssuer) IssueConvertSubnetToL1Tx(subnetID ids.ID, chainID ids.ID, address []byte, validators []*txs.ConvertSubnetToL1Validator, _ ...common.Option) (*txs.Tx, error) { +func (s *stubConvertSubnetToL1TxIssuer) IssueConvertSubnetToL1Tx(subnetID ids.ID, chainID ids.ID, address []byte, validators []*platform.ConvertSubnetToL1Validator, _ ...common.Option) (*platform.Tx, error) { s.gotSubnetID = subnetID s.gotChainID = chainID s.gotManagerAddr = address @@ -156,27 +156,27 @@ func (s *stubConvertSubnetToL1TxIssuer) IssueConvertSubnetToL1Tx(subnetID ids.ID // stubAddSubnetValidatorTxIssuer implements addSubnetValidatorTxIssuer. type stubAddSubnetValidatorTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error - gotVdr *txs.SubnetValidator + gotVdr *platform.SubnetValidator } -func (s *stubAddSubnetValidatorTxIssuer) IssueAddSubnetValidatorTx(vdr *txs.SubnetValidator, _ ...common.Option) (*txs.Tx, error) { +func (s *stubAddSubnetValidatorTxIssuer) IssueAddSubnetValidatorTx(vdr *platform.SubnetValidator, _ ...common.Option) (*platform.Tx, error) { s.gotVdr = vdr return s.tx, s.err } // stubRemoveSubnetValidatorTxIssuer implements removeSubnetValidatorTxIssuer. type stubRemoveSubnetValidatorTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotNodeID ids.NodeID gotSubnetID ids.ID } -func (s *stubRemoveSubnetValidatorTxIssuer) IssueRemoveSubnetValidatorTx(nodeID ids.NodeID, subnetID ids.ID, _ ...common.Option) (*txs.Tx, error) { +func (s *stubRemoveSubnetValidatorTxIssuer) IssueRemoveSubnetValidatorTx(nodeID ids.NodeID, subnetID ids.ID, _ ...common.Option) (*platform.Tx, error) { s.gotNodeID = nodeID s.gotSubnetID = subnetID return s.tx, s.err @@ -184,13 +184,13 @@ func (s *stubRemoveSubnetValidatorTxIssuer) IssueRemoveSubnetValidatorTx(nodeID // stubCreateChainTxIssuer implements createChainTxIssuer. type stubCreateChainTxIssuer struct { - tx *txs.Tx + tx *platform.Tx err error gotCfg CreateChainConfig } -func (s *stubCreateChainTxIssuer) IssueCreateChainTx(subnetID ids.ID, genesis []byte, vmID ids.ID, fxIDs []ids.ID, chainName string, _ ...common.Option) (*txs.Tx, error) { +func (s *stubCreateChainTxIssuer) IssueCreateChainTx(subnetID ids.ID, genesis []byte, vmID ids.ID, fxIDs []ids.ID, chainName string, _ ...common.Option) (*platform.Tx, error) { s.gotCfg = CreateChainConfig{ SubnetID: subnetID, Genesis: genesis, @@ -211,7 +211,7 @@ func TestIssueSendTx(t *testing.T) { amount := uint64(42_000) txID := ids.GenerateTestID() - issuer := &stubBaseTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubBaseTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueSendTx(issuer, assetID, dest, amount) if err != nil { t.Fatalf("issueSendTx() returned error: %v", err) @@ -244,7 +244,7 @@ func TestIssueSendTx(t *testing.T) { func TestIssueSendTxPassesOptions(t *testing.T) { ctx := context.WithValue(context.Background(), testContextKey("key"), "value") - issuer := &stubBaseTxIssuer{tx: &txs.Tx{TxID: ids.GenerateTestID()}} + issuer := &stubBaseTxIssuer{tx: &platform.Tx{TxID: ids.GenerateTestID()}} _, err := issueSendTx( issuer, ids.GenerateTestID(), @@ -285,7 +285,7 @@ func TestIssueExportTx(t *testing.T) { amount := uint64(7) txID := ids.GenerateTestID() - issuer := &stubExportTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubExportTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueExportTx( issuer, destChainID, @@ -323,7 +323,7 @@ func TestIssueImportTx(t *testing.T) { owner := ids.GenerateTestShortID() txID := ids.GenerateTestID() - issuer := &stubImportTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubImportTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueImportTx( issuer, sourceChainID, @@ -364,7 +364,7 @@ func TestIssueAddPermissionlessValidatorTx(t *testing.T) { } txID := ids.GenerateTestID() - issuer := &stubValidatorTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubValidatorTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueAddPermissionlessValidatorTx( issuer, assetID, @@ -429,7 +429,7 @@ func TestIssueAddPermissionlessDelegatorTx(t *testing.T) { } txID := ids.GenerateTestID() - issuer := &stubDelegatorTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubDelegatorTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueAddPermissionlessDelegatorTx( issuer, assetID, @@ -466,7 +466,7 @@ func TestIssueCreateSubnetTx(t *testing.T) { owner := ids.GenerateTestShortID() txID := ids.GenerateTestID() - issuer := &stubCreateSubnetTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubCreateSubnetTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueCreateSubnetTx( issuer, owner, @@ -487,7 +487,7 @@ func TestIssueTransferSubnetOwnershipTx(t *testing.T) { newOwner := ids.GenerateTestShortID() txID := ids.GenerateTestID() - issuer := &stubTransferSubnetOwnershipTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubTransferSubnetOwnershipTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueTransferSubnetOwnershipTx( issuer, subnetID, @@ -511,10 +511,10 @@ func TestIssueConvertSubnetToL1Tx(t *testing.T) { subnetID := ids.GenerateTestID() chainID := ids.GenerateTestID() managerAddr := []byte{0x01, 0x02} - validators := []*txs.ConvertSubnetToL1Validator{{NodeID: []byte{0xAA}, Weight: 1}} + validators := []*platform.ConvertSubnetToL1Validator{{NodeID: []byte{0xAA}, Weight: 1}} txID := ids.GenerateTestID() - issuer := &stubConvertSubnetToL1TxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubConvertSubnetToL1TxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueConvertSubnetToL1Tx( issuer, subnetID, @@ -554,7 +554,7 @@ func TestIssueAddSubnetValidatorTx(t *testing.T) { } txID := ids.GenerateTestID() - issuer := &stubAddSubnetValidatorTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubAddSubnetValidatorTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueAddSubnetValidatorTx( issuer, cfg, @@ -589,7 +589,7 @@ func TestIssueRemoveSubnetValidatorTx(t *testing.T) { nodeID := ids.GenerateTestNodeID() txID := ids.GenerateTestID() - issuer := &stubRemoveSubnetValidatorTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubRemoveSubnetValidatorTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueRemoveSubnetValidatorTx( issuer, RemoveSubnetValidatorConfig{ @@ -639,7 +639,7 @@ func TestIssueCreateChainTx(t *testing.T) { } txID := ids.GenerateTestID() - issuer := &stubCreateChainTxIssuer{tx: &txs.Tx{TxID: txID}} + issuer := &stubCreateChainTxIssuer{tx: &platform.Tx{TxID: txID}} gotTxID, err := issueCreateChainTx( issuer, cfg, diff --git a/pkg/wallet/keychain.go b/pkg/wallet/keychain.go index 5cba921..cb3d9d8 100644 --- a/pkg/wallet/keychain.go +++ b/pkg/wallet/keychain.go @@ -45,13 +45,13 @@ func ParsePrivateKey(keyStr string) ([]byte, error) { } else if strings.HasPrefix(keyStr, "PrivateKey-") { // Avalanche CB58 format (PrivateKey-...) keyStr = strings.TrimPrefix(keyStr, "PrivateKey-") - keyBytes, err = cb58.Decode(keyStr) + keyBytes, err = cb58.Decode(keyStr, secp256k1.PrivateKeyLen) if err != nil { return nil, fmt.Errorf("failed to decode CB58 private key: %w", err) } } else { // Try CB58 without prefix - keyBytes, err = cb58.Decode(keyStr) + keyBytes, err = cb58.Decode(keyStr, secp256k1.PrivateKeyLen) if err != nil { // Try hex without prefix keyBytes, err = hex.DecodeString(keyStr)