diff --git a/core/lib/config/src/configs/chain.rs b/core/lib/config/src/configs/chain.rs index bbce533acb3..69c7e38793c 100644 --- a/core/lib/config/src/configs/chain.rs +++ b/core/lib/config/src/configs/chain.rs @@ -58,15 +58,15 @@ pub enum L1BatchCommitDataGeneratorMode { // If the bytes are "0x0000000000000000000000000000000000000000000000000000000000000001" i want the validium case, // Else, an error. impl L1BatchCommitDataGeneratorMode { - pub fn from_eth_response(response: &Bytes) -> Result { + pub fn from_eth_response(response: &Bytes) -> Self { match &response.0.as_slice() { &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] => { - Ok(Self::Rollup) + Self::Rollup } &[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1] => { - Ok(Self::Validium) + Self::Validium } - _ => Err("Invalid response".to_string()), + _response => panic!("Invalid response: {:?}", _response), } } } diff --git a/core/lib/zksync_core/src/lib.rs b/core/lib/zksync_core/src/lib.rs index 22c17aaba75..1baae27c3b3 100644 --- a/core/lib/zksync_core/src/lib.rs +++ b/core/lib/zksync_core/src/lib.rs @@ -640,16 +640,19 @@ pub async fn initialize_components( .build(), ) .await - .unwrap(); + .context("failed to get the current commitment mode from the Ethereum")?; let current_commitment_mode = L1BatchCommitDataGeneratorMode::from_eth_response( ¤t_commitment_mode_eth_response, - ) - .unwrap(); + ); - if current_commitment_mode != state_keeper_config.l1_batch_commit_data_generator_mode { - panic!("The selected L1BatchCommitDataGeneratorMode does not match the existing commitment mode"); - } + assert_eq!( + current_commitment_mode, + state_keeper_config.l1_batch_commit_data_generator_mode, + "The selected L1BatchCommitDataGeneratorMode ({:?}) does not match the existing commitment mode ({:?})", + state_keeper_config.l1_batch_commit_data_generator_mode, + current_commitment_mode + ); let eth_tx_aggregator_actor = EthTxAggregator::new( eth_sender.sender.clone(),