Skip to content

Commit 701b516

Browse files
apollo_batcher_config: add first_block_with_partial_block_hash field to BatcherConfig
1 parent 3a57aaa commit 701b516

File tree

6 files changed

+64
-1
lines changed

6 files changed

+64
-1
lines changed

Cargo.lock

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/apollo_batcher_config/Cargo.toml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ apollo_config.workspace = true
1111
apollo_storage.workspace = true
1212
blockifier.workspace = true
1313
serde = { workspace = true, features = ["derive"] }
14+
starknet_api.workspace = true
1415
url.workspace = true
1516
validator.workspace = true
1617

crates/apollo_batcher_config/src/config.rs

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ use blockifier::blockifier_versioned_constants::VersionedConstantsOverrides;
1010
use blockifier::bouncer::BouncerConfig;
1111
use blockifier::context::ChainInfo;
1212
use serde::{Deserialize, Serialize};
13+
use starknet_api::block::{BlockHash, BlockNumber};
1314
use url::Url;
1415
use validator::{Validate, ValidationError};
1516

@@ -137,6 +138,38 @@ impl SerializeConfig for PreconfirmedCendeConfig {
137138
}
138139
}
139140

141+
#[derive(Clone, Debug, Serialize, Deserialize, PartialEq, Default)]
142+
pub struct FirstBlockWithPartialBlockHash {
143+
pub block_number: BlockNumber,
144+
pub block_hash: BlockHash,
145+
pub parent_block_hash: BlockHash,
146+
}
147+
148+
impl SerializeConfig for FirstBlockWithPartialBlockHash {
149+
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
150+
BTreeMap::from([
151+
ser_param(
152+
"block_number",
153+
&self.block_number,
154+
"The number of the first block with a partial block hash components.",
155+
ParamPrivacyInput::Public,
156+
),
157+
ser_param(
158+
"block_hash",
159+
&self.block_hash,
160+
"The hash of the first block with a partial block hash components.",
161+
ParamPrivacyInput::Public,
162+
),
163+
ser_param(
164+
"parent_block_hash",
165+
&self.parent_block_hash,
166+
"The hash of the parent block of the first block with a partial block hash \
167+
components.",
168+
ParamPrivacyInput::Public,
169+
),
170+
])
171+
}
172+
}
140173
/// The batcher related configuration.
141174
#[derive(Clone, Debug, Serialize, Deserialize, Validate, PartialEq)]
142175
#[validate(schema(function = "validate_batcher_config"))]
@@ -150,6 +183,7 @@ pub struct BatcherConfig {
150183
pub max_l1_handler_txs_per_block_proposal: usize,
151184
pub pre_confirmed_cende_config: PreconfirmedCendeConfig,
152185
pub propose_l1_txs_every: u64,
186+
pub first_block_with_partial_block_hash: FirstBlockWithPartialBlockHash,
153187
}
154188

155189
impl SerializeConfig for BatcherConfig {
@@ -199,6 +233,10 @@ impl SerializeConfig for BatcherConfig {
199233
self.pre_confirmed_cende_config.dump(),
200234
"pre_confirmed_cende_config",
201235
));
236+
dump.append(&mut prepend_sub_config_name(
237+
self.first_block_with_partial_block_hash.dump(),
238+
"first_block_with_partial_block_hash",
239+
));
202240
dump
203241
}
204242
}
@@ -224,6 +262,8 @@ impl Default for BatcherConfig {
224262
max_l1_handler_txs_per_block_proposal: 3,
225263
pre_confirmed_cende_config: PreconfirmedCendeConfig::default(),
226264
propose_l1_txs_every: 1, // Default is to propose L1 transactions every proposal.
265+
// TODO(Rotem): set a more reasonable default value.
266+
first_block_with_partial_block_hash: FirstBlockWithPartialBlockHash::default(),
227267
}
228268
}
229269
}

crates/apollo_deployments/resources/app_configs/batcher_config.json

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,5 +52,8 @@
5252
"batcher_config.storage.mmap_file_config.max_object_size": 1073741824,
5353
"batcher_config.storage.mmap_file_config.max_size": 1099511627776,
5454
"batcher_config.storage.scope": "StateOnly",
55-
"batcher_config.propose_l1_txs_every": 10
55+
"batcher_config.propose_l1_txs_every": 10,
56+
"batcher_config.first_block_with_partial_block_hash.block_number": 0,
57+
"batcher_config.first_block_with_partial_block_hash.block_hash": "0x0",
58+
"batcher_config.first_block_with_partial_block_hash.parent_block_hash": "0x0"
5659
}

crates/apollo_deployments/resources/app_configs/replacer_batcher_config.json

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,9 @@
3737
"batcher_config.contract_class_manager_config.native_compiler_config.max_memory_usage": 16106127360,
3838
"batcher_config.contract_class_manager_config.native_compiler_config.max_memory_usage.#is_none": false,
3939
"batcher_config.contract_class_manager_config.native_compiler_config.optimization_level": 2,
40+
"batcher_config.first_block_with_partial_block_hash.block_hash": "0x0",
41+
"batcher_config.first_block_with_partial_block_hash.block_number": 0,
42+
"batcher_config.first_block_with_partial_block_hash.parent_block_hash": "0x0",
4043
"batcher_config.input_stream_content_buffer_size": 4000,
4144
"batcher_config.max_l1_handler_txs_per_block_proposal": 200,
4245
"batcher_config.outstream_content_buffer_size": 64,

crates/apollo_node/resources/config_schema.json

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -259,6 +259,21 @@
259259
"privacy": "Public",
260260
"value": 2
261261
},
262+
"batcher_config.first_block_with_partial_block_hash.block_hash": {
263+
"description": "The hash of the first block with a partial block hash components.",
264+
"privacy": "Public",
265+
"value": "0x0"
266+
},
267+
"batcher_config.first_block_with_partial_block_hash.block_number": {
268+
"description": "The number of the first block with a partial block hash components.",
269+
"privacy": "Public",
270+
"value": 0
271+
},
272+
"batcher_config.first_block_with_partial_block_hash.parent_block_hash": {
273+
"description": "The hash of the parent block of the first block with a partial block hash components.",
274+
"privacy": "Public",
275+
"value": "0x0"
276+
},
262277
"batcher_config.input_stream_content_buffer_size": {
263278
"description": "Sets the buffer size for the input transaction channel. Adding more transactions beyond this limit will block until space is available.",
264279
"privacy": "Public",

0 commit comments

Comments
 (0)