Skip to content

Commit

Permalink
fixing random
Browse files Browse the repository at this point in the history
  • Loading branch information
dzmitry-lahoda committed Apr 19, 2024
1 parent 5ac4593 commit adaba4e
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 23 deletions.
42 changes: 22 additions & 20 deletions mantis/node/src/bin/mantis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -141,26 +141,28 @@ async fn simulate_orders(simulate_args: &SimulateArgs) {
let tip =
get_latest_block_and_account_by_key(&args.rpc_centauri, &args.grpc_centauri, &signer).await;

let pair = simulate_args
.coins
.choose(&mut rand::thread_rng())
.expect("some");
let rpc = CosmosChainInfo {
rpc: args.rpc_centauri.clone(),
chain_id: args.main_chain_id.clone(),
};
simulate::simulate_order(
&mut write_client,
&mut cosmos_query_client,
args.order_contract.clone(),
pair,
&signer,
&rpc,
&tip,
gas,
simulate_args.random_parts,
)
.await;
assert!(simulate_args.coins.len() > 0);
let mut coinpairs = simulate_args.coins.clone();
coinpairs.shuffle(&mut rand::thread_rng());

for coin_pair in coinpairs {
let rpc = CosmosChainInfo {
rpc: args.rpc_centauri.clone(),
chain_id: args.main_chain_id.clone(),
};
simulate::simulate_order(
&mut write_client,
&mut cosmos_query_client,
args.order_contract.clone(),
&coin_pair,
&signer,
&rpc,
&tip,
gas,
simulate_args.random_parts,
)
.await;
}
}

enum CoinToss {}
Expand Down
4 changes: 2 additions & 2 deletions mantis/node/src/mantis/cosmos/client.rs
Original file line number Diff line number Diff line change
Expand Up @@ -139,7 +139,7 @@ pub async fn sign_and_tx_tendermint(
.broadcast_commit(&rpc_client)
.await
.expect("broadcasted");
println!("result: {:?}", result);
log::error!("result: {:?}", result);
assert!(!result.check_tx.code.is_err(), "err");
assert!(!result.tx_result.code.is_err(), "err");
result
Expand All @@ -166,7 +166,7 @@ pub async fn tx_broadcast_single_signed_msg(
&chain::Id::try_from(rpc.chain_id.as_ref()).expect("chain_id"),
tip.account.account_number,
)
.unwrap();
.expect("sign works");

sign_and_tx_tendermint(&rpc.rpc, sign_doc, signing_key).await
}
Expand Down
2 changes: 1 addition & 1 deletion mantis/node/src/mantis/simulate.rs
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ pub async fn simulate_order(
log::info!("========================= simulate_order =========================");
let (msg, fund) = randomize_order(&coins_pair, tip.block, random_parts);

println!("msg: {:?}", msg);
log::info!("msg: {:?}", msg);

let auth_info = simulate_and_set_fee(signing_key, &tip.account, gas).await;

Expand Down

0 comments on commit adaba4e

Please sign in to comment.