diff --git a/.changelog/unreleased/SDK/2561-remove-update-vp.md b/.changelog/unreleased/SDK/2561-remove-update-vp.md new file mode 100644 index 0000000000..ff78b36dc4 --- /dev/null +++ b/.changelog/unreleased/SDK/2561-remove-update-vp.md @@ -0,0 +1,3 @@ +- `InitAccount` and `UpdateAccount` don't require `vp_code_hash` anymore. + `TxInitAccount`. `TxUpdateAccount` and `TxInitValidator` don't have a path to + the vp code anymore. ([\#2561](https://github.com/anoma/namada/pull/2561)) \ No newline at end of file diff --git a/.changelog/unreleased/improvements/2561-remove-update-vp.md b/.changelog/unreleased/improvements/2561-remove-update-vp.md new file mode 100644 index 0000000000..9dccd33f2d --- /dev/null +++ b/.changelog/unreleased/improvements/2561-remove-update-vp.md @@ -0,0 +1,2 @@ +- Removed custom vps for established accounts. + ([\#2561](https://github.com/anoma/namada/pull/2561)) \ No newline at end of file diff --git a/crates/account/src/types.rs b/crates/account/src/types.rs index 332c3e8764..1fb7bc7474 100644 --- a/crates/account/src/types.rs +++ b/crates/account/src/types.rs @@ -1,6 +1,5 @@ use namada_core::address::Address; use namada_core::borsh::{BorshDeserialize, BorshSchema, BorshSerialize}; -use namada_core::hash::Hash; use namada_core::key::common; use serde::{Deserialize, Serialize}; @@ -20,13 +19,11 @@ pub struct InitAccount { /// for signature verification of transactions for the newly created /// account. pub public_keys: Vec, - /// The VP code hash - pub vp_code_hash: Hash, /// The account signature threshold pub threshold: u8, } -/// A tx data type to update an account's validity predicate +/// A tx data type to update an account's signature threshold and keys #[derive( Debug, Clone, @@ -40,8 +37,6 @@ pub struct InitAccount { pub struct UpdateAccount { /// An address of the account pub addr: Address, - /// The new VP code hash - pub vp_code_hash: Option, /// Public keys to be written into the account's storage. This can be used /// for signature verification of transactions for the newly created /// account. @@ -54,7 +49,6 @@ pub struct UpdateAccount { /// Tests and strategies for accounts pub mod tests { use namada_core::address::testing::arb_non_internal_address; - use namada_core::hash::testing::arb_hash; use namada_core::key::testing::arb_common_pk; use proptest::prelude::Just; use proptest::{collection, option, prop_compose}; @@ -68,11 +62,9 @@ pub mod tests { )( threshold in 0..=public_keys.len() as u8, public_keys in Just(public_keys), - vp_code_hash in arb_hash(), ) -> InitAccount { InitAccount { public_keys, - vp_code_hash, threshold, } } @@ -84,13 +76,11 @@ pub mod tests { public_keys in collection::vec(arb_common_pk(), 0..10), )( addr in arb_non_internal_address(), - vp_code_hash in option::of(arb_hash()), threshold in option::of(0..=public_keys.len() as u8), public_keys in Just(public_keys), ) -> UpdateAccount { UpdateAccount { addr, - vp_code_hash, public_keys, threshold, } diff --git a/crates/apps/src/lib/cli.rs b/crates/apps/src/lib/cli.rs index 109c0d78af..e77d38b90e 100644 --- a/crates/apps/src/lib/cli.rs +++ b/crates/apps/src/lib/cli.rs @@ -1246,8 +1246,8 @@ pub mod cmds { fn def() -> App { App::new(Self::CMD) .about( - "Send a signed transaction to update account's validity \ - predicate.", + "Send a signed transaction to update account's threshold \ + or keys.", ) .add_args::>() } @@ -3197,8 +3197,6 @@ pub mod args { arg_multi("account-keys"); pub const VALIDATOR_CONSENSUS_KEY: ArgOpt = arg_opt("consensus-key"); - pub const VALIDATOR_CODE_PATH: ArgOpt = - arg_opt("validator-code-path"); pub const VALIDATOR_ETH_COLD_KEY: ArgOpt = arg_opt("eth-cold-key"); pub const VALIDATOR_ETH_HOT_KEY: ArgOpt = @@ -3208,7 +3206,6 @@ pub mod args { pub const VIEWING_KEY: Arg = arg("key"); pub const VIEWING_KEYS: ArgMulti = arg_multi("viewing-keys"); - pub const VP: ArgOpt = arg_opt("vp"); pub const WALLET_ALIAS_FORCE: ArgFlag = flag("wallet-alias-force"); pub const WASM_CHECKSUMS_PATH: Arg = arg("wasm-checksums-path"); pub const WASM_DIR: ArgOpt = arg_opt("wasm-dir"); @@ -4134,7 +4131,6 @@ pub mod args { let chain_ctx = ctx.borrow_mut_chain_or_exit(); TxInitAccount:: { tx, - vp_code_path: self.vp_code_path, tx_code_path: self.tx_code_path, public_keys: self .public_keys @@ -4149,15 +4145,11 @@ pub mod args { impl Args for TxInitAccount { fn parse(matches: &ArgMatches) -> Self { let tx = Tx::parse(matches); - let vp_code_path = CODE_PATH_OPT - .parse(matches) - .unwrap_or_else(|| PathBuf::from(VP_USER_WASM)); let tx_code_path = PathBuf::from(TX_INIT_ACCOUNT_WASM); let public_keys = PUBLIC_KEYS.parse(matches); let threshold = THRESHOLD.parse(matches); Self { tx, - vp_code_path, public_keys, threshold, tx_code_path, @@ -4166,11 +4158,6 @@ pub mod args { fn def(app: App) -> App { app.add_args::>() - .arg(CODE_PATH_OPT.def().help( - "The path to the validity predicate WASM code to be used \ - for the new account. Uses the default user VP if none \ - specified.", - )) .arg(PUBLIC_KEYS.def().help( "A list public keys to be associated with the new account \ in hexadecimal encoding.", @@ -4291,11 +4278,6 @@ pub mod args { .arg(WEBSITE_OPT.def().help("The validator's website.")) .arg(DISCORD_OPT.def().help("The validator's discord handle.")) .arg(AVATAR_OPT.def().help("The validator's avatar.")) - .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 \ - if none specified.", - )) .arg(UNSAFE_DONT_ENCRYPT.def().help( "UNSAFE: Do not encrypt the generated keypairs. Do not \ use this for keys used in a live network.", @@ -4327,9 +4309,6 @@ pub mod args { website: self.website, discord_handle: self.discord_handle, avatar: self.avatar, - validator_vp_code_path: self - .validator_vp_code_path - .to_path_buf(), unsafe_dont_encrypt: self.unsafe_dont_encrypt, tx_init_account_code_path: self .tx_init_account_code_path @@ -4358,9 +4337,6 @@ pub mod args { let website = WEBSITE_OPT.parse(matches); let discord_handle = DISCORD_OPT.parse(matches); let avatar = AVATAR_OPT.parse(matches); - let validator_vp_code_path = VALIDATOR_CODE_PATH - .parse(matches) - .unwrap_or_else(|| PathBuf::from(VP_USER_WASM)); let unsafe_dont_encrypt = UNSAFE_DONT_ENCRYPT.parse(matches); let tx_init_account_code_path = PathBuf::from(TX_INIT_ACCOUNT_WASM); let tx_become_validator_code_path = @@ -4382,7 +4358,6 @@ pub mod args { website, discord_handle, avatar, - validator_vp_code_path, unsafe_dont_encrypt, tx_init_account_code_path, tx_become_validator_code_path, @@ -4435,11 +4410,6 @@ pub mod args { .arg(WEBSITE_OPT.def().help("The validator's website.")) .arg(DISCORD_OPT.def().help("The validator's discord handle.")) .arg(AVATAR_OPT.def().help("The validator's avatar.")) - .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 \ - if none specified.", - )) .arg(UNSAFE_DONT_ENCRYPT.def().help( "UNSAFE: Do not encrypt the generated keypairs. Do not \ use this for keys used in a live network.", @@ -4458,7 +4428,6 @@ pub mod args { let chain_ctx = ctx.borrow_mut_chain_or_exit(); TxUpdateAccount:: { tx, - vp_code_path: self.vp_code_path, tx_code_path: self.tx_code_path, addr: chain_ctx.get(&self.addr), public_keys: self @@ -4474,14 +4443,12 @@ pub mod args { impl Args for TxUpdateAccount { fn parse(matches: &ArgMatches) -> Self { let tx = Tx::parse(matches); - let vp_code_path = CODE_PATH_OPT.parse(matches); let addr = ADDRESS.parse(matches); let tx_code_path = PathBuf::from(TX_UPDATE_ACCOUNT_WASM); let public_keys = PUBLIC_KEYS.parse(matches); let threshold = THRESHOLD.parse(matches); Self { tx, - vp_code_path, addr, tx_code_path, public_keys, @@ -4491,11 +4458,6 @@ pub mod args { fn def(app: App) -> App { app.add_args::>() - .arg( - CODE_PATH_OPT.def().help( - "The path to the new validity predicate WASM code.", - ), - ) .arg(ADDRESS.def().help( "The account's address. It's key is used to produce the \ signature.", @@ -6983,7 +6945,6 @@ pub mod args { #[derive(Clone, Debug)] pub struct InitGenesisEstablishedAccount { - pub vp: String, pub wallet_aliases: Vec, pub threshold: u8, pub output_path: PathBuf, @@ -6991,14 +6952,11 @@ pub mod args { impl Args for InitGenesisEstablishedAccount { fn parse(matches: &ArgMatches) -> Self { - use crate::config::genesis::utils::VP_USER; let wallet_aliases = ALIAS_MANY.parse(matches); - let vp = VP.parse(matches).unwrap_or_else(|| VP_USER.to_string()); let threshold = THRESHOLD.parse(matches).unwrap_or(1); let output_path = PATH.parse(matches); Self { wallet_aliases, - vp, threshold, output_path, } @@ -7014,9 +6972,6 @@ pub mod args { authorization. Must be less than or equal to the maximum \ number of key aliases provided.", )) - .arg(VP.def().help( - "The validity predicate of the account. Defaults to `vp_user`.", - )) .arg(PATH.def().help( "The path of the .toml file to write the established account \ transaction to. Overwrites the file if it exists.", diff --git a/crates/apps/src/lib/client/tx.rs b/crates/apps/src/lib/client/tx.rs index 30d41f17c7..200f5ff04c 100644 --- a/crates/apps/src/lib/client/tx.rs +++ b/crates/apps/src/lib/client/tx.rs @@ -874,7 +874,6 @@ pub async fn submit_init_validator( description, discord_handle, avatar, - validator_vp_code_path, unsafe_dont_encrypt, tx_init_account_code_path, tx_become_validator_code_path, @@ -884,7 +883,6 @@ pub async fn submit_init_validator( namada, args::TxInitAccount { tx: tx_args.clone(), - vp_code_path: validator_vp_code_path, tx_code_path: tx_init_account_code_path, public_keys: account_keys, threshold, diff --git a/crates/apps/src/lib/client/utils.rs b/crates/apps/src/lib/client/utils.rs index 24a9591098..7baa613e34 100644 --- a/crates/apps/src/lib/client/utils.rs +++ b/crates/apps/src/lib/client/utils.rs @@ -739,7 +739,6 @@ pub fn init_genesis_established_account( .collect(); let (address, txs) = genesis::transactions::init_established_account( - args.vp, public_keys, args.threshold, ); diff --git a/crates/apps/src/lib/config/genesis.rs b/crates/apps/src/lib/config/genesis.rs index 8ab5fcb1d4..bb75d4da76 100644 --- a/crates/apps/src/lib/config/genesis.rs +++ b/crates/apps/src/lib/config/genesis.rs @@ -193,10 +193,6 @@ pub struct Validator { /// These tokens are not staked and hence do not contribute to the /// validator's voting power pub non_staked_balance: token::Amount, - /// Validity predicate code WASM - pub validator_vp_code_path: String, - /// Expected SHA-256 hash of the validator VP - pub validator_vp_sha256: [u8; 32], } #[derive( @@ -206,10 +202,6 @@ pub struct Validator { pub struct EstablishedAccount { /// Address pub address: Address, - /// Validity predicate code WASM - pub vp_code_path: String, - /// Expected SHA-256 hash of the validity predicate wasm - pub vp_sha256: [u8; 32], /// A public key to be stored in the account's storage, if any pub public_key: Option, /// Account's sub-space storage. The values must be borsh encoded bytes. @@ -446,7 +438,6 @@ pub fn make_dev_genesis( genesis.transactions.established_account.as_mut().unwrap(); let tx = transactions::EstablishedAccountTx { - vp: utils::VP_USER.to_string(), public_keys: vec![StringEncoded::new( consensus_keypair.ref_to(), )], @@ -461,7 +452,6 @@ pub fn make_dev_genesis( let validator_account_tx = transactions::ValidatorAccountTx { address: StringEncoded::new(address.clone()), - vp: utils::VP_USER.to_string(), commission_rate: Dec::new(5, 2).expect("This can't fail"), max_commission_rate_change: Dec::new(1, 2) .expect("This can't fail"), @@ -496,7 +486,6 @@ pub fn make_dev_genesis( tx: transactions::Signed::new( transactions::ValidatorAccountTx { address: StringEncoded::new(address.clone()), - vp: validator_account_tx.vp, commission_rate: validator_account_tx.commission_rate, max_commission_rate_change: validator_account_tx .max_commission_rate_change, diff --git a/crates/apps/src/lib/config/genesis/transactions.rs b/crates/apps/src/lib/config/genesis/transactions.rs index a1b4213b38..67a1406709 100644 --- a/crates/apps/src/lib/config/genesis/transactions.rs +++ b/crates/apps/src/lib/config/genesis/transactions.rs @@ -233,12 +233,10 @@ pub fn parse_unsigned( /// Create signed [`Transactions`] for an established account. pub fn init_established_account( - vp: String, public_keys: Vec>, threshold: u8, ) -> (Address, UnsignedTransactions) { let unsigned_tx = EstablishedAccountTx { - vp, threshold, public_keys, }; @@ -303,8 +301,6 @@ pub fn init_validator( eth_cold_key: StringEncoded::new( validator_wallet.eth_cold_key.ref_to(), ), - // No custom validator VPs yet - vp: utils::VP_USER.to_string(), commission_rate, max_commission_rate_change, net_address, @@ -383,7 +379,6 @@ pub async fn sign_validator_account_tx( consensus_key, protocol_key, tendermint_node_key, - vp, commission_rate, max_commission_rate_change, net_address, @@ -420,7 +415,6 @@ pub async fn sign_validator_account_tx( consensus_key, protocol_key, tendermint_node_key, - vp, commission_rate, max_commission_rate_change, net_address, @@ -584,8 +578,6 @@ pub type SignedBondTx = Signed>; pub struct ValidatorAccountTx { /// The address of the validator. pub address: StringEncoded, - // TODO: remove the vp field - pub vp: String, /// Commission rate charged on rewards for delegators (bounded inside /// 0-1) pub commission_rate: Dec, @@ -677,7 +669,6 @@ impl TxToSign for ValidatorAccountTx { Ord, )] pub struct EstablishedAccountTx { - pub vp: String, #[serde(default = "default_threshold")] pub threshold: u8, /// PKs have to come last in TOML to avoid `ValueAfterTable` error @@ -1108,7 +1099,6 @@ pub fn validate( signatures: acct.signatures, data: ValidatorAccountTx { address: acct.data.address, - vp: acct.data.vp, commission_rate: acct.data.commission_rate, max_commission_rate_change: acct .data @@ -1246,7 +1236,7 @@ pub struct TokenBalancesForValidation { pub fn validate_established_account( tx: &EstablishedAccountTx, - vps: Option<&ValidityPredicates>, + _vps: Option<&ValidityPredicates>, all_used_addresses: &mut BTreeSet
, established_accounts: &mut BTreeMap, u8)>, ) -> bool { @@ -1304,19 +1294,6 @@ pub fn validate_established_account( all_used_addresses.insert(established_address); } - // Check the VP exists - if !vps - .map(|vps| vps.wasm.contains_key(&tx.vp)) - .unwrap_or_default() - { - eprintln!( - "An `established_account` tx `vp` \"{}\" not found in Validity \ - predicates file.", - tx.vp - ); - is_valid = false; - } - // If PK is used, check the authorization if tx.public_keys.is_empty() { eprintln!("An `established_account` tx was found with no public keys."); @@ -1327,7 +1304,7 @@ pub fn validate_established_account( pub fn validate_validator_account( signed_tx: &SignedValidatorAccountTx, - vps: Option<&ValidityPredicates>, + _vps: Option<&ValidityPredicates>, all_used_addresses: &BTreeSet
, established_accounts: &BTreeMap, u8)>, validator_accounts: &mut BTreeSet
, @@ -1414,19 +1391,6 @@ pub fn validate_validator_account( established_address }; - // Check the VP exists - if !vps - .map(|vps| vps.wasm.contains_key(&tx.vp)) - .unwrap_or_default() - { - eprintln!( - "A `validator_account` tx `vp` \"{}\" not found in Validity \ - predicates file.", - tx.vp - ); - is_valid = false; - } - // Check keys authorizations let unsigned = UnsignedValidatorAccountTx::from(tx); if !validate_signature( @@ -1515,7 +1479,6 @@ impl From<&ValidatorAccountTx> for UnsignedValidatorAccountTx { fn from(tx: &ValidatorAccountTx) -> Self { let ValidatorAccountTx { address, - vp, commission_rate, max_commission_rate_change, metadata, @@ -1530,7 +1493,6 @@ impl From<&ValidatorAccountTx> for UnsignedValidatorAccountTx { Self { address: address.clone(), - vp: vp.clone(), commission_rate: *commission_rate, max_commission_rate_change: *max_commission_rate_change, metadata: metadata.clone(), diff --git a/crates/apps/src/lib/node/ledger/shell/init_chain.rs b/crates/apps/src/lib/node/ledger/shell/init_chain.rs index 8982367b78..6c6db98860 100644 --- a/crates/apps/src/lib/node/ledger/shell/init_chain.rs +++ b/crates/apps/src/lib/node/ledger/shell/init_chain.rs @@ -113,6 +113,7 @@ where let chain_dir = self.base_dir.join(chain_id); genesis::make_dev_genesis(_num_validators, &chain_dir) }; + #[cfg(all( any(test, feature = "benches"), not(feature = "integration") @@ -519,7 +520,6 @@ where address, tx: EstablishedAccountTx { - vp, threshold, public_keys, }, @@ -529,7 +529,7 @@ where "Applying genesis tx to init an established account \ {address}" ); - let vp_code = self.lookup_vp(vp, genesis, vp_cache)?; + let vp_code = self.lookup_vp("vp_user", genesis, vp_cache)?; let code_hash = CodeHash::sha256(&vp_code); self.state .write_bytes(&Key::validity_predicate(address), code_hash) @@ -564,7 +564,6 @@ where data: ValidatorAccountTx { address, - vp, commission_rate, max_commission_rate_change, metadata, @@ -586,7 +585,7 @@ where "Applying genesis tx to init a validator account {address}" ); - let vp_code = self.lookup_vp(vp, genesis, vp_cache)?; + let vp_code = self.lookup_vp("vp_user", genesis, vp_cache)?; let code_hash = CodeHash::sha256(&vp_code); self.state .write_bytes(&Key::validity_predicate(address), code_hash) diff --git a/crates/benches/txs.rs b/crates/benches/txs.rs index 04a40f74b7..73c0faffbf 100644 --- a/crates/benches/txs.rs +++ b/crates/benches/txs.rs @@ -50,7 +50,6 @@ use namada_apps::bench_utils::{ VP_USER_WASM, }; use namada_apps::wallet::defaults; -use sha2::Digest; fn transfer(c: &mut Criterion) { let mut group = c.benchmark_group("transfer"); @@ -365,21 +364,8 @@ fn reveal_pk(c: &mut Criterion) { fn update_account(c: &mut Criterion) { let shell = BenchShell::default(); - let vp_code_hash: Hash = shell - .read_storage_key(&Key::wasm_hash(VP_USER_WASM)) - .unwrap(); - let extra_section = Section::ExtraData(Code::from_hash( - vp_code_hash, - Some(VP_USER_WASM.to_string()), - )); let data = UpdateAccount { addr: defaults::albert_address(), - vp_code_hash: Some(Hash( - extra_section - .hash(&mut sha2::Sha256::new()) - .finalize_reset() - .into(), - )), public_keys: vec![defaults::albert_keypair().ref_to()], threshold: None, }; @@ -387,7 +373,7 @@ fn update_account(c: &mut Criterion) { TX_UPDATE_ACCOUNT_WASM, data, None, - Some(vec![extra_section]), + None, vec![&defaults::albert_keypair()], ); @@ -415,15 +401,8 @@ fn init_account(c: &mut Criterion) { vp_code_hash, Some(VP_USER_WASM.to_string()), )); - let extra_hash = Hash( - extra_section - .hash(&mut sha2::Sha256::new()) - .finalize_reset() - .into(), - ); let data = InitAccount { public_keys: vec![new_account.to_public()], - vp_code_hash: extra_hash, threshold: 1, }; let tx = shell.generate_tx( diff --git a/crates/benches/vps.rs b/crates/benches/vps.rs index 48e9229443..3d320c042e 100644 --- a/crates/benches/vps.rs +++ b/crates/benches/vps.rs @@ -14,7 +14,6 @@ use namada::governance::VoteProposalData; use namada::ledger::gas::{TxGasMeter, VpGasMeter}; use namada::token::{Amount, Transfer}; use namada::tx::data::pos::{Bond, CommissionChange}; -use namada::tx::{Code, Section}; use namada::vm::wasm::run; use namada_apps::bench_utils::{ generate_foreign_key_tx, BenchShell, TX_BOND_WASM, @@ -23,7 +22,6 @@ use namada_apps::bench_utils::{ VP_USER_WASM, }; use namada_apps::wallet::defaults; -use sha2::Digest; const VP_IMPLICIT_WASM: &str = "vp_implicit.wasm"; @@ -67,21 +65,8 @@ fn vp_user(c: &mut Criterion) { vec![&defaults::bertha_keypair()], ); - let vp_validator_hash = shell - .read_storage_key(&Key::wasm_hash(VP_USER_WASM)) - .unwrap(); - let extra_section = Section::ExtraData(Code::from_hash( - vp_validator_hash, - Some(VP_USER_WASM.to_string()), - )); let data = UpdateAccount { addr: defaults::albert_address(), - vp_code_hash: Some(Hash( - extra_section - .hash(&mut sha2::Sha256::new()) - .finalize_reset() - .into(), - )), public_keys: vec![defaults::albert_keypair().to_public()], threshold: None, }; @@ -89,7 +74,7 @@ fn vp_user(c: &mut Criterion) { TX_UPDATE_ACCOUNT_WASM, data, None, - Some(vec![extra_section]), + None, vec![&defaults::albert_keypair()], ); @@ -356,18 +341,8 @@ fn vp_validator(c: &mut Criterion) { vec![&defaults::bertha_keypair()], ); - let extra_section = Section::ExtraData(Code::from_hash( - vp_code_hash, - Some(VP_USER_WASM.to_string()), - )); let data = UpdateAccount { addr: defaults::validator_address(), - vp_code_hash: Some(Hash( - extra_section - .hash(&mut sha2::Sha256::new()) - .finalize_reset() - .into(), - )), public_keys: vec![defaults::validator_account_keypair().to_public()], threshold: None, }; @@ -375,7 +350,7 @@ fn vp_validator(c: &mut Criterion) { TX_UPDATE_ACCOUNT_WASM, data, None, - Some(vec![extra_section]), + None, vec![&defaults::validator_account_keypair()], ); diff --git a/crates/light_sdk/src/transaction/account.rs b/crates/light_sdk/src/transaction/account.rs index fce8794bb6..e52435582f 100644 --- a/crates/light_sdk/src/transaction/account.rs +++ b/crates/light_sdk/src/transaction/account.rs @@ -20,13 +20,11 @@ impl InitAccount { /// Build a raw InitAccount transaction from the given parameters pub fn new( public_keys: Vec, - vp_code_hash: Hash, threshold: u8, args: GlobalArgs, ) -> Self { let init_account = namada_sdk::account::InitAccount { public_keys, - vp_code_hash, threshold, }; @@ -174,14 +172,12 @@ impl UpdateAccount { /// Build a raw UpdateAccount transaction from the given parameters pub fn new( addr: Address, - vp_code_hash: Option, public_keys: Vec, threshold: Option, args: GlobalArgs, ) -> Self { let update_account = namada_sdk::account::UpdateAccount { addr, - vp_code_hash, public_keys, threshold, }; diff --git a/crates/namada/src/vm/host_env.rs b/crates/namada/src/vm/host_env.rs index f3a219e93e..b15aa6b553 100644 --- a/crates/namada/src/vm/host_env.rs +++ b/crates/namada/src/vm/host_env.rs @@ -1430,63 +1430,9 @@ where Ok(()) } -/// Update a validity predicate function exposed to the wasm VM Tx environment -pub fn tx_update_validity_predicate( - env: &TxVmEnv, - addr_ptr: u64, - addr_len: u64, - code_hash_ptr: u64, - code_hash_len: u64, - code_tag_ptr: u64, - code_tag_len: u64, -) -> TxResult<()> -where - MEM: VmMemory, - D: 'static + DB + for<'iter> DBIter<'iter>, - H: 'static + StorageHasher, - CA: WasmCacheAccess, -{ - let (addr, gas) = env - .memory - .read_string(addr_ptr, addr_len as _) - .map_err(|e| TxRuntimeError::MemoryError(Box::new(e)))?; - tx_charge_gas::(env, gas)?; - - let addr = Address::decode(addr).map_err(TxRuntimeError::AddressError)?; - tracing::debug!("tx_update_validity_predicate for addr {}", addr); - - let (code_tag, gas) = env - .memory - .read_bytes(code_tag_ptr, code_tag_len as _) - .map_err(|e| TxRuntimeError::MemoryError(Box::new(e)))?; - tx_charge_gas::(env, gas)?; - let code_tag = Option::::try_from_slice(&code_tag) - .map_err(TxRuntimeError::EncodingError)?; - - let key = Key::validity_predicate(&addr); - let (code_hash, gas) = env - .memory - .read_bytes(code_hash_ptr, code_hash_len as _) - .map_err(|e| TxRuntimeError::MemoryError(Box::new(e)))?; - tx_charge_gas::(env, gas)?; - - tx_validate_vp_code_hash::(env, &code_hash, &code_tag)?; - - let mut state = env.state(); - let (gas, _size_diff) = state - .write_log_mut() - .write(&key, code_hash) - .map_err(TxRuntimeError::StorageModificationError)?; - tx_charge_gas::(env, gas) -} - /// Initialize a new account established address. pub fn tx_init_account( env: &TxVmEnv, - code_hash_ptr: u64, - code_hash_len: u64, - code_tag_ptr: u64, - code_tag_len: u64, result_ptr: u64, ) -> TxResult<()> where @@ -1495,29 +1441,22 @@ where H: 'static + StorageHasher, CA: WasmCacheAccess, { - let (code_hash, gas) = env - .memory - .read_bytes(code_hash_ptr, code_hash_len as _) - .map_err(|e| TxRuntimeError::MemoryError(Box::new(e)))?; - tx_charge_gas::(env, gas)?; - - let (code_tag, gas) = env - .memory - .read_bytes(code_tag_ptr, code_tag_len as _) - .map_err(|e| TxRuntimeError::MemoryError(Box::new(e)))?; - tx_charge_gas::(env, gas)?; - let code_tag = Option::::try_from_slice(&code_tag) - .map_err(TxRuntimeError::EncodingError)?; - - tx_validate_vp_code_hash::(env, &code_hash, &code_tag)?; - tracing::debug!("tx_init_account"); - let code_hash = Hash::try_from(&code_hash[..]) - .map_err(|e| TxRuntimeError::InvalidVpCodeHash(e.to_string()))?; let mut state = env.state(); + let hash_key = Key::wasm_hash("vp_user.wasm"); + let (vp_hash, gas) = state + .db_read(&hash_key) + .map_err(TxRuntimeError::StateError)?; + tx_charge_gas::(env, gas)?; let (write_log, in_mem, _db) = state.split_borrow(); let gen = &in_mem.address_gen; + let code_hash = Hash::try_from( + &vp_hash.ok_or(TxRuntimeError::StorageError( + StorageError::SimpleMessage("Missing hash of vp_user in storage"), + ))?[..], + ) + .map_err(|e| TxRuntimeError::InvalidVpCodeHash(e.to_string()))?; let (addr, gas) = write_log.init_account(gen, code_hash); let addr_bytes = addr.serialize_to_vec(); tx_charge_gas::(env, gas)?; diff --git a/crates/namada/src/vm/wasm/host_env.rs b/crates/namada/src/vm/wasm/host_env.rs index 58655037f6..679d8379b4 100644 --- a/crates/namada/src/vm/wasm/host_env.rs +++ b/crates/namada/src/vm/wasm/host_env.rs @@ -72,7 +72,6 @@ where "namada_tx_iter_prefix" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_iter_prefix), "namada_tx_iter_next" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_iter_next), "namada_tx_insert_verifier" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_insert_verifier), - "namada_tx_update_validity_predicate" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_update_validity_predicate), "namada_tx_init_account" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_init_account), "namada_tx_emit_ibc_event" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_emit_ibc_event), "namada_tx_get_ibc_events" => Function::new_native_with_env(wasm_store, env.clone(), host_env::tx_get_ibc_events), diff --git a/crates/sdk/src/args.rs b/crates/sdk/src/args.rs index 1b3617be49..ce262b065e 100644 --- a/crates/sdk/src/args.rs +++ b/crates/sdk/src/args.rs @@ -650,8 +650,6 @@ impl VoteProposal { pub struct TxInitAccount { /// Common tx arguments pub tx: Tx, - /// Path to the VP WASM code file for the new account - pub vp_code_path: PathBuf, /// Path to the TX WASM code file pub tx_code_path: PathBuf, /// Public key for the new account @@ -689,14 +687,6 @@ impl TxInitAccount { } } - /// Path to the VP WASM code file - pub fn vp_code_path(self, vp_code_path: PathBuf) -> Self { - Self { - vp_code_path, - ..self - } - } - /// Path to the TX WASM code file pub fn tx_code_path(self, tx_code_path: PathBuf) -> Self { Self { @@ -786,8 +776,6 @@ pub struct TxInitValidator { pub discord_handle: Option, /// The validator's avatar pub avatar: Option, - /// Path to the VP WASM code file - pub validator_vp_code_path: PathBuf, /// Path to the TX WASM code file pub tx_init_account_code_path: PathBuf, /// Path to the TX WASM code file @@ -801,8 +789,6 @@ pub struct TxInitValidator { pub struct TxUpdateAccount { /// Common tx arguments pub tx: Tx, - /// Path to the VP WASM code file - pub vp_code_path: Option, /// Path to the TX WASM code file pub tx_code_path: PathBuf, /// Address of the account whose VP is to be updated @@ -826,14 +812,6 @@ impl TxBuilder for TxUpdateAccount { } impl TxUpdateAccount { - /// Path to the VP WASM code file - pub fn vp_code_path(self, vp_code_path: PathBuf) -> Self { - Self { - vp_code_path: Some(vp_code_path), - ..self - } - } - /// Path to the TX WASM code file pub fn tx_code_path(self, tx_code_path: PathBuf) -> Self { Self { diff --git a/crates/sdk/src/lib.rs b/crates/sdk/src/lib.rs index 71dc57aa46..cbe453d875 100644 --- a/crates/sdk/src/lib.rs +++ b/crates/sdk/src/lib.rs @@ -62,7 +62,6 @@ use crate::tx::{ TX_REDELEGATE_WASM, TX_RESIGN_STEWARD, TX_REVEAL_PK, TX_TRANSFER_WASM, TX_UNBOND_WASM, TX_UNJAIL_VALIDATOR_WASM, TX_UPDATE_ACCOUNT_WASM, TX_UPDATE_STEWARD_COMMISSION, TX_VOTE_PROPOSAL, TX_WITHDRAW_WASM, - VP_USER_WASM, }; use crate::wallet::{Wallet, WalletIo, WalletStorage}; @@ -175,7 +174,6 @@ pub trait Namada: Sized + MaybeSync + MaybeSend { ) -> args::TxInitAccount { args::TxInitAccount { tx: self.tx_builder(), - vp_code_path: PathBuf::from(VP_USER_WASM), tx_code_path: PathBuf::from(TX_INIT_ACCOUNT_WASM), public_keys, threshold, @@ -283,7 +281,6 @@ pub trait Namada: Sized + MaybeSync + MaybeSend { fn new_update_account(&self, addr: Address) -> args::TxUpdateAccount { args::TxUpdateAccount { addr, - vp_code_path: None, public_keys: vec![], threshold: None, tx_code_path: PathBuf::from(TX_UPDATE_ACCOUNT_WASM), @@ -398,7 +395,6 @@ pub trait Namada: Sized + MaybeSync + MaybeSend { eth_cold_key: None, eth_hot_key: None, protocol_key: None, - validator_vp_code_path: PathBuf::from(VP_USER_WASM), unsafe_dont_encrypt: false, tx_init_account_code_path: PathBuf::from(TX_INIT_ACCOUNT_WASM), tx_become_validator_code_path: PathBuf::from( @@ -1129,14 +1125,13 @@ pub mod testing { pub fn arb_init_account_tx()( mut header in arb_header(), wrapper in arb_wrapper_tx(), - mut init_account in arb_init_account(), + init_account in arb_init_account(), extra_data in arb_code(), code_hash in arb_hash(), ) -> (Tx, TxData) { header.tx_type = TxType::Wrapper(Box::new(wrapper)); let mut tx = Tx { header, sections: vec![] }; - let vp_code_hash = tx.add_section(Section::ExtraData(extra_data)).get_hash(); - init_account.vp_code_hash = vp_code_hash; + let _vp_code_hash = tx.add_section(Section::ExtraData(extra_data)).get_hash(); tx.add_data(init_account.clone()); tx.add_code_from_hash(code_hash, Some(TX_INIT_ACCOUNT_WASM.to_owned())); (tx, TxData::InitAccount(init_account)) @@ -1234,20 +1229,15 @@ pub mod testing { } prop_compose! { - // Generate an arbitrary account initialization transaction + // Generate an arbitrary account update transaction pub fn arb_update_account_tx()( mut header in arb_header(), wrapper in arb_wrapper_tx(), - mut update_account in arb_update_account(), - extra_data in arb_code(), + update_account in arb_update_account(), code_hash in arb_hash(), ) -> (Tx, TxData) { header.tx_type = TxType::Wrapper(Box::new(wrapper)); let mut tx = Tx { header, sections: vec![] }; - if let Some(vp_code_hash) = &mut update_account.vp_code_hash { - let new_code_hash = tx.add_section(Section::ExtraData(extra_data)).get_hash(); - *vp_code_hash = new_code_hash; - } tx.add_data(update_account.clone()); tx.add_code_from_hash(code_hash, Some(TX_UPDATE_ACCOUNT_WASM.to_owned())); (tx, TxData::UpdateAccount(update_account)) diff --git a/crates/sdk/src/signing.rs b/crates/sdk/src/signing.rs index 82c0c7f4ae..6b4b7e7357 100644 --- a/crates/sdk/src/signing.rs +++ b/crates/sdk/src/signing.rs @@ -55,7 +55,6 @@ use crate::tx::{ TX_RESIGN_STEWARD, TX_REVEAL_PK, TX_TRANSFER_WASM, TX_UNBOND_WASM, TX_UNJAIL_VALIDATOR_WASM, TX_UPDATE_ACCOUNT_WASM, TX_UPDATE_STEWARD_COMMISSION, TX_VOTE_PROPOSAL, TX_WITHDRAW_WASM, - VP_USER_WASM, }; pub use crate::wallet::store::AddressVpType; use crate::wallet::{Wallet, WalletIo}; @@ -1110,17 +1109,6 @@ pub async fn to_ledger_vector( })?; tv.name = "Init_Account_0".to_string(); - let extra = tx - .get_section(&init_account.vp_code_hash) - .and_then(|x| Section::extra_data_sec(x.as_ref())) - .ok_or_else(|| { - Error::Other("unable to load vp code".to_string()) - })?; - let vp_code = if extra.tag == Some(VP_USER_WASM.to_string()) { - "User".to_string() - } else { - HEXLOWER.encode(&extra.code.hash().0) - }; tv.output.extend(vec![format!("Type : Init Account")]); tv.output.extend( init_account @@ -1128,10 +1116,8 @@ pub async fn to_ledger_vector( .iter() .map(|k| format!("Public key : {}", k)), ); - tv.output.extend(vec![ - format!("Threshold : {}", init_account.threshold), - format!("VP type : {}", vp_code), - ]); + tv.output + .extend(vec![format!("Threshold : {}", init_account.threshold)]); tv.output_expert.extend( init_account @@ -1139,10 +1125,8 @@ pub async fn to_ledger_vector( .iter() .map(|k| format!("Public key : {}", k)), ); - tv.output_expert.extend(vec![ - format!("Threshold : {}", init_account.threshold), - format!("VP type : {}", HEXLOWER.encode(&extra.code.hash().0)), - ]); + tv.output_expert + .extend(vec![format!("Threshold : {}", init_account.threshold)]); } else if code_sec.tag == Some(TX_BECOME_VALIDATOR_WASM.to_string()) { let init_validator = BecomeValidator::try_from_slice( &tx.data() @@ -1337,26 +1321,6 @@ pub async fn to_ledger_vector( )]) } - let vp_code_data = match &update_account.vp_code_hash { - Some(hash) => { - let extra = tx - .get_section(hash) - .and_then(|x| Section::extra_data_sec(x.as_ref())) - .ok_or_else(|| { - Error::Other("unable to load vp code".to_string()) - })?; - let vp_code = if extra.tag == Some(VP_USER_WASM.to_string()) { - "User".to_string() - } else { - HEXLOWER.encode(&extra.code.hash().0) - }; - Some((vp_code, extra.code.hash())) - } - None => None, - }; - if let Some((vp_code, _)) = &vp_code_data { - tv.output.extend(vec![format!("VP type : {}", vp_code)]); - } tv.output_expert .extend(vec![format!("Address : {}", update_account.addr)]); tv.output_expert.extend( @@ -1369,12 +1333,6 @@ pub async fn to_ledger_vector( tv.output_expert .extend(vec![format!("Threshold : {}", threshold,)]) } - if let Some((_, extra_code_hash)) = vp_code_data { - tv.output_expert.extend(vec![format!( - "VP type : {}", - HEXLOWER.encode(&extra_code_hash.0) - )]); - } } else if code_sec.tag == Some(TX_TRANSFER_WASM.to_string()) { let transfer = Transfer::try_from_slice( &tx.data() diff --git a/crates/sdk/src/tx.rs b/crates/sdk/src/tx.rs index 1c7e19cbd9..dbc8cb0a39 100644 --- a/crates/sdk/src/tx.rs +++ b/crates/sdk/src/tx.rs @@ -2615,7 +2615,6 @@ pub async fn build_init_account( context: &impl Namada, args::TxInitAccount { tx: tx_args, - vp_code_path, tx_code_path, public_keys, threshold, @@ -2630,8 +2629,6 @@ pub async fn build_init_account( ) .await?; - let vp_code_hash = query_wasm_code_hash_buf(context, vp_code_path).await?; - let threshold = match threshold { Some(threshold) => *threshold, None => { @@ -2647,25 +2644,15 @@ pub async fn build_init_account( let data = InitAccount { public_keys: public_keys.clone(), - // We will add the hash inside the add_code_hash function - vp_code_hash: Hash::zero(), threshold, }; - let add_code_hash = |tx: &mut Tx, data: &mut InitAccount| { - let extra_section_hash = tx.add_extra_section_from_hash( - vp_code_hash, - Some(vp_code_path.to_string_lossy().into_owned()), - ); - data.vp_code_hash = extra_section_hash; - Ok(()) - }; build( context, tx_args, tx_code_path.clone(), data, - add_code_hash, + do_nothing, unshield, fee_amount, &signing_data.fee_payer, @@ -2679,7 +2666,6 @@ pub async fn build_update_account( context: &impl Namada, args::TxUpdateAccount { tx: tx_args, - vp_code_path, tx_code_path, addr, public_keys, @@ -2713,53 +2699,24 @@ pub async fn build_update_account( ))); }; - let vp_code_hash = match vp_code_path { - Some(code_path) => { - let vp_hash = query_wasm_code_hash_buf(context, code_path).await?; - Some(vp_hash) - } - None => None, - }; - let chain_id = tx_args.chain_id.clone().unwrap(); let mut tx = Tx::new(chain_id, tx_args.expiration); if let Some(memo) = &tx_args.memo { tx.add_memo(memo); } - let extra_section_hash = vp_code_path.as_ref().zip(vp_code_hash).map( - |(code_path, vp_code_hash)| { - tx.add_extra_section_from_hash( - vp_code_hash, - Some(code_path.to_string_lossy().into_owned()), - ) - }, - ); let data = UpdateAccount { addr, - vp_code_hash: extra_section_hash, public_keys: public_keys.clone(), threshold: *threshold, }; - let add_code_hash = |tx: &mut Tx, data: &mut UpdateAccount| { - let extra_section_hash = vp_code_path.as_ref().zip(vp_code_hash).map( - |(code_path, vp_code_hash)| { - tx.add_extra_section_from_hash( - vp_code_hash, - Some(code_path.to_string_lossy().into_owned()), - ) - }, - ); - data.vp_code_hash = extra_section_hash; - Ok(()) - }; build( context, tx_args, tx_code_path.clone(), data, - add_code_hash, + do_nothing, unshield, fee_amount, &signing_data.fee_payer, diff --git a/crates/tests/src/e2e/ledger_tests.rs b/crates/tests/src/e2e/ledger_tests.rs index 17c85d5fd7..2c5b6fad19 100644 --- a/crates/tests/src/e2e/ledger_tests.rs +++ b/crates/tests/src/e2e/ledger_tests.rs @@ -513,8 +513,6 @@ fn ledger_txs_and_queries() -> Result<()> { "update-account", "--address", BERTHA, - "--code-path", - VP_USER_WASM, "--signing-keys", BERTHA_KEY, "--node", @@ -542,8 +540,6 @@ fn ledger_txs_and_queries() -> Result<()> { "tpknam1qpqfzxu3gt05jx2mvg82f4anf90psqerkwqhjey4zlqv0qfgwuvkzt5jhkp", "--threshold", "1", - "--code-path", - VP_USER_WASM, "--alias", "Test-Account", "--signing-keys", @@ -558,8 +554,6 @@ fn ledger_txs_and_queries() -> Result<()> { &multisig_account, "--threshold", "2", - "--code-path", - VP_USER_WASM, "--alias", "Test-Account-2", "--signing-keys", diff --git a/crates/tests/src/e2e/multitoken_tests/helpers.rs b/crates/tests/src/e2e/multitoken_tests/helpers.rs index 948fc750da..91edb6cae1 100644 --- a/crates/tests/src/e2e/multitoken_tests/helpers.rs +++ b/crates/tests/src/e2e/multitoken_tests/helpers.rs @@ -43,8 +43,6 @@ pub fn init_multitoken_vp(test: &Test, rpc_addr: &str) -> Result { // Value obtained from // `namada::core::key::ed25519::tests::gen_keypair` "001be519a321e29020fa3cbfbfd01bd5e92db134305609270b71dace25b5a21168", - "--code-path", - &multitoken_vp_wasm_path, "--alias", multitoken_alias, "--gas-limit", diff --git a/crates/tests/src/e2e/setup.rs b/crates/tests/src/e2e/setup.rs index 4d996052d2..c5b3b20b6c 100644 --- a/crates/tests/src/e2e/setup.rs +++ b/crates/tests/src/e2e/setup.rs @@ -177,7 +177,6 @@ where let validator_address = { use namada_apps::config::genesis::chain::DeriveEstablishedAddress; let pre_genesis_tx = transactions::EstablishedAccountTx { - vp: "vp_user".to_string(), threshold: 1, public_keys: vec![StringEncoded::new(sk.ref_to())], }; @@ -1230,7 +1229,7 @@ where #[allow(dead_code)] pub mod constants { // Paths to the WASMs used for tests - pub use namada_sdk::tx::{TX_IBC_WASM, TX_TRANSFER_WASM, VP_USER_WASM}; + pub use namada_sdk::tx::{TX_IBC_WASM, TX_TRANSFER_WASM}; // User addresses aliases pub const ALBERT: &str = "Albert"; diff --git a/crates/tests/src/vm_host_env/ibc.rs b/crates/tests/src/vm_host_env/ibc.rs index bf5ed4dabe..16d5cfac14 100644 --- a/crates/tests/src/vm_host_env/ibc.rs +++ b/crates/tests/src/vm_host_env/ibc.rs @@ -208,7 +208,7 @@ pub fn validate_multitoken_vp_from_tx<'a>( /// Initialize the test storage. Requires initialized [`tx_host_env::ENV`]. pub fn init_storage() -> (Address, Address) { - // wasm for init_account + // wasm for init_account, mock vp_user let code = TestWasms::VpAlwaysTrue.read_bytes(); let code_hash = Hash::sha256(&code); @@ -225,7 +225,11 @@ pub fn init_storage() -> (Address, Address) { .unwrap(); // store wasm code let key = Key::wasm_code(&code_hash); + let hash_key = Key::wasm_hash("vp_user.wasm"); + let code_name_key = Key::wasm_code_name("vp_user.wasm".to_owned()); env.state.db_write(&key, code.clone()).unwrap(); + env.state.db_write(&hash_key, code_hash).unwrap(); + env.state.db_write(&code_name_key, code_hash).unwrap(); // block header to check timeout timestamp env.state @@ -239,11 +243,11 @@ pub fn init_storage() -> (Address, Address) { }); // initialize a token - let token = tx_host_env::ctx().init_account(code_hash, &None).unwrap(); + let token = tx_host_env::ctx().init_account().unwrap(); let denom_key = token::storage_key::denom_key(&token); let token_denom = token::Denomination(ANY_DENOMINATION); // initialize an account - let account = tx_host_env::ctx().init_account(code_hash, &None).unwrap(); + let account = tx_host_env::ctx().init_account().unwrap(); let key = token::storage_key::balance_key(&token, &account); let init_bal = Amount::from_uint(100, token_denom).unwrap(); tx_host_env::with(|env| { diff --git a/crates/tests/src/vm_host_env/mod.rs b/crates/tests/src/vm_host_env/mod.rs index 06dca03ef7..a237c5e298 100644 --- a/crates/tests/src/vm_host_env/mod.rs +++ b/crates/tests/src/vm_host_env/mod.rs @@ -207,66 +207,6 @@ mod tests { ); } - #[test] - #[should_panic] - fn test_tx_init_account_with_invalid_vp() { - // The environment must be initialized first - tx_host_env::init(); - - let code = vec![]; - tx::ctx().init_account(code, &None).unwrap(); - } - - #[test] - fn test_tx_init_account_with_valid_vp() { - // The environment must be initialized first - tx_host_env::init(); - - let code = TestWasms::VpAlwaysTrue.read_bytes(); - let code_hash = Hash::sha256(&code); - tx_host_env::with(|env| { - // store wasm code - let key = Key::wasm_code(&code_hash); - env.state.write_bytes(&key, &code).unwrap(); - }); - tx::ctx().init_account(code_hash, &None).unwrap(); - } - - /// Test that a tx updating validity predicate that is not in the allowlist - /// fails. - #[test] - #[should_panic = "DisallowedVp"] - fn test_tx_update_vp_not_allowed_rejected() { - // Initialize a tx environment - tx_host_env::init(); - - let vp_owner = address::testing::established_address_1(); - let keypair = key::testing::keypair_1(); - let public_key = keypair.ref_to(); - let vp_code = TestWasms::VpAlwaysTrue.read_bytes(); - let vp_hash = sha256(&vp_code); - - tx_host_env::with(|tx_env| { - // let mut tx_env = TestTxEnv::default(); - tx_env.init_parameters( - None, - Some(vec!["some_hash".to_string()]), - None, - None, - ); - - // Spawn the accounts to be able to modify their storage - tx_env.spawn_accounts([&vp_owner]); - tx_env.init_account_storage(&vp_owner, vec![public_key.clone()], 1); - }); - - // Update VP in a transaction. - // Panics only due to unwrap in `native_host_fn!` test macro - tx::ctx() - .update_validity_predicate(&vp_owner, vp_hash, &None) - .unwrap() - } - /// Test that a tx writing validity predicate that is not in the allowlist /// directly to storage fails #[test] @@ -282,7 +222,6 @@ mod tests { let vp_hash = sha256(&vp_code); tx_host_env::with(|tx_env| { - // let mut tx_env = TestTxEnv::default(); tx_env.init_parameters( None, Some(vec!["some_hash".to_string()]), @@ -300,38 +239,6 @@ mod tests { tx::ctx().write_bytes(&vp_key, vp_hash).unwrap(); } - /// Test that a tx initializing a new account with validity predicate that - /// is not in the allowlist fails - #[test] - #[should_panic = "DisallowedVp"] - fn test_tx_init_vp_not_allowed_rejected() { - // Initialize a tx environment - tx_host_env::init(); - - let vp_owner = address::testing::established_address_1(); - let keypair = key::testing::keypair_1(); - let public_key = keypair.ref_to(); - let vp_code = TestWasms::VpAlwaysTrue.read_bytes(); - let vp_hash = sha256(&vp_code); - - tx_host_env::with(|tx_env| { - // let mut tx_env = TestTxEnv::default(); - tx_env.init_parameters( - None, - Some(vec!["some_hash".to_string()]), - None, - None, - ); - - // Spawn the accounts to be able to modify their storage - tx_env.spawn_accounts([&vp_owner]); - tx_env.init_account_storage(&vp_owner, vec![public_key.clone()], 1); - }); - - // Initializing a new account with the VP should fail - tx::ctx().init_account(vp_hash, &None).unwrap(); - } - #[test] fn test_tx_get_metadata() { // The environment must be initialized first diff --git a/crates/tests/src/vm_host_env/tx.rs b/crates/tests/src/vm_host_env/tx.rs index 7ef5a5e418..4e76968ef1 100644 --- a/crates/tests/src/vm_host_env/tx.rs +++ b/crates/tests/src/vm_host_env/tx.rs @@ -472,21 +472,7 @@ mod native_tx_host_env { native_host_fn!(tx_iter_prefix(prefix_ptr: u64, prefix_len: u64) -> u64); native_host_fn!(tx_iter_next(iter_id: u64) -> i64); native_host_fn!(tx_insert_verifier(addr_ptr: u64, addr_len: u64)); - native_host_fn!(tx_update_validity_predicate( - addr_ptr: u64, - addr_len: u64, - code_hash_ptr: u64, - code_hash_len: u64, - code_tag_ptr: u64, - code_tag_len: u64, - )); - native_host_fn!(tx_init_account( - code_hash_ptr: u64, - code_hash_len: u64, - code_tag_ptr: u64, - code_tag_len: u64, - result_ptr: u64 - )); + native_host_fn!(tx_init_account(result_ptr: u64)); native_host_fn!(tx_emit_ibc_event(event_ptr: u64, event_len: u64)); native_host_fn!(tx_get_ibc_events(event_type_ptr: u64, event_type_len: u64) -> i64); native_host_fn!(tx_get_chain_id(result_ptr: u64)); diff --git a/crates/tx_env/src/lib.rs b/crates/tx_env/src/lib.rs index 25242bfacf..00601693cb 100644 --- a/crates/tx_env/src/lib.rs +++ b/crates/tx_env/src/lib.rs @@ -34,19 +34,7 @@ pub trait TxEnv: StorageRead + StorageWrite { /// Initialize a new account generates a new established address and /// writes the given code as its validity predicate into the storage. - fn init_account( - &mut self, - code_hash: impl AsRef<[u8]>, - code_tag: &Option, - ) -> Result
; - - /// Update a validity predicate - fn update_validity_predicate( - &mut self, - addr: &Address, - code: impl AsRef<[u8]>, - code_tag: &Option, - ) -> Result<()>; + fn init_account(&mut self) -> Result
; /// Emit an IBC event. On multiple calls, these emitted event will be added. fn emit_ibc_event(&mut self, event: &IbcEvent) -> Result<()>; diff --git a/crates/tx_prelude/src/lib.rs b/crates/tx_prelude/src/lib.rs index b83f2cf345..7f3311aa92 100644 --- a/crates/tx_prelude/src/lib.rs +++ b/crates/tx_prelude/src/lib.rs @@ -286,23 +286,9 @@ impl TxEnv for Ctx { Ok(()) } - fn init_account( - &mut self, - code_hash: impl AsRef<[u8]>, - code_tag: &Option, - ) -> Result { - let code_hash = code_hash.as_ref(); - let code_tag = code_tag.serialize_to_vec(); + fn init_account(&mut self) -> Result { let result = Vec::with_capacity(address::ESTABLISHED_ADDRESS_BYTES_LEN); - unsafe { - namada_tx_init_account( - code_hash.as_ptr() as _, - code_hash.len() as _, - code_tag.as_ptr() as _, - code_tag.len() as _, - result.as_ptr() as _, - ) - }; + unsafe { namada_tx_init_account(result.as_ptr() as _) }; let slice = unsafe { slice::from_raw_parts( result.as_ptr(), @@ -313,28 +299,6 @@ impl TxEnv for Ctx { .expect("Decoding address created by the ledger shouldn't fail")) } - fn update_validity_predicate( - &mut self, - addr: &Address, - code_hash: impl AsRef<[u8]>, - code_tag: &Option, - ) -> Result<(), Error> { - let addr = addr.encode(); - let code_hash = code_hash.as_ref(); - let code_tag = code_tag.serialize_to_vec(); - unsafe { - namada_tx_update_validity_predicate( - addr.as_ptr() as _, - addr.len() as _, - code_hash.as_ptr() as _, - code_hash.len() as _, - code_tag.as_ptr() as _, - code_tag.len() as _, - ) - }; - Ok(()) - } - fn emit_ibc_event(&mut self, event: &ibc::IbcEvent) -> Result<(), Error> { let event = borsh::to_vec(event).unwrap(); unsafe { diff --git a/crates/vm_env/src/lib.rs b/crates/vm_env/src/lib.rs index a8b15a90d4..14f31e2167 100644 --- a/crates/vm_env/src/lib.rs +++ b/crates/vm_env/src/lib.rs @@ -60,24 +60,8 @@ pub mod tx { // Insert a verifier pub fn namada_tx_insert_verifier(addr_ptr: u64, addr_len: u64); - // Update a validity predicate - pub fn namada_tx_update_validity_predicate( - addr_ptr: u64, - addr_len: u64, - code_hash_ptr: u64, - code_hash_len: u64, - code_tag_ptr: u64, - code_tag_len: u64, - ); - // Initialize a new account - pub fn namada_tx_init_account( - code_hash_ptr: u64, - code_hash_len: u64, - code_tag_ptr: u64, - code_tag_len: u64, - result_ptr: u64, - ); + pub fn namada_tx_init_account(result_ptr: u64); // Emit an IBC event pub fn namada_tx_emit_ibc_event(event_ptr: u64, event_len: u64); diff --git a/genesis/README.md b/genesis/README.md index 1aec869104..6e17d89f2f 100644 --- a/genesis/README.md +++ b/genesis/README.md @@ -36,27 +36,25 @@ The [transactions.toml file](transactions.toml) contains any transactions that c ### Genesis tx `established_account` -An established account with some `alias`, a validity predicate `vp` and optionally a `public_key`. When a public key is used, the transaction must be [signed](#signing-genesis-txs) with it to authorize its use. +An established account with some `alias` and optionally a `public_key`. When a public key is used, the transaction must be [signed](#signing-genesis-txs) with it to authorize its use. An unsigned `established_account` tx example: ```toml [[established_account]] alias = "Albert" # Aliases are case-insensitive -vp = "vp_user" public_key = "tpknam1qz0aphcsrw37j8fy742cjwhphu9jwx7esd3ad4xxtxrkwv07ff63we33t3r" ``` ### Genesis tx `validator_account` -A validator account with some `alias`, a validity predicate `vp`, various keys and validator variables. Public keys used in the transaction must also [sign](#signing-validator-genesis-txs) the transaction to authorize their use. +A validator account with some `alias`, various keys and validator variables. Public keys used in the transaction must also [sign](#signing-validator-genesis-txs) the transaction to authorize their use. An unsigned `validator_account` tx example: ```toml [[validator_account]] alias = "validator-0" -vp = "vp_user" commission_rate = "0.05" max_commission_rate_change = "0.01" net_address = "127.0.0.1:27656" diff --git a/genesis/localnet/README.md b/genesis/localnet/README.md index 52d03d794c..de64a70bc7 100644 --- a/genesis/localnet/README.md +++ b/genesis/localnet/README.md @@ -11,17 +11,17 @@ cargo watch -x "test test_validate_localnet_genesis_templates" The pre-genesis balances wallet is located at [pre-genesis/wallet.toml](pre-genesis/wallet.toml) and can be re-generated from the repo's root dir with: ```shell -cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key gen \ +cargo run --bin namadaw -- --pre-genesis --base-dir "genesis/localnet/src" gen \ --alias albert-key --unsafe-dont-encrypt -cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key gen \ +cargo run --bin namadaw -- --pre-genesis --base-dir "genesis/localnet/src" gen \ --alias bertha-key --unsafe-dont-encrypt -cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key gen \ +cargo run --bin namadaw -- --pre-genesis --base-dir "genesis/localnet/src" gen \ --alias christel --unsafe-dont-encrypt -cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key gen \ +cargo run --bin namadaw -- --pre-genesis --base-dir "genesis/localnet/src" gen \ --alias daewon --unsafe-dont-encrypt -cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key gen \ +cargo run --bin namadaw -- --pre-genesis --base-dir "genesis/localnet/src" gen \ --alias validator-0-account-key --unsafe-dont-encrypt -cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key gen \ +cargo run --bin namadaw -- --pre-genesis --base-dir "genesis/localnet/src" gen \ --alias faucet-key --unsafe-dont-encrypt ``` @@ -79,6 +79,7 @@ A delegation with e.g. 20 000 NAM tokens to a validator account whose address ha cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ genesis-bond \ --validator tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx \ + --source tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg\ --amount 20000 \ --path "genesis/localnet/src/pre-genesis/bond/bond-tx-albert.toml" ``` @@ -100,7 +101,7 @@ The validator transactions are signed using (note the extra `--alias` argument n cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ sign-genesis-txs \ --path "genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml" \ - --output "genesis/localnet/src/validator-0/signed-transactions.toml" + --output "genesis/localnet/src/pre-genesis/validator-0/signed-transactions.toml" \ --alias validator-0 ``` diff --git a/genesis/localnet/balances.toml b/genesis/localnet/balances.toml index a14c274456..12e0deced5 100644 --- a/genesis/localnet/balances.toml +++ b/genesis/localnet/balances.toml @@ -16,102 +16,102 @@ [token.NAM] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "2000000" -tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha = "2000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "2000000" +tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847= "2000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "2000000" -tpknam1qq52dx5e290wyh7ngdt6wudtyd502lg6ln49yvg3vz97e8j2ruux5e3yewq = "2000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "2000000" +tpknam1qrdn4pnry9tmgrth6azjuwv5f758974ej0j34xtye5wq4fqy202825vmlsn= "2000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "2000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "2000000" tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79 = "2000000" # daewon -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "100000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "100000000" # ester tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "200000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "200000" tpknam1qpzrttnzfyt6xfu2vy092eruasll3z52rjfexwapdw0rdww5uktlk3j73dw = "200000" [token.BTC] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "1000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "1000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "1000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "1000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "1000000" # daewon-key -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "1000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "1000000" # ester-key tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "1000000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "1000000" [token.ETH] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "1000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "1000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "1000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "1000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "1000000" # daewon-key -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "1000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "1000000" # ester-key tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "1000000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "1000000" [token.DOT] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "1000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "1000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "1000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "1000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "1000000" # daewon-key -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "1000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "1000000" # ester-key tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "1000000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "1000000" [token.Schnitzel] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "1000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "1000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "1000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "1000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "1000000" # daewon-key -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "1000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "1000000" # ester-key tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "1000000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "1000000" [token.Apfel] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "1000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "1000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "1000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "1000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "1000000" # daewon-key -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "1000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "1000000" # ester-key tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "1000000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "1000000" [token.Kartoffel] # albert -tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu = "1000000" +tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg = "1000000" # bertha -tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn = "1000000" +tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac = "1000000" # christel -tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" +tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03 = "1000000" # daewon-key -tpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm = "1000000" +tpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6 = "1000000" # ester-key tpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4 = "1000000" # validator-0 -tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx = "1000000" +tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh = "1000000" diff --git a/genesis/localnet/parameters.toml b/genesis/localnet/parameters.toml index f99f9e0a50..792d111487 100644 --- a/genesis/localnet/parameters.toml +++ b/genesis/localnet/parameters.toml @@ -93,9 +93,9 @@ min_proposal_grace_epochs = 6 # Initial set of stewards stewards = [ # bertha - "tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn", + "tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac", # validator-0 - "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" + "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" ] # The pgf funding inflation rate pgf_inflation_rate = "0.1" diff --git a/genesis/localnet/src/pre-genesis/bond/bond-tx-albert.toml b/genesis/localnet/src/pre-genesis/bond/bond-tx-albert.toml index 73b2960a07..35c8a45ecb 100644 --- a/genesis/localnet/src/pre-genesis/bond/bond-tx-albert.toml +++ b/genesis/localnet/src/pre-genesis/bond/bond-tx-albert.toml @@ -1,4 +1,4 @@ [[bond]] -source = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "20000" diff --git a/genesis/localnet/src/pre-genesis/established/established-account-tx-albert.toml b/genesis/localnet/src/pre-genesis/established/established-account-tx-albert.toml index 532198f7e2..081191a280 100644 --- a/genesis/localnet/src/pre-genesis/established/established-account-tx-albert.toml +++ b/genesis/localnet/src/pre-genesis/established/established-account-tx-albert.toml @@ -1,4 +1,3 @@ [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha"] +public_keys = ["tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847"] diff --git a/genesis/localnet/src/pre-genesis/established/established-account-tx-bertha.toml b/genesis/localnet/src/pre-genesis/established/established-account-tx-bertha.toml index 177974ff4a..8e30e00607 100644 --- a/genesis/localnet/src/pre-genesis/established/established-account-tx-bertha.toml +++ b/genesis/localnet/src/pre-genesis/established/established-account-tx-bertha.toml @@ -1,4 +1,3 @@ [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qq52dx5e290wyh7ngdt6wudtyd502lg6ln49yvg3vz97e8j2ruux5e3yewq"] +public_keys = ["tpknam1qrdn4pnry9tmgrth6azjuwv5f758974ej0j34xtye5wq4fqy202825vmlsn"] diff --git a/genesis/localnet/src/pre-genesis/established/established-account-tx-christel.toml b/genesis/localnet/src/pre-genesis/established/established-account-tx-christel.toml index cdb56e0666..18faa463f0 100644 --- a/genesis/localnet/src/pre-genesis/established/established-account-tx-christel.toml +++ b/genesis/localnet/src/pre-genesis/established/established-account-tx-christel.toml @@ -1,4 +1,3 @@ [[established_account]] -vp = "vp_user" threshold = 1 public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] diff --git a/genesis/localnet/src/pre-genesis/signed-transactions.toml b/genesis/localnet/src/pre-genesis/signed-transactions.toml index 6fd4f6f5d3..3ff6958416 100644 --- a/genesis/localnet/src/pre-genesis/signed-transactions.toml +++ b/genesis/localnet/src/pre-genesis/signed-transactions.toml @@ -1,22 +1,19 @@ [[established_account]] -vp = "vp_user" threshold = 1 public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qq52dx5e290wyh7ngdt6wudtyd502lg6ln49yvg3vz97e8j2ruux5e3yewq"] +public_keys = ["tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847"] [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha"] +public_keys = ["tpknam1qrdn4pnry9tmgrth6azjuwv5f758974ej0j34xtye5wq4fqy202825vmlsn"] [[bond]] -source = "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "20000" [bond.signatures] -tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha = "signam1qqv8vvt2yk3gpzth6f5qdtf2g889mk6jv0qrrj0np62czy0qrruj5pgezjhqfvs4vg5f9zmelngpy04c7klschc57upr7zlk9w7647sx4j7x9c" +tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847 = "signam1qpu3zdvx6t72uyq4g8q3yavnwwgp50mfvnsnle2ausuvyke2pns6yhujeh0525cs9m0a8h7m3fmswlg8ffq4kxryqpytac4yyv5f5espapz5vv" diff --git a/genesis/localnet/src/pre-genesis/unsigned-transactions.toml b/genesis/localnet/src/pre-genesis/unsigned-transactions.toml index 32dc9fff47..ba38f3e376 100644 --- a/genesis/localnet/src/pre-genesis/unsigned-transactions.toml +++ b/genesis/localnet/src/pre-genesis/unsigned-transactions.toml @@ -12,19 +12,16 @@ # Albert [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha"] +public_keys = ["tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847"] # Bertha [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qq52dx5e290wyh7ngdt6wudtyd502lg6ln49yvg3vz97e8j2ruux5e3yewq"] +public_keys = ["tpknam1qrdn4pnry9tmgrth6azjuwv5f758974ej0j34xtye5wq4fqy202825vmlsn"] # Christel [[established_account]] -vp = "vp_user" threshold = 1 public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] @@ -32,6 +29,6 @@ public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs # Albert bonds to `validator-0` [[bond]] -source = "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "20000" diff --git a/genesis/localnet/src/pre-genesis/validator-0/signed-transactions.toml b/genesis/localnet/src/pre-genesis/validator-0/signed-transactions.toml index 1d56ab2c9c..3df885cdb7 100644 --- a/genesis/localnet/src/pre-genesis/validator-0/signed-transactions.toml +++ b/genesis/localnet/src/pre-genesis/validator-0/signed-transactions.toml @@ -1,45 +1,43 @@ [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj"] +public_keys = ["tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc"] [[validator_account]] -address = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -vp = "vp_user" +address = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" commission_rate = "0.05" max_commission_rate_change = "0.01" net_address = "127.0.0.1:27656" [validator_account.consensus_key] -pk = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg" -authorization = "signam1qqxsgw7k5yu200657evhu7kuenf5zw86lvx8nw7wk9zrgt0tx3xpf492f2k054ml6zu6x7p6d3j6rmdm33747ptwrxtvmwdaenyqvvcp3v9gpn" +pk = "tpknam1qpal0gey94q784f09p4lmknyym23r8dyqvlsx7w5wfll9dzumtrmy6kzt9l" +authorization = "signam1qr3t5n54k2qnpecmfsy5klmmq7jtjs273fpxejdmvltd26ym4uwxr86wx4hlzmcs9qfmx7rlhvqyjfg9y7v3la6vqw8zdj4j03vyrmszmuglwg" [validator_account.protocol_key] -pk = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa" -authorization = "signam1qpnjzsgnvgfnfjld89wtjtn7w843dhw39tktuxgw49tcyj678u03hdaufdsf6rakmrjfa6ywjnngy7hmwvwsgkjr60330w9jwl7azus20tcmwj" +pk = "tpknam1qrtvl3s52trj2qacj3m38urvmfpattqjmqh5q6vtcmgd5z3qc3hqvvppyte" +authorization = "signam1qzmhxyuwdcs325wpdcqz2cyexlhxphfvfkyhyeu6xjsa8qxdjkurf73v92n3x9jyv7latketzq6dkrskny7ceakz3nhkdquvz2cw9lsp8wyxjy" [validator_account.tendermint_node_key] -pk = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3" -authorization = "signam1qq8d8k43779lxsz3hx3pkpucetdd4kzrl56hk52nwa5dfu97y2gq9axxffftx726e5n8ch2na4c8wn98yxcjpzzdpdkj86655g4hynsgwf35af" +pk = "tpknam1qqn3wqgdldslwagk6zzjnq8ewsw0wmzprajjqxtrfatyumtvjy6d6gc84f7" +authorization = "signam1qrtqmyf8j7g4pxhdttzz5807hsxte2hkl0m7x500jr3ycnsf7m9eauxru56ec82ajwrw5mnt2uwwnqryt9t8ytsvdcxpvac20sj6casdm6wa8u" [validator_account.eth_hot_key] -pk = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx" -authorization = "signam1q8t7shqzpmdwtfumrahs022mt96mazwq2d843sad4dgcvz9prlj6x37qp7nvhpluclq8ta4sjkg7da77e9xlvyh4eujc3v936egqqf4eqytrku9n" +pk = "tpknam1qypv77znljd9w0mpm4s7ve3knxfqdvr9fu378mq94mtwjmhghh78zucchgk5m" +authorization = "signam1q9z6fnrw9f2g9rs3yw5ddr9n2rlhnvfj6nfaykvkwu8w4n88tw20ghyms50373v5kr6rn08zcyqjje5qr02n448fejtns9q43u5kq38fqypzeul6" [validator_account.eth_cold_key] -pk = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv" -authorization = "signam1qxe6c5h7sfrsampxlhsxdkq33zmetwg45y2lqxxhf4v7sy7sa933xat3m9f4g76dpzvpnaedrdy4d7t5xfmwmu0u9cdgdu8pgwqx9k8zqyzkce99" +pk = "tpknam1qypapqlvu9s7xegz6l8j4v3em043k7tydyrvrvllt7lhy973q88rrtqga4ed8" +authorization = "signam1qyfky7u6mhw5049xfp6cq4mtwcme798wsfyahcxfx2t2leanlhxhken872qld892e7f4n29sz8pxuay39eejyk0m0xxz4tj5uv22d2slqqaw3rdd" [validator_account.metadata] email = "null@null.net" [validator_account.signatures] -tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qrgen2xu6zm27mzjeycqhzjt4c0dun8jwqxhaj7d3yduqpxud80whuqpec2k5k5a40w0jfgzwec8483vrvnaa30ky9r2utaxccvh2wsr9em3es" +tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc = "signam1qr3qcnzyz5e77y26uckd4nm6mdql0749dvtrrklgfpeknhg3qxm2ddj8gg0z4k57xngn88fukkepc7dzffn97tjhk7h76ux2y824elq9yevthj" [[bond]] -source = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "100000" [bond.signatures] -tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qpama7hqj2lqleln7yhqa94s97mz8n8wqemtljwa9znfr5yq3uhrf33deeskf9alx6zdd8mzpuhrlc0gfr79hkkzhjqa7kw4a6j7r0sdxzqlj8" +tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc = "signam1qqaucmk7nlfrqfk8pvzk63gkvalf76a7trel5j0yfeazlpx9zwezteflldzxtd890dcm9q3nclpgqkmwj05w8h7szep4lw79mk0napgvwnwz5a" diff --git a/genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml b/genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml index aa84f561ac..5848b78853 100644 --- a/genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml +++ b/genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml @@ -1,24 +1,22 @@ [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj"] +public_keys = ["tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc"] [[validator_account]] -address = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -vp = "vp_user" +address = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" commission_rate = "0.05" max_commission_rate_change = "0.01" net_address = "127.0.0.1:27656" -consensus_key = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg" -protocol_key = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa" -tendermint_node_key = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3" -eth_hot_key = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx" -eth_cold_key = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv" +consensus_key = "tpknam1qpal0gey94q784f09p4lmknyym23r8dyqvlsx7w5wfll9dzumtrmy6kzt9l" +protocol_key = "tpknam1qrtvl3s52trj2qacj3m38urvmfpattqjmqh5q6vtcmgd5z3qc3hqvvppyte" +tendermint_node_key = "tpknam1qqn3wqgdldslwagk6zzjnq8ewsw0wmzprajjqxtrfatyumtvjy6d6gc84f7" +eth_hot_key = "tpknam1qypv77znljd9w0mpm4s7ve3knxfqdvr9fu378mq94mtwjmhghh78zucchgk5m" +eth_cold_key = "tpknam1qypapqlvu9s7xegz6l8j4v3em043k7tydyrvrvllt7lhy973q88rrtqga4ed8" [validator_account.metadata] email = "null@null.net" [[bond]] -source = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "100000" diff --git a/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml b/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml index d7ceb76fb9..320edeffba 100644 --- a/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml +++ b/genesis/localnet/src/pre-genesis/validator-0/validator-wallet.toml @@ -1,7 +1,7 @@ -consensus_key = "unencrypted:0037a44681b64d42497e2229516479f83e5344a7a30e8316bde45881a1ec745359" -eth_cold_key = "unencrypted:010d34fcb42383f0babe7c86203f07bf4134f0756a630eb07923f21c90cc068602" -tendermint_node_key = "unencrypted:002f2e94bb5834e18433343345baf47b2b5d4e1ef4d46ba0f876d3d2c89d831419" +consensus_key = "unencrypted:00aaf9f3b4f11ca0165551bc152ebf1eb533427ee8ecbf8361d12b9229db9d9f15" +eth_cold_key = "unencrypted:018903dbd93a20e1c75beaa11aeab7ea3b1296d198414aa1799b7b9f0438dce65d" +tendermint_node_key = "unencrypted:0085233d29ceb3419af5f3f3bc76fe36c6671a554131994917a2575d6a8d48fda4" [validator_keys] -protocol_keypair = "ED25519_SK_PREFIX00610677d4c52ab8ca5e8abe7dfb40246a271a03069fded6099763cbc41e04df02" -eth_bridge_keypair = "SECP256K1_SK_PREFIX01a81af251a711382d6b649a44b36ac5d4f41106f356e1f2fb33c001e91ffaa169" +protocol_keypair = "ED25519_SK_PREFIX00bd6845ae606a4a4903c6d2d59a81e40c160497016ee6345ce99e67145e27e765" +eth_bridge_keypair = "SECP256K1_SK_PREFIX01939e69be7a8cf8da78444d7a158bdf49c5fb8e1bc5a723f0dffceb1535aa1e69" diff --git a/genesis/localnet/src/pre-genesis/wallet.toml b/genesis/localnet/src/pre-genesis/wallet.toml index fbf083e87b..791ee5be35 100644 --- a/genesis/localnet/src/pre-genesis/wallet.toml +++ b/genesis/localnet/src/pre-genesis/wallet.toml @@ -5,44 +5,54 @@ [payment_addrs] [secret_keys] -albert-key = "unencrypted:000d5e9d7d66f0e4307edacde6e6578e31d331bcf234352647d00d20955102d3ce" -bertha-key = "unencrypted:0009eedb2e68fd69d6772bf02d92a10f85dfa7eac6fdad0ee589255756b25ab760" +albert-key = "unencrypted:0093450f762db86f6a1c554d3ec37d8db48c73a5e63fe2af43633dae79ccc03a6e" +bertha-key = "unencrypted:00690e35456411d95e41212f41ef83c22591ade92e23128b7b30e5dbbaf1090ca1" +christel = "unencrypted:0085461198b2549645fc869973eeef6189da3ba912a86929ba69e7c6357c10aa8c" christel-key = "unencrypted:00a08de8d33b9798328d2e4476fade49f515dc82754451fc6ef7060ea0bd1e8f1a" -daewon = "unencrypted:00d19e226c0e7d123d79f5908b5948d4c461b66a5f8aa95600c28b55ab6f5dc772" +daewon = "unencrypted:00372ef36a23741a2dbadca7ff50fc0a34d80e2355d958ec10fe9caca0bae02fb2" ester = "unencrypted:01369093e2035d84f72a7e5a17c89b7a938b5d08cc87b2289805e3afcc66ef9a42" -faucet-key = "unencrypted:00548aa8393422b88dce5f4be8ee0320638061c3e0649ada1b0dacbec4c0c75bb2" -validator-0-account-key = "unencrypted:0024204e13c51b26ed9b42c05647bc46b3821bb453e53d194962ede57ce5ec66ac" +faucet-key = "unencrypted:00ec176dd5594767f6d98d66393992c35949afacd3b923274d3bfedcef9b158019" +validator-0-account-key = "unencrypted:0010d8adca6c74f730973ecc33b055f41cb415b9e3db757adb4b1a73a580b6fff9" [public_keys] -albert-key = "ED25519_PK_PREFIXtpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha" -bertha-key = "ED25519_PK_PREFIXtpknam1qq52dx5e290wyh7ngdt6wudtyd502lg6ln49yvg3vz97e8j2ruux5e3yewq" +albert-key = "ED25519_PK_PREFIXtpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847" +bertha-key = "ED25519_PK_PREFIXtpknam1qrdn4pnry9tmgrth6azjuwv5f758974ej0j34xtye5wq4fqy202825vmlsn" +christel = "ED25519_PK_PREFIXtpknam1qz5h8kwndc7c260xcx2ud3aaegdzpkveyxndhl2zy7pjk0wnl3v2cw8kj07" christel-key = "ED25519_PK_PREFIXtpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79" -daewon = "ED25519_PK_PREFIXtpknam1qzz4x4fammhdcfa0g8xw4udkq8s4n6kjhzlxh00ul3da05wuu9wkykqqvjm" +daewon = "ED25519_PK_PREFIXtpknam1qrtaguluxe2370dq8phr3t0d54d8nwg5scp6av7vfnhq04kt9d3fkzea5r6" ester = "SECP256K1_PK_PREFIXtpknam1qypvqpzu74nafjahlwyq272dj76qq9rz30dulyc94883tmj893mquqs74gxv4" -faucet-key = "ED25519_PK_PREFIXtpknam1qzh2d8vk9wvj2j63fa3cvjru9uldpdjctjjxpafl5r8vwwf56pdgyq0vra4" -validator-0-account-key = "ED25519_PK_PREFIXtpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj" +faucet-key = "ED25519_PK_PREFIXtpknam1qzm6ex7ernmgm49vsxnq7vtgzrvrkr5zcxjcduyesw982g08pwfez3er34a" +validator-0-account-key = "ED25519_PK_PREFIXtpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc" [derivation_paths] +albert-key = "m/44'/877'/0'/0'/0'" +bertha-key = "m/44'/877'/0'/0'/0'" +christel = "m/44'/877'/0'/0'/0'" +daewon = "m/44'/877'/0'/0'/0'" +faucet-key = "m/44'/877'/0'/0'/0'" +validator-0-account-key = "m/44'/877'/0'/0'/0'" [addresses] -albert = "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu" -bertha = "tnam1q9rhgyv3ydq0zu3whnftvllqnvhvhm270qxay5tn" -christel = "tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf" -albert-key = "tnam1qrr8r00nrf6490ff9zgfz52xrnfhdja7rqvldl46" -bertha-key = "tnam1qqc2ge6tg7s03nlshjr5d79dqyjr33aa8g2mxyzm" +albert = "tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg" +albert-key = "tnam1qq4rfc3rzxd2ygt8xgg39tvrxewqhe4v8ym7pqtr" +bertha = "tnam1q8wnhp0jgpzewqnuwtvw28wj546sx4j73g3lq9ac" +bertha-key = "tnam1qqzr5d352sk4le7hz08jd566jtmvvxl0mulurga8" +christel = "tnam1q8qpqvc2g8aqmfmpkx7l5vttqdpsjf4yuvt5xz03" christel-key = "tnam1qz0nvec686e9pks8ynhm5ddq8ke7j2eey50uagtr" -daewon = "tnam1qpca48f45pdtpcz06rue7k4kfdcjrvrux5cr3pwn" +daewon = "tnam1qqpp8xy5w0xe67l4vrl3f0wl6te6tgs4uv62syrt" ester = "tnam1qpm3dpsv76ttu382vfggtr7m8n00na3sfyzm2g2q" -faucet-key = "tnam1qzgcl2znamndmku7ujw6e79dmvd4v7rfd5c89dfz" -validator-0 = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +faucet-key = "tnam1qzcrqgul7fslkrny2jf6gzfmvul0zykayvftrfhz" +validator-0 = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" +validator-0-account-key = "tnam1qrexllzcc8jpcme0tjdtvuqcnytmmfsty50f898f" [pkhs] -30A4674B47A0F8CFF0BC8746F8AD012438C7BD3A = "bertha-key" -C671BDF31A7552BD2928909151461CD376CBBE18 = "albert-key" -71DA9D35A05AB0E04FD0F99F5AB64B7121B07C35 = "daewon" -918FA853EEE6DDDB9EE49DACF8ADDB1B5678696D = "faucet-key" -9F36671A3EB250DA0724EFBA35A03DB3E92B3925 = "christel-key" +0213989473CD9D7BF560FF14BDDFD2F3A5A215E3 = "daewon" +043A3634542D5FE7D713CF26D35A92F6C61BEFDF = "bertha-key" +2A34E223119AA22167321112AD83365C0BE6AC39 = "albert-key" +3A20C3A16DF6044483F9B87D1A0468E16B1481F2 = "christel" 7716860CF696BE44EA6250858FDB3CDEF9F63049 = "ester" -9D371C6D220F8A4C6D70F0D3F828698881AB2447 = "validator-0-account-key" +9F36671A3EB250DA0724EFBA35A03DB3E92B3925 = "christel-key" +B030239FF261FB0E645493A4093B673EF112DD23 = "faucet-key" +F26FFC58C1E41C6F2F5C9AB670189917BDA60B25 = "validator-0-account-key" [address_vp_types] diff --git a/genesis/localnet/transactions.toml b/genesis/localnet/transactions.toml index cb1523c515..49bbc29131 100644 --- a/genesis/localnet/transactions.toml +++ b/genesis/localnet/transactions.toml @@ -6,72 +6,67 @@ # 1. [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj"] +public_keys = ["tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc"] [[validator_account]] -address = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -vp = "vp_user" +address = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" commission_rate = "0.05" max_commission_rate_change = "0.01" net_address = "127.0.0.1:27656" [validator_account.consensus_key] -pk = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg" -authorization = "signam1qqxsgw7k5yu200657evhu7kuenf5zw86lvx8nw7wk9zrgt0tx3xpf492f2k054ml6zu6x7p6d3j6rmdm33747ptwrxtvmwdaenyqvvcp3v9gpn" +pk = "tpknam1qpal0gey94q784f09p4lmknyym23r8dyqvlsx7w5wfll9dzumtrmy6kzt9l" +authorization = "signam1qr3t5n54k2qnpecmfsy5klmmq7jtjs273fpxejdmvltd26ym4uwxr86wx4hlzmcs9qfmx7rlhvqyjfg9y7v3la6vqw8zdj4j03vyrmszmuglwg" [validator_account.protocol_key] -pk = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa" -authorization = "signam1qpnjzsgnvgfnfjld89wtjtn7w843dhw39tktuxgw49tcyj678u03hdaufdsf6rakmrjfa6ywjnngy7hmwvwsgkjr60330w9jwl7azus20tcmwj" +pk = "tpknam1qrtvl3s52trj2qacj3m38urvmfpattqjmqh5q6vtcmgd5z3qc3hqvvppyte" +authorization = "signam1qzmhxyuwdcs325wpdcqz2cyexlhxphfvfkyhyeu6xjsa8qxdjkurf73v92n3x9jyv7latketzq6dkrskny7ceakz3nhkdquvz2cw9lsp8wyxjy" [validator_account.tendermint_node_key] -pk = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3" -authorization = "signam1qq8d8k43779lxsz3hx3pkpucetdd4kzrl56hk52nwa5dfu97y2gq9axxffftx726e5n8ch2na4c8wn98yxcjpzzdpdkj86655g4hynsgwf35af" +pk = "tpknam1qqn3wqgdldslwagk6zzjnq8ewsw0wmzprajjqxtrfatyumtvjy6d6gc84f7" +authorization = "signam1qrtqmyf8j7g4pxhdttzz5807hsxte2hkl0m7x500jr3ycnsf7m9eauxru56ec82ajwrw5mnt2uwwnqryt9t8ytsvdcxpvac20sj6casdm6wa8u" [validator_account.eth_hot_key] -pk = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx" -authorization = "signam1q8t7shqzpmdwtfumrahs022mt96mazwq2d843sad4dgcvz9prlj6x37qp7nvhpluclq8ta4sjkg7da77e9xlvyh4eujc3v936egqqf4eqytrku9n" +pk = "tpknam1qypv77znljd9w0mpm4s7ve3knxfqdvr9fu378mq94mtwjmhghh78zucchgk5m" +authorization = "signam1q9z6fnrw9f2g9rs3yw5ddr9n2rlhnvfj6nfaykvkwu8w4n88tw20ghyms50373v5kr6rn08zcyqjje5qr02n448fejtns9q43u5kq38fqypzeul6" [validator_account.eth_cold_key] -pk = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv" -authorization = "signam1qxe6c5h7sfrsampxlhsxdkq33zmetwg45y2lqxxhf4v7sy7sa933xat3m9f4g76dpzvpnaedrdy4d7t5xfmwmu0u9cdgdu8pgwqx9k8zqyzkce99" +pk = "tpknam1qypapqlvu9s7xegz6l8j4v3em043k7tydyrvrvllt7lhy973q88rrtqga4ed8" +authorization = "signam1qyfky7u6mhw5049xfp6cq4mtwcme798wsfyahcxfx2t2leanlhxhken872qld892e7f4n29sz8pxuay39eejyk0m0xxz4tj5uv22d2slqqaw3rdd" [validator_account.metadata] email = "null@null.net" [validator_account.signatures] -tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qrgen2xu6zm27mzjeycqhzjt4c0dun8jwqxhaj7d3yduqpxud80whuqpec2k5k5a40w0jfgzwec8483vrvnaa30ky9r2utaxccvh2wsr9em3es" +tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc = "signam1qr3qcnzyz5e77y26uckd4nm6mdql0749dvtrrklgfpeknhg3qxm2ddj8gg0z4k57xngn88fukkepc7dzffn97tjhk7h76ux2y824elq9yevthj" [[bond]] -source = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "100000" [bond.signatures] -tpknam1qpg2tsrplvhu3fd7z7tq5ztc2ne3s7e2ahjl2a2cddufrzdyr752g666ytj = "signam1qpama7hqj2lqleln7yhqa94s97mz8n8wqemtljwa9znfr5yq3uhrf33deeskf9alx6zdd8mzpuhrlc0gfr79hkkzhjqa7kw4a6j7r0sdxzqlj8" +tpknam1qzcrjlea5ey5v56yvx4q0ptuz067rgd03cacwtg0f5tsemvlmdnr7tsazcc = "signam1qqaucmk7nlfrqfk8pvzk63gkvalf76a7trel5j0yfeazlpx9zwezteflldzxtd890dcm9q3nclpgqkmwj05w8h7szep4lw79mk0napgvwnwz5a" # 2. [[established_account]] -vp = "vp_user" threshold = 1 public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qq52dx5e290wyh7ngdt6wudtyd502lg6ln49yvg3vz97e8j2ruux5e3yewq"] +public_keys = ["tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847"] [[established_account]] -vp = "vp_user" threshold = 1 -public_keys = ["tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha"] +public_keys = ["tpknam1qrdn4pnry9tmgrth6azjuwv5f758974ej0j34xtye5wq4fqy202825vmlsn"] [[bond]] -source = "tnam1qxfj3sf6a0meahdu9t6znp05g8zx4dkjtgyn9gfu" -validator = "tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx" +source = "tnam1qy0rydkctp5nvx5vnjq80rq0w23dn3mrt5c8lzmg" +validator = "tnam1qy5uswpdgykvmev526vrf8ewczjzwnr0qcyccjwh" amount = "20000" [bond.signatures] -tpknam1qrnw8mxyqlj60mykgevnldcj5mg2fya7fs5a8xqdkd2gwtxhef0zy8a2wha = "signam1qqv8vvt2yk3gpzth6f5qdtf2g889mk6jv0qrrj0np62czy0qrruj5pgezjhqfvs4vg5f9zmelngpy04c7klschc57upr7zlk9w7647sx4j7x9c" +tpknam1qrtpj7fldnq8dpjukye6jskjlr2f7xsk2atz5y3wa378yv8w0l8xy7rj847 = "signam1qpu3zdvx6t72uyq4g8q3yavnwwgp50mfvnsnle2ausuvyke2pns6yhujeh0525cs9m0a8h7m3fmswlg8ffq4kxryqpytac4yyv5f5espapz5vv" diff --git a/wasm/wasm_source/src/tx_init_account.rs b/wasm/wasm_source/src/tx_init_account.rs index 5b21855c4a..67691e42b2 100644 --- a/wasm/wasm_source/src/tx_init_account.rs +++ b/wasm/wasm_source/src/tx_init_account.rs @@ -1,5 +1,4 @@ -//! A tx to initialize a new established address with a given public key and -//! a validity predicate. +//! A tx to initialize a new established address with a given public key. use namada_tx_prelude::*; @@ -14,22 +13,7 @@ fn apply_tx(ctx: &mut Ctx, tx_data: Tx) -> TxResult { .wrap_err("failed to decode InitAccount")?; debug_log!("apply_tx called to init a new established account"); - let vp_code_sec = signed - .get_section(&tx_data.vp_code_hash) - .ok_or_err_msg("vp code section not found") - .map_err(|err| { - ctx.set_commitment_sentinel(); - err - })? - .extra_data_sec() - .ok_or_err_msg("vp code section must be tagged as extra") - .map_err(|err| { - ctx.set_commitment_sentinel(); - err - })?; - - let address = - ctx.init_account(vp_code_sec.code.hash(), &vp_code_sec.tag)?; + let address = ctx.init_account()?; match account::init_account(ctx, &address, tx_data) { Ok(address) => { diff --git a/wasm/wasm_source/src/tx_update_account.rs b/wasm/wasm_source/src/tx_update_account.rs index 86038ab489..153aa33c11 100644 --- a/wasm/wasm_source/src/tx_update_account.rs +++ b/wasm/wasm_source/src/tx_update_account.rs @@ -17,28 +17,6 @@ fn apply_tx(ctx: &mut Ctx, tx: Tx) -> TxResult { let owner = &tx_data.addr; debug_log!("update VP for: {:#?}", tx_data.addr); - if let Some(hash) = tx_data.vp_code_hash { - let vp_code_sec = signed - .get_section(&hash) - .ok_or_err_msg("vp code section not found") - .map_err(|err| { - ctx.set_commitment_sentinel(); - err - })? - .extra_data_sec() - .ok_or_err_msg("vp code section must be tagged as extra") - .map_err(|err| { - ctx.set_commitment_sentinel(); - err - })?; - - ctx.update_validity_predicate( - owner, - vp_code_sec.code.hash(), - &vp_code_sec.tag, - )?; - } - if let Some(threshold) = tx_data.threshold { let threshold_key = account::threshold_key(owner); ctx.write(&threshold_key, threshold)?; diff --git a/wasm/wasm_source/src/vp_implicit.rs b/wasm/wasm_source/src/vp_implicit.rs index 6ac6a9d735..443fc4e20c 100644 --- a/wasm/wasm_source/src/vp_implicit.rs +++ b/wasm/wasm_source/src/vp_implicit.rs @@ -75,7 +75,8 @@ fn validate_tx( verifiers: BTreeSet
, ) -> VpResult { debug_log!( - "vp_user called with user addr: {}, key_changed: {:?}, verifiers: {:?}", + "vp_implicit called with user addr: {}, key_changed: {:?}, verifiers: \ + {:?}", addr, keys_changed, verifiers @@ -291,7 +292,6 @@ mod tests { use namada::ledger::pos::{GenesisValidator, PosParams}; use namada::tx::data::TxType; use namada::tx::{Code, Data, Signature}; - use namada_test_utils::TestWasms; use namada_tests::log::test; use namada_tests::native_vp::pos::init_pos; use namada_tests::tx::{self, tx_host_env, TestTxEnv}; @@ -947,43 +947,4 @@ mod tests { assert!(validate_tx(&CTX, signed_tx, vp_owner, keys_changed, verifiers).unwrap()); } } - - /// Test that a validity predicate update without a valid signature is - /// rejected. - #[test] - fn test_unsigned_vp_update_rejected() { - // Initialize a tx environment - let mut tx_env = TestTxEnv::default(); - - let secret_key = key::testing::keypair_1(); - let public_key = secret_key.ref_to(); - let vp_owner: Address = (&public_key).into(); - let vp_code = TestWasms::VpAlwaysTrue.read_bytes(); - let vp_hash = sha256(&vp_code); - // for the update - tx_env.store_wasm_code(vp_code); - - // Spawn the accounts to be able to modify their storage - tx_env.spawn_accounts([&vp_owner]); - - // Initialize VP environment from a transaction - vp_host_env::init_from_tx(vp_owner.clone(), tx_env, |address| { - // Update VP in a transaction - tx::ctx() - .update_validity_predicate(address, vp_hash, &None) - .unwrap(); - }); - - let vp_env = vp_host_env::take(); - let mut tx_data = Tx::from_type(TxType::Raw); - tx_data.set_data(Data::new(vec![])); - let keys_changed: BTreeSet = - vp_env.all_touched_storage_keys(); - let verifiers: BTreeSet
= BTreeSet::default(); - vp_host_env::set(vp_env); - assert!( - !validate_tx(&CTX, tx_data, vp_owner, keys_changed, verifiers) - .unwrap() - ); - } } diff --git a/wasm/wasm_source/src/vp_user.rs b/wasm/wasm_source/src/vp_user.rs index 655d73ccd6..cdc2e18698 100644 --- a/wasm/wasm_source/src/vp_user.rs +++ b/wasm/wasm_source/src/vp_user.rs @@ -1257,28 +1257,23 @@ mod tests { } } - /// Test that a validity predicate update without a valid signature is + /// Test that a threhsold update without a valid signature is /// rejected. #[test] - fn test_unsigned_vp_update_rejected() { + fn test_unsigned_threshold_update_rejected() { // Initialize a tx environment let mut tx_env = TestTxEnv::default(); let vp_owner = address::testing::established_address_1(); - let vp_code = TestWasms::VpAlwaysTrue.read_bytes(); - let vp_hash = sha256(&vp_code); - // for the update - tx_env.store_wasm_code(vp_code); // Spawn the accounts to be able to modify their storage tx_env.spawn_accounts([&vp_owner]); // Initialize VP environment from a transaction vp_host_env::init_from_tx(vp_owner.clone(), tx_env, |address| { - // Update VP in a transaction - tx::ctx() - .update_validity_predicate(address, vp_hash, &None) - .unwrap(); + // Update threshold in a transaction + let threshold_key = account::threshold_key(address); + tx::ctx().write(&threshold_key, 10).unwrap(); }); let vp_env = vp_host_env::take(); @@ -1306,76 +1301,27 @@ mod tests { let vp_owner = address::testing::established_address_1(); let keypair = key::testing::keypair_1(); let public_key = keypair.ref_to(); - let vp_code = TestWasms::VpAlwaysTrue.read_bytes(); - let vp_hash = sha256(&vp_code); - // for the update - tx_env.store_wasm_code(vp_code); - - // Spawn the accounts to be able to modify their storage - tx_env.spawn_accounts([&vp_owner]); - tx_env.init_account_storage(&vp_owner, vec![public_key.clone()], 1); - - // Initialize VP environment from a transaction - vp_host_env::init_from_tx(vp_owner.clone(), tx_env, |address| { - // Update VP in a transaction - tx::ctx() - .update_validity_predicate(address, vp_hash, &None) - .unwrap(); - }); - - let pks_map = AccountPublicKeysMap::from_iter(vec![public_key]); - - let mut vp_env = vp_host_env::take(); - let mut tx = vp_env.tx.clone(); - tx.set_data(Data::new(vec![])); - tx.set_code(Code::new(vec![], None)); - tx.add_section(Section::Signature(Signature::new( - vec![tx.raw_header_hash()], - pks_map.index_secret_keys(vec![keypair]), - None, - ))); - let signed_tx = tx.clone(); - vp_env.tx = signed_tx.clone(); - let keys_changed: BTreeSet = - vp_env.all_touched_storage_keys(); - let verifiers: BTreeSet
= BTreeSet::default(); - vp_host_env::set(vp_env); - assert!( - validate_tx(&CTX, signed_tx, vp_owner, keys_changed, verifiers) - .unwrap() - ); - } - /// Test that a validity predicate update is accepted if allowed - #[test] - fn test_signed_vp_update_allowed_accepted() { - // Initialize a tx environment - let mut tx_env = TestTxEnv::default(); - - let vp_owner = address::testing::established_address_1(); - let keypair = key::testing::keypair_1(); - let public_key = keypair.ref_to(); let vp_code = TestWasms::VpAlwaysTrue.read_bytes(); let vp_hash = sha256(&vp_code); // for the update tx_env.store_wasm_code(vp_code); - tx_env.init_parameters( - None, - Some(vec![vp_hash.to_string()]), - None, - None, - ); - // Spawn the accounts to be able to modify their storage tx_env.spawn_accounts([&vp_owner]); tx_env.init_account_storage(&vp_owner, vec![public_key.clone()], 1); // Initialize VP environment from a transaction vp_host_env::init_from_tx(vp_owner.clone(), tx_env, |address| { - // Update VP in a transaction + // Update threshold in a transaction + let threshold_key = account::threshold_key(address); + tx::ctx().write(&threshold_key, 10).unwrap(); + // Update the vp tx::ctx() - .update_validity_predicate(address, vp_hash, &None) + .write( + &namada::storage::Key::validity_predicate(address), + vp_hash, + ) .unwrap(); });