diff --git a/apps/src/lib/config/genesis.rs b/apps/src/lib/config/genesis.rs index 502082af48..921e42a844 100644 --- a/apps/src/lib/config/genesis.rs +++ b/apps/src/lib/config/genesis.rs @@ -338,6 +338,12 @@ pub mod genesis_config { .unwrap() .to_public_key() .unwrap(), + protocol_key: config + .protocol_public_key + .as_ref() + .unwrap() + .to_public_key() + .unwrap(), eth_cold_key: config .eth_cold_key .as_ref() @@ -372,12 +378,6 @@ pub mod genesis_config { .unwrap() .to_public_key() .unwrap(), - protocol_key: config - .protocol_public_key - .as_ref() - .unwrap() - .to_public_key() - .unwrap(), dkg_public_key: config .dkg_public_key .as_ref() @@ -774,9 +774,6 @@ pub struct Validator { /// this key on a transaction signature. /// Note that this is distinct from consensus key used in the PoS system. pub account_key: common::PublicKey, - /// Public key associated with validator account used for signing protocol - /// transactions - pub protocol_key: common::PublicKey, /// The public DKG session key used during the DKG protocol pub dkg_public_key: DkgPublicKey, /// These tokens are not staked and hence do not contribute to the @@ -938,6 +935,7 @@ pub fn genesis(num_validators: u64) -> Genesis { address, tokens: token::Amount::native_whole(200_000), consensus_key: consensus_keypair.ref_to(), + protocol_key: protocol_keypair.ref_to(), commission_rate: Dec::new(5, 2).expect("This can't fail"), max_commission_rate_change: Dec::new(1, 2) .expect("This can't fail"), @@ -945,7 +943,6 @@ pub fn genesis(num_validators: u64) -> Genesis { eth_hot_key: eth_bridge_keypair.ref_to(), }, account_key: account_keypair.ref_to(), - protocol_key: protocol_keypair.ref_to(), dkg_public_key: dkg_keypair.public(), non_staked_balance: token::Amount::native_whole(100_000), // TODO replace with https://github.com/anoma/namada/issues/25) @@ -971,6 +968,7 @@ pub fn genesis(num_validators: u64) -> Genesis { address, tokens: token::Amount::native_whole(200_000), consensus_key: consensus_keypair.ref_to(), + protocol_key: protocol_keypair.ref_to(), commission_rate: Dec::new(5, 2).expect("This can't fail"), max_commission_rate_change: Dec::new(1, 2) .expect("This can't fail"), @@ -978,7 +976,6 @@ pub fn genesis(num_validators: u64) -> Genesis { eth_hot_key: eth_bridge_keypair.ref_to(), }, account_key: account_keypair.ref_to(), - protocol_key: protocol_keypair.ref_to(), dkg_public_key: dkg_keypair.public(), non_staked_balance: token::Amount::native_whole(100_000), // TODO replace with https://github.com/anoma/namada/issues/25) diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index 4d7522aaba..a8d47df174 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -394,10 +394,6 @@ where ) .unwrap(); - self.wl_storage - .write(&protocol_pk_key(addr), &validator.protocol_key) - .expect("Unable to set genesis user protocol public key"); - self.wl_storage .write( &dkg_session_keys::dkg_pk_key(addr), diff --git a/apps/src/lib/node/ledger/shell/vote_extensions/bridge_pool_vext.rs b/apps/src/lib/node/ledger/shell/vote_extensions/bridge_pool_vext.rs index 880409bef8..05f0263a10 100644 --- a/apps/src/lib/node/ledger/shell/vote_extensions/bridge_pool_vext.rs +++ b/apps/src/lib/node/ledger/shell/vote_extensions/bridge_pool_vext.rs @@ -276,7 +276,6 @@ mod test_bp_vote_extensions { #[cfg(not(feature = "abcipp"))] use namada::ledger::eth_bridge::EthBridgeQueries; use namada::ledger::pos::PosQueries; - use namada::ledger::storage_api::StorageWrite; use namada::proof_of_stake::types::{ Position as ValidatorPosition, WeightedValidator, }; @@ -321,24 +320,12 @@ mod test_bp_vote_extensions { ) .expect("Test failed"); - // register Bertha's protocol key - let pk_key = protocol_pk_key(&bertha_address()); - shell - .wl_storage - .write_bytes( - &pk_key, - bertha_keypair() - .ref_to() - .try_to_vec() - .expect("Test failed."), - ) - .expect("Test failed."); - // change pipeline length to 1 let mut params = shell.wl_storage.pos_queries().get_pos_params(); params.owned.pipeline_len = 1; let consensus_key = gen_keypair(); + let protocol_key = bertha_keypair(); let hot_key = gen_secp256k1_keypair(); let cold_key = gen_secp256k1_keypair(); @@ -347,6 +334,7 @@ mod test_bp_vote_extensions { params: ¶ms, address: &bertha_address(), consensus_key: &consensus_key.ref_to(), + protocol_key: &protocol_key.ref_to(), eth_hot_key: &hot_key.ref_to(), eth_cold_key: &cold_key.ref_to(), current_epoch: 0.into(), diff --git a/ethereum_bridge/src/test_utils.rs b/ethereum_bridge/src/test_utils.rs index 8091566f10..2764d5c4d7 100644 --- a/ethereum_bridge/src/test_utils.rs +++ b/ethereum_bridge/src/test_utils.rs @@ -198,6 +198,7 @@ pub fn init_storage_with_validators( .map(|(address, tokens)| { let keys = TestValidatorKeys::generate(); let consensus_key = keys.consensus.ref_to(); + let protocol_key = keys.protocol.ref_to(); let eth_cold_key = keys.eth_gov.ref_to(); let eth_hot_key = keys.eth_bridge.ref_to(); all_keys.insert(address.clone(), keys); @@ -205,6 +206,7 @@ pub fn init_storage_with_validators( address, tokens, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate: Dec::new(5, 2).unwrap(), @@ -270,6 +272,7 @@ pub fn append_validators_to_storage( let keys = TestValidatorKeys::generate(); let consensus_key = &keys.consensus.ref_to(); + let protocol_key = &&keys.protocol.ref_to(); let eth_cold_key = &keys.eth_gov.ref_to(); let eth_hot_key = &keys.eth_bridge.ref_to(); @@ -278,6 +281,7 @@ pub fn append_validators_to_storage( params: ¶ms, address: &validator, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, current_epoch, diff --git a/proof_of_stake/src/epoched.rs b/proof_of_stake/src/epoched.rs index 0f66a36d84..e8e8498645 100644 --- a/proof_of_stake/src/epoched.rs +++ b/proof_of_stake/src/epoched.rs @@ -1372,6 +1372,7 @@ mod test { address: established_address_1(), tokens: token::Amount::native_whole(1_000), consensus_key: key::testing::keypair_1().to_public(), + protocol_key: key::testing::keypair_2().to_public(), eth_hot_key: key::testing::keypair_3().to_public(), eth_cold_key: key::testing::keypair_3().to_public(), commission_rate: Dec::new(1, 1).expect("Dec creation failed"), diff --git a/proof_of_stake/src/lib.rs b/proof_of_stake/src/lib.rs index 223abdc1fe..bcb03319f9 100644 --- a/proof_of_stake/src/lib.rs +++ b/proof_of_stake/src/lib.rs @@ -41,7 +41,7 @@ use namada_core::ledger::storage_api::{ use namada_core::types::address::{Address, InternalAddress}; use namada_core::types::dec::Dec; use namada_core::types::key::{ - common, tm_consensus_key_raw_hash, PublicKeyTmRawHash, + common, protocol_pk_key, tm_consensus_key_raw_hash, PublicKeyTmRawHash, }; pub use namada_core::types::storage::{Epoch, Key, KeySeg}; use namada_core::types::token; @@ -58,7 +58,7 @@ use storage::{ BondsAndUnbondsDetail, BondsAndUnbondsDetails, EpochedSlashes, ReverseOrdTokenAmount, RewardsAccumulator, SlashedAmount, TotalConsensusStakes, UnbondDetails, ValidatorAddresses, - ValidatorUnbondRecords, + ValidatorProtocolKeys, ValidatorUnbondRecords, }; use thiserror::Error; use types::{ @@ -261,6 +261,14 @@ pub fn validator_consensus_key_handle( ValidatorConsensusKeys::open(key) } +/// Get the storage handle to a PoS validator's protocol key key. +pub fn validator_protocol_key_handle( + validator: &Address, +) -> ValidatorProtocolKeys { + let key = protocol_pk_key(validator); + ValidatorProtocolKeys::open(key) +} + /// Get the storage handle to a PoS validator's eth hot key. pub fn validator_eth_hot_key_handle( validator: &Address, @@ -414,6 +422,7 @@ where address, tokens, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate, @@ -453,6 +462,11 @@ where consensus_key, current_epoch, )?; + validator_protocol_key_handle(&address).init_at_genesis( + storage, + protocol_key, + current_epoch, + )?; validator_eth_hot_key_handle(&address).init_at_genesis( storage, eth_hot_key, @@ -2159,6 +2173,8 @@ pub struct BecomeValidator<'a, S> { pub address: &'a Address, /// The validator's consensus key, used by Tendermint. pub consensus_key: &'a common::PublicKey, + /// The validator's protocol key. + pub protocol_key: &'a common::PublicKey, /// The validator's Ethereum bridge cold key. pub eth_cold_key: &'a common::PublicKey, /// The validator's Ethereum bridge hot key. @@ -2183,6 +2199,7 @@ where params, address, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, current_epoch, @@ -2213,6 +2230,12 @@ where current_epoch, params.pipeline_len, )?; + validator_protocol_key_handle(address).set( + storage, + protocol_key.clone(), + current_epoch, + params.pipeline_len, + )?; validator_eth_hot_key_handle(address).set( storage, eth_hot_key.clone(), diff --git a/proof_of_stake/src/pos_queries.rs b/proof_of_stake/src/pos_queries.rs index 190548570b..b694897aa8 100644 --- a/proof_of_stake/src/pos_queries.rs +++ b/proof_of_stake/src/pos_queries.rs @@ -1,7 +1,6 @@ //! Storage API for querying data about Proof-of-stake related //! data. This includes validator and epoch related data. -use borsh::{BorshDeserialize, BorshSerialize}; use namada_core::ledger::parameters::storage::get_max_proposal_bytes_key; use namada_core::ledger::parameters::EpochDuration; use namada_core::ledger::storage::WlStorage; @@ -172,17 +171,17 @@ where pk: &key::common::PublicKey, epoch: Option, ) -> Result { - let pk_bytes = pk - .try_to_vec() - .expect("Serializing public key should not fail"); + let params = crate::read_pos_params(self.wl_storage) + .expect("Failed to fetch Pos params"); let epoch = epoch .unwrap_or_else(|| self.wl_storage.storage.get_current_epoch().0); self.get_consensus_validators(Some(epoch)) .iter() .find(|validator| { - let pk_key = key::protocol_pk_key(&validator.address); - match self.wl_storage.storage.read(&pk_key) { - Ok((Some(bytes), _)) => bytes == pk_bytes, + let protocol_keys = + crate::validator_protocol_key_handle(&validator.address); + match protocol_keys.get(self.wl_storage, epoch, ¶ms) { + Ok(Some(key)) => key == *pk, _ => false, } }) @@ -195,26 +194,24 @@ where address: &Address, epoch: Option, ) -> Result<(token::Amount, key::common::PublicKey)> { + let params = crate::read_pos_params(self.wl_storage) + .expect("Failed to fetch Pos params"); let epoch = epoch .unwrap_or_else(|| self.wl_storage.storage.get_current_epoch().0); self.get_consensus_validators(Some(epoch)) .iter() .find(|validator| address == &validator.address) .map(|validator| { - let protocol_pk_key = key::protocol_pk_key(&validator.address); - // TODO: rewrite this, to use `StorageRead::read` - let bytes = self - .wl_storage - .storage - .read(&protocol_pk_key) - .expect("Validator should have public protocol key") - .0 - .expect("Validator should have public protocol key"); - let protocol_pk: key::common::PublicKey = - BorshDeserialize::deserialize(&mut bytes.as_ref()).expect( - "Protocol public key in storage should be \ - deserializable", + let protocol_keys = + crate::validator_protocol_key_handle(&validator.address); + let protocol_pk = protocol_keys + .get(self.wl_storage, epoch, ¶ms) + .unwrap() + .expect( + "Protocol public key should be set in storage after \ + genesis.", ); + (validator.bonded_stake, protocol_pk) }) .ok_or_else(|| Error::NotValidatorAddress(address.clone(), epoch)) diff --git a/proof_of_stake/src/tests.rs b/proof_of_stake/src/tests.rs index 045fc383da..497b53151c 100644 --- a/proof_of_stake/src/tests.rs +++ b/proof_of_stake/src/tests.rs @@ -853,6 +853,8 @@ fn test_become_validator_aux( // Initialize the validator account let consensus_key = new_validator_consensus_key.to_public(); + let protocol_sk = common_sk_from_simple_seed(0); + let protocol_key = protocol_sk.to_public(); let eth_hot_key = key::common::PublicKey::Secp256k1( key::testing::gen_keypair::().ref_to(), ); @@ -864,6 +866,7 @@ fn test_become_validator_aux( params: ¶ms, address: &new_validator, consensus_key: &consensus_key, + protocol_key: &protocol_key, eth_cold_key: ð_cold_key, eth_hot_key: ð_hot_key, current_epoch, @@ -1176,6 +1179,9 @@ fn test_validator_sets() { let start_epoch = Epoch::default(); let epoch = start_epoch; + let protocol_sk_1 = common_sk_from_simple_seed(0); + let protocol_sk_2 = common_sk_from_simple_seed(1); + let params = test_init_genesis( &mut s, params, @@ -1184,6 +1190,7 @@ fn test_validator_sets() { address: val1.clone(), tokens: stake1, consensus_key: pk1.clone(), + protocol_key: protocol_sk_1.to_public(), eth_hot_key: key::common::PublicKey::Secp256k1( key::testing::gen_keypair::() .ref_to(), @@ -1200,6 +1207,7 @@ fn test_validator_sets() { address: val2.clone(), tokens: stake2, consensus_key: pk2.clone(), + protocol_key: protocol_sk_2.to_public(), eth_hot_key: key::common::PublicKey::Secp256k1( key::testing::gen_keypair::() .ref_to(), @@ -1847,6 +1855,9 @@ fn test_validator_sets_swap() { println!("val2: {val2}, {pk2}, {}", stake2.to_string_native()); println!("val3: {val3}, {pk3}, {}", stake3.to_string_native()); + let protocol_sk_1 = common_sk_from_simple_seed(0); + let protocol_sk_2 = common_sk_from_simple_seed(1); + let params = test_init_genesis( &mut s, params, @@ -1855,6 +1866,7 @@ fn test_validator_sets_swap() { address: val1, tokens: stake1, consensus_key: pk1, + protocol_key: protocol_sk_1.to_public(), eth_hot_key: key::common::PublicKey::Secp256k1( key::testing::gen_keypair::() .ref_to(), @@ -1871,6 +1883,7 @@ fn test_validator_sets_swap() { address: val2.clone(), tokens: stake2, consensus_key: pk2, + protocol_key: protocol_sk_2.to_public(), eth_hot_key: key::common::PublicKey::Secp256k1( key::testing::gen_keypair::() .ref_to(), @@ -2098,6 +2111,9 @@ fn arb_genesis_validators( let consensus_sk = common_sk_from_simple_seed(seed); let consensus_key = consensus_sk.to_public(); + let protocol_sk = common_sk_from_simple_seed(seed); + let protocol_key = protocol_sk.to_public(); + let eth_hot_key = key::common::PublicKey::Secp256k1( key::testing::gen_keypair::( ) @@ -2116,6 +2132,7 @@ fn arb_genesis_validators( address, tokens, consensus_key, + protocol_key, eth_hot_key, eth_cold_key, commission_rate, diff --git a/proof_of_stake/src/tests/state_machine.rs b/proof_of_stake/src/tests/state_machine.rs index 05b9b26345..1313c467ff 100644 --- a/proof_of_stake/src/tests/state_machine.rs +++ b/proof_of_stake/src/tests/state_machine.rs @@ -106,6 +106,7 @@ enum Transition { InitValidator { address: Address, consensus_key: PublicKey, + protocol_key: PublicKey, eth_cold_key: PublicKey, eth_hot_key: PublicKey, commission_rate: Dec, @@ -189,6 +190,7 @@ impl StateMachineTest for ConcretePosState { Transition::InitValidator { address, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate, @@ -202,6 +204,7 @@ impl StateMachineTest for ConcretePosState { params: ¶ms, address: &address, consensus_key: &consensus_key, + protocol_key: &protocol_key, eth_cold_key: ð_cold_key, eth_hot_key: ð_hot_key, current_epoch, @@ -1226,6 +1229,7 @@ impl ReferenceStateMachine for AbstractPosState { address, tokens, consensus_key: _, + protocol_key: _, eth_cold_key: _, eth_hot_key: _, commission_rate: _, @@ -1349,6 +1353,7 @@ impl ReferenceStateMachine for AbstractPosState { 1 => ( address::testing::arb_established_address(), key::testing::arb_common_keypair(), + key::testing::arb_common_keypair(), key::testing::arb_common_secp256k1_keypair(), key::testing::arb_common_secp256k1_keypair(), arb_rate(), @@ -1358,6 +1363,7 @@ impl ReferenceStateMachine for AbstractPosState { |( addr, consensus_key, + protocol_key, eth_hot_key, eth_cold_key, commission_rate, @@ -1366,6 +1372,7 @@ impl ReferenceStateMachine for AbstractPosState { Transition::InitValidator { address: Address::Established(addr), consensus_key: consensus_key.to_public(), + protocol_key: protocol_key.to_public(), eth_hot_key: eth_hot_key.to_public(), eth_cold_key: eth_cold_key.to_public(), commission_rate, @@ -1443,6 +1450,7 @@ impl ReferenceStateMachine for AbstractPosState { Transition::InitValidator { address, consensus_key: _, + protocol_key: _, eth_cold_key: _, eth_hot_key: _, commission_rate: _, @@ -1839,6 +1847,7 @@ impl ReferenceStateMachine for AbstractPosState { Transition::InitValidator { address, consensus_key: _, + protocol_key: _, eth_cold_key: _, eth_hot_key: _, commission_rate: _, diff --git a/proof_of_stake/src/types.rs b/proof_of_stake/src/types.rs index 3cc24ffbbb..6a38785917 100644 --- a/proof_of_stake/src/types.rs +++ b/proof_of_stake/src/types.rs @@ -40,6 +40,13 @@ pub type ValidatorConsensusKeys = crate::epoched::Epoched< crate::epoched::OffsetDefaultNumPastEpochs, >; +/// Epoched validator's protocol key. +pub type ValidatorProtocolKeys = crate::epoched::Epoched< + common::PublicKey, + crate::epoched::OffsetPipelineLen, + crate::epoched::OffsetMaxProposalPeriodPlus, +>; + /// Epoched validator's eth hot key. pub type ValidatorEthHotKeys = crate::epoched::Epoched< common::PublicKey, @@ -205,6 +212,8 @@ pub struct GenesisValidator { pub tokens: token::Amount, /// A public key used for signing validator's consensus actions pub consensus_key: common::PublicKey, + /// A public key used for signing protocol transactions + pub protocol_key: common::PublicKey, /// An Eth bridge governance public key pub eth_cold_key: common::PublicKey, /// An Eth bridge hot signing public key used for validator set updates and diff --git a/shared/src/ledger/native_vp/ibc/mod.rs b/shared/src/ledger/native_vp/ibc/mod.rs index 818aa4df79..0f6c9ef6f7 100644 --- a/shared/src/ledger/native_vp/ibc/mod.rs +++ b/shared/src/ledger/native_vp/ibc/mod.rs @@ -257,6 +257,9 @@ pub fn get_dummy_genesis_validator() let consensus_sk = common_sk_from_simple_seed(0); let consensus_key = consensus_sk.to_public(); + let protocol_sk = common_sk_from_simple_seed(1); + let protocol_key = protocol_sk.to_public(); + let commission_rate = Dec::new(1, 1).expect("expected 0.1 to be a valid decimal"); let max_commission_rate_change = @@ -278,6 +281,7 @@ pub fn get_dummy_genesis_validator() address, tokens, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate, diff --git a/tx_prelude/src/proof_of_stake.rs b/tx_prelude/src/proof_of_stake.rs index cc8bcb7b63..341c819347 100644 --- a/tx_prelude/src/proof_of_stake.rs +++ b/tx_prelude/src/proof_of_stake.rs @@ -96,8 +96,6 @@ impl Ctx { &account_keys, threshold, )?; - let protocol_pk_key = key::protocol_pk_key(&validator_address); - self.write(&protocol_pk_key, &protocol_key)?; let dkg_pk_key = key::dkg_session_keys::dkg_pk_key(&validator_address); self.write(&dkg_pk_key, &dkg_key)?; let eth_cold_key = key::common::PublicKey::Secp256k1(eth_cold_key); @@ -109,6 +107,7 @@ impl Ctx { params: ¶ms, address: &validator_address, consensus_key: &consensus_key, + protocol_key: &protocol_key, eth_cold_key: ð_cold_key, eth_hot_key: ð_hot_key, current_epoch, diff --git a/wasm/wasm_source/src/tx_bond.rs b/wasm/wasm_source/src/tx_bond.rs index 509a50f822..e51164b3a3 100644 --- a/wasm/wasm_source/src/tx_bond.rs +++ b/wasm/wasm_source/src/tx_bond.rs @@ -76,6 +76,7 @@ mod tests { let is_delegation = matches!(&bond.source, Some(source) if *source != bond.validator); let consensus_key = key::testing::keypair_1().ref_to(); + let protocol_key = key::testing::keypair_2().ref_to(); let commission_rate = Dec::new(5, 2).expect("Cannot fail"); let max_commission_rate_change = Dec::new(1, 2).expect("Cannot fail"); let eth_cold_key = key::testing::keypair_3().ref_to(); @@ -85,6 +86,7 @@ mod tests { address: bond.validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate, diff --git a/wasm/wasm_source/src/tx_change_validator_commission.rs b/wasm/wasm_source/src/tx_change_validator_commission.rs index b8db50ecb0..82bdd5717f 100644 --- a/wasm/wasm_source/src/tx_change_validator_commission.rs +++ b/wasm/wasm_source/src/tx_change_validator_commission.rs @@ -66,6 +66,8 @@ mod tests { pos_params: OwnedPosParams, ) -> TxResult { let consensus_key = key::testing::keypair_1().ref_to(); + let protocol_key = key::testing::keypair_2().ref_to(); + let eth_hot_key = key::common::PublicKey::Secp256k1( key::testing::gen_keypair::().ref_to(), ); @@ -76,6 +78,7 @@ mod tests { address: commission_change.validator.clone(), tokens: token::Amount::from_uint(1_000_000, 0).unwrap(), consensus_key, + protocol_key, commission_rate: initial_rate, max_commission_rate_change: max_change, eth_hot_key, diff --git a/wasm/wasm_source/src/tx_unbond.rs b/wasm/wasm_source/src/tx_unbond.rs index 5e1eaeb2a3..cd085e3c2e 100644 --- a/wasm/wasm_source/src/tx_unbond.rs +++ b/wasm/wasm_source/src/tx_unbond.rs @@ -75,6 +75,8 @@ mod tests { &unbond.source, Some(source) if *source != unbond.validator); let consensus_key = key::testing::keypair_1().ref_to(); + let protocol_key = key::testing::keypair_2().ref_to(); + let eth_cold_key = key::testing::keypair_3().ref_to(); let eth_hot_key = key::testing::keypair_4().ref_to(); let commission_rate = Dec::new(5, 2).expect("Cannot fail"); @@ -90,6 +92,7 @@ mod tests { initial_stake }, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate, diff --git a/wasm/wasm_source/src/tx_withdraw.rs b/wasm/wasm_source/src/tx_withdraw.rs index e288282c42..54280fa7e2 100644 --- a/wasm/wasm_source/src/tx_withdraw.rs +++ b/wasm/wasm_source/src/tx_withdraw.rs @@ -78,6 +78,8 @@ mod tests { let is_delegation = matches!( &withdraw.source, Some(source) if *source != withdraw.validator); let consensus_key = key::testing::keypair_1().ref_to(); + let protocol_key = key::testing::keypair_2().ref_to(); + let eth_cold_key = key::testing::keypair_3().ref_to(); let eth_hot_key = key::testing::keypair_4().ref_to(); let commission_rate = Dec::new(5, 2).expect("Cannot fail"); @@ -94,6 +96,7 @@ mod tests { initial_stake }, consensus_key, + protocol_key, eth_cold_key, eth_hot_key, commission_rate, diff --git a/wasm/wasm_source/src/vp_implicit.rs b/wasm/wasm_source/src/vp_implicit.rs index 215dccf421..c51650b752 100644 --- a/wasm/wasm_source/src/vp_implicit.rs +++ b/wasm/wasm_source/src/vp_implicit.rs @@ -391,6 +391,7 @@ mod tests { let validator = address::testing::established_address_3(); let initial_stake = token::Amount::from_uint(10_098_123, 0).unwrap(); let consensus_key = key::testing::keypair_2().ref_to(); + let protocol_key = key::testing::keypair_1().ref_to(); let eth_cold_key = key::testing::keypair_3().ref_to(); let eth_hot_key = key::testing::keypair_4().ref_to(); let commission_rate = Dec::new(5, 2).unwrap(); @@ -400,6 +401,7 @@ mod tests { address: validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, commission_rate, max_commission_rate_change, eth_hot_key, @@ -470,6 +472,7 @@ mod tests { let validator = address::testing::established_address_3(); let initial_stake = token::Amount::from_uint(10_098_123, 0).unwrap(); let consensus_key = key::testing::keypair_2().ref_to(); + let protocol_key = key::testing::keypair_1().ref_to(); let commission_rate = Dec::new(5, 2).unwrap(); let max_commission_rate_change = Dec::new(1, 2).unwrap(); @@ -477,6 +480,7 @@ mod tests { address: validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, commission_rate, max_commission_rate_change, eth_hot_key: key::common::PublicKey::Secp256k1( diff --git a/wasm/wasm_source/src/vp_user.rs b/wasm/wasm_source/src/vp_user.rs index a334576b53..5283b5e8db 100644 --- a/wasm/wasm_source/src/vp_user.rs +++ b/wasm/wasm_source/src/vp_user.rs @@ -418,6 +418,7 @@ mod tests { let validator = address::testing::established_address_3(); let initial_stake = token::Amount::from_uint(10_098_123, 0).unwrap(); let consensus_key = key::testing::keypair_2().ref_to(); + let protocol_key = key::testing::keypair_1().ref_to(); let eth_cold_key = key::testing::keypair_3().ref_to(); let eth_hot_key = key::testing::keypair_4().ref_to(); let commission_rate = Dec::new(5, 2).unwrap(); @@ -427,6 +428,7 @@ mod tests { address: validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, commission_rate, max_commission_rate_change, eth_hot_key, @@ -495,6 +497,7 @@ mod tests { let validator = address::testing::established_address_3(); let initial_stake = token::Amount::from_uint(10_098_123, 0).unwrap(); let consensus_key = key::testing::keypair_2().ref_to(); + let protocol_key = key::testing::keypair_1().ref_to(); let commission_rate = Dec::new(5, 2).unwrap(); let max_commission_rate_change = Dec::new(1, 2).unwrap(); @@ -502,6 +505,7 @@ mod tests { address: validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, commission_rate, max_commission_rate_change, eth_hot_key: key::common::PublicKey::Secp256k1( diff --git a/wasm/wasm_source/src/vp_validator.rs b/wasm/wasm_source/src/vp_validator.rs index 77a8c76d66..1c53daa4f1 100644 --- a/wasm/wasm_source/src/vp_validator.rs +++ b/wasm/wasm_source/src/vp_validator.rs @@ -425,6 +425,7 @@ mod tests { let validator = address::testing::established_address_3(); let initial_stake = token::Amount::from_uint(10_098_123, 0).unwrap(); let consensus_key = key::testing::keypair_2().ref_to(); + let protocol_key = key::testing::keypair_1().ref_to(); let eth_cold_key = key::testing::keypair_3().ref_to(); let eth_hot_key = key::testing::keypair_4().ref_to(); let commission_rate = Dec::new(5, 2).unwrap(); @@ -434,6 +435,7 @@ mod tests { address: validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, commission_rate, max_commission_rate_change, eth_hot_key, @@ -508,6 +510,7 @@ mod tests { let validator = address::testing::established_address_3(); let initial_stake = token::Amount::from_uint(10_098_123, 0).unwrap(); let consensus_key = key::testing::keypair_2().ref_to(); + let protocol_key = key::testing::keypair_1().ref_to(); let commission_rate = Dec::new(5, 2).unwrap(); let max_commission_rate_change = Dec::new(1, 2).unwrap(); @@ -515,6 +518,7 @@ mod tests { address: validator.clone(), tokens: initial_stake, consensus_key, + protocol_key, commission_rate, max_commission_rate_change, eth_hot_key: key::common::PublicKey::Secp256k1(