From 2e38800da76ee1e5ebfdc5bb490a2e51e1893a9c Mon Sep 17 00:00:00 2001 From: brentstone Date: Mon, 6 Nov 2023 10:44:51 +0100 Subject: [PATCH] update with new genesis + remove alias --- apps/src/lib/cli.rs | 49 +++++++++++++------ apps/src/lib/client/rpc.rs | 6 --- apps/src/lib/client/tx.rs | 19 +++++++ apps/src/lib/client/utils.rs | 11 +++-- apps/src/lib/config/genesis.rs | 5 +- apps/src/lib/config/genesis/transactions.rs | 33 +++++++++++++ apps/src/lib/node/ledger/shell/init_chain.rs | 11 +++++ .../shell/vote_extensions/bridge_pool_vext.rs | 1 + benches/txs.rs | 5 +- core/src/types/transaction/pos.rs | 10 +++- ethereum_bridge/src/test_utils.rs | 1 + proof_of_stake/src/lib.rs | 49 ++++--------------- proof_of_stake/src/storage.rs | 8 --- proof_of_stake/src/tests.rs | 1 + proof_of_stake/src/tests/state_machine.rs | 1 + proof_of_stake/src/tests/state_machine_v2.rs | 1 + proof_of_stake/src/types.rs | 3 -- sdk/src/args.rs | 10 +++- sdk/src/lib.rs | 7 ++- sdk/src/queries/vp/pos.rs | 4 +- sdk/src/signing.rs | 7 --- sdk/src/tx.rs | 2 - tx_prelude/src/proof_of_stake.rs | 13 ++++- 23 files changed, 161 insertions(+), 96 deletions(-) diff --git a/apps/src/lib/cli.rs b/apps/src/lib/cli.rs index 3664a71567a..fde9a4afdf7 100644 --- a/apps/src/lib/cli.rs +++ b/apps/src/lib/cli.rs @@ -2851,7 +2851,6 @@ pub mod args { pub const MAX_ETH_GAS: ArgOpt = arg_opt("max_eth-gas"); pub const MODE: ArgOpt = arg_opt("mode"); pub const NET_ADDRESS: Arg = arg("net-address"); - pub const NEW_ALIAS: ArgOpt = arg_opt("new-alias"); pub const NAMADA_START_TIME: ArgOpt = arg_opt("time"); pub const NO_CONVERSIONS: ArgFlag = flag("no-conversions"); pub const NUT: ArgFlag = flag("nut"); @@ -3900,6 +3899,10 @@ pub mod args { .map(|x| chain_ctx.get_cached(&x)), commission_rate: self.commission_rate, max_commission_rate_change: self.max_commission_rate_change, + email: self.email, + description: self.description, + website: self.website, + discord_handle: self.discord_handle, validator_vp_code_path: self .validator_vp_code_path .to_path_buf(), @@ -3921,6 +3924,10 @@ pub mod args { let commission_rate = COMMISSION_RATE.parse(matches); let max_commission_rate_change = MAX_COMMISSION_RATE_CHANGE.parse(matches); + let email = EMAIL.parse(matches); + let description = DESCRIPTION_OPT.parse(matches); + let website = WEBSITE_OPT.parse(matches); + let discord_handle = DISCORD_OPT.parse(matches); let validator_vp_code_path = VALIDATOR_CODE_PATH .parse(matches) .unwrap_or_else(|| PathBuf::from(VP_USER_WASM)); @@ -3938,6 +3945,10 @@ pub mod args { protocol_key, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, validator_vp_code_path, unsafe_dont_encrypt, tx_code_path, @@ -3985,6 +3996,24 @@ pub mod args { Expressed as a decimal between 0 and 1. This is a \ required parameter.", )) + .arg(EMAIL_OPT.def().help( + "The desired new validator email. To remove the existing \ + email, pass an empty string to this argument.", + )) + .arg(DESCRIPTION_OPT.def().help( + "The desired new validator description. To remove the \ + existing description, pass an empty string to this \ + argument.", + )) + .arg(WEBSITE_OPT.def().help( + "The desired new validator website. To remove the \ + existing website, pass an empty string to this argument.", + )) + .arg(DISCORD_OPT.def().help( + "The desired new validator discord handle. To remove the \ + existing discord handle, pass an empty string to this \ + argument.", + )) .arg(VALIDATOR_CODE_PATH.def().help( "The path to the validity predicate WASM code to be used \ for the validator account. Uses the default validator VP \ @@ -4960,11 +4989,10 @@ pub mod args { fn to_sdk(self, ctx: &mut Context) -> MetaDataChange { MetaDataChange:: { tx: self.tx.to_sdk(ctx), - validator: ctx.get(&self.validator), + validator: ctx.borrow_chain_or_exit().get(&self.validator), email: self.email, description: self.description, website: self.website, - alias: self.alias, discord_handle: self.discord_handle, commission_rate: self.commission_rate, tx_code_path: self.tx_code_path.to_path_buf(), @@ -4979,7 +5007,6 @@ pub mod args { let email = EMAIL_OPT.parse(matches); let description = DESCRIPTION_OPT.parse(matches); let website = WEBSITE_OPT.parse(matches); - let alias = NEW_ALIAS.parse(matches); let discord_handle = DISCORD_OPT.parse(matches); let commission_rate = COMMISSION_RATE_OPT.parse(matches); let tx_code_path = PathBuf::from(TX_CHANGE_METADATA_WASM); @@ -4989,7 +5016,6 @@ pub mod args { email, description, website, - alias, discord_handle, commission_rate, tx_code_path, @@ -5014,10 +5040,6 @@ pub mod args { "The desired new validator website. To remove the \ existing website, pass an empty string to this argument.", )) - .arg(NEW_ALIAS.def().help( - "The desired new validator alias. To remove the existing \ - website, pass an empty string to this argument.", - )) .arg(DISCORD_OPT.def().help( "The desired new validator discord handle. To remove the \ existing discord handle, pass an empty string to this \ @@ -5195,7 +5217,7 @@ pub mod args { fn to_sdk(self, ctx: &mut Context) -> QueryMetaData { QueryMetaData:: { query: self.query.to_sdk(ctx), - validator: ctx.get(&self.validator), + validator: ctx.borrow_chain_or_exit().get(&self.validator), } } } @@ -6343,18 +6365,17 @@ pub mod args { ) .arg(EMAIL.def().help( "The email address of the validator. This is a required \ - parameter.", + parameter.", )) .arg(DESCRIPTION_OPT.def().help( - "The validator's description. This is an optional \ - parameter.", + "The validator's description. This is an optional parameter.", )) .arg(WEBSITE_OPT.def().help( "The validator's website. This is an optional parameter.", )) .arg(DISCORD_OPT.def().help( "The validator's discord handle. This is an optional \ - parameter.", + parameter.", )) } } diff --git a/apps/src/lib/client/rpc.rs b/apps/src/lib/client/rpc.rs index 7b83c60e052..afd724d21f3 100644 --- a/apps/src/lib/client/rpc.rs +++ b/apps/src/lib/client/rpc.rs @@ -1970,7 +1970,6 @@ pub async fn query_and_print_metadata<'a>( email, description, website, - alias, discord_handle, }) => { display_line!( @@ -1989,11 +1988,6 @@ pub async fn query_and_print_metadata<'a>( } else { display_line!(context.io(), "No website"); } - if let Some(alias) = alias { - display_line!(context.io(), "Alias: {}", alias); - } else { - display_line!(context.io(), "No alias"); - } if let Some(discord_handle) = discord_handle { display_line!( context.io(), diff --git a/apps/src/lib/client/tx.rs b/apps/src/lib/client/tx.rs index 8f814808274..a8c2944784a 100644 --- a/apps/src/lib/client/tx.rs +++ b/apps/src/lib/client/tx.rs @@ -196,6 +196,10 @@ pub async fn submit_init_validator<'a>( protocol_key, commission_rate, max_commission_rate_change, + email, + website, + description, + discord_handle, validator_vp_code_path, unsafe_dont_encrypt, tx_code_path: _, @@ -368,6 +372,17 @@ pub async fn submit_init_validator<'a>( safe_exit(1) } } + // Validate the email + if email.is_empty() { + edisplay_line!( + namada.io(), + "The validator email must not be an empty string" + ); + if !tx_args.force { + safe_exit(1) + } + } + let tx_code_hash = query_wasm_code_hash(namada, args::TX_INIT_VALIDATOR_WASM) .await @@ -390,6 +405,10 @@ pub async fn submit_init_validator<'a>( dkg_key, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, validator_vp_code_hash: extra_section_hash, }; diff --git a/apps/src/lib/client/utils.rs b/apps/src/lib/client/utils.rs index a8affd8d0bd..2c66d68f9cf 100644 --- a/apps/src/lib/client/utils.rs +++ b/apps/src/lib/client/utils.rs @@ -636,6 +636,11 @@ pub fn init_genesis_validator( ); safe_exit(1) } + // Validate the email + if email.is_empty() { + eprintln!("The validator email must not be an empty string"); + safe_exit(1) + } let pre_genesis_dir = validator_pre_genesis_dir(&global_args.base_dir, &alias); println!("Generating validator keys..."); @@ -666,9 +671,9 @@ pub fn init_genesis_validator( transfer_from_source_amount, self_bond_amount, email, - description, - website, - discord_handle, + description, + website, + discord_handle, }, &mut source_wallet, &validator_wallet, diff --git a/apps/src/lib/config/genesis.rs b/apps/src/lib/config/genesis.rs index 204baff3e35..f9c54c9c79f 100644 --- a/apps/src/lib/config/genesis.rs +++ b/apps/src/lib/config/genesis.rs @@ -24,7 +24,6 @@ use namada::types::key::*; use namada::types::time::{DateTimeUtc, DurationSecs}; use namada::types::token::Denomination; use namada::types::{storage, token}; -use namada_sdk::proof_of_stake::types::ValidatorMetaData; use serde::{Deserialize, Serialize}; #[cfg(all(any(test, feature = "benches"), not(feature = "integration")))] @@ -392,6 +391,10 @@ pub fn make_dev_genesis( commission_rate: Dec::new(5, 2).expect("This can't fail"), max_commission_rate_change: Dec::new(1, 2) .expect("This can't fail"), + email: "null@null.net".to_string(), + description: None, + website: None, + discord_handle: None, net_address: SocketAddr::new( IpAddr::V4(Ipv4Addr::new(0, 0, 0, 0)), 8080, diff --git a/apps/src/lib/config/genesis/transactions.rs b/apps/src/lib/config/genesis/transactions.rs index 21db15f43a9..7232ccc801b 100644 --- a/apps/src/lib/config/genesis/transactions.rs +++ b/apps/src/lib/config/genesis/transactions.rs @@ -41,6 +41,10 @@ pub struct GenesisValidatorData { pub net_address: SocketAddr, pub transfer_from_source_amount: token::DenominatedAmount, pub self_bond_amount: token::DenominatedAmount, + pub email: String, + pub description: Option, + pub website: Option, + pub discord_handle: Option, } /// Panics if given `txs.validator_accounts` is not empty, because validator @@ -120,6 +124,10 @@ pub fn init_validator( net_address, transfer_from_source_amount, self_bond_amount, + email, + description, + website, + discord_handle, }: GenesisValidatorData, source_wallet: &mut Wallet, validator_wallet: &ValidatorWallet, @@ -158,6 +166,10 @@ pub fn init_validator( vp: "vp_validator".to_string(), commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, net_address, }; let validator_account = Some(vec![sign_validator_account_tx( @@ -256,6 +268,10 @@ pub fn sign_validator_account_tx( vp, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, net_address, eth_hot_key, eth_cold_key, @@ -298,6 +314,10 @@ pub fn sign_validator_account_tx( vp, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, net_address, eth_hot_key, eth_cold_key, @@ -554,6 +574,11 @@ pub struct ValidatorAccountTx { pub commission_rate: Dec, /// Maximum change in commission rate permitted per epoch pub max_commission_rate_change: Dec, + /// Validator metadata + pub email: String, + pub description: Option, + pub website: Option, + pub discord_handle: Option, /// P2P IP:port pub net_address: SocketAddr, /// PKs have to come last in TOML to avoid `ValueAfterTable` error @@ -1443,6 +1468,10 @@ impl From<&SignedValidatorAccountTx> for UnsignedValidatorAccountTx { vp, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, net_address, account_key, consensus_key, @@ -1458,6 +1487,10 @@ impl From<&SignedValidatorAccountTx> for UnsignedValidatorAccountTx { vp: vp.clone(), commission_rate: *commission_rate, max_commission_rate_change: *max_commission_rate_change, + email: email.clone(), + description: description.clone(), + website: website.clone(), + discord_handle: discord_handle.clone(), net_address: *net_address, account_key: account_key.pk.clone(), consensus_key: consensus_key.pk.clone(), diff --git a/apps/src/lib/node/ledger/shell/init_chain.rs b/apps/src/lib/node/ledger/shell/init_chain.rs index 57ddde6b269..437205ca281 100644 --- a/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/apps/src/lib/node/ledger/shell/init_chain.rs @@ -15,6 +15,7 @@ use namada::types::storage::KeySeg; use namada::types::time::{DateTimeUtc, TimeZone, Utc}; use namada::vm::validate_untrusted_wasm; use namada_sdk::eth_bridge::EthBridgeStatus; +use namada_sdk::proof_of_stake::types::ValidatorMetaData; use namada_sdk::proof_of_stake::PosParams; use super::*; @@ -416,6 +417,10 @@ where dkg_key, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, net_address: _, account_key, consensus_key, @@ -468,6 +473,12 @@ where current_epoch, commission_rate: *commission_rate, max_commission_rate_change: *max_commission_rate_change, + metadata: ValidatorMetaData { + email: email.clone(), + description: description.clone(), + website: website.clone(), + discord_handle: discord_handle.clone(), + }, offset_opt: Some(0), }, ) { 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 2cefc82bf45..cd9a779f919 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 @@ -340,6 +340,7 @@ mod test_bp_vote_extensions { current_epoch: 0.into(), commission_rate: Default::default(), max_commission_rate_change: Default::default(), + metadata: Default::default(), offset_opt: None, }) .expect("Test failed"); diff --git a/benches/txs.rs b/benches/txs.rs index d962dad1ce0..27ca1eff4ed 100644 --- a/benches/txs.rs +++ b/benches/txs.rs @@ -617,6 +617,10 @@ fn init_validator(c: &mut Criterion) { dkg_key, commission_rate: namada::types::dec::Dec::default(), max_commission_rate_change: namada::types::dec::Dec::default(), + email: "null@null.net".to_string(), + description: None, + website: None, + discord_handle: None, validator_vp_code_hash: extra_hash, }; let tx = generate_tx( @@ -664,7 +668,6 @@ fn change_validator_metadata(c: &mut Criterion) { email: None, description: Some("I will change this piece of data".to_string()), website: None, - alias: None, discord_handle: None, commission_rate: None, }; diff --git a/core/src/types/transaction/pos.rs b/core/src/types/transaction/pos.rs index 9e4abff75b5..35b7aaba3a6 100644 --- a/core/src/types/transaction/pos.rs +++ b/core/src/types/transaction/pos.rs @@ -43,6 +43,14 @@ pub struct InitValidator { /// The maximum change allowed per epoch to the commission rate. This is /// immutable once set here. pub max_commission_rate_change: Dec, + /// The validator email + pub email: String, + /// The validator description + pub description: Option, + /// The validator website + pub website: Option, + /// The validator's discord handle + pub discord_handle: Option, /// The VP code for validator account pub validator_vp_code_hash: Hash, } @@ -161,8 +169,6 @@ pub struct MetaDataChange { pub description: Option, /// Validator website pub website: Option, - /// Validator alias - pub alias: Option, /// Validator's discord handle pub discord_handle: Option, /// Validator's commission rate diff --git a/ethereum_bridge/src/test_utils.rs b/ethereum_bridge/src/test_utils.rs index 0874ad7a78d..78b30600c49 100644 --- a/ethereum_bridge/src/test_utils.rs +++ b/ethereum_bridge/src/test_utils.rs @@ -289,6 +289,7 @@ pub fn append_validators_to_storage( current_epoch, commission_rate: Dec::new(5, 2).unwrap(), max_commission_rate_change: Dec::new(1, 2).unwrap(), + metadata: Default::default(), offset_opt: Some(1), }) .expect("Test failed"); diff --git a/proof_of_stake/src/lib.rs b/proof_of_stake/src/lib.rs index 189016e3a78..062fbe7cba5 100644 --- a/proof_of_stake/src/lib.rs +++ b/proof_of_stake/src/lib.rs @@ -51,10 +51,9 @@ use storage::{ get_validator_address_from_bond, is_bond_key, is_unbond_key, is_validator_slashes_key, last_block_proposer_key, params_key, slashes_prefix, unbonds_for_source_prefix, unbonds_prefix, - validator_address_raw_hash_key, validator_alias_key, - validator_description_key, validator_discord_key, validator_email_key, - validator_last_slash_key, validator_max_commission_rate_change_key, - validator_website_key, + validator_address_raw_hash_key, validator_description_key, + validator_discord_key, validator_email_key, validator_last_slash_key, + validator_max_commission_rate_change_key, validator_website_key, }; use types::{ into_tm_voting_power, BelowCapacityValidatorSet, @@ -2692,6 +2691,8 @@ pub struct BecomeValidator<'a, S> { pub commission_rate: Dec, /// Max commission rate change. pub max_commission_rate_change: Dec, + /// Validator metadata + pub metadata: ValidatorMetaData, /// Optional offset to use instead of pipeline offset pub offset_opt: Option, } @@ -2714,6 +2715,7 @@ where current_epoch, commission_rate, max_commission_rate_change, + metadata, offset_opt, } = args; let offset = offset_opt.unwrap_or(params.pipeline_len); @@ -2733,6 +2735,7 @@ where address, max_commission_rate_change, )?; + write_validator_metadata(storage, address, &metadata)?; // Epoched validator data validator_consensus_key_handle(address).set( @@ -5370,6 +5373,7 @@ pub mod test_utils { commission_rate, max_commission_rate_change, tokens, + metadata, } in validators { become_validator(BecomeValidator { @@ -5383,6 +5387,7 @@ pub mod test_utils { current_epoch, commission_rate, max_commission_rate_change, + metadata, offset_opt: Some(0), })?; // Credit token amount to be bonded to the validator address so it @@ -5514,35 +5519,6 @@ where } } -/// Read PoS validator's alias. -pub fn read_validator_alias( - storage: &S, - validator: &Address, -) -> storage_api::Result> -where - S: StorageRead, -{ - storage.read(&validator_alias_key(validator)) -} - -/// Write PoS validator's alias. If the provided arg is an empty string, -/// remove the data. -pub fn write_validator_alias( - storage: &mut S, - validator: &Address, - alias: &String, -) -> storage_api::Result<()> -where - S: StorageRead + StorageWrite, -{ - let key = validator_alias_key(validator); - if alias.is_empty() { - storage.delete(&key) - } else { - storage.write(&key, alias) - } -} - /// Read PoS validator's discord handle. pub fn read_validator_discord_handle( storage: &S, @@ -5590,9 +5566,6 @@ where if let Some(website) = metadata.website.as_ref() { write_validator_website(storage, validator, website)?; } - if let Some(alias) = metadata.alias.as_ref() { - write_validator_alias(storage, validator, alias)?; - } if let Some(discord) = metadata.discord_handle.as_ref() { write_validator_discord_handle(storage, validator, discord)?; } @@ -5609,7 +5582,6 @@ pub fn change_validator_metadata( email: Option, description: Option, website: Option, - alias: Option, discord_handle: Option, commission_rate: Option, current_epoch: Epoch, @@ -5626,9 +5598,6 @@ where if let Some(website) = website { write_validator_website(storage, validator, &website)?; } - if let Some(alias) = alias { - write_validator_alias(storage, validator, &alias)?; - } if let Some(discord) = discord_handle { write_validator_discord_handle(storage, validator, &discord)?; } diff --git a/proof_of_stake/src/storage.rs b/proof_of_stake/src/storage.rs index a3d0be6f72f..6d1136e6bf3 100644 --- a/proof_of_stake/src/storage.rs +++ b/proof_of_stake/src/storage.rs @@ -53,7 +53,6 @@ const DELEGATOR_REDELEGATED_UNBONDS_KEY: &str = "delegator_redelegated_unbonds"; const VALIDATOR_EMAIL_KEY: &str = "email"; const VALIDATOR_DESCRIPTION_KEY: &str = "description"; const VALIDATOR_WEBSITE_KEY: &str = "website"; -const VALIDATOR_ALIAS_KEY: &str = "alias"; const VALIDATOR_DISCORD_KEY: &str = "discord_handle"; /// Is the given key a PoS storage key? @@ -778,13 +777,6 @@ pub fn validator_website_key(validator: &Address) -> Key { .expect("Cannot obtain a storage key") } -/// Storage key for a validator's alias -pub fn validator_alias_key(validator: &Address) -> Key { - validator_prefix(validator) - .push(&VALIDATOR_ALIAS_KEY.to_owned()) - .expect("Cannot obtain a storage key") -} - /// Storage key for a validator's discord handle pub fn validator_discord_key(validator: &Address) -> Key { validator_prefix(validator) diff --git a/proof_of_stake/src/tests.rs b/proof_of_stake/src/tests.rs index f4af2038ead..2c578b5d69b 100644 --- a/proof_of_stake/src/tests.rs +++ b/proof_of_stake/src/tests.rs @@ -951,6 +951,7 @@ fn test_become_validator_aux( commission_rate: Dec::new(5, 2).expect("Dec creation failed"), max_commission_rate_change: Dec::new(5, 2) .expect("Dec creation failed"), + metadata: Default::default(), offset_opt: None, }) .unwrap(); diff --git a/proof_of_stake/src/tests/state_machine.rs b/proof_of_stake/src/tests/state_machine.rs index ee056f5b768..9681c6f409e 100644 --- a/proof_of_stake/src/tests/state_machine.rs +++ b/proof_of_stake/src/tests/state_machine.rs @@ -275,6 +275,7 @@ impl StateMachineTest for ConcretePosState { current_epoch, commission_rate, max_commission_rate_change, + metadata: Default::default(), offset_opt: None, }) .unwrap(); diff --git a/proof_of_stake/src/tests/state_machine_v2.rs b/proof_of_stake/src/tests/state_machine_v2.rs index a49d341e006..70b0216d0b9 100644 --- a/proof_of_stake/src/tests/state_machine_v2.rs +++ b/proof_of_stake/src/tests/state_machine_v2.rs @@ -2003,6 +2003,7 @@ impl StateMachineTest for ConcretePosState { current_epoch, commission_rate, max_commission_rate_change, + metadata: Default::default(), offset_opt: None, }) .unwrap(); diff --git a/proof_of_stake/src/types.rs b/proof_of_stake/src/types.rs index d727af29caf..d72b599cdcd 100644 --- a/proof_of_stake/src/types.rs +++ b/proof_of_stake/src/types.rs @@ -351,8 +351,6 @@ pub struct ValidatorMetaData { pub description: Option, /// Validator website pub website: Option, - /// Validator alias - pub alias: Option, /// Validator's discord handle pub discord_handle: Option, } @@ -364,7 +362,6 @@ impl Default for ValidatorMetaData { email: String::from("null@null.net"), description: Default::default(), website: Default::default(), - alias: Default::default(), discord_handle: Default::default(), } } diff --git a/sdk/src/args.rs b/sdk/src/args.rs index f2537ba361a..91455d5752c 100644 --- a/sdk/src/args.rs +++ b/sdk/src/args.rs @@ -746,6 +746,14 @@ pub struct TxInitValidator { pub commission_rate: Dec, /// Maximum commission rate change pub max_commission_rate_change: Dec, + /// The validator email + pub email: String, + /// The validator description + pub description: Option, + /// The validator website + pub website: Option, + /// The validator's discord handle + pub discord_handle: Option, /// Path to the VP WASM code file pub validator_vp_code_path: PathBuf, /// Path to the TX WASM code file @@ -1279,8 +1287,6 @@ pub struct MetaDataChange { pub description: Option, /// New validator website pub website: Option, - /// New validator alias - pub alias: Option, /// New validator discord handle pub discord_handle: Option, /// New validator commission rate diff --git a/sdk/src/lib.rs b/sdk/src/lib.rs index 69f8f5a30b6..2b47fe8d87c 100644 --- a/sdk/src/lib.rs +++ b/sdk/src/lib.rs @@ -306,7 +306,6 @@ pub trait Namada<'a>: Sized { email: Option, description: Option, website: Option, - alias: Option, discord_handle: Option, commission_rate: Option, ) -> args::MetaDataChange { @@ -315,7 +314,6 @@ pub trait Namada<'a>: Sized { email, description, website, - alias, discord_handle, commission_rate, tx_code_path: PathBuf::from(TX_CHANGE_METADATA_WASM), @@ -328,6 +326,7 @@ pub trait Namada<'a>: Sized { &self, commission_rate: Dec, max_commission_rate_change: Dec, + email: String, ) -> args::TxInitValidator { args::TxInitValidator { commission_rate, @@ -343,6 +342,10 @@ pub trait Namada<'a>: Sized { unsafe_dont_encrypt: false, tx_code_path: PathBuf::from(TX_INIT_VALIDATOR_WASM), tx: self.tx_builder(), + email, + description: None, + website: None, + discord_handle: None, } } diff --git a/sdk/src/queries/vp/pos.rs b/sdk/src/queries/vp/pos.rs index b2197dfbb93..cd775d899be 100644 --- a/sdk/src/queries/vp/pos.rs +++ b/sdk/src/queries/vp/pos.rs @@ -21,7 +21,7 @@ use namada_proof_of_stake::{ read_all_validator_addresses, read_below_capacity_validator_set_addresses_with_stake, read_consensus_validator_set_addresses_with_stake, read_pos_params, - read_total_stake, read_validator_alias, read_validator_description, + read_total_stake, read_validator_description, read_validator_discord_handle, read_validator_email, read_validator_max_commission_rate_change, read_validator_stake, read_validator_website, unbond_handle, validator_commission_rate_handle, @@ -247,7 +247,6 @@ where let email = read_validator_email(ctx.wl_storage, &validator)?; let description = read_validator_description(ctx.wl_storage, &validator)?; let website = read_validator_website(ctx.wl_storage, &validator)?; - let alias = read_validator_alias(ctx.wl_storage, &validator)?; let discord_handle = read_validator_discord_handle(ctx.wl_storage, &validator)?; @@ -257,7 +256,6 @@ where email, description, website, - alias, discord_handle, })), _ => Ok(None), diff --git a/sdk/src/signing.rs b/sdk/src/signing.rs index 95e95f0096f..0ba002ea5e1 100644 --- a/sdk/src/signing.rs +++ b/sdk/src/signing.rs @@ -1494,13 +1494,6 @@ pub async fn to_ledger_vector<'a>( other_items.push(format!("New website : {}", website)); } } - if let Some(alias) = metadata_change.alias { - if alias.is_empty() { - other_items.push("Alias removed".to_string()); - } else { - other_items.push(format!("New alias : {}", alias)); - } - } if let Some(discord_handle) = metadata_change.discord_handle { if discord_handle.is_empty() { other_items.push("Discord handle removed".to_string()); diff --git a/sdk/src/tx.rs b/sdk/src/tx.rs index da1e8a9b9ff..e45b1a9dcd2 100644 --- a/sdk/src/tx.rs +++ b/sdk/src/tx.rs @@ -618,7 +618,6 @@ pub async fn build_validator_metadata_change<'a>( email, description, website, - alias, discord_handle, commission_rate, tx_code_path, @@ -722,7 +721,6 @@ pub async fn build_validator_metadata_change<'a>( email: email.clone(), website: website.clone(), description: description.clone(), - alias: alias.clone(), discord_handle: discord_handle.clone(), commission_rate: *commission_rate, }; diff --git a/tx_prelude/src/proof_of_stake.rs b/tx_prelude/src/proof_of_stake.rs index 81241baf0ef..fc32363a0b4 100644 --- a/tx_prelude/src/proof_of_stake.rs +++ b/tx_prelude/src/proof_of_stake.rs @@ -5,6 +5,7 @@ use namada_core::types::hash::Hash; use namada_core::types::transaction::pos::InitValidator; use namada_core::types::{key, token}; pub use namada_proof_of_stake::parameters::PosParams; +use namada_proof_of_stake::types::ValidatorMetaData; use namada_proof_of_stake::{ become_validator, bond_tokens, change_validator_commission_rate, change_validator_metadata, read_pos_params, redelegate_tokens, @@ -102,6 +103,10 @@ impl Ctx { dkg_key, commission_rate, max_commission_rate_change, + email, + description, + website, + discord_handle, validator_vp_code_hash: _, }: InitValidator, validator_vp_code_hash: Hash, @@ -132,6 +137,12 @@ impl Ctx { current_epoch, commission_rate, max_commission_rate_change, + metadata: ValidatorMetaData { + email, + description, + website, + discord_handle, + }, offset_opt: None, })?; @@ -146,7 +157,6 @@ impl Ctx { email: Option, description: Option, website: Option, - alias: Option, discord_handle: Option, commission_rate: Option, ) -> TxResult { @@ -157,7 +167,6 @@ impl Ctx { email, description, website, - alias, discord_handle, commission_rate, current_epoch,