Skip to content

Commit

Permalink
feat(batcher): add input channel size config for validate flow
Browse files Browse the repository at this point in the history
  • Loading branch information
Yael-Starkware committed Nov 14, 2024
1 parent 422ee5d commit 372c808
Show file tree
Hide file tree
Showing 2 changed files with 24 additions and 10 deletions.
7 changes: 6 additions & 1 deletion config/sequencer/default_config.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "Sets the maximum number of items to retrieve from the output stream in a single get_proposal_content request.",
"privacy": "Public",
"value": 100
},
Expand Down
27 changes: 18 additions & 9 deletions crates/starknet_batcher/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand All @@ -20,14 +21,21 @@ pub struct BatcherConfig {
impl SerializeConfig for BatcherConfig {
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
// 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,
"Sets the maximum number of items to retrieve from the output stream in a single \
get_proposal_content request.",
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,
Expand All @@ -41,7 +49,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(),
Expand All @@ -66,6 +74,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,
Expand Down

0 comments on commit 372c808

Please sign in to comment.