Skip to content

Commit

Permalink
max block size env for dev node (#2504)
Browse files Browse the repository at this point in the history
  • Loading branch information
imabdulbasit authored Jan 29, 2025
2 parents e343feb + 90b48a8 commit e66bffe
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 1 deletion.
14 changes: 14 additions & 0 deletions sequencer/src/api.rs
Original file line number Diff line number Diff line change
Expand Up @@ -554,6 +554,7 @@ pub mod test_helpers {
api_config: Options,
}

#[derive(Clone)]
pub struct TestNetworkConfigBuilder<const NUM_NODES: usize, P, C>
where
P: PersistenceOptions,
Expand Down Expand Up @@ -592,6 +593,19 @@ pub mod test_helpers {
api_config: None,
}
}

pub fn with_max_block_size(&self, max_block_size: u64) -> Self {
let cf = ChainConfig {
max_block_size: max_block_size.into(),
..Default::default()
}
.into();

let mut cfg = self.clone();
cfg.state.iter_mut().for_each(|s| s.chain_config = cf);

cfg
}
}

impl<const NUM_NODES: usize, P, C> TestNetworkConfigBuilder<{ NUM_NODES }, P, C>
Expand Down
14 changes: 13 additions & 1 deletion sequencer/src/bin/espresso-dev-node.rs
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,15 @@ struct Args {
#[clap(short, long, env = "ESPRESSO_DEV_NODE_PORT", default_value = "20000")]
dev_node_port: u16,

/// Port for connecting to the builder.
#[clap(
short,
long,
env = "ESPRESSO_DEV_NODE_MAX_BLOCK_SIZE",
default_value = "1000000"
)]
max_block_size: u64,

#[clap(flatten)]
sql: persistence::sql::Options,

Expand Down Expand Up @@ -177,6 +186,7 @@ async fn main() -> anyhow::Result<()> {
alt_prover_retry_intervals,
alt_prover_update_intervals,
l1_interval,
max_block_size,
} = cli_params;

logging.init();
Expand Down Expand Up @@ -215,6 +225,7 @@ async fn main() -> anyhow::Result<()> {
let config = TestNetworkConfigBuilder::<NUM_NODES, _, _>::with_num_nodes()
.api_config(api_options)
.network_config(network_config)
.with_max_block_size(max_block_size)
.build();

let network =
Expand Down Expand Up @@ -620,6 +631,7 @@ mod tests {
tmp_dir.path().as_os_str(),
)
.env("ESPRESSO_SEQUENCER_DATABASE_MAX_CONNECTIONS", "25")
.env("ESPRESSO_DEV_NODE_MAX_BLOCK_SIZE", "500000")
.spawn()
.unwrap();

Expand Down Expand Up @@ -709,7 +721,7 @@ mod tests {

{
// transactions with size larger than max_block_size result in an error
let extremely_large_tx = Transaction::new(100_u32.into(), vec![0; 50120]);
let extremely_large_tx = Transaction::new(100_u32.into(), vec![0; 7 * 1000 * 1000]);
api_client
.post::<Commitment<Transaction>>("submit/submit")
.body_json(&extremely_large_tx)
Expand Down

0 comments on commit e66bffe

Please sign in to comment.