diff --git a/.changelog/unreleased/testing/3570-hw-e2e.md b/.changelog/unreleased/testing/3570-hw-e2e.md new file mode 100644 index 0000000000..fd68d538ca --- /dev/null +++ b/.changelog/unreleased/testing/3570-hw-e2e.md @@ -0,0 +1,2 @@ +- Enable E2E tests to be run using hardware wallet. + ([\#3570](https://github.com/anoma/namada/pull/3570)) \ No newline at end of file diff --git a/crates/apps_lib/src/cli.rs b/crates/apps_lib/src/cli.rs index f0012a9a19..cc7c51844c 100644 --- a/crates/apps_lib/src/cli.rs +++ b/crates/apps_lib/src/cli.rs @@ -7044,7 +7044,8 @@ pub mod args { DRY_RUN_TX .def() .help(wrap!("Simulate the transaction application.")) - .conflicts_with(DRY_RUN_WRAPPER_TX.name), + .conflicts_with(DRY_RUN_WRAPPER_TX.name) + .conflicts_with(USE_DEVICE.name), ) .arg( DRY_RUN_WRAPPER_TX @@ -7154,10 +7155,15 @@ pub mod args { )) .conflicts_with(DISPOSABLE_SIGNING_KEY.name), ) - .arg(USE_DEVICE.def().help(wrap!( - "Use an attached hardware wallet device to sign the \ - transaction." - ))) + .arg( + USE_DEVICE + .def() + .help(wrap!( + "Use an attached hardware wallet device to sign the \ + transaction." + )) + .conflicts_with(DRY_RUN_TX.name), + ) .arg( MEMO_OPT .def() diff --git a/crates/apps_lib/src/wallet/defaults.rs b/crates/apps_lib/src/wallet/defaults.rs index 7ea0c136d9..9a97a60ff3 100644 --- a/crates/apps_lib/src/wallet/defaults.rs +++ b/crates/apps_lib/src/wallet/defaults.rs @@ -4,12 +4,15 @@ pub use dev::{ addresses, albert_address, albert_keypair, bertha_address, bertha_keypair, christel_address, christel_keypair, daewon_address, daewon_keypair, - ester_address, ester_keypair, keys, tokens, validator_account_keypair, - validator_address, validator_keypair, validator_keys, + derive_template_dir, ester_address, ester_keypair, get_unencrypted_keypair, + is_use_device, keys, tokens, validator_account_keypair, validator_address, + validator_keypair, validator_keys, }; #[cfg(any(test, feature = "testing", feature = "benches"))] mod dev { + use std::path::{Path, PathBuf}; + use lazy_static::lazy_static; use namada_sdk::address::testing::{ apfel, btc, dot, eth, kartoffel, nam, schnitzel, @@ -182,12 +185,36 @@ mod dev { get_unencrypted_keypair("validator-0-account-key") } + /// Env. var to enable the usage of hardware wallets in tests + pub const ENV_VAR_USE_DEVICE: &str = "NAMADA_E2E_USE_DEVICE"; + + /// Check whether the ENV_VAR_USE_DEVICE environment variable is set + pub fn is_use_device() -> bool { + match std::env::var(ENV_VAR_USE_DEVICE) { + Ok(val) => val.to_ascii_lowercase() != "false", + _ => false, + } + } + + /// Derive the genesis path depending on whether the hardware wallet is in + /// use + pub fn derive_template_dir(working_dir: &Path) -> PathBuf { + // The E2E tests genesis config source. + // This file must contain a single validator with alias "validator-0". + // To add more validators, use the [`set_validators`] function in the + // call to setup the [`network`]. + if is_use_device() { + working_dir.join("genesis").join("hardware") + } else { + working_dir.join("genesis").join("localnet") + } + } + /// The name of a file that is unique to the project's root directory. const PROJECT_ROOT_UNIQUE_FILE: &str = "rust-toolchain.toml"; /// The pre-genesis directory of `validator-0`. - const VALIDATOR_0_PREGENESIS_DIR: &str = - "genesis/localnet/src/pre-genesis/validator-0"; + const VALIDATOR_0_PREGENESIS_DIR: &str = "src/pre-genesis/validator-0"; lazy_static! { static ref PREGENESIS_WALLET: Wallet = { @@ -199,7 +226,7 @@ mod dev { while !root_dir.join(PROJECT_ROOT_UNIQUE_FILE).exists() { root_dir.pop(); } - let path = root_dir.join("genesis/localnet/src/pre-genesis"); + let path = derive_template_dir(&root_dir).join("src/pre-genesis"); crate::wallet::load(&path).unwrap() }; @@ -213,7 +240,7 @@ mod dev { root_dir.pop(); } let path = - root_dir.join(VALIDATOR_0_PREGENESIS_DIR); + derive_template_dir(&root_dir).join(VALIDATOR_0_PREGENESIS_DIR); crate::wallet::pre_genesis::load(&path).unwrap() }; } diff --git a/crates/tests/src/e2e/helpers.rs b/crates/tests/src/e2e/helpers.rs index b495c7a4c0..e722dc3ba8 100644 --- a/crates/tests/src/e2e/helpers.rs +++ b/crates/tests/src/e2e/helpers.rs @@ -32,8 +32,8 @@ use namada_sdk::wallet::Wallet; use toml::Value; use super::setup::{ - self, run_gaia_cmd, sleep, NamadaBgCmd, NamadaCmd, Test, ENV_VAR_DEBUG, - ENV_VAR_USE_PREBUILT_BINARIES, + self, ensure_hot_key, run_gaia_cmd, sleep, NamadaBgCmd, NamadaCmd, Test, + ENV_VAR_DEBUG, ENV_VAR_USE_PREBUILT_BINARIES, }; use crate::e2e::setup::{constants, Bin, Who, APPS_PACKAGE}; use crate::strings::{LEDGER_STARTED, TX_APPLIED_SUCCESS}; @@ -219,9 +219,8 @@ pub fn get_pregenesis_pk>( alias: &str, base_dir_path: P, ) -> Option { - let mut wallet = get_pregenesis_wallet(base_dir_path); - let sk = wallet.find_secret_key(alias, None).ok()?; - Some(sk.ref_to()) + let wallet = get_pregenesis_wallet(base_dir_path); + wallet.find_public_key(alias).ok() } /// Get a pregenesis public key. @@ -610,7 +609,9 @@ fn make_hermes_chain_config(test: &Test) -> Value { chain.insert("account_prefix".to_owned(), Value::String("".to_owned())); chain.insert( "key_name".to_owned(), - Value::String(setup::constants::CHRISTEL_KEY.to_owned()), + Value::String( + ensure_hot_key(setup::constants::CHRISTEL_KEY).to_owned(), + ), ); chain.insert("store_prefix".to_owned(), Value::String("ibc".to_owned())); let mut table = toml::map::Map::new(); diff --git a/crates/tests/src/e2e/ibc_tests.rs b/crates/tests/src/e2e/ibc_tests.rs index 60bdd4970e..fb01648738 100644 --- a/crates/tests/src/e2e/ibc_tests.rs +++ b/crates/tests/src/e2e/ibc_tests.rs @@ -94,8 +94,9 @@ use crate::e2e::helpers::{ }; use crate::e2e::ledger_tests::{prepare_proposal_data, write_json_file}; use crate::e2e::setup::{ - self, run_gaia_cmd, run_hermes_cmd, set_ethereum_bridge_mode, setup_gaia, - setup_hermes, sleep, Bin, NamadaCmd, Test, Who, + self, apply_use_device, ensure_hot_addr, ensure_hot_key, run_gaia_cmd, + run_hermes_cmd, set_ethereum_bridge_mode, setup_gaia, setup_hermes, sleep, + Bin, NamadaCmd, Test, Who, }; use crate::strings::{ LEDGER_STARTED, TX_APPLIED_SUCCESS, TX_FAILED, VALIDATOR_NODE, @@ -1126,8 +1127,8 @@ fn create_client(test_a: &Test, test_b: &Test) -> Result<(ClientId, ClientId)> { let height_a = submit_ibc_tx( test_a, make_ibc_data(message.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1142,8 +1143,8 @@ fn create_client(test_a: &Test, test_b: &Test) -> Result<(ClientId, ClientId)> { let height_b = submit_ibc_tx( test_b, make_ibc_data(message.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1275,8 +1276,8 @@ fn update_client( submit_ibc_tx( target_test, make_ibc_data(message.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1321,8 +1322,8 @@ fn connection_handshake( let height = submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; let events = get_events(test_a, height)?; @@ -1361,8 +1362,8 @@ fn connection_handshake( let height = submit_ibc_tx( test_b, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; let events = get_events(test_b, height)?; @@ -1394,8 +1395,8 @@ fn connection_handshake( submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1414,8 +1415,8 @@ fn connection_handshake( submit_ibc_tx( test_b, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1458,8 +1459,8 @@ fn channel_handshake( let height = submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; let events = get_events(test_a, height)?; @@ -1491,8 +1492,8 @@ fn channel_handshake( let height = submit_ibc_tx( test_b, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; let events = get_events(test_b, height)?; @@ -1518,8 +1519,8 @@ fn channel_handshake( submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1540,8 +1541,8 @@ fn channel_handshake( submit_ibc_tx( test_b, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1640,8 +1641,8 @@ fn transfer_token( let height = submit_ibc_tx( test_b, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; let events = get_events(test_b, height)?; @@ -1665,8 +1666,8 @@ fn transfer_token( submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1733,7 +1734,7 @@ fn transfer_on_chain( std::env::set_var(ENV_VAR_CHAIN_ID, test.net.chain_id.to_string()); let rpc = get_actor_rpc(test, Who::Validator(0)); let amount = amount.to_string(); - let tx_args = vec![ + let tx_args = apply_use_device(vec![ kind.as_ref(), "--source", sender.as_ref(), @@ -1747,7 +1748,7 @@ fn transfer_on_chain( signer.as_ref(), "--node", &rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(120))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -1801,8 +1802,8 @@ fn transfer_back( let height = submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; let events = get_events(test_a, height)?; @@ -1825,8 +1826,8 @@ fn transfer_back( submit_ibc_tx( test_b, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1880,8 +1881,8 @@ fn transfer_timeout( submit_ibc_tx( test_a, make_ibc_data(msg.to_any()), - ALBERT, - ALBERT_KEY, + ensure_hot_addr(ALBERT), + ensure_hot_key(ALBERT_KEY), false, )?; @@ -1954,7 +1955,7 @@ fn submit_ibc_tx( let mut client = run!( test, Bin::Client, - [ + apply_use_device(vec![ "tx", "--code-path", TX_IBC_WASM, @@ -1970,7 +1971,7 @@ fn submit_ibc_tx( "150000", "--node", &rpc - ], + ]), Some(40) )?; client.exp_string(TX_APPLIED_SUCCESS)?; @@ -2001,7 +2002,7 @@ fn transfer( let channel_id = channel_id.to_string(); let port_id = port_id.to_string(); let amount = amount.to_string(); - let mut tx_args = vec![ + let mut tx_args = apply_use_device(vec![ "ibc-transfer", "--source", sender.as_ref(), @@ -2019,7 +2020,7 @@ fn transfer( "150000", "--node", &rpc, - ]; + ]); if let Some(signer) = signer { tx_args.extend_from_slice(&["--signing-keys", signer]); @@ -2061,7 +2062,7 @@ fn transfer( fn delegate_token(test: &Test) -> Result<()> { std::env::set_var(ENV_VAR_CHAIN_ID, test.net.chain_id.to_string()); let rpc = get_actor_rpc(test, Who::Validator(0)); - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", "validator-0", @@ -2071,7 +2072,7 @@ fn delegate_token(test: &Test) -> Result<()> { "900", "--node", &rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -2115,14 +2116,14 @@ fn propose_funding( start_epoch, ); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--pgf-funding", "--data-path", proposal_json_path.to_str().unwrap(), "--node", &rpc_a, - ]; + ]); let mut client = run!(test_a, Bin::Client, submit_proposal_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -2159,7 +2160,7 @@ fn propose_inflation(test: &Test) -> Result { let proposal_json_path = test.test_dir.path().join("proposal.json"); write_json_file(proposal_json_path.as_path(), proposal_json); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--data-path", proposal_json_path.to_str().unwrap(), @@ -2167,7 +2168,7 @@ fn propose_inflation(test: &Test) -> Result { "2000000", "--node", &rpc, - ]; + ]); let mut client = run!(test, Bin::Client, submit_proposal_args, Some(100))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -2200,7 +2201,7 @@ fn submit_votes(test: &Test) -> Result<()> { client.assert_success(); // Send different yay vote from delegator to check majority on 1/3 - let submit_proposal_vote_delagator = vec![ + let submit_proposal_vote_delagator = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -2210,7 +2211,7 @@ fn submit_votes(test: &Test) -> Result<()> { BERTHA, "--node", &rpc, - ]; + ]); let mut client = run!(test, Bin::Client, submit_proposal_vote_delagator, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; diff --git a/crates/tests/src/e2e/ledger_tests.rs b/crates/tests/src/e2e/ledger_tests.rs index 97413bb057..f5bf0ea56a 100644 --- a/crates/tests/src/e2e/ledger_tests.rs +++ b/crates/tests/src/e2e/ledger_tests.rs @@ -44,7 +44,8 @@ use crate::e2e::helpers::{ is_debug_mode, parse_reached_epoch, }; use crate::e2e::setup::{ - self, allow_duplicate_ips, default_port_offset, sleep, Bin, Who, + self, allow_duplicate_ips, apply_use_device, default_port_offset, sleep, + Bin, Who, }; use crate::strings::{ LEDGER_SHUTDOWN, LEDGER_STARTED, NON_VALIDATOR_NODE, TX_APPLIED_SUCCESS, @@ -167,7 +168,7 @@ fn test_node_connectivity_and_consensus() -> Result<()> { let _ = epoch_sleep(&test, &validator_one_rpc, 720)?; // 3. Submit a valid token transfer tx - let tx_args = [ + let tx_args = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -183,7 +184,7 @@ fn test_node_connectivity_and_consensus() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -557,7 +558,7 @@ fn pos_bonds() -> Result<()> { client.assert_success(); // 3. Submit a delegation to the first genesis validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", "validator-0", @@ -569,13 +570,13 @@ fn pos_bonds() -> Result<()> { BERTHA_KEY, "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); // 4. Submit a re-delegation from the first to the second genesis validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "redelegate", "--source-validator", "validator-0", @@ -589,7 +590,7 @@ fn pos_bonds() -> Result<()> { BERTHA_KEY, "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -613,7 +614,7 @@ fn pos_bonds() -> Result<()> { client.assert_success(); // 6. Submit an unbond of the delegation from the first validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "unbond", "--validator", "validator-0", @@ -625,14 +626,14 @@ fn pos_bonds() -> Result<()> { BERTHA_KEY, "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; let expected = "Amount 1600.000000 withdrawable starting from epoch "; let _ = client.exp_regex(&format!("{expected}.*\n"))?; client.assert_success(); // 7. Submit an unbond of the re-delegation from the second validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "unbond", "--validator", "validator-1", @@ -644,7 +645,7 @@ fn pos_bonds() -> Result<()> { BERTHA_KEY, "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; let expected = "Amount 1600.000000 withdrawable starting from epoch "; let (_unread, matched) = client.exp_regex(&format!("{expected}.*\n"))?; @@ -698,7 +699,7 @@ fn pos_bonds() -> Result<()> { client.assert_success(); // 10. Submit a withdrawal of the delegation - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "withdraw", "--validator", "validator-0", @@ -708,13 +709,13 @@ fn pos_bonds() -> Result<()> { BERTHA_KEY, "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); // 11. Submit an withdrawal of the re-delegation - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "withdraw", "--validator", "validator-1", @@ -724,7 +725,7 @@ fn pos_bonds() -> Result<()> { BERTHA_KEY, "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -799,7 +800,7 @@ fn pos_init_validator() -> Result<()> { // 2. Initialize a new validator account with the non-validator node let new_validator = "new-validator"; let _new_validator_key = format!("{}-key", new_validator); - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "init-validator", "--alias", new_validator, @@ -818,7 +819,7 @@ fn pos_init_validator() -> Result<()> { "--node", &non_validator_rpc, "--unsafe-dont-encrypt", - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -853,7 +854,7 @@ fn pos_init_validator() -> Result<()> { // 3. Submit a delegation to the new validator First, transfer some tokens // to the validator's key for fees: - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -867,14 +868,14 @@ fn pos_init_validator() -> Result<()> { BERTHA_KEY, "--node", &non_validator_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); // Then self-bond the tokens: let delegation = 5_u64; let delegation_str = &delegation.to_string(); - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", new_validator, @@ -886,14 +887,14 @@ fn pos_init_validator() -> Result<()> { BERTHA_KEY, "--node", &non_validator_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); // 4. Transfer some NAM to the new validator let validator_stake_str = &validator_stake.to_string_native(); - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -907,13 +908,13 @@ fn pos_init_validator() -> Result<()> { BERTHA_KEY, "--node", &non_validator_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); // 5. Submit a self-bond for the new validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", new_validator, @@ -921,7 +922,7 @@ fn pos_init_validator() -> Result<()> { validator_stake_str, "--node", &non_validator_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -995,7 +996,7 @@ fn ledger_many_txs_in_a_block() -> Result<()> { let validator_one_rpc = Arc::new(get_actor_rpc(&test, Who::Validator(0))); // A token transfer tx args - let tx_args = Arc::new(vec![ + let tx_args = Arc::new(apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -1007,30 +1008,42 @@ fn ledger_many_txs_in_a_block() -> Result<()> { "1.01", "--signing-keys", BERTHA_KEY, - "--node", - ]); - - // 2. Spawn threads each submitting token transfer tx - // We collect to run the threads in parallel. - #[allow(clippy::needless_collect)] - let tasks: Vec> = (0..4) - .map(|_| { - let test = Arc::clone(&test); - let validator_one_rpc = Arc::clone(&validator_one_rpc); - let tx_args = Arc::clone(&tx_args); - std::thread::spawn(move || { - let mut args = (*tx_args).clone(); - args.push(&*validator_one_rpc); - let mut client = run!(*test, Bin::Client, args, Some(80))?; - client.exp_string(TX_APPLIED_SUCCESS)?; - client.assert_success(); - let res: Result<()> = Ok(()); - res + ])); + + if tx_args.contains(&"--use-device") { + // Sequentialize transaction signing when hardware wallet is involved + for _ in 0..4 { + let mut args = (*tx_args).clone(); + args.push("--node"); + args.push(&*validator_one_rpc); + let mut client = run!(*test, Bin::Client, args, Some(80))?; + client.exp_string(TX_APPLIED_SUCCESS)?; + client.assert_success(); + } + } else { + // 2. Spawn threads each submitting token transfer tx + // We collect to run the threads in parallel. + #[allow(clippy::needless_collect)] + let tasks: Vec> = (0..4) + .map(|_| { + let test = Arc::clone(&test); + let validator_one_rpc = Arc::clone(&validator_one_rpc); + let tx_args = Arc::clone(&tx_args); + std::thread::spawn(move || { + let mut args = (*tx_args).clone(); + args.push("--node"); + args.push(&*validator_one_rpc); + let mut client = run!(*test, Bin::Client, args, Some(80))?; + client.exp_string(TX_APPLIED_SUCCESS)?; + client.assert_success(); + let res: Result<()> = Ok(()); + res + }) }) - }) - .collect(); - for task in tasks.into_iter() { - task.join().unwrap()?; + .collect(); + for task in tasks.into_iter() { + task.join().unwrap()?; + } } // Wait to commit a block let mut ledger = bg_ledger.foreground(); @@ -1224,7 +1237,7 @@ fn double_signing_gets_slashed() -> Result<()> { // 5. Submit a valid token transfer tx to validator 0 let validator_one_rpc = get_actor_rpc(&test, Who::Validator(0)); - let tx_args = [ + let tx_args = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -1236,7 +1249,7 @@ fn double_signing_gets_slashed() -> Result<()> { "10.1", "--node", &validator_one_rpc, - ]; + ]); let _client = run!(test, Bin::Client, tx_args, Some(100))?; // We don't wait for tx result - sometimes the node may crash before while // it's being applied, because the slashed validator will stop voting and @@ -1929,7 +1942,7 @@ fn proposal_change_shielded_reward() -> Result<()> { let validator_0_rpc = get_actor_rpc(&test, Who::Validator(0)); // 1.1 Delegate some token - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", "validator-0", @@ -1939,7 +1952,7 @@ fn proposal_change_shielded_reward() -> Result<()> { "900", "--node", &validator_0_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, tx_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -1954,7 +1967,7 @@ fn proposal_change_shielded_reward() -> Result<()> { ); let validator_one_rpc = get_actor_rpc(&test, Who::Validator(0)); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--data-path", valid_proposal_json_path.to_str().unwrap(), @@ -1962,7 +1975,7 @@ fn proposal_change_shielded_reward() -> Result<()> { "2000000", "--node", &validator_one_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, submit_proposal_args, Some(40))?; client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); @@ -2014,7 +2027,7 @@ fn proposal_change_shielded_reward() -> Result<()> { client.exp_string(TX_APPLIED_SUCCESS)?; client.assert_success(); - let submit_proposal_vote_delagator = vec![ + let submit_proposal_vote_delagator = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -2024,7 +2037,7 @@ fn proposal_change_shielded_reward() -> Result<()> { BERTHA, "--node", &validator_one_rpc, - ]; + ]); let mut client = run!(test, Bin::Client, submit_proposal_vote_delagator, Some(40))?; @@ -2258,7 +2271,7 @@ fn rollback() -> Result<()> { let ledger = ledger.background(); // send a few transactions - let txs_args = vec![vec![ + let txs_args = vec![apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -2272,7 +2285,7 @@ fn rollback() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ]]; + ])]; for tx_args in &txs_args { let mut client = run!(test, Bin::Client, tx_args, Some(40))?; diff --git a/crates/tests/src/e2e/setup.rs b/crates/tests/src/e2e/setup.rs index ba61380b9b..d845125367 100644 --- a/crates/tests/src/e2e/setup.rs +++ b/crates/tests/src/e2e/setup.rs @@ -27,6 +27,7 @@ use namada_apps_lib::config::genesis::{ templates, transactions, GenesisAddress, }; use namada_apps_lib::config::{ethereum_bridge, genesis, Config}; +use namada_apps_lib::wallet::defaults::{derive_template_dir, is_use_device}; use namada_apps_lib::{config, wallet}; use namada_core::address::Address; use namada_core::collections::HashMap; @@ -66,12 +67,6 @@ const ENV_VAR_TEMP_PATH: &str = "NAMADA_E2E_TEMP_PATH"; pub const ENV_VAR_USE_PREBUILT_BINARIES: &str = "NAMADA_E2E_USE_PREBUILT_BINARIES"; -/// The E2E tests genesis config source. -/// This file must contain a single validator with alias "validator-0". -/// To add more validators, use the [`set_validators`] function in the call to -/// setup the [`network`]. -#[allow(dead_code)] -pub const SINGLE_NODE_NET_GENESIS: &str = "genesis/localnet"; /// An E2E test network. #[derive(Debug, Clone)] pub struct Network { @@ -81,6 +76,35 @@ pub struct Network { /// Offset the ports used in the network configuration to avoid shared resources pub const ANOTHER_CHAIN_PORT_OFFSET: u16 = 1000; +/// Apply the --use-device flag depending on the environment variables +pub fn apply_use_device(mut tx_args: Vec<&str>) -> Vec<&str> { + if is_use_device() { + tx_args.push("--use-device"); + } + tx_args +} + +/// Replace the given key with a key that is stored unencrypted in the wallet. +/// This is useful for IBC tests where a keypair needs to be added to the Hermes +/// keyring or where IBC messages unsupported by the hardware wallet need to be +/// signed +pub fn ensure_hot_key(key: &str) -> &str { + if is_use_device() { + constants::FRANK_KEY + } else { + key + } +} + +/// Same as ensure_hot_key but for addressees +pub fn ensure_hot_addr(key: &str) -> &str { + if is_use_device() { + constants::FRANK + } else { + key + } +} + /// Default functions for offsetting ports when /// adding multiple validators to a network pub fn default_port_offset(ix: u8) -> u16 { @@ -348,7 +372,7 @@ pub fn network( let test_dir = TestDir::new(); // Open the source genesis file templates - let templates_dir = working_dir.join("genesis").join("localnet"); + let templates_dir = derive_template_dir(&working_dir); println!( "{} {}.", "Loading genesis templates from".yellow(), @@ -1412,6 +1436,9 @@ pub mod constants { pub const DAEWON_KEY: &str = "Daewon-key"; pub const ESTER: &str = "Ester"; pub const MATCHMAKER_KEY: &str = "matchmaker-key"; + // Special user that must be stored unencrypted for IBC tests + pub const FRANK: &str = "Frank"; + pub const FRANK_KEY: &str = "Frank-key"; // Shielded spending and viewing keys and payment addresses pub const A_SPENDING_KEY: &str = "zsknam1qdrk9kd8qqqqpqy3pxzxu2kexydl7ug22s3808htl604emmz9qlde9cl9mx6euhvh3cpl9w7guustfzjxsyaeqtefhden6q8776t9cr9vkqztj7u0mgs5k9nz945sypev9ppptn5d85as3ccsnu3q6g3acqp2gpsrwe6naqg3stqp43uk9x2cj79gcxuum8a7jayjqlv4ptcfnunqkqzsj6m2r3sn8ft0tyqqpv28nghe4ag68eccaqx7v5f65he95g5uwq2wr4yuqc06jgc7"; diff --git a/crates/tests/src/integration/ledger_tests.rs b/crates/tests/src/integration/ledger_tests.rs index 90f17d7359..5b995e16de 100644 --- a/crates/tests/src/integration/ledger_tests.rs +++ b/crates/tests/src/integration/ledger_tests.rs @@ -6,7 +6,9 @@ use borsh::BorshDeserialize; use borsh_ext::BorshSerializeExt; use color_eyre::eyre::Result; use data_encoding::HEXLOWER; -use namada_apps_lib::wallet::defaults::{self, albert_keypair}; +use namada_apps_lib::wallet::defaults::{ + self, get_unencrypted_keypair, is_use_device, +}; use namada_core::dec::Dec; use namada_core::hash::Hash; use namada_core::storage::{DbColFam, Epoch, Key}; @@ -28,6 +30,7 @@ use crate::e2e::setup::constants::{ ALBERT, ALBERT_KEY, APFEL, BERTHA, BERTHA_KEY, BTC, CHRISTEL, CHRISTEL_KEY, DAEWON, DOT, ESTER, ETH, GOVERNANCE_ADDRESS, KARTOFFEL, NAM, SCHNITZEL, }; +use crate::e2e::setup::{apply_use_device, ensure_hot_key}; use crate::integration::helpers::{ find_address, prepare_steward_commission_update_data, }; @@ -80,7 +83,7 @@ fn ledger_txs_and_queries() -> Result<()> { let txs_args = vec![ // 2. Submit a token transfer tx (from an established account) - vec![ + apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -94,9 +97,9 @@ fn ledger_txs_and_queries() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ], + ]), // Submit a token transfer tx (from an ed25519 implicit account) - vec![ + apply_use_device(vec![ "transparent-transfer", "--source", DAEWON, @@ -110,9 +113,9 @@ fn ledger_txs_and_queries() -> Result<()> { DAEWON, "--node", &validator_one_rpc, - ], + ]), // Submit a token transfer tx (from a secp256k1 implicit account) - vec![ + apply_use_device(vec![ "transparent-transfer", "--source", ESTER, @@ -124,10 +127,10 @@ fn ledger_txs_and_queries() -> Result<()> { "10.1", "--node", &validator_one_rpc, - ], + ]), // 3. Submit a transaction to update an account's validity // predicate - vec![ + apply_use_device(vec![ "update-account", "--address", BERTHA, @@ -137,9 +140,9 @@ fn ledger_txs_and_queries() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ], + ]), // 4. Submit a custom tx - vec![ + apply_use_device(vec![ "tx", "--code-path", TX_TRANSFER_WASM, @@ -151,9 +154,9 @@ fn ledger_txs_and_queries() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ], + ]), // 5. Submit a tx to initialize a new account - vec![ + apply_use_device(vec![ "init-account", "--public-keys", // Value obtained from `namada_sdk::key::ed25519::tests::gen_keypair` @@ -168,9 +171,9 @@ fn ledger_txs_and_queries() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ], + ]), // 5. Submit a tx to initialize a new multisig account - vec![ + apply_use_device(vec![ "init-account", "--public-keys", &multisig_account, @@ -184,12 +187,13 @@ fn ledger_txs_and_queries() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ], + ]), ]; for tx_args in &txs_args { for &dry_run in &[true, false] { - let tx_args = if dry_run && tx_args[0] == "tx" { + let tx_args = if dry_run && (tx_args[0] == "tx" || is_use_device()) + { continue; } else if dry_run { [tx_args.clone(), vec!["--dry-run"]].concat() @@ -358,7 +362,7 @@ fn invalid_transactions() -> Result<()> { // 2. Submit an invalid transaction (trying to transfer tokens should fail // in the user's VP due to the wrong signer) - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -373,7 +377,7 @@ fn invalid_transactions() -> Result<()> { "--node", &validator_one_rpc, "--force", - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); @@ -387,7 +391,7 @@ fn invalid_transactions() -> Result<()> { } let daewon_lower = DAEWON.to_lowercase(); - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "transparent-transfer", "--source", DAEWON, @@ -404,7 +408,7 @@ fn invalid_transactions() -> Result<()> { "--force", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert!(captured.contains(TX_INSUFFICIENT_BALANCE)); @@ -496,7 +500,7 @@ fn pos_rewards() -> Result<()> { .unwrap(); // Claim rewards - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "claim-rewards", "--validator", "validator-0-validator", @@ -504,7 +508,7 @@ fn pos_rewards() -> Result<()> { "validator-0-account-key", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); println!("{:?}", captured.result); assert_matches!(captured.result, Ok(_)); @@ -553,7 +557,7 @@ fn test_bond_queries() -> Result<()> { let validator_alias = "validator-0-validator"; // 2. Submit a delegation to the genesis validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", validator_alias, @@ -561,13 +565,13 @@ fn test_bond_queries() -> Result<()> { "100", "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); // 3. Submit a delegation to the genesis validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", "validator-0-validator", @@ -579,7 +583,7 @@ fn test_bond_queries() -> Result<()> { BERTHA_KEY, "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); @@ -591,7 +595,7 @@ fn test_bond_queries() -> Result<()> { } // 4. Submit another delegation to the genesis validator - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", validator_alias, @@ -603,13 +607,13 @@ fn test_bond_queries() -> Result<()> { BERTHA_KEY, "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); // 5. Submit an unbond of the delegation - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "unbond", "--validator", validator_alias, @@ -621,7 +625,7 @@ fn test_bond_queries() -> Result<()> { BERTHA_KEY, "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); @@ -685,7 +689,7 @@ fn proposal_submission() -> Result<()> { let (mut node, _services) = setup::setup()?; // 1.1 Delegate some token - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", "validator-0-validator", @@ -695,7 +699,7 @@ fn proposal_submission() -> Result<()> { "900", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); @@ -709,7 +713,7 @@ fn proposal_submission() -> Result<()> { 12, ); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--data-path", valid_proposal_json_path.to_str().unwrap(), @@ -717,7 +721,7 @@ fn proposal_submission() -> Result<()> { "2000000", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, submit_proposal_args)); assert_matches!(captured.result, Ok(_)); @@ -776,13 +780,13 @@ fn proposal_submission() -> Result<()> { 1, ); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--data-path", invalid_proposal_json.to_str().unwrap(), "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, submit_proposal_args)); @@ -826,7 +830,7 @@ fn proposal_submission() -> Result<()> { node.next_epoch(); } - let submit_proposal_vote = vec![ + let submit_proposal_vote = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -836,7 +840,7 @@ fn proposal_submission() -> Result<()> { "validator-0-validator", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, submit_proposal_vote)); @@ -844,7 +848,7 @@ fn proposal_submission() -> Result<()> { assert!(captured.contains(TX_APPLIED_SUCCESS)); // 9.2. Send a valid yay vote from a delegator with bonds - let submit_proposal_vote_delegator = vec![ + let submit_proposal_vote_delegator = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -854,7 +858,7 @@ fn proposal_submission() -> Result<()> { BERTHA, "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| { run(&node, Bin::Client, submit_proposal_vote_delegator) @@ -863,7 +867,7 @@ fn proposal_submission() -> Result<()> { assert!(captured.contains(TX_APPLIED_SUCCESS)); // 10. Send a yay vote from a non-validator/non-delegator user - let submit_proposal_vote = vec![ + let submit_proposal_vote = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -873,7 +877,7 @@ fn proposal_submission() -> Result<()> { CHRISTEL, "--node", &validator_one_rpc, - ]; + ]); // Expect a client failure here let captured = @@ -949,7 +953,7 @@ fn proposal_submission() -> Result<()> { assert!(captured.contains(".*Min. proposal grace epochs: 9.*")); // 15. Try to initialize a new account with the no more allowlisted vp - let init_account = vec![ + let init_account = apply_use_device(vec![ "init-account", "--public-keys", // Value obtained from @@ -965,7 +969,7 @@ fn proposal_submission() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, init_account)); assert_matches!(captured.result, Ok(_)); assert!( @@ -975,7 +979,7 @@ fn proposal_submission() -> Result<()> { // 16. Submit a tx touching a previous account with the no more allowlisted // vp and verify that the transaction succeeds, i.e. the non allowlisted // vp can still run - let transfer = vec![ + let transfer = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -989,7 +993,7 @@ fn proposal_submission() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, transfer)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); @@ -1018,7 +1022,7 @@ fn pgf_governance_proposal() -> Result<()> { // 1. start the ledger node let (mut node, _services) = setup::setup()?; - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "bond", "--validator", "validator-0-validator", @@ -1028,7 +1032,7 @@ fn pgf_governance_proposal() -> Result<()> { "900", "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); @@ -1042,14 +1046,14 @@ fn pgf_governance_proposal() -> Result<()> { let valid_proposal_json_path = prepare_proposal_data(node.test_dir.path(), albert, pgf_stewards, 12); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--pgf-stewards", "--data-path", valid_proposal_json_path.to_str().unwrap(), "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, submit_proposal_args)); assert_matches!(captured.result, Ok(_)); @@ -1103,7 +1107,7 @@ fn pgf_governance_proposal() -> Result<()> { node.next_epoch(); } - let submit_proposal_vote = vec![ + let submit_proposal_vote = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -1113,14 +1117,14 @@ fn pgf_governance_proposal() -> Result<()> { "validator-0-validator", "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, submit_proposal_vote)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); // Send different yay vote from delegator to check majority on 1/3 - let submit_proposal_vote_delegator = vec![ + let submit_proposal_vote_delegator = apply_use_device(vec![ "vote-proposal", "--proposal-id", "0", @@ -1130,7 +1134,7 @@ fn pgf_governance_proposal() -> Result<()> { BERTHA, "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| { run(&node, Bin::Client, submit_proposal_vote_delegator) }); @@ -1218,14 +1222,14 @@ fn pgf_governance_proposal() -> Result<()> { let valid_proposal_json_path = prepare_proposal_data(node.test_dir.path(), albert, pgf_funding, 36); - let submit_proposal_args = vec![ + let submit_proposal_args = apply_use_device(vec![ "init-proposal", "--pgf-funding", "--data-path", valid_proposal_json_path.to_str().unwrap(), "--ledger-address", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, submit_proposal_args)); assert_matches!(captured.result, Ok(_)); @@ -1301,7 +1305,7 @@ fn pgf_steward_change_commission() -> Result<()> { commission, ); // Update steward commissions - let tx_args = vec![ + let tx_args = apply_use_device(vec![ "update-steward-rewards", "--steward", ALBERT, @@ -1309,7 +1313,7 @@ fn pgf_steward_change_commission() -> Result<()> { commission_path.to_str().unwrap(), "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, tx_args)); assert_matches!(captured.result, Ok(_)); assert!(captured.contains(TX_APPLIED_SUCCESS)); @@ -1437,7 +1441,7 @@ fn implicit_account_reveal_pk() -> Result<()> { // Apply the key_alias once the key is generated to obtain tx args let tx_args = tx_args(&key_alias); // 2b. Send some funds to the implicit account. - let credit_args = vec![ + let credit_args = apply_use_device(vec![ "transparent-transfer", "--source", BERTHA, @@ -1451,7 +1455,7 @@ fn implicit_account_reveal_pk() -> Result<()> { BERTHA_KEY, "--node", &validator_one_rpc, - ]; + ]); run(&node, Bin::Client, credit_args)?; node.assert_success(); @@ -1511,7 +1515,7 @@ fn change_validator_metadata() -> Result<()> { assert!(captured.contains("max change per epoch:")); // 3. Add some metadata to the validator - let metadata_change_args = vec![ + let metadata_change_args = apply_use_device(vec![ "change-metadata", "--validator", "validator-0-validator", @@ -1525,7 +1529,7 @@ fn change_validator_metadata() -> Result<()> { "theokayestvalidator.com", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, metadata_change_args)); @@ -1548,7 +1552,7 @@ fn change_validator_metadata() -> Result<()> { assert!(captured.contains("max change per epoch:")); // 5. Remove the validator website - let metadata_change_args = vec![ + let metadata_change_args = apply_use_device(vec![ "change-metadata", "--validator", "validator-0-validator", @@ -1556,7 +1560,7 @@ fn change_validator_metadata() -> Result<()> { "", "--node", &validator_one_rpc, - ]; + ]); let captured = CapturedOutput::of(|| run(&node, Bin::Client, metadata_change_args)); assert_matches!(captured.result, Ok(_)); @@ -1599,7 +1603,7 @@ fn enforce_fee_payment() -> Result<()> { vec![ "balance", "--owner", - ALBERT_KEY, + ensure_hot_key(ALBERT_KEY), "--token", NAM, "--node", @@ -1613,10 +1617,10 @@ fn enforce_fee_payment() -> Result<()> { run( &node, Bin::Client, - vec![ + apply_use_device(vec![ "transparent-transfer", "--source", - ALBERT_KEY, + ensure_hot_key(ALBERT_KEY), "--target", BERTHA, "--token", @@ -1632,7 +1636,7 @@ fn enforce_fee_payment() -> Result<()> { "--dump-tx", "--ledger-address", validator_one_rpc, - ], + ]), )?; node.assert_success(); let file_path = tempdir @@ -1649,10 +1653,10 @@ fn enforce_fee_payment() -> Result<()> { run( &node, Bin::Client, - vec![ + apply_use_device(vec![ "transparent-transfer", "--source", - ALBERT_KEY, + ensure_hot_key(ALBERT_KEY), "--target", CHRISTEL, "--token", @@ -1660,13 +1664,13 @@ fn enforce_fee_payment() -> Result<()> { "--amount", "50", "--gas-payer", - ALBERT_KEY, + ensure_hot_key(ALBERT_KEY), "--output-folder-path", tempdir.path().to_str().unwrap(), "--dump-tx", "--ledger-address", validator_one_rpc, - ], + ]), )?; node.assert_success(); let file_path = tempdir @@ -1680,7 +1684,9 @@ fn enforce_fee_payment() -> Result<()> { txs_bytes.push(std::fs::read(&file_path).unwrap()); std::fs::remove_file(&file_path).unwrap(); - let sk = albert_keypair(); + let sk = get_unencrypted_keypair( + &ensure_hot_key("albert-key").to_ascii_lowercase(), + ); let pk = sk.to_public(); let native_token = node @@ -1740,7 +1746,7 @@ fn enforce_fee_payment() -> Result<()> { vec![ "balance", "--owner", - ALBERT_KEY, + ensure_hot_key(ALBERT_KEY), "--token", NAM, "--node", diff --git a/crates/tests/src/integration/setup.rs b/crates/tests/src/integration/setup.rs index 49561b517b..8cbc8214ad 100644 --- a/crates/tests/src/integration/setup.rs +++ b/crates/tests/src/integration/setup.rs @@ -14,6 +14,7 @@ use namada_apps_lib::config::genesis::templates::load_and_validate; use namada_apps_lib::config::TendermintMode; use namada_apps_lib::facade::tendermint::Timeout; use namada_apps_lib::facade::tendermint_proto::google::protobuf::Timestamp; +use namada_apps_lib::wallet::defaults::derive_template_dir; use namada_apps_lib::wallet::pre_genesis; use namada_core::chain::ChainIdPrefix; use namada_core::collections::HashMap; @@ -27,7 +28,7 @@ use namada_sdk::dec::Dec; use namada_sdk::token; use namada_sdk::wallet::alias::Alias; -use crate::e2e::setup::{copy_wasm_to_chain_dir, SINGLE_NODE_NET_GENESIS}; +use crate::e2e::setup::copy_wasm_to_chain_dir; /// Env. var for keeping temporary files created by the integration tests const ENV_VAR_KEEP_TEMP: &str = "NAMADA_INT_KEEP_TEMP"; @@ -49,7 +50,7 @@ pub fn initialize_genesis( _ => false, }; let test_dir = TestDir::new(); - let template_dir = working_dir.join(SINGLE_NODE_NET_GENESIS); + let template_dir = derive_template_dir(&working_dir); // Copy genesis files to test directory. let mut templates = templates::All::read_toml_files(&template_dir) diff --git a/genesis/hardware/README.md b/genesis/hardware/README.md new file mode 100644 index 0000000000..6b5b7e6d29 --- /dev/null +++ b/genesis/hardware/README.md @@ -0,0 +1,134 @@ +# Localnet genesis templates using hardware wallet keys + +This directory contains genesis templates for a local network with a single validator. The `src` directory contains generated pre-genesis wallet pre-loaded with public keys, derivation paths, and a single validator `validator-0` wallet that are being used in the templates. Most of the keys for this network are derived from a hardware wallet configured with a specific seed phrase. + +If you're modifying any of the files here, you can run this to ensure that the changes are valid: + +```shell +cargo watch -x "test test_validate_localnet_genesis_templates" +``` +## Reproducibility +To ensure that the key generated by the hardware wallet for a given derivation path is always the same, the hardware wallet must be configured to use a known test mnemonic. Specifically, these genesis templates were generated using the following test mnemonic: `equip will roof matter pink blind book anxiety banner elbow sun young`. Instructions on how to configure the hardware wallet with this mnemonic can be found in the `Set a test mnemonic` section of https://github.com/Zondax/ledger-namada?tab=readme-ov-file#how-to-prepare-your-development-device . +## E2E and Integration Tests +The E2E and integration tests can be made to use these hardware wallet based genesis templates by setting the environment variable `NAMADA_E2E_USE_DEVICE` to `true` when running `make test ...`. In order to ensure the success of these tests, please ensure that the following requirements are met: +* The hardware wallet is connected and the Ledger app is open for the duration of the E2E tests +* Transactions are promptly manually approved on the hardware wallet before the E2E test timeouts ellapse +* The hardware wallet is configured with the same test mnemonic used to generate these genesis templates. See [reproducibility](#reproducibility). +## pre-genesis/wallet.toml +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/hardware/src" derive \ + --alias albert-key --pre-genesis --use-device --hd-path "m/44'/877'/0'/0'/0'" +cargo run --bin namadaw -- --base-dir "genesis/hardware/src" derive \ + --alias bertha-key --pre-genesis --use-device --hd-path "m/44'/877'/0'/0'/1'" +cargo run --bin namadaw -- --base-dir "genesis/hardware/src" derive \ + --alias christel --pre-genesis --use-device --hd-path "m/44'/877'/0'/0'/2'" +cargo run --bin namadaw -- --base-dir "genesis/hardware/src" derive \ + --alias daewon --pre-genesis --use-device --hd-path "m/44'/877'/0'/0'/3'" +cargo run --bin namadaw -- --base-dir "genesis/hardware/src" derive \ + --alias validator-0-account-key --pre-genesis --use-device --hd-path "m/44'/877'/0'/0'/5'" +cargo run --bin namadaw -- --base-dir "genesis/hardware/src" gen \ + --alias faucet-key --unsafe-dont-encrypt --pre-genesis +``` + +Some keys are used to setup established accounts and some are directly assigned balances in the [balances.toml](#balancestoml) file to implicit addresses derived from these keys. + +## transactions.toml + +### Transaction to initialize an established account + +For example, Albert's account is created with: + +```shell +cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ + init-genesis-established-account \ + --path "genesis/localnet/src/pre-genesis/established/established-account-tx-albert.toml" \ + --aliases "albert-key" +``` + +Note that the command will print out your `Derived established account address`. + +### Validator transactions + +To create a validator's account, first initialize an established account: + +```shell +cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ + init-genesis-established-account \ + --path "genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml" \ + --aliases "validator-0-account-key" +``` + +The `Derived established account address` and the transaction added to the TOML file from this command is used in the following command. + +The pre-genesis validator wallet used to generate [validator transactions for transactions.toml](src/pre-genesis/validator-0/transactions.toml) is located at [src/pre-genesis/validator-0/validator-wallet.toml](src/pre-genesis/validator-0/validator-wallet.toml) and can be re-generated: + +```shell +cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ + init-genesis-validator \ + --alias validator-0 \ + --address tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx \ + --path "genesis/localnet/src/pre-genesis/validator-0/unsigned-transactions.toml" \ + --net-address "127.0.0.1:27656" \ + --commission-rate 0.05 \ + --max-commission-rate-change 0.01 \ + --email "null@null.net" \ + --self-bond-amount 100000 \ + --unsafe-dont-encrypt +``` + +### Delegations + +A delegation with e.g. 20 000 NAM tokens to a validator account whose address has to be known beforehand (here the validator-0 created above) is created with: + +```shell +cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ + genesis-bond \ + --validator tnam1q9vhfdur7gadtwx4r223agpal0fvlqhywylf2mzx \ + --amount 20000 \ + --path "genesis/localnet/src/pre-genesis/bond/bond-tx-albert.toml" +``` + +### Signing + +The non-validator transactions are manually appended together in [src/pre-genesis/unsigned-transactions.toml](src/pre-genesis/unsigned-transactions.toml) and then signed to produce [src/pre-genesis/signed-transactions.toml](src/pre-genesis/signed-transactions.toml) using: + +```shell +cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ + sign-genesis-txs \ + --path "genesis/localnet/src/pre-genesis/unsigned-transactions.toml" \ + --output "genesis/localnet/src/pre-genesis/signed-transactions.toml" +``` + +The validator transactions are signed using (note the extra `--alias` argument needed to find the validator pre-genesis wallet): + +```shell +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/pre-genesis/validator-0/signed-transactions.toml" \ + --alias validator-0 +``` + +This non-validator [src/pre-genesis/signed-transactions.toml](src/pre-genesis/signed-transactions.toml) are joined together with [src/validator-0/signed-transactions.toml](src/validator-0/signed-transactions.toml) in [transactions.toml](transactions.toml). + +## balances.toml + +The [balances.toml file](balances.toml) contains token balances associated with public keys or established addresses which can be derived from genesis transactions. The public keys from the wallet can be found with: + +```shell +cargo run --bin namadaw -- --base-dir "genesis/localnet/src" key list +``` + +If you didn't note the address from your transactions, you can deterministically derive an established address from the TOML file again, run with the `--path` set to a transaction TOML file: + +```shell +cargo run --bin namadac -- --base-dir "genesis/localnet/src" utils \ + derive-genesis-addresses \ + --path "genesis/localnet/src/pre-genesis/established/established-account-tx-validator-0.toml" +``` + +## Validation + +A unit test `test_validate_localnet_genesis_templates` is setup to check validity of the localnet setup. diff --git a/genesis/hardware/balances.toml b/genesis/hardware/balances.toml new file mode 100644 index 0000000000..61fb124255 --- /dev/null +++ b/genesis/hardware/balances.toml @@ -0,0 +1,135 @@ +# Genesis balances. +# +# This files contains the genesis balances of any tokens present at genesis +# associated with implicit addresses (in the form of public keys) or established +# addresses. +# +# For example: +# ``` +# [token.NAM] +# some_pk_bech32m_encoding = 10 # genesis tokens, the amount can have up to 6 decimal places +# ``` +# +# The public keys present in here are taken from `pre-genesis/wallet.toml`. +# As for the established addresses, these are derived from their respective +# genesis tx toml files. + +[token.NAM] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "2000000" +tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz = "2000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "2000000" +tpknam1qrg6qx72e0vqhg8plg20hv97g3p3q092gl88jlngkly0hpmca2h2we44uzw = "2000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "2000000" +tpknam1qp7r3et2usz538fxzkm69h3awr7t0kgk7h6528za7pk4g2jldk5dz0qjkhx = "2000000" +# daewon +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "100000000" +# ester +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "200000" +tpknam1qpzrttnzfyt6xfu2vy092eruasll3z52rjfexwapdw0rdww5uktlk3j73dw = "200000" +# validator-0-account-key +tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "2000000" +tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79 = "2000000" + +[token.BTC] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "1000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "1000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "1000000" +# daewon-key +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "1000000" +# ester-key +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" + +[token.ETH] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "1000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "1000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "1000000" +# daewon-key +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "1000000" +# ester-key +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" + + +[token.DOT] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "1000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "1000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "1000000" +# daewon-key +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "1000000" +# ester-key +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" + +[token.Schnitzel] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "1000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "1000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "1000000" +# daewon-key +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "1000000" +# ester-key +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" + +[token.Apfel] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "1000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "1000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "1000000" +# daewon-key +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "1000000" +# ester-key +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" + +[token.Kartoffel] +# albert +tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e = "1000000" +# bertha +tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v = "1000000" +# christel +tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm = "1000000" +# daewon-key +tpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv = "1000000" +# ester-key +tpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y = "1000000" +# validator-0 +tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss = "1000000" +# frank +tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf = "1000000" diff --git a/genesis/hardware/parameters.toml b/genesis/hardware/parameters.toml new file mode 100644 index 0000000000..f3b48ffece --- /dev/null +++ b/genesis/hardware/parameters.toml @@ -0,0 +1,113 @@ +# General protocol parameters. +[parameters] +native_token = "NAM" +is_native_token_transferable = true +# Minimum number of blocks in an epoch. +min_num_of_blocks = 4 +# Max payload size, in bytes, for a tx. +max_tx_bytes = 1048576 +# Max payload size, in bytes, for a block proposal. +max_proposal_bytes = 6291456 +# vp allowlist +vp_allowlist = [] +# tx allowlist +tx_allowlist = [] +# Implicit VP WASM name +implicit_vp = "vp_implicit" +# Expected number of epochs per year (also sets the min duration of an epoch in seconds) +epochs_per_year = 31_536_000 +# The multiplier for masp epochs +masp_epoch_multiplier = 2 +# Max gas for block +max_block_gas = 20000000 +# Masp fee payment gas limit +masp_fee_payment_gas_limit = 150_000 +# Gas scale +gas_scale = 10_000_000 + +# Map of the cost per gas unit for every token allowed for fee payment +[parameters.minimum_gas_price] +nam = "0.000001" + +# Proof of stake parameters. +[pos_params] +# Maximum number of active validators. +max_validator_slots = 128 +# Pipeline length (in epochs). Any change in the validator set made in +# epoch 'n' will become active in epoch 'n + pipeline_len'. +pipeline_len = 2 +# Unbonding length (in epochs). Validators may have their stake slashed +# for a fault in epoch 'n' up through epoch 'n + unbonding_len'. +unbonding_len = 3 +# Votes per fundamental staking token (namnam) +tm_votes_per_token = "1" +# Reward for proposing a block. +block_proposer_reward = "0.125" +# Reward for voting on a block. +block_vote_reward = "0.1" +# Maximum inflation rate per annum (10%) +max_inflation_rate = "0.1" +# Targeted ratio of staked tokens to total tokens in the supply +target_staked_ratio = "0.6667" +# Portion of a validator's stake that should be slashed on a duplicate +# vote. +duplicate_vote_min_slash_rate = "0.001" +# Portion of a validator's stake that should be slashed on a light +# client attack. +light_client_attack_min_slash_rate = "0.001" +# Number of epochs above and below (separately) the current epoch to +# consider when doing cubic slashing +cubic_slashing_window_length = 1 +# The minimum amount of bonded tokens that a validator needs to be in +# either the `consensus` or `below_capacity` validator sets +validator_stake_threshold = "1000000" +# The length, in blocks, of the sliding window for consensus validators +# inactivity verification +liveness_window_check = 100 +# The minimum required activity of consensus validators, in percentage, over +# the `liveness_window_check` +liveness_threshold = "0.9" +# The P gain factor in the Proof of Stake rewards controller +rewards_gain_p = "0.25" +# The D gain factor in the Proof of Stake rewards controller +rewards_gain_d = "0.25" + +# Governance parameters. +[gov_params] +# minimum amount of nam token to lock +min_proposal_fund = 500 +# proposal code size in bytes +max_proposal_code_size = 600000 +# min proposal period length in epochs +min_proposal_voting_period = 3 +# max proposal period length in epochs +max_proposal_period = 27 +# maximum number of characters in the proposal content +max_proposal_content_size = 10000 +# minimum epochs between end and activation epoch +min_proposal_grace_epochs = 6 +# maximum number of epochs between current epoch and start epoch +max_proposal_latency = 30 + +# Public goods funding parameters +[pgf_params] +# Initial set of stewards +stewards = [ + # bertha + "tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v", + # validator-0 + "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +] +# The pgf funding inflation rate +pgf_inflation_rate = "0.1" +# The pgf stewards inflation rate +stewards_inflation_rate = "0.01" +# The maximum number of pgf stewards +maximum_number_of_stewards = 5 + +# IBC parameters +[ibc_params] +# default mint limit of each token +default_mint_limit = "0" +# default per-epoch throughput limit of each token +default_per_epoch_throughput_limit = "0" diff --git a/genesis/hardware/src/pre-genesis/bond/bond-tx-albert.toml b/genesis/hardware/src/pre-genesis/bond/bond-tx-albert.toml new file mode 100644 index 0000000000..f1aaf70aef --- /dev/null +++ b/genesis/hardware/src/pre-genesis/bond/bond-tx-albert.toml @@ -0,0 +1,4 @@ +[[bond]] +source = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "20000" diff --git a/genesis/hardware/src/pre-genesis/established/established-account-tx-albert.toml b/genesis/hardware/src/pre-genesis/established/established-account-tx-albert.toml new file mode 100644 index 0000000000..3d7ed59c05 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/established/established-account-tx-albert.toml @@ -0,0 +1,4 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz"] diff --git a/genesis/hardware/src/pre-genesis/established/established-account-tx-bertha.toml b/genesis/hardware/src/pre-genesis/established/established-account-tx-bertha.toml new file mode 100644 index 0000000000..bc544c9c80 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/established/established-account-tx-bertha.toml @@ -0,0 +1,4 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrg6qx72e0vqhg8plg20hv97g3p3q092gl88jlngkly0hpmca2h2we44uzw"] diff --git a/genesis/hardware/src/pre-genesis/established/established-account-tx-christel.toml b/genesis/hardware/src/pre-genesis/established/established-account-tx-christel.toml new file mode 100644 index 0000000000..9d539dc979 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/established/established-account-tx-christel.toml @@ -0,0 +1,4 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qp7r3et2usz538fxzkm69h3awr7t0kgk7h6528za7pk4g2jldk5dz0qjkhx"] diff --git a/genesis/hardware/src/pre-genesis/established/established-account-tx-frank.toml b/genesis/hardware/src/pre-genesis/established/established-account-tx-frank.toml new file mode 100644 index 0000000000..cdb56e0666 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/established/established-account-tx-frank.toml @@ -0,0 +1,4 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] diff --git a/genesis/hardware/src/pre-genesis/signed-transactions.toml b/genesis/hardware/src/pre-genesis/signed-transactions.toml new file mode 100644 index 0000000000..d08893c91c --- /dev/null +++ b/genesis/hardware/src/pre-genesis/signed-transactions.toml @@ -0,0 +1,27 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz"] + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qp7r3et2usz538fxzkm69h3awr7t0kgk7h6528za7pk4g2jldk5dz0qjkhx"] + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrg6qx72e0vqhg8plg20hv97g3p3q092gl88jlngkly0hpmca2h2we44uzw"] + +[[bond]] +source = "tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "20000" + +[bond.signatures] +tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz = "signam1qzgqntx4tqsrlwn2g2lwwhkcvwkjpd768fup0yr9ctunrc6yj89h57uxgv74vn3y5unz55slmlkyj0td5nu8wjvf52el3azn95uk3xcfjmzcpl" diff --git a/genesis/hardware/src/pre-genesis/unsigned-transactions.toml b/genesis/hardware/src/pre-genesis/unsigned-transactions.toml new file mode 100644 index 0000000000..b906c6d7de --- /dev/null +++ b/genesis/hardware/src/pre-genesis/unsigned-transactions.toml @@ -0,0 +1,43 @@ +# This file contains hand-written unsigned transactions for localnet with: +# +# - 3 established accounts for "Albert", "Bertha" and "Christel" +# - a bond from "Albert"'s established account to validator-0 +# +# Note that 1 localnet user account "Daewon" is left as +# implicit account, so their tokens are kept in the accounts derived from their +# keys used in `balances.toml`. +# +# This file is used to produce `signed-transactions.toml` with +# the `sign-genesis-txs` command. + +# Albert +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz"] + +# Bertha +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrg6qx72e0vqhg8plg20hv97g3p3q092gl88jlngkly0hpmca2h2we44uzw"] + +# Christel +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qp7r3et2usz538fxzkm69h3awr7t0kgk7h6528za7pk4g2jldk5dz0qjkhx"] + +# Frank +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] + +########################################################################################## + +# Albert bonds to `validator-0` +[[bond]] +source = "tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "20000" diff --git a/genesis/hardware/src/pre-genesis/validator-0/signed-transactions.toml b/genesis/hardware/src/pre-genesis/validator-0/signed-transactions.toml new file mode 100644 index 0000000000..f1fa75a707 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/validator-0/signed-transactions.toml @@ -0,0 +1,45 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak"] + +[[validator_account]] +address = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +vp = "vp_user" +commission_rate = "0.05" +max_commission_rate_change = "0.01" +net_address = "127.0.0.1:27656" + +[validator_account.consensus_key] +pk = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg" +authorization = "signam1qqc8l8rvl5kx36sgnrqfzsyc5p6047c3xp5hqnhz8w7qmqzw5umqtglaejn6ekajm2jt98qhwlje38wdackknk4qrj9jycutmw2eevgvlv0uq6" + +[validator_account.protocol_key] +pk = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa" +authorization = "signam1qrgem8wds2eupup8a5wl8he9ftvx6a4elyt97322q483vh8j3fm0x330h0pfcpumpm2tqgz2chmw567mhxtqdlncggz8uc8u66svnsqw26ra2v" + +[validator_account.tendermint_node_key] +pk = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3" +authorization = "signam1qq05nmg0v5w9377235dpuk7k5k7kkjx5zyewqr4ecd0yyawz3ll2r7jxq9ss9wpnl69c9s0t9aqyuf7y6e7avh8m6d6nvyt5qnmaz5qyay596t" + +[validator_account.eth_hot_key] +pk = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx" +authorization = "signam1q86yxmjctxx7h59cl3tz8sf6j9r6wlxplv282fkm8yxyc8wvjkz4q8lhcavq8xa9jk3clnuxfpdg9hnp4t589ld3v2lv9tla3phucle7qysufnv4" + +[validator_account.eth_cold_key] +pk = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv" +authorization = "signam1qxxc4ulf7qlc0vdz477sgg3hms07vn3apkluxrq0erhchtw90yw9z2m6kmjcrgc8zks0fvwsmr88q0dxd3cs9zy7pz94wuum5urwu868qyzvqmr5" + +[validator_account.metadata] +email = "null@null.net" + +[validator_account.signatures] +tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak = "signam1qzg4cjyctnrnl8vpgp95tvjgwpcye3xfwchxq66de6wqn5ujwk6m69qd4n4mzx40ch48xtzhdhnq9m605pwm2v0gy422ehula4xt89cz39ngg0" + +[[bond]] +source = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "100000" + +[bond.signatures] +tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak = "signam1qzwn66j9dx49eyg72fd7s2cw5l2va3p9dj07te0egf93p6qatf95hk447ty6s6cds55ggtz8dcr65xqqz00a0wclqrhqcknk504a2ps9jqe6f7" diff --git a/genesis/hardware/src/pre-genesis/validator-0/unsigned-transactions.toml b/genesis/hardware/src/pre-genesis/validator-0/unsigned-transactions.toml new file mode 100644 index 0000000000..80e15d14b5 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/validator-0/unsigned-transactions.toml @@ -0,0 +1,24 @@ +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak"] + +[[validator_account]] +address = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +vp = "vp_user" +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" + +[validator_account.metadata] +email = "null@null.net" + +[[bond]] +source = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "100000" diff --git a/genesis/hardware/src/pre-genesis/validator-0/validator-wallet.toml b/genesis/hardware/src/pre-genesis/validator-0/validator-wallet.toml new file mode 100644 index 0000000000..d7ceb76fb9 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/validator-0/validator-wallet.toml @@ -0,0 +1,7 @@ +consensus_key = "unencrypted:0037a44681b64d42497e2229516479f83e5344a7a30e8316bde45881a1ec745359" +eth_cold_key = "unencrypted:010d34fcb42383f0babe7c86203f07bf4134f0756a630eb07923f21c90cc068602" +tendermint_node_key = "unencrypted:002f2e94bb5834e18433343345baf47b2b5d4e1ef4d46ba0f876d3d2c89d831419" + +[validator_keys] +protocol_keypair = "ED25519_SK_PREFIX00610677d4c52ab8ca5e8abe7dfb40246a271a03069fded6099763cbc41e04df02" +eth_bridge_keypair = "SECP256K1_SK_PREFIX01a81af251a711382d6b649a44b36ac5d4f41106f356e1f2fb33c001e91ffaa169" diff --git a/genesis/hardware/src/pre-genesis/wallet.toml b/genesis/hardware/src/pre-genesis/wallet.toml new file mode 100644 index 0000000000..1f36ffe432 --- /dev/null +++ b/genesis/hardware/src/pre-genesis/wallet.toml @@ -0,0 +1,53 @@ +[view_keys] + +[spend_keys] + +[payment_addrs] + +[secret_keys] +faucet-key = "unencrypted:00548aa8393422b88dce5f4be8ee0320638061c3e0649ada1b0dacbec4c0c75bb2" +frank-key = "unencrypted:00a08de8d33b9798328d2e4476fade49f515dc82754451fc6ef7060ea0bd1e8f1a" + +[public_keys] +albert-key = "ED25519_PK_PREFIXtpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz" +bertha-key = "ED25519_PK_PREFIXtpknam1qrg6qx72e0vqhg8plg20hv97g3p3q092gl88jlngkly0hpmca2h2we44uzw" +christel-key = "ED25519_PK_PREFIXtpknam1qp7r3et2usz538fxzkm69h3awr7t0kgk7h6528za7pk4g2jldk5dz0qjkhx" +daewon = "ED25519_PK_PREFIXtpknam1qzdgg0q7c2szvx67q84r859axuwmyvsku0t9w97kwdvz7ff89xy4xrqxfmv" +ester = "ED25519_PK_PREFIXtpknam1qplr7n6ej99zyvzvjy0w726p0809m6a279a02rn5zw0c52k8wdw8q5gfc8y" +faucet-key = "ED25519_PK_PREFIXtpknam1qzh2d8vk9wvj2j63fa3cvjru9uldpdjctjjxpafl5r8vwwf56pdgyq0vra4" +validator-0-account-key = "ED25519_PK_PREFIXtpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak" +frank-key = "ED25519_PK_PREFIXtpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79" + +[derivation_paths] +albert-key = "m/44'/877'/0'/0'/0'" +bertha-key = "m/44'/877'/0'/0'/1'" +christel-key = "m/44'/877'/0'/0'/2'" +daewon = "m/44'/877'/0'/0'/3'" +ester = "m/44'/877'/0'/0'/4'" +validator-0-account-key = "m/44'/877'/0'/0'/5'" + +[addresses] +albert = "tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e" +bertha = "tnam1qyvmxf6r5e9gjtq2pwsndgq77hmx4vw2rghnmt8v" +christel = "tnam1q8wemh6ws8vctdyg3dh9339qusttefzp0qw0qhvm" +albert-key = "tnam1qq6qyugak0gd4up6lma8z8wr88w3pq9lgvfhw6yu" +bertha-key = "tnam1qp7z909dsdv4qw5jcasywzm9p7xa3qeqqghcjqxe" +christel-key = "tnam1qq8kszasdp30f2j2pkhz40zpfvztdakwqvkm0xy4" +daewon = "tnam1qqnxq04amahj5yuwux7pdsjp3dyu07at3u3f742p" +ester = "tnam1qr2y927swt2ax66m9fgc9ejs40m7m77rry53cvkv" +faucet-key = "tnam1qzgcl2znamndmku7ujw6e79dmvd4v7rfd5c89dfz" +validator-0 = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +frank = "tnam1q9sx4ekzqaq3xdxtruxkm764nhl00cvcsc7df5jf" +frank-key = "tnam1qz0nvec686e9pks8ynhm5ddq8ke7j2eey50uagtr" + +[pkhs] +7C22BCAD8359503A92C760470B650F8DD8832002 = "bertha-key" +3402711DB3D0DAF03AFEFA711DC339DD1080BF43 = "albert-key" +26603EBDDF6F2A138EE1BC16C2418B49C7FBAB8F = "daewon" +918FA853EEE6DDDB9EE49DACF8ADDB1B5678696D = "faucet-key" +0F680BB06862F4AA4A0DAE2ABC414B04B6F6CE03 = "christel-key" +D442ABD072D5D36B5B2A5182E650ABF7EDFBC319 = "ester" +E9A42797AA7E25F01F0DA8FCD1B69C8C76627715 = "validator-0-account-key" +9F36671A3EB250DA0724EFBA35A03DB3E92B3925 = "frank-key" + +[address_vp_types] diff --git a/genesis/hardware/tokens.toml b/genesis/hardware/tokens.toml new file mode 100644 index 0000000000..3a851f7102 --- /dev/null +++ b/genesis/hardware/tokens.toml @@ -0,0 +1,64 @@ +# Token accounts with their validity predicates + +[token.NAM] +denom = 6 + +[token.NAM.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 + +[token.BTC] +denom = 8 + +[token.BTC.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 + +[token.ETH] +denom = 18 + +[token.ETH.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 + +[token.DOT] +denom = 10 + +[token.DOT.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 + +[token.Schnitzel] +denom = 6 + +[token.Schnitzel.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 + +[token.Apfel] +denom = 6 + +[token.Apfel.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 + +[token.Kartoffel] +denom = 6 + +[token.Kartoffel.masp_params] +max_reward_rate = "0.01" +kd_gain_nom = "0.25" +kp_gain_nom = "0.25" +locked_amount_target = 10000 diff --git a/genesis/hardware/transactions.toml b/genesis/hardware/transactions.toml new file mode 100644 index 0000000000..fbf8e5b1e9 --- /dev/null +++ b/genesis/hardware/transactions.toml @@ -0,0 +1,82 @@ +# Transactions pasted from: +# +# 1. `src/pre-genesis/validator-0/signed-transactions.toml` +# 2. `src/pre-genesis/signed-transactions.toml` + +# 1. + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak"] + +[[validator_account]] +address = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +vp = "vp_user" +commission_rate = "0.05" +max_commission_rate_change = "0.01" +net_address = "127.0.0.1:27656" + +[validator_account.consensus_key] +pk = "tpknam1qr9u5py97pdmcvnrxhzuuv79ydv5rw7r9z402sucwt6h0lvmmmwqy2wrweg" +authorization = "signam1qqc8l8rvl5kx36sgnrqfzsyc5p6047c3xp5hqnhz8w7qmqzw5umqtglaejn6ekajm2jt98qhwlje38wdackknk4qrj9jycutmw2eevgvlv0uq6" + +[validator_account.protocol_key] +pk = "tpknam1qrenhfdphzpszlr7fzand6qgmppge430g3a2lquqzhz64fkve5mq2hdfjaa" +authorization = "signam1qrgem8wds2eupup8a5wl8he9ftvx6a4elyt97322q483vh8j3fm0x330h0pfcpumpm2tqgz2chmw567mhxtqdlncggz8uc8u66svnsqw26ra2v" + +[validator_account.tendermint_node_key] +pk = "tpknam1qpgcgptcjl22hl2te2uqnp33aqjmvfaud3a3f3sgtxezg7uu5rsv6d2flr3" +authorization = "signam1qq05nmg0v5w9377235dpuk7k5k7kkjx5zyewqr4ecd0yyawz3ll2r7jxq9ss9wpnl69c9s0t9aqyuf7y6e7avh8m6d6nvyt5qnmaz5qyay596t" + +[validator_account.eth_hot_key] +pk = "tpknam1qypnh98mexms8edj8rcwu0cayx0459p39dwzsffxrr394mf4cse707qcctyrx" +authorization = "signam1q86yxmjctxx7h59cl3tz8sf6j9r6wlxplv282fkm8yxyc8wvjkz4q8lhcavq8xa9jk3clnuxfpdg9hnp4t589ld3v2lv9tla3phucle7qysufnv4" + +[validator_account.eth_cold_key] +pk = "tpknam1qypz8zr0w8lsz3s98vh4p974xuxeedpecj9s2l3326r3kdz4tc0snrcpnc8yv" +authorization = "signam1qxxc4ulf7qlc0vdz477sgg3hms07vn3apkluxrq0erhchtw90yw9z2m6kmjcrgc8zks0fvwsmr88q0dxd3cs9zy7pz94wuum5urwu868qyzvqmr5" + +[validator_account.metadata] +email = "null@null.net" + +[validator_account.signatures] +tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak = "signam1qzg4cjyctnrnl8vpgp95tvjgwpcye3xfwchxq66de6wqn5ujwk6m69qd4n4mzx40ch48xtzhdhnq9m605pwm2v0gy422ehula4xt89cz39ngg0" + +[[bond]] +source = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "100000" + +[bond.signatures] +tpknam1qrulnacf6l6lt2vlpc8y2yudlgzs9hzrfa9p66fv4p7vk8utf6m4554t3ak = "signam1qzwn66j9dx49eyg72fd7s2cw5l2va3p9dj07te0egf93p6qatf95hk447ty6s6cds55ggtz8dcr65xqqz00a0wclqrhqcknk504a2ps9jqe6f7" + +# 2. + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qqwfpuvn8x7yqtquejhppef4vddv9ghusec2rkaxav38amamxaxpgj9cs79"] + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz"] + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qp7r3et2usz538fxzkm69h3awr7t0kgk7h6528za7pk4g2jldk5dz0qjkhx"] + +[[established_account]] +vp = "vp_user" +threshold = 1 +public_keys = ["tpknam1qrg6qx72e0vqhg8plg20hv97g3p3q092gl88jlngkly0hpmca2h2we44uzw"] + +[[bond]] +source = "tnam1qye83lg3ncsen8wjedgz27rxjktn0gcrc574p78e" +validator = "tnam1q9q3lph40w88cs5000k48thkw3f7s0m6mqrtfgss" +amount = "20000" + +[bond.signatures] +tpknam1qquurf975axryz4sf0jmyxpknkxp4cs7g8e8ahhpw089u6j3q9dy6qssdhz = "signam1qzgqntx4tqsrlwn2g2lwwhkcvwkjpd768fup0yr9ctunrc6yj89h57uxgv74vn3y5unz55slmlkyj0td5nu8wjvf52el3azn95uk3xcfjmzcpl" diff --git a/genesis/hardware/validity-predicates.toml b/genesis/hardware/validity-predicates.toml new file mode 100644 index 0000000000..0216abe982 --- /dev/null +++ b/genesis/hardware/validity-predicates.toml @@ -0,0 +1,10 @@ +# WASM Validity predicate that can be used for genesis accounts + +# Implicit VP +[wasm.vp_implicit] +filename = "vp_implicit.wasm" + +# Default user VP in established accounts +[wasm.vp_user] +filename = "vp_user.wasm" + diff --git a/wasm/checksums.json b/wasm/checksums.json index 214edb98fb..e2c4dd2c74 100644 --- a/wasm/checksums.json +++ b/wasm/checksums.json @@ -1,26 +1,26 @@ { - "tx_become_validator.wasm": "tx_become_validator.7e050a410cd63c3dbcd909670ec94ce8c85d902446614e107bfaaf2cd8884f21.wasm", - "tx_bond.wasm": "tx_bond.76f633853c23ae641cfb391e55b2497b0f8e415b099d497a69aa4a5a8da3aefa.wasm", - "tx_bridge_pool.wasm": "tx_bridge_pool.094cc9f7b26e3f80d4c27ad80ea9f044b5276272d088bcfb00346381c4513fd4.wasm", - "tx_change_consensus_key.wasm": "tx_change_consensus_key.017e40783051971094da8416e2c7f470f1d3074276f78639a679682255d3e454.wasm", - "tx_change_validator_commission.wasm": "tx_change_validator_commission.ed8f2a4f3bde50a2554f0dc46dd002611d30de0ea1f42dd501242a0fcbb6834f.wasm", - "tx_change_validator_metadata.wasm": "tx_change_validator_metadata.9d5c62746062862fee478955e9f466b2cf382b4e1749a9841dad6a616588d909.wasm", - "tx_claim_rewards.wasm": "tx_claim_rewards.6935d856662d0dead13ce8cadc540582755aa84a95b0e0842548e0d122da84ff.wasm", - "tx_deactivate_validator.wasm": "tx_deactivate_validator.fb24ce20403ea01b6c05ab8ebc08824862dec3b1b411de806b057ded949216f3.wasm", - "tx_ibc.wasm": "tx_ibc.74015ec20700282700775f5df576db36b6b7f65c4819da21a900a9a4e817ba33.wasm", - "tx_init_account.wasm": "tx_init_account.b09f6d1b3ec4275e1bfcdfea9a4d6811f21cd831192c2eb591b9058d9e8fabcf.wasm", - "tx_init_proposal.wasm": "tx_init_proposal.ade6cdaf5ca51afd31a878ae2d03be4cdfbd4b9b0f293cc5b2f7d44baf7b01f0.wasm", - "tx_reactivate_validator.wasm": "tx_reactivate_validator.5128cf4ee042c77e778489dfd3930974725077d0bfa638f7f8104ce5f9f98c3d.wasm", - "tx_redelegate.wasm": "tx_redelegate.65fd98f1b94f07c1469b76a72c4175fad1caaa72a7ef9d9b55df33d10a33f52e.wasm", - "tx_resign_steward.wasm": "tx_resign_steward.709185532cd801be422cf129a7657c43619cff0b4d441ad0ba40166f333b358c.wasm", - "tx_reveal_pk.wasm": "tx_reveal_pk.0aa78ff0e901c2c4d9d407dd9769b5e6a48ce12c29332d3113f1b10e9bf32673.wasm", - "tx_transfer.wasm": "tx_transfer.362c30269da7f4497eb1a7c094c75e0aa7c578d9f0eaf3979aeaaffda105ef1e.wasm", - "tx_unbond.wasm": "tx_unbond.1805394203f416f59f9ac958bcd2ee92196234bfe4580e71fa8f751fd0ab32a1.wasm", - "tx_unjail_validator.wasm": "tx_unjail_validator.65ad976d32046edc3d84d3b2bcb336062a753eee1427eda9db46d6641f2392bb.wasm", - "tx_update_account.wasm": "tx_update_account.9b4925aedf019da5e437aa5112730071c2e22e583a9473341ade8c44e19c15ff.wasm", - "tx_update_steward_commission.wasm": "tx_update_steward_commission.01c368cec0ec50e4b4a082bbf6b95e1be6059583b299c5536e01c9f709cf6ba5.wasm", - "tx_vote_proposal.wasm": "tx_vote_proposal.ae5ddd5a72fb24381dd41a70495ade61f0ab1967fdd73c98ab42bfd56e7a1e46.wasm", - "tx_withdraw.wasm": "tx_withdraw.420e1925aa35e7aadbaeff056179b82f57da1507fe65892ac621ba687d08d1ce.wasm", - "vp_implicit.wasm": "vp_implicit.1bd524107d97584f7304e41648bd4c6ba3e2404606b32e9e40784323ff34230f.wasm", - "vp_user.wasm": "vp_user.45e467b2f23f65a1ce3b658e15667f4e792f7433eb26e288aa6548031061106e.wasm" + "tx_become_validator.wasm": "tx_become_validator.d569a05881708c96425ac9c9417c5e88e1a68087faf6b5732f28d3c64dbcfe21.wasm", + "tx_bond.wasm": "tx_bond.7e0682c551312234f2ac18c332ef897e7279378e3e971f2adc76c7e62a2ccc26.wasm", + "tx_bridge_pool.wasm": "tx_bridge_pool.d51b4d6ac83f994d3d416980fafcfcc75794c9d2faa4ef28d74ac87dc22d2360.wasm", + "tx_change_consensus_key.wasm": "tx_change_consensus_key.13b6dad977d14f0def504691865395523cbc4c7e739df88eb0b51363f147810c.wasm", + "tx_change_validator_commission.wasm": "tx_change_validator_commission.7081cf9debef3d8768b770a97f70837b84b4e66ced5da95666cbc67bdd416c44.wasm", + "tx_change_validator_metadata.wasm": "tx_change_validator_metadata.e586419bf454e6a70934d1e5883dbdbb62d28babb49da95d0e875aaed3456748.wasm", + "tx_claim_rewards.wasm": "tx_claim_rewards.1a2dca54ea6d8074cee7fd281f8b45e12b28457d4b367b917da366577abed074.wasm", + "tx_deactivate_validator.wasm": "tx_deactivate_validator.d15295fd37c9ab1c9a4f464b2132cd41ff4f4f42362e7fb88031c62988be3e59.wasm", + "tx_ibc.wasm": "tx_ibc.7e6d443616c7711fc66adf85cc76f37b973cab3378a73b7da5faf73d0c3a12b6.wasm", + "tx_init_account.wasm": "tx_init_account.2e2b67c73848b647e73d3d7cde19cf00af851a1e0625777c585bd65ce33c9ae9.wasm", + "tx_init_proposal.wasm": "tx_init_proposal.eae9a906c1b6ebbbcedd0ffffce35b057e1bb2fbf66f474bec531c5baac1b298.wasm", + "tx_reactivate_validator.wasm": "tx_reactivate_validator.5de08115ac8876b4f0268228219b4c6baa6dc7777154c40a7543c62d38855903.wasm", + "tx_redelegate.wasm": "tx_redelegate.b605c6745edf3b7a2864e5edf65cbb40bf87c872b3e22ae98e964618059562cf.wasm", + "tx_resign_steward.wasm": "tx_resign_steward.de90c2f6db79543403e2dea2579e4a01f217c191dffec6a542ee02b6c7cbd28a.wasm", + "tx_reveal_pk.wasm": "tx_reveal_pk.cae15193baad19bee09604c0d77de04ce528a1f4bea1f613dd7ab43b47faed44.wasm", + "tx_transfer.wasm": "tx_transfer.8b6255cca6afd87b6d45d17fb57a8cae37d274290633dc7adc8ed4b0b51513e0.wasm", + "tx_unbond.wasm": "tx_unbond.d25d812e51b9d1407b5f4a6da300dd6ef53bec7de2ff57ea41437b2eb8c8c40e.wasm", + "tx_unjail_validator.wasm": "tx_unjail_validator.d5e52f554184b19db7d9da414893449b0d3b402bc1f7ebb423d913be4c1d780c.wasm", + "tx_update_account.wasm": "tx_update_account.9b672d756d6cda79fded73f79867befff8d8e366781d2a1970130e2b83249230.wasm", + "tx_update_steward_commission.wasm": "tx_update_steward_commission.e2a0240ab19b78574230dacd2172e68fa03fd246f02c57c33d0074692c1bd44d.wasm", + "tx_vote_proposal.wasm": "tx_vote_proposal.e05f791fc421f416b8fcb813b6d5d4e01ea7b21ae2fa6564ef3dc66fdda9f4a2.wasm", + "tx_withdraw.wasm": "tx_withdraw.10d059e7d834f423943ac339ad3d226ffeee1fd83134a4a2be57b9eceb9d3768.wasm", + "vp_implicit.wasm": "vp_implicit.d0ae30bd4a0cdbb23584e5013828caf439fb9da881cfa83ca5b906e45b13e250.wasm", + "vp_user.wasm": "vp_user.3ca2a7038991c4d491acc71ca99519e07820fb0f456237c5789c3f6b95d06e79.wasm" } \ No newline at end of file