From 62c9668b29ec620f3792a25c419e68a821ce2119 Mon Sep 17 00:00:00 2001 From: Yael Doweck Date: Thu, 14 Nov 2024 10:37:05 +0200 Subject: [PATCH] feat(batcher): add input channel size config for validate flow --- config/sequencer/default_config.json | 7 ++++++- crates/starknet_batcher/src/config.rs | 26 +++++++++++++++++--------- 2 files changed, 23 insertions(+), 10 deletions(-) diff --git a/config/sequencer/default_config.json b/config/sequencer/default_config.json index de80dc7f2d..3f181850f6 100644 --- a/config/sequencer/default_config.json +++ b/config/sequencer/default_config.json @@ -139,13 +139,18 @@ "privacy": "Public", "value": 400 }, + "batcher_config.input_stream_content_buffer_size": { + "description": "Sets the buffer size for the input transaction channel. Adding more transactions beyond this limit will block until space is available.", + "privacy": "Public", + "value": 400 + }, "batcher_config.max_l1_handler_txs_per_block_proposal": { "description": "The maximum number of L1 handler transactions to include in a block proposal.", "privacy": "Public", "value": 3 }, "batcher_config.outstream_content_buffer_size": { - "description": "Maximum items to add to the outstream buffer before blocking further filling of the stream.", + "description": "The maximum number of items to include in a single get_proposal_content response.", "privacy": "Public", "value": 100 }, diff --git a/crates/starknet_batcher/src/config.rs b/crates/starknet_batcher/src/config.rs index 6351c1495f..d36329e733 100644 --- a/crates/starknet_batcher/src/config.rs +++ b/crates/starknet_batcher/src/config.rs @@ -12,6 +12,7 @@ use crate::block_builder::BlockBuilderConfig; pub struct BatcherConfig { pub storage: papyrus_storage::StorageConfig, pub outstream_content_buffer_size: usize, + pub input_stream_content_buffer_size: usize, pub block_builder_config: BlockBuilderConfig, pub global_contract_cache_size: usize, pub max_l1_handler_txs_per_block_proposal: usize, @@ -20,14 +21,20 @@ pub struct BatcherConfig { impl SerializeConfig for BatcherConfig { fn dump(&self) -> BTreeMap { // TODO(yair): create nicer function to append sub configs. - let mut dump = BTreeMap::from([ser_param( - "outstream_content_buffer_size", - &self.outstream_content_buffer_size, - "Maximum items to add to the outstream buffer before blocking further filling of the \ - stream.", - ParamPrivacyInput::Public, - )]); - dump.append(&mut BTreeMap::from([ + let mut dump = BTreeMap::from([ + ser_param( + "outstream_content_buffer_size", + &self.outstream_content_buffer_size, + "The maximum number of items to include in a single get_proposal_content response.", + ParamPrivacyInput::Public, + ), + ser_param( + "input_stream_content_buffer_size", + &self.input_stream_content_buffer_size, + "Sets the buffer size for the input transaction channel. Adding more transactions \ + beyond this limit will block until space is available.", + ParamPrivacyInput::Public, + ), ser_param( "global_contract_cache_size", &self.global_contract_cache_size, @@ -41,7 +48,7 @@ impl SerializeConfig for BatcherConfig { "The maximum number of L1 handler transactions to include in a block proposal.", ParamPrivacyInput::Public, ), - ])); + ]); dump.append(&mut append_sub_config_name(self.storage.dump(), "storage")); dump.append(&mut append_sub_config_name( self.block_builder_config.dump(), @@ -66,6 +73,7 @@ impl Default for BatcherConfig { }, // TODO: set a more reasonable default value. outstream_content_buffer_size: 100, + input_stream_content_buffer_size: 400, block_builder_config: BlockBuilderConfig::default(), global_contract_cache_size: 400, max_l1_handler_txs_per_block_proposal: 3,