diff --git a/vms/platformvm/block/builder/helpers_test.go b/vms/platformvm/block/builder/helpers_test.go index 4f18ba89c7b4..a00227309810 100644 --- a/vms/platformvm/block/builder/helpers_test.go +++ b/vms/platformvm/block/builder/helpers_test.go @@ -221,6 +221,7 @@ func newWallet(t testing.TB, e *environment, c walletConfig) wallet.Wallet { e.state, secp256k1fx.NewKeychain(c.keys...), c.subnetIDs, + nil, // validationIDs []ids.ID{e.ctx.CChainID, e.ctx.XChainID}, ) } diff --git a/vms/platformvm/block/executor/helpers_test.go b/vms/platformvm/block/executor/helpers_test.go index 14554e248b5d..cef542533ded 100644 --- a/vms/platformvm/block/executor/helpers_test.go +++ b/vms/platformvm/block/executor/helpers_test.go @@ -224,6 +224,7 @@ func newWallet(t testing.TB, e *environment, c walletConfig) wallet.Wallet { e.state, secp256k1fx.NewKeychain(c.keys...), c.subnetIDs, + nil, // validationIDs []ids.ID{e.ctx.CChainID, e.ctx.XChainID}, ) } diff --git a/vms/platformvm/block/executor/verifier_test.go b/vms/platformvm/block/executor/verifier_test.go index 26023c36718a..4060c6152803 100644 --- a/vms/platformvm/block/executor/verifier_test.go +++ b/vms/platformvm/block/executor/verifier_test.go @@ -197,6 +197,7 @@ func TestVerifierVisitAtomicBlock(t *testing.T) { verifier.state, secp256k1fx.NewKeychain(genesis.EWOQKey), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) exportedOutput = &avax.TransferableOutput{ @@ -346,6 +347,7 @@ func TestVerifierVisitStandardBlock(t *testing.T) { verifier.state, secp256k1fx.NewKeychain(genesis.EWOQKey), nil, // subnetIDs + nil, // validationIDs []ids.ID{ctx.XChainID}, // Read the UTXO to import ) initialTimestamp = verifier.state.GetTimestamp() @@ -1100,6 +1102,7 @@ func TestBlockExecutionWithComplexity(t *testing.T) { verifier.state, secp256k1fx.NewKeychain(genesis.EWOQKey), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) diff --git a/vms/platformvm/txs/executor/helpers_test.go b/vms/platformvm/txs/executor/helpers_test.go index 3823355795d7..7c1dbdc1e005 100644 --- a/vms/platformvm/txs/executor/helpers_test.go +++ b/vms/platformvm/txs/executor/helpers_test.go @@ -192,6 +192,7 @@ func newWallet(t testing.TB, e *environment, c walletConfig) wallet.Wallet { e.state, secp256k1fx.NewKeychain(c.keys...), c.subnetIDs, + nil, // validationIDs c.chainIDs, ) } diff --git a/vms/platformvm/txs/executor/standard_tx_executor_test.go b/vms/platformvm/txs/executor/standard_tx_executor_test.go index 376a31499dd7..350267ad23ca 100644 --- a/vms/platformvm/txs/executor/standard_tx_executor_test.go +++ b/vms/platformvm/txs/executor/standard_tx_executor_test.go @@ -2383,6 +2383,7 @@ func TestStandardExecutorConvertSubnetTx(t *testing.T) { baseState, secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) flowChecker = utxo.NewVerifier( @@ -2562,6 +2563,7 @@ func TestStandardExecutorConvertSubnetTx(t *testing.T) { baseState, secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...), []ids.ID{subnetID}, + nil, // validationIDs nil, // chainIDs ) chainID = ids.GenerateTestID() @@ -2707,6 +2709,7 @@ func TestStandardExecutorRegisterSubnetValidatorTx(t *testing.T) { baseState, secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) flowChecker = utxo.NewVerifier( @@ -3122,6 +3125,7 @@ func TestStandardExecutorRegisterSubnetValidatorTx(t *testing.T) { baseState, secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) @@ -3238,6 +3242,7 @@ func TestStandardExecutorSetSubnetValidatorWeightTx(t *testing.T) { baseState, secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) flowChecker = utxo.NewVerifier( @@ -3633,6 +3638,7 @@ func TestStandardExecutorSetSubnetValidatorWeightTx(t *testing.T) { baseState, secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...), nil, // subnetIDs + nil, // validationIDs nil, // chainIDs ) diff --git a/vms/platformvm/txs/txstest/wallet.go b/vms/platformvm/txs/txstest/wallet.go index f26f2d612aef..2de042d402ef 100644 --- a/vms/platformvm/txs/txstest/wallet.go +++ b/vms/platformvm/txs/txstest/wallet.go @@ -18,6 +18,7 @@ import ( "github.com/ava-labs/avalanchego/vms/platformvm/fx" "github.com/ava-labs/avalanchego/vms/platformvm/state" "github.com/ava-labs/avalanchego/vms/platformvm/txs" + "github.com/ava-labs/avalanchego/vms/platformvm/warp/message" "github.com/ava-labs/avalanchego/vms/secp256k1fx" "github.com/ava-labs/avalanchego/wallet/chain/p/builder" "github.com/ava-labs/avalanchego/wallet/chain/p/signer" @@ -32,6 +33,7 @@ func NewWallet( state state.State, kc *secp256k1fx.Keychain, subnetIDs []ids.ID, + validationIDs []ids.ID, chainIDs []ids.ID, ) wallet.Wallet { var ( @@ -74,12 +76,24 @@ func NewWallet( } } - owners := make(map[ids.ID]fx.Owner, len(subnetIDs)) + owners := make(map[ids.ID]fx.Owner, len(subnetIDs)+len(validationIDs)) for _, subnetID := range subnetIDs { owner, err := state.GetSubnetOwner(subnetID) require.NoError(err) owners[subnetID] = owner } + for _, validationID := range validationIDs { + sov, err := state.GetSubnetOnlyValidator(validationID) + require.NoError(err) + + var owner message.PChainOwner + _, err = txs.Codec.Unmarshal(sov.DeactivationOwner, &owner) + require.NoError(err) + owners[validationID] = &secp256k1fx.OutputOwners{ + Threshold: owner.Threshold, + Addrs: owner.Addresses, + } + } builderContext := newContext(ctx, config, state) backend := wallet.NewBackend( diff --git a/vms/platformvm/vm_test.go b/vms/platformvm/vm_test.go index e8c83ba3350e..3a9f2f695817 100644 --- a/vms/platformvm/vm_test.go +++ b/vms/platformvm/vm_test.go @@ -241,6 +241,7 @@ func newWallet(t testing.TB, vm *VM, c walletConfig) wallet.Wallet { vm.state, secp256k1fx.NewKeychain(c.keys...), c.subnetIDs, + nil, // validationIDs []ids.ID{vm.ctx.CChainID, vm.ctx.XChainID}, ) }