Skip to content

Commit

Permalink
Merge branch 'implement-acp-77-warp-verification' into implement-acp-…
Browse files Browse the repository at this point in the history
…77-warp-signing
  • Loading branch information
StephenButtolph authored Nov 13, 2024
2 parents 26aa5a3 + a245061 commit ef445ca
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 1 deletion.
1 change: 1 addition & 0 deletions vms/platformvm/block/builder/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)
}
Expand Down
1 change: 1 addition & 0 deletions vms/platformvm/block/executor/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)
}
Expand Down
3 changes: 3 additions & 0 deletions vms/platformvm/block/executor/verifier_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -197,6 +197,7 @@ func TestVerifierVisitAtomicBlock(t *testing.T) {
verifier.state,
secp256k1fx.NewKeychain(genesis.EWOQKey),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)
exportedOutput = &avax.TransferableOutput{
Expand Down Expand Up @@ -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()
Expand Down Expand Up @@ -1100,6 +1102,7 @@ func TestBlockExecutionWithComplexity(t *testing.T) {
verifier.state,
secp256k1fx.NewKeychain(genesis.EWOQKey),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)

Expand Down
1 change: 1 addition & 0 deletions vms/platformvm/txs/executor/helpers_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
)
}
Expand Down
6 changes: 6 additions & 0 deletions vms/platformvm/txs/executor/standard_tx_executor_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -2383,6 +2383,7 @@ func TestStandardExecutorConvertSubnetTx(t *testing.T) {
baseState,
secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)
flowChecker = utxo.NewVerifier(
Expand Down Expand Up @@ -2562,6 +2563,7 @@ func TestStandardExecutorConvertSubnetTx(t *testing.T) {
baseState,
secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...),
[]ids.ID{subnetID},
nil, // validationIDs
nil, // chainIDs
)
chainID = ids.GenerateTestID()
Expand Down Expand Up @@ -2707,6 +2709,7 @@ func TestStandardExecutorRegisterSubnetValidatorTx(t *testing.T) {
baseState,
secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)
flowChecker = utxo.NewVerifier(
Expand Down Expand Up @@ -3122,6 +3125,7 @@ func TestStandardExecutorRegisterSubnetValidatorTx(t *testing.T) {
baseState,
secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)

Expand Down Expand Up @@ -3238,6 +3242,7 @@ func TestStandardExecutorSetSubnetValidatorWeightTx(t *testing.T) {
baseState,
secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)
flowChecker = utxo.NewVerifier(
Expand Down Expand Up @@ -3633,6 +3638,7 @@ func TestStandardExecutorSetSubnetValidatorWeightTx(t *testing.T) {
baseState,
secp256k1fx.NewKeychain(genesistest.DefaultFundedKeys...),
nil, // subnetIDs
nil, // validationIDs
nil, // chainIDs
)

Expand Down
16 changes: 15 additions & 1 deletion vms/platformvm/txs/txstest/wallet.go
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -32,6 +33,7 @@ func NewWallet(
state state.State,
kc *secp256k1fx.Keychain,
subnetIDs []ids.ID,
validationIDs []ids.ID,
chainIDs []ids.ID,
) wallet.Wallet {
var (
Expand Down Expand Up @@ -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(
Expand Down
1 change: 1 addition & 0 deletions vms/platformvm/vm_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -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},
)
}
Expand Down

0 comments on commit ef445ca

Please sign in to comment.