Skip to content

Commit fa649e2

Browse files
committed
Update loadtest for running with chain params
Signed-off-by: Danil <deniallugo@gmail.com>
1 parent 053ea0f commit fa649e2

File tree

2 files changed

+56
-0
lines changed

2 files changed

+56
-0
lines changed
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
use anyhow::Context;
2+
use common::{cmd::Cmd, config::global_config, logger};
3+
use config::EcosystemConfig;
4+
use xshell::{cmd, Shell};
5+
6+
use crate::messages::MSG_CHAIN_NOT_FOUND_ERR;
7+
8+
pub fn run(shell: &Shell) -> anyhow::Result<()> {
9+
let ecosystem_config = EcosystemConfig::from_file(shell)?;
10+
11+
let chain_config = ecosystem_config
12+
.load_chain(global_config().chain_name.clone())
13+
.context(MSG_CHAIN_NOT_FOUND_ERR)?;
14+
15+
let general_api = chain_config
16+
.get_general_config()?
17+
.api_config
18+
.context("API config is not found")?;
19+
20+
let mut command = cmd!(shell, "cargo run --release --bin loadnext")
21+
.env(
22+
"L2_CHAIN_ID",
23+
chain_config
24+
.get_genesis_config()?
25+
.l2_chain_id
26+
.as_u64()
27+
.to_string(),
28+
)
29+
.env(
30+
"MAIN_TOKEN",
31+
format!(
32+
"{:?}",
33+
ecosystem_config
34+
.get_erc20_tokens()
35+
.first()
36+
.context("NO Erc20 tokens were deployed")?
37+
.address
38+
),
39+
)
40+
.env("L2_RPC_ADDRESS", general_api.web3_json_rpc.http_url)
41+
.env("L2_WS_RPC_ADDRESS", general_api.web3_json_rpc.ws_url);
42+
43+
if global_config().verbose {
44+
command = command.env("RUST_LOG", "loadnext=debug")
45+
}
46+
47+
Cmd::new(command).with_force_run().run()?;
48+
49+
logger::outro("Loadtest success");
50+
51+
Ok(())
52+
}

zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ mod args;
1515
mod build;
1616
mod integration;
1717
mod l1_contracts;
18+
mod loadtest;
1819
mod prover;
1920
mod recovery;
2021
mod revert;
@@ -43,6 +44,8 @@ pub enum TestCommands {
4344
Prover,
4445
#[clap(about = MSG_TEST_WALLETS_INFO)]
4546
Wallet,
47+
#[clap(about = MSG_TEST_WALLETS_INFO)]
48+
Loadtest,
4649
}
4750

4851
pub async fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> {
@@ -56,5 +59,6 @@ pub async fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> {
5659
TestCommands::L1Contracts => l1_contracts::run(shell),
5760
TestCommands::Prover => prover::run(shell),
5861
TestCommands::Wallet => wallet::run(shell),
62+
TestCommands::Loadtest => loadtest::run(shell),
5963
}
6064
}

0 commit comments

Comments
 (0)