diff --git a/Cargo.lock b/Cargo.lock index 43038f6..6b91d00 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3700,7 +3700,7 @@ dependencies = [ [[package]] name = "namada_account" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "namada_core", @@ -3712,7 +3712,7 @@ dependencies = [ [[package]] name = "namada_controller" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "namada_core", "smooth-operator", @@ -3722,7 +3722,7 @@ dependencies = [ [[package]] name = "namada_core" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "bech32 0.8.1", "borsh", @@ -3733,7 +3733,6 @@ dependencies = [ "ethabi", "ethbridge-structs", "eyre", - "futures", "ibc", "ics23", "impl-num-traits", @@ -3772,7 +3771,7 @@ dependencies = [ [[package]] name = "namada_ethereum_bridge" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "ethers", @@ -3800,7 +3799,7 @@ dependencies = [ [[package]] name = "namada_events" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "namada_core", @@ -3814,7 +3813,7 @@ dependencies = [ [[package]] name = "namada_gas" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "namada_core", @@ -3827,7 +3826,7 @@ dependencies = [ [[package]] name = "namada_governance" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "itertools 0.12.1", @@ -3850,7 +3849,7 @@ dependencies = [ [[package]] name = "namada_ibc" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "data-encoding", @@ -3864,7 +3863,6 @@ dependencies = [ "namada_gas", "namada_macros", "namada_state", - "namada_storage", "namada_systems", "namada_tx", "namada_vp", @@ -3881,7 +3879,7 @@ dependencies = [ [[package]] name = "namada_macros" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "data-encoding", "proc-macro2", @@ -3893,7 +3891,7 @@ dependencies = [ [[package]] name = "namada_merkle_tree" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "eyre", @@ -3908,12 +3906,11 @@ dependencies = [ [[package]] name = "namada_parameters" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "namada_core", "namada_macros", "namada_state", - "namada_storage", "namada_systems", "namada_tx", "namada_vp", @@ -3924,7 +3921,7 @@ dependencies = [ [[package]] name = "namada_proof_of_stake" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "itertools 0.12.1", @@ -3935,7 +3932,6 @@ dependencies = [ "namada_events", "namada_macros", "namada_state", - "namada_storage", "namada_systems", "namada_tx", "namada_vp", @@ -3949,7 +3945,7 @@ dependencies = [ [[package]] name = "namada_replay_protection" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "namada_core", ] @@ -3957,7 +3953,7 @@ dependencies = [ [[package]] name = "namada_sdk" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "async-trait", "bimap", @@ -4031,7 +4027,7 @@ dependencies = [ [[package]] name = "namada_shielded_token" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "lazy_static", @@ -4042,7 +4038,6 @@ dependencies = [ "namada_core", "namada_gas", "namada_state", - "namada_storage", "namada_systems", "namada_tx", "namada_vp", @@ -4058,7 +4053,7 @@ dependencies = [ [[package]] name = "namada_state" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "clru", @@ -4081,7 +4076,7 @@ dependencies = [ [[package]] name = "namada_storage" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "itertools 0.12.1", @@ -4099,7 +4094,7 @@ dependencies = [ [[package]] name = "namada_systems" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "namada_core", "namada_storage", @@ -4108,14 +4103,13 @@ dependencies = [ [[package]] name = "namada_token" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "namada_core", "namada_events", "namada_macros", "namada_shielded_token", - "namada_storage", "namada_systems", "namada_trans_token", "serde", @@ -4124,13 +4118,12 @@ dependencies = [ [[package]] name = "namada_trans_token" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "konst", "namada_core", "namada_events", "namada_state", - "namada_storage", "namada_systems", "namada_tx", "namada_vp", @@ -4141,7 +4134,7 @@ dependencies = [ [[package]] name = "namada_tx" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "ark-bls12-381", "bitflags 2.6.0", @@ -4150,6 +4143,7 @@ dependencies = [ "either", "konst", "masp_primitives", + "namada_account", "namada_core", "namada_events", "namada_gas", @@ -4169,10 +4163,11 @@ dependencies = [ [[package]] name = "namada_vm" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "clru", + "namada_account", "namada_core", "namada_events", "namada_gas", @@ -4190,7 +4185,7 @@ dependencies = [ [[package]] name = "namada_vote_ext" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "borsh", "namada_core", @@ -4202,7 +4197,7 @@ dependencies = [ [[package]] name = "namada_vp" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "namada_core", "namada_events", @@ -4218,7 +4213,7 @@ dependencies = [ [[package]] name = "namada_vp_env" version = "0.43.0" -source = "git+https://github.com/anoma/namada?tag=v0.43.0#f5c3b708018c38bb8768da57ce3199a208ff9e12" +source = "git+https://github.com/anoma/namada?branch=fraccaman/query-active-validators#a20ac2e6067c51becc7f91c30b9e61ea087ca904" dependencies = [ "derivative", "masp_primitives", diff --git a/Cargo.toml b/Cargo.toml index d9d8174..c75e3cc 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -9,7 +9,7 @@ edition = "2021" clap = { version = "4.4.2", features = ["derive", "env"] } rand = {version = "0.8", default-features = false} rand_core = {version = "0.6", default-features = false} -namada_sdk = { git = "https://github.com/anoma/namada", tag = "v0.43.0", default-features = false, features = ["std", "async-send", "download-params"] } +namada_sdk = { git = "https://github.com/anoma/namada", branch = "fraccaman/query-active-validators", default-features = false, features = ["std", "async-send", "download-params"] } tendermint-config = "0.37.0" tendermint-rpc = { version = "0.37.0", features = ["http-client"]} tokio = {version = "1.8.2", default-features = false} diff --git a/local_run.sh b/local_run.sh index 08f0dc1..2e814df 100755 --- a/local_run.sh +++ b/local_run.sh @@ -7,4 +7,4 @@ RPC=${3} OUTPUT=$(cargo run --bin scenario-generator -- --steps 200) SCENARIO_NAME="$(cut -d' ' -f2 <<<"$OUTPUT")" echo "Using scenario $SCENARIO_NAME" -RUST_BACKTRACE=full cargo run --bin scenario-tester --release -- --rpc ${RPC} --chain-id $CHAIN_ID --faucet-sk ${SK} --scenario scenarios/$SCENARIO_NAME.json --workers 1 --avoid-check +RUST_BACKTRACE=full cargo run --bin scenario-tester --release -- --rpc ${RPC} --chain-id $CHAIN_ID --faucet-sk ${SK} --scenario scenarios/$SCENARIO_NAME.json --workers 1 diff --git a/src/gen/main.rs b/src/gen/main.rs index f5fbbe1..b1771bb 100644 --- a/src/gen/main.rs +++ b/src/gen/main.rs @@ -22,10 +22,44 @@ pub mod utils; #[derive(Parser, Debug)] #[command(version, about, long_about = None)] struct Args { - #[arg(short, long)] + #[arg(long)] steps: u64, - #[arg(short, long, default_value_t = 1)] + #[arg(long, default_value_t = 1)] total: u64, + #[arg(long, default_value_t = 5)] + transparent_transfers: u64, + #[arg(long, default_value_t = 3)] + shielding_transfer: u64, + #[arg(long, default_value_t = 3)] + unshielding_transfer: u64, + #[arg(long, default_value_t = 3)] + init_account: u64, + #[arg(long, default_value_t = 4)] + bond: u64, + #[arg(long, default_value_t = 4)] + unbond: u64, + #[arg(long, default_value_t = 1)] + withdraw: u64, + #[arg(long, default_value_t = 10)] + vote_proposal: u64, + #[arg(long, default_value_t = 4)] + redelegate: u64, + #[arg(long, default_value_t = 15)] + init_default_proposal: u64, + #[arg(long, default_value_t = 15)] + init_pgf_steward_proposal: u64, + #[arg(long, default_value_t = 15)] + init_pgf_funding_proposal: u64, + #[arg(long, default_value_t = 2)] + become_validator: u64, + #[arg(long, default_value_t = 3)] + update_account: u64, + #[arg(long, default_value_t = 1)] + deactivate_validator: u64, + #[arg(long, default_value_t = 2)] + change_metadata: u64, + #[arg(long, default_value_t = 4)] + claim_rewards: u64, } fn main() { @@ -34,31 +68,30 @@ fn main() { // TODO: // change commission // activate validator - // update steward commission // TODO: // randomize tx settings let tasks: HashMap = HashMap::from_iter([ - (TaskType::NewWalletKey, 1.into()), + (TaskType::NewWalletKey, 2.into()), (TaskType::FaucetTransafer, 2.into()), - (TaskType::TransparentTransfer, 3.into()), - // (TaskType::ShieldingTransfer, 6.into()), - // (TaskType::UnshieldingTransfer, 6.into()), - (TaskType::InitAccount, 4.into()), - // (TaskType::Bond, 5.into()), - // (TaskType::InitDefaultProposal, 6.into()), - // (TaskType::Unbond, 4.into()), - // (TaskType::Withdraw, 4.into()), - // (TaskType::VoteProposal, 3.into()), - // (TaskType::Redelegate, 4.into()), - // (TaskType::InitPgfStewardProposal, 5.into()), - // (TaskType::InitPgfFundingProposal, 4.into()), - // (TaskType::BecomeValidator, 5.into()), - (TaskType::UpdateAccount, 5.into()), - // (TaskType::DeactivateValidator, 5.into()), - // (TaskType::ChangeMetadata, 4.into()), - // (TaskType::ClaimRewards, 5.into()), + (TaskType::TransparentTransfer, args.transparent_transfers.into()), + (TaskType::ShieldingTransfer, args.shielding_transfer.into()), + (TaskType::UnshieldingTransfer, args.unshielding_transfer.into()), + (TaskType::InitAccount, args.init_account.into()), + (TaskType::Bond, args.bond.into()), + (TaskType::InitDefaultProposal, args.init_default_proposal.into()), + (TaskType::Unbond, args.unbond.into()), + (TaskType::Withdraw, args.withdraw.into()), + (TaskType::VoteProposal, args.vote_proposal.into()), + (TaskType::Redelegate, args.redelegate.into()), + (TaskType::InitPgfStewardProposal, args.init_pgf_steward_proposal.into()), + (TaskType::InitPgfFundingProposal, args.init_pgf_funding_proposal.into()), + (TaskType::BecomeValidator, args.become_validator.into()), + (TaskType::UpdateAccount, args.update_account.into()), + (TaskType::DeactivateValidator, args.deactivate_validator.into()), + (TaskType::ChangeMetadata, args.change_metadata.into()), + (TaskType::ClaimRewards, args.claim_rewards.into()), ]); let mut scenario_builder = ScenarioBuilder::new( diff --git a/src/queries/validators.rs b/src/queries/validators.rs index 9625a74..af0e8c0 100644 --- a/src/queries/validators.rs +++ b/src/queries/validators.rs @@ -49,7 +49,7 @@ impl Query for ValidatorsQuery { None => rpc::query_epoch(sdk.namada.client()).await.unwrap(), }; - let validators: BTreeSet<_> = rpc::get_all_validators(sdk.namada.client(), current_epoch) + let validators: BTreeSet<_> = rpc::get_all_consensus_validators(sdk.namada.client(), current_epoch) .await .unwrap_or_default() .into_iter() @@ -62,9 +62,9 @@ impl Query for ValidatorsQuery { validators.len().to_string(), ); - for (index, address) in validators.into_iter().enumerate() { + for (index, validator) in validators.into_iter().enumerate() { let (validator_state, _) = - rpc::get_validator_state(sdk.namada.client(), &address, None) + rpc::get_validator_state(sdk.namada.client(), &validator.address, None) .await .unwrap(); @@ -78,7 +78,7 @@ impl Query for ValidatorsQuery { ); storage.add( ValidatorsQueryStorageKeys::Validator(index as u64).to_string(), - address.to_string(), + validator.address.to_string(), ); } diff --git a/src/tasks/mod.rs b/src/tasks/mod.rs index 8923fe1..c4c1a25 100644 --- a/src/tasks/mod.rs +++ b/src/tasks/mod.rs @@ -2,7 +2,7 @@ use async_trait::async_trait; use namada_sdk::{ args::{SdkTypes, TxBuilder}, rpc::{self}, - state::{Epoch, LastBlock}, + state::Epoch, tx::{data::GasLimit, either, ProcessTxResponse, Tx}, Namada, }; diff --git a/src/tasks/tx_shielded_transfer.rs b/src/tasks/tx_shielded_transfer.rs index 1bbea0c..e08d489 100644 --- a/src/tasks/tx_shielded_transfer.rs +++ b/src/tasks/tx_shielded_transfer.rs @@ -77,7 +77,7 @@ impl Task for TxShieldedTransfer { let transfer_tx_builder = sdk .namada - .new_shielded_transfer(vec![tx_transfer_data], vec![]); + .new_shielded_transfer(vec![tx_transfer_data], vec![], false); let mut transfer_tx_builder = self.add_settings(sdk, transfer_tx_builder, settings).await; diff --git a/src/tasks/tx_unshielding_transfer.rs b/src/tasks/tx_unshielding_transfer.rs index 5a9ae95..14a6665 100644 --- a/src/tasks/tx_unshielding_transfer.rs +++ b/src/tasks/tx_unshielding_transfer.rs @@ -80,8 +80,8 @@ impl Task for TxUnshieldingTransfer { settings: TxSettings, _state: &Storage, ) -> Result { - let source_address = parameters.target.to_spending_key(sdk).await; - let target_address = parameters.source.to_namada_address(sdk).await; + let source_address = parameters.source.to_spending_key(sdk).await; + let target_address = parameters.target.to_namada_address(sdk).await; let token_address = parameters.token.to_namada_address(sdk).await; let token_amount = token::Amount::from_u64(parameters.amount); @@ -95,7 +95,7 @@ impl Task for TxUnshieldingTransfer { let mut transfer_tx_builder = UnshieldingTransferBuilder( sdk.namada - .new_unshielding_transfer(source_address, vec![tx_transfer_data], vec![]), + .new_unshielding_transfer(source_address, vec![tx_transfer_data], vec![], false), ); transfer_tx_builder.0.tx.signing_keys = vec![