Skip to content

Commit 5d86548

Browse files
blockifier: add l3 field to ChainInfo
1 parent 1f82ff0 commit 5d86548

File tree

7 files changed

+37
-8
lines changed

7 files changed

+37
-8
lines changed

config/sequencer/default_config.json

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -119,6 +119,11 @@
119119
"pointer_target": "strk_fee_token_address",
120120
"privacy": "Public"
121121
},
122+
"batcher_config.block_builder_config.chain_info.is_layer_3": {
123+
"description": "Whether the chain is a layer 3 chain.",
124+
"privacy": "Public",
125+
"value": false
126+
},
122127
"batcher_config.block_builder_config.execute_config.n_workers": {
123128
"description": "Number of parallel transaction execution workers.",
124129
"privacy": "Public",
@@ -1284,6 +1289,11 @@
12841289
"pointer_target": "strk_fee_token_address",
12851290
"privacy": "Public"
12861291
},
1292+
"gateway_config.chain_info.is_layer_3": {
1293+
"description": "Whether the chain is a layer 3 chain.",
1294+
"privacy": "Public",
1295+
"value": false
1296+
},
12871297
"gateway_config.stateful_tx_validator_config.max_allowed_nonce_gap": {
12881298
"description": "The maximum allowed gap between the account nonce and the transaction nonce.",
12891299
"privacy": "Public",

crates/apollo_deployments/resources/base_app_config.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
"batcher_config.block_builder_config.bouncer_config.builtin_weights.add_mod": 250,
2020
"batcher_config.block_builder_config.bouncer_config.builtin_weights.mul_mod": 604,
2121
"batcher_config.block_builder_config.bouncer_config.builtin_weights.range_check96": 56,
22+
"batcher_config.block_builder_config.chain_info.is_layer_3": false,
2223
"batcher_config.block_builder_config.execute_config.n_workers": 4,
2324
"batcher_config.block_builder_config.execute_config.stack_size": 62914560,
2425
"batcher_config.block_builder_config.n_concurrent_txs": 10,
@@ -116,6 +117,7 @@
116117
"consensus_manager_config.stream_handler_config.max_streams": 100,
117118
"consensus_manager_config.votes_topic": "consensus_votes",
118119
"gateway_config.block_declare": false,
120+
"gateway_config.chain_info.is_layer_3": false,
119121
"gateway_config.stateful_tx_validator_config.max_allowed_nonce_gap": 50,
120122
"gateway_config.stateful_tx_validator_config.max_nonce_for_validation_skip": "0x1",
121123
"gateway_config.stateful_tx_validator_config.reject_future_declare_txs": true,
@@ -249,4 +251,4 @@
249251
"versioned_constants_overrides.max_n_events": 1000,
250252
"versioned_constants_overrides.max_recursion_depth": 50,
251253
"versioned_constants_overrides.validate_max_n_steps": 1000000
252-
}
254+
}

crates/apollo_rpc_execution/src/lib.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -394,6 +394,7 @@ fn create_block_context(
394394
strk_fee_token_address: execution_config.strk_fee_contract_address,
395395
eth_fee_token_address: execution_config.eth_fee_contract_address,
396396
},
397+
is_layer_3: false,
397398
};
398399
let starknet_version = storage_reader
399400
.begin_ro_txn()?

crates/blockifier/src/context.rs

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ impl BlockContext {
200200
pub struct ChainInfo {
201201
pub chain_id: ChainId,
202202
pub fee_token_addresses: FeeTokenAddresses,
203+
pub is_layer_3: bool,
203204
}
204205

205206
impl ChainInfo {
@@ -217,18 +218,27 @@ impl Default for ChainInfo {
217218
// TODO(guyn): should we remove the default value for chain_id?
218219
chain_id: ChainId::Other("0x0".to_string()),
219220
fee_token_addresses: FeeTokenAddresses::default(),
221+
is_layer_3: false,
220222
}
221223
}
222224
}
223225

224226
impl SerializeConfig for ChainInfo {
225227
fn dump(&self) -> BTreeMap<ParamPath, SerializedParam> {
226-
let members = BTreeMap::from_iter([ser_param(
227-
"chain_id",
228-
&self.chain_id,
229-
"The chain ID of the StarkNet chain.",
230-
ParamPrivacyInput::Public,
231-
)]);
228+
let members = BTreeMap::from_iter([
229+
ser_param(
230+
"chain_id",
231+
&self.chain_id,
232+
"The chain ID of the StarkNet chain.",
233+
ParamPrivacyInput::Public,
234+
),
235+
ser_param(
236+
"is_layer_3",
237+
&self.is_layer_3,
238+
"Whether the chain is a layer 3 chain.",
239+
ParamPrivacyInput::Public,
240+
),
241+
]);
232242

233243
vec![
234244
members,

crates/blockifier/src/test_utils/struct_impls.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,7 @@ impl ChainInfo {
144144
eth_fee_token_address: contract_address!(TEST_ERC20_CONTRACT_ADDRESS),
145145
strk_fee_token_address: contract_address!(TEST_ERC20_CONTRACT_ADDRESS2),
146146
},
147+
is_layer_3: false,
147148
}
148149
}
149150
}

crates/blockifier_reexecution/src/state_reader/utils.rs

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,11 @@ pub fn get_rpc_state_reader_config() -> RpcStateReaderConfig {
6767

6868
/// Returns the chain info of mainnet.
6969
pub fn get_chain_info(chain_id: &ChainId) -> ChainInfo {
70-
ChainInfo { chain_id: chain_id.clone(), fee_token_addresses: get_fee_token_addresses(chain_id) }
70+
ChainInfo {
71+
chain_id: chain_id.clone(),
72+
fee_token_addresses: get_fee_token_addresses(chain_id),
73+
is_layer_3: false,
74+
}
7175
}
7276

7377
// TODO(Aner): import the following functions instead, to reduce code duplication.

crates/native_blockifier/src/py_block_executor.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -454,6 +454,7 @@ impl TryFrom<PyOsConfig> for ChainInfo {
454454
py_os_config.fee_token_address.0,
455455
)?,
456456
},
457+
is_layer_3: false,
457458
})
458459
}
459460
}

0 commit comments

Comments
 (0)