Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .config/nextest.toml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,4 @@ path = "test-results.xml"
# Tests in `prover.rs` rely on prover (CPU or GPU). CPU prover can take >10m to prove one batch, so we give these tests
# a longer timeout.
filter = 'binary(prover)'
slow-timeout = { period = "15m", terminate-after = 3 }
slow-timeout = { period = "1500m", terminate-after = 3 }
13 changes: 10 additions & 3 deletions integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -171,7 +171,7 @@ impl Tester {
address: status_address,
};

let config = Config {
let mut config = Config {
general_config,
genesis_config: GenesisConfig {
genesis_input_path: Some(
Expand All @@ -187,7 +187,7 @@ impl Tester {
l1_watcher_config: Default::default(),
batcher_config: Default::default(),
prover_input_generator_config: ProverInputGeneratorConfig {
logging_enabled: enable_prover,
logging_enabled: false,
..Default::default()
},
prover_api_config,
Expand All @@ -196,6 +196,13 @@ impl Tester {
gas_adjuster_config: Default::default(),
batch_verification_config: Default::default(),
};
if enable_prover {
config.sequencer_config.block_time = Duration::from_secs(3600);
config.sequencer_config.max_transactions_in_block = 1000000;
config.sequencer_config.block_pubdata_limit_bytes = 100000000;
config.l1_sender_config.max_priority_fee_per_gas_gwei = 0;
config.sequencer_config.block_gas_limit = 2000000000;
};
let main_task = tokio::task::spawn(async move {
zksync_os_server::run::<FullDiffsState>(stop_receiver, config).await;
});
Expand All @@ -215,7 +222,7 @@ impl Tester {
circuit_limit: 10000,
output_dir: output_dir.to_str().unwrap().to_string(),
trusted_setup_file: trusted_setup_file.to_string(),
iterations: Some(1),
iterations: Some(2),
fri_path: None,
max_snark_latency: None,
max_fris_per_snark: Some(1),
Expand Down
21 changes: 20 additions & 1 deletion integration-tests/tests/prover.rs
Original file line number Diff line number Diff line change
@@ -1,18 +1,37 @@
#![cfg(feature = "prover-tests")]

use alloy::network::TransactionBuilder;
use alloy::primitives::{Address, U256};
use alloy::providers::Provider;
use alloy::rpc::types::TransactionRequest;
use zksync_os_integration_tests::Tester;

#[test_log::test(tokio::test)]
async fn prover() -> anyhow::Result<()> {
// Test that prover can successfully prove at least one batch
let tester = Tester::builder().enable_prover().build().await?;
run_txs(&tester).await?;

// Test environment comes with some L1 transactions by default, so one batch should be provable
// without any new transactions inside the test.
tester.prover_tester.wait_for_batch_proven(1).await?;
tester.prover_tester.wait_for_batch_proven(2).await?;

// todo: consider expanding this test to prove multiple batches on top of the first batch
// also to test L2 transactions are provable too

Ok(())
}

async fn run_txs(tester: &Tester) -> anyhow::Result<()> {
for nonce in 0..60000 {
let tx = TransactionRequest::default()
.with_to(Address::ZERO)
.with_value(U256::from(1))
.nonce(nonce)
.gas_limit(21_000);

let _ = tester.l2_provider.send_transaction(tx).await?;
}

Ok(())
}
8 changes: 7 additions & 1 deletion lib/sequencer/src/execution/block_executor.rs
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,13 @@ pub async fn execute_block<R: ReadStateHistory + WriteState>(

/* ---------- deadline config ------------------------------------ */
let deadline_dur = match command.seal_policy {
SealPolicy::Decide(d, _) => Some(d),
SealPolicy::Decide(d, _) => {
if ctx.block_number == 1 {
Some(std::time::Duration::from_secs(1))
} else {
Some(d)
}
}
SealPolicy::UntilExhausted { .. } => None,
};
let mut deadline: Option<Pin<Box<Sleep>>> = None; // will arm after 1st tx success
Expand Down
Loading