Skip to content

Commit

Permalink
Set the max block size
Browse files Browse the repository at this point in the history
  • Loading branch information
ImJeremyHe committed Jul 25, 2024
1 parent 3bcfc87 commit c405391
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 4 deletions.
16 changes: 14 additions & 2 deletions sequencer/src/bin/espresso-dev-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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},
Expand Down Expand Up @@ -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::<NUM_NODES, _, _>::with_num_nodes()
.api_config(api_options)
.network_config(network_config)
.states(states)
.build();

let network = TestNetwork::new(config).await;
Expand Down Expand Up @@ -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<Transaction> = api_client
.post("submit/submit")
Expand Down Expand Up @@ -469,7 +482,6 @@ mod tests {
.send()
.await;
}
println!("finish sending large tx");

let tx_block_height = tx_result.unwrap().block_height();

Expand Down
4 changes: 2 additions & 2 deletions sequencer/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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,
)
Expand Down

0 comments on commit c405391

Please sign in to comment.