From c40539152e1bf22e72c7c271397b8e11deb2d9f4 Mon Sep 17 00:00:00 2001 From: ImJeremyHe Date: Wed, 24 Jul 2024 20:46:36 +0800 Subject: [PATCH] Set the max block size --- sequencer/src/bin/espresso-dev-node.rs | 16 ++++++++++++++-- sequencer/src/lib.rs | 4 ++-- 2 files changed, 16 insertions(+), 4 deletions(-) diff --git a/sequencer/src/bin/espresso-dev-node.rs b/sequencer/src/bin/espresso-dev-node.rs index 461ee5fef7..21d9433946 100644 --- a/sequencer/src/bin/espresso-dev-node.rs +++ b/sequencer/src/bin/espresso-dev-node.rs @@ -5,6 +5,7 @@ use async_std::task::spawn; use clap::Parser; use contract_bindings::light_client_mock::LightClientMock; use es_version::SEQUENCER_VERSION; +use espresso_types::{ChainConfig, ResolvableChainConfig, ValidatedState}; use ethers::{ middleware::{MiddlewareBuilder, SignerMiddleware}, providers::{Http, Middleware, Provider}, @@ -122,10 +123,23 @@ async fn main() -> anyhow::Result<()> { .state_relay_url(relay_server_url.clone()) .l1_url(url.clone()) .build(); + + // Set the max_block_size + let states = std::array::from_fn(|_| { + let mut s = ValidatedState::default(); + let chain_config = ChainConfig { + max_block_size: 30000.into(), + ..Default::default() + }; + s.chain_config = ResolvableChainConfig::from(chain_config); + s + }); + const NUM_NODES: usize = 2; let config = TestNetworkConfigBuilder::::with_num_nodes() .api_config(api_options) .network_config(network_config) + .states(states) .build(); let network = TestNetwork::new(config).await; @@ -438,7 +452,6 @@ mod tests { .await; } - println!("sending large tx"); let large_tx = Transaction::new(100_u32.into(), vec![0; 20000]); let large_hash: Commitment = api_client .post("submit/submit") @@ -469,7 +482,6 @@ mod tests { .send() .await; } - println!("finish sending large tx"); let tx_block_height = tx_result.unwrap().block_height(); diff --git a/sequencer/src/lib.rs b/sequencer/src/lib.rs index 346db3b090..7ba5a11b87 100644 --- a/sequencer/src/lib.rs +++ b/sequencer/src/lib.rs @@ -376,7 +376,7 @@ pub mod testing { eth_signature_key::EthKeyPair, mock::MockStateCatchup, v0::traits::{PersistenceOptions, StateCatchup}, - ChainConfig, Event, FeeAccount, PubKey, SeqTypes, Transaction, Upgrade, + Event, FeeAccount, PubKey, SeqTypes, Transaction, Upgrade, }; use futures::{ future::join_all, @@ -664,7 +664,7 @@ pub mod testing { state.prefund_account(builder_account, U256::max_value().into()); let node_state = NodeState::new( i as u64, - ChainConfig::default(), + state.chain_config.resolve().unwrap_or_default(), L1Client::new(self.l1_url.clone(), 1000), catchup::local_and_remote(persistence_opt.clone(), catchup).await, )