Skip to content

Commit

Permalink
improve validator query, fix unshielding-tx
Browse files Browse the repository at this point in the history
  • Loading branch information
Fraccaman committed Aug 30, 2024
1 parent 4159bf2 commit 8da5435
Show file tree
Hide file tree
Showing 8 changed files with 92 additions and 64 deletions.
59 changes: 27 additions & 32 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -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}
Expand Down
2 changes: 1 addition & 1 deletion local_run.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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
75 changes: 54 additions & 21 deletions src/gen/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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() {
Expand All @@ -34,31 +68,30 @@ fn main() {
// TODO:
// change commission
// activate validator
// update steward commission

// TODO:
// randomize tx settings

let tasks: HashMap<TaskType, Weight> = 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(
Expand Down
Loading

0 comments on commit 8da5435

Please sign in to comment.