Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(zk_toolbox): add fees integration test to toolbox #2898

Merged
merged 56 commits into from
Sep 30, 2024
Merged
Show file tree
Hide file tree
Changes from 14 commits
Commits
Show all changes
56 commits
Select commit Hold shift + click to select a range
51381cf
feat: add fees integration test to toolbox
manuelmauro Sep 17, 2024
19b0976
ci: add CI step for fees integration test
manuelmauro Sep 17, 2024
533655b
Merge branch 'main' into manuel-add-ts-integration-fees-test-to-toolbox
manuelmauro Sep 17, 2024
4f586d5
ci: add CI step for fees integration test
manuelmauro Sep 17, 2024
0d01aa6
refactor: use a single constant for TS_INTEGRATION_PATH
manuelmauro Sep 17, 2024
f934384
style: lint
manuelmauro Sep 17, 2024
3028221
refactor: simplify code
manuelmauro Sep 17, 2024
ff58c82
Merge branch 'main' into manuel-add-ts-integration-fees-test-to-toolbox
manuelmauro Sep 17, 2024
4379a32
fix: restore contracts
manuelmauro Sep 17, 2024
732ab9d
feat: test fees on all chains
manuelmauro Sep 17, 2024
5b816e1
refactor: remove unused arg
manuelmauro Sep 18, 2024
c364c8e
ci: parallelize fees testing
manuelmauro Sep 18, 2024
c67a0f1
style: remove unused import
manuelmauro Sep 18, 2024
aeb9c50
fix: wrong args type
manuelmauro Sep 18, 2024
9b363d6
feat: add FEES_LOGS_DIR to GITHUB_ENV
manuelmauro Sep 18, 2024
8c87f51
fix: truly run fees testing
manuelmauro Sep 18, 2024
b270415
revert: temporarily revert to sequential fees testing
manuelmauro Sep 18, 2024
0b29ee4
fix: try to re-run servers before fees testing
manuelmauro Sep 18, 2024
2860b8f
revert: do not re-run servers
manuelmauro Sep 19, 2024
ebbe4c1
style: remove optional double dash
manuelmauro Sep 19, 2024
66c4f5f
refactor: use managed start/kill node
manuelmauro Sep 19, 2024
ffda3f7
style: format
manuelmauro Sep 19, 2024
6b7233b
fix: update config on the fly
manuelmauro Sep 20, 2024
7ab0b1c
feat: add L2 node PID to TestEnvironment
manuelmauro Sep 20, 2024
7f62481
fix: set right properties on the fly
manuelmauro Sep 20, 2024
539517b
style: lint
manuelmauro Sep 20, 2024
eacd4de
fix: kill server before running fees.test.ts
manuelmauro Sep 20, 2024
b36f2d1
fix: logs folder
manuelmauro Sep 20, 2024
72d92ce
Merge branch 'main' into manuel-add-ts-integration-fees-test-to-toolbox
manuelmauro Sep 20, 2024
e3e33ff
test: temporarily run fees tests only on era chain
manuelmauro Sep 20, 2024
7e3889b
style: use const case for env variable in CI
manuelmauro Sep 20, 2024
87a3d26
style: format code
manuelmauro Sep 20, 2024
1699dd4
fix: bring forward server start
manuelmauro Sep 20, 2024
2ffcd92
style: format
manuelmauro Sep 20, 2024
5ba3f36
fix: read test environment before killing the node
manuelmauro Sep 20, 2024
a12bf21
fix: fix operations in beforeAll step
manuelmauro Sep 20, 2024
285289d
Revert "style: format code"
manuelmauro Sep 20, 2024
fb75f04
fix: remove extra node restart
manuelmauro Sep 20, 2024
a936b04
refactor: remove unused code from tester
manuelmauro Sep 20, 2024
a5d2f8f
fix: unref node processes
manuelmauro Sep 22, 2024
19138a7
fix: unref only when needed
manuelmauro Sep 22, 2024
44f743b
refactor: simplify waiting
manuelmauro Sep 22, 2024
dd71070
Merge branch 'main' into manuel-add-ts-integration-fees-test-to-toolbox
Deniallugo Sep 24, 2024
1ce733b
Fix queries
Deniallugo Sep 24, 2024
790e1a5
Fix
Deniallugo Sep 24, 2024
f5cfc0d
fix
Deniallugo Sep 24, 2024
f70e7d8
Correct kill the process
Deniallugo Sep 25, 2024
df0a451
Reset pid
Deniallugo Sep 25, 2024
74e2951
Fix lints and increase timings
Deniallugo Sep 26, 2024
f02b261
Fix nits
Deniallugo Sep 27, 2024
fb31b2d
Fix logs place
Deniallugo Sep 27, 2024
1cec206
Run all fee tests
Deniallugo Sep 27, 2024
77e8814
Fix multiple chains for fees
Deniallugo Sep 27, 2024
1a47104
Merge branch 'main' into manuel-add-ts-integration-fees-test-to-toolbox
Deniallugo Sep 27, 2024
4028d35
Add no deps
Deniallugo Sep 27, 2024
c89b351
add logs
Deniallugo Sep 30, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 22 additions & 0 deletions .github/workflows/ci-core-reusable.yml
Original file line number Diff line number Diff line change
Expand Up @@ -175,6 +175,7 @@ jobs:
SNAPSHOT_RECOVERY_LOGS_DIR=logs/snapshot_recovery/
GENESIS_RECOVERY_LOGS_DIR=logs/genesis_recovery/
EXTERNAL_NODE_LOGS_DIR=logs/external_node
FEES_LOGS_DIR=logs/fees
REVERT_LOGS_DIR=logs/revert

mkdir -p $SERVER_LOGS_DIR
Expand All @@ -183,6 +184,7 @@ jobs:
mkdir -p $SNAPSHOT_RECOVERY_LOGS_DIR
mkdir -p $GENESIS_RECOVERY_LOGS_DIR
mkdir -p $EXTERNAL_NODE_LOGS_DIR
mkdir -p $FEES_LOGS_DIR
manuelmauro marked this conversation as resolved.
Show resolved Hide resolved
mkdir -p $REVERT_LOGS_DIR

echo "SERVER_LOGS_DIR=$SERVER_LOGS_DIR" >> $GITHUB_ENV
Expand Down Expand Up @@ -444,6 +446,26 @@ jobs:
wait $PID3
wait $PID4

- name: Fee projection tests
run: |
ci_run zk_supervisor test fees --chain era &> ${{ env.FEES_LOGS_DIR }}/era.log &
PID1=$!

ci_run zk_supervisor test fees --chain validium &> ${{ env.FEES_LOGS_DIR }}/validium.log &
PID2=$!

ci_run zk_supervisor test fees --chain custom_token &> ${{ env.FEES_LOGS_DIR }}/custom_token.log &
PID3=$!

ci_run zk_supervisor test fees --chain consensus &> ${{ env.FEES_LOGS_DIR }}/consensus.log &
PID4=$!

wait $PID1
wait $PID2
wait $PID3
wait $PID4


- name: Run revert tests
run: |
ci_run killall -INT zksync_server || true
Expand Down
10 changes: 10 additions & 0 deletions zk_toolbox/crates/zk_supervisor/src/commands/test/args/fees.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
use clap::Parser;
use serde::{Deserialize, Serialize};

use crate::messages::MSG_NO_DEPS_HELP;

#[derive(Debug, Serialize, Deserialize, Parser)]
pub struct FeesArgs {
#[clap(short, long, help = MSG_NO_DEPS_HELP)]
pub no_deps: bool,
}
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
pub mod fees;
pub mod integration;
pub mod recovery;
pub mod revert;
Expand Down
41 changes: 41 additions & 0 deletions zk_toolbox/crates/zk_supervisor/src/commands/test/fees.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
use common::{cmd::Cmd, config::global_config, logger};
use config::EcosystemConfig;
use xshell::{cmd, Shell};

use super::{
args::fees::FeesArgs,
utils::{build_contracts, install_and_build_dependencies, TS_INTEGRATION_PATH},
};
use crate::messages::MSG_INTEGRATION_TESTS_RUN_SUCCESS;

pub async fn run(shell: &Shell, args: FeesArgs) -> anyhow::Result<()> {
let ecosystem_config = EcosystemConfig::from_file(shell)?;
shell.change_dir(ecosystem_config.link_to_code.join(TS_INTEGRATION_PATH));

if !args.no_deps {
logger::info("Installing dependencies");
build_contracts(shell, &ecosystem_config)?;
install_and_build_dependencies(shell, &ecosystem_config)?;
}

logger::info(format!(
"Running fees tests on chain: {}",
ecosystem_config.current_chain()
));

let mut command = cmd!(shell, "yarn jest -- fees.test.ts")
.env("CHAIN_NAME", ecosystem_config.current_chain());

if global_config().verbose {
command = command.env(
"ZKSYNC_DEBUG_LOGS",
format!("{:?}", global_config().verbose),
)
}

Cmd::new(command).with_force_run().run()?;

logger::outro(MSG_INTEGRATION_TESTS_RUN_SUCCESS);

Ok(())
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,15 +7,16 @@ use xshell::{cmd, Shell};

use super::{
args::integration::IntegrationArgs,
utils::{build_contracts, install_and_build_dependencies, TestWallets, TEST_WALLETS_PATH},
utils::{
build_contracts, install_and_build_dependencies, TestWallets, TEST_WALLETS_PATH,
TS_INTEGRATION_PATH,
},
};
use crate::messages::{
msg_integration_tests_run, MSG_CHAIN_NOT_FOUND_ERR, MSG_DESERIALIZE_TEST_WALLETS_ERR,
MSG_INTEGRATION_TESTS_RUN_SUCCESS,
};

const TS_INTEGRATION_PATH: &str = "core/tests/ts-integration";

pub async fn run(shell: &Shell, args: IntegrationArgs) -> anyhow::Result<()> {
let ecosystem_config = EcosystemConfig::from_file(shell)?;

Expand Down
8 changes: 6 additions & 2 deletions zk_toolbox/crates/zk_supervisor/src/commands/test/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use args::{
integration::IntegrationArgs, recovery::RecoveryArgs, revert::RevertArgs, rust::RustArgs,
upgrade::UpgradeArgs,
fees::FeesArgs, integration::IntegrationArgs, recovery::RecoveryArgs, revert::RevertArgs,
rust::RustArgs, upgrade::UpgradeArgs,
};
use clap::Subcommand;
use xshell::Shell;
Expand All @@ -14,6 +14,7 @@ use crate::messages::{
mod args;
mod build;
mod db;
mod fees;
mod integration;
mod l1_contracts;
mod loadtest;
Expand All @@ -29,6 +30,8 @@ mod wallet;
pub enum TestCommands {
#[clap(about = MSG_INTEGRATION_TESTS_ABOUT, alias = "i")]
Integration(IntegrationArgs),
#[clap(about = "Run fees test", alias = "i")]
Fees(FeesArgs),
#[clap(about = MSG_REVERT_TEST_ABOUT, alias = "r")]
Revert(RevertArgs),
#[clap(about = MSG_RECOVERY_TEST_ABOUT, alias = "rec")]
Expand All @@ -52,6 +55,7 @@ pub enum TestCommands {
pub async fn run(shell: &Shell, args: TestCommands) -> anyhow::Result<()> {
match args {
TestCommands::Integration(args) => integration::run(shell, args).await,
TestCommands::Fees(args) => fees::run(shell, args).await,
TestCommands::Revert(args) => revert::run(shell, args).await,
TestCommands::Recovery(args) => recovery::run(shell, args).await,
TestCommands::Upgrade(args) => upgrade::run(shell, args),
Expand Down
2 changes: 1 addition & 1 deletion zk_toolbox/crates/zk_supervisor/src/commands/test/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use crate::messages::{
pub const TEST_WALLETS_PATH: &str = "etc/test_config/constant/eth.json";
const AMOUNT_FOR_DISTRIBUTION_TO_WALLETS: u128 = 1000000000000000000000;

const TS_INTEGRATION_PATH: &str = "core/tests/ts-integration";
pub const TS_INTEGRATION_PATH: &str = "core/tests/ts-integration";
const CONTRACTS_TEST_DATA_PATH: &str = "etc/contracts-test-data";

#[derive(Deserialize)]
Expand Down
Loading