diff --git a/core/lib/protobuf_config/src/genesis.rs b/core/lib/protobuf_config/src/genesis.rs index 754f1fc16d0e..9cab754150d2 100644 --- a/core/lib/protobuf_config/src/genesis.rs +++ b/core/lib/protobuf_config/src/genesis.rs @@ -29,12 +29,21 @@ impl ProtoRepr for proto::Genesis { type Type = configs::GenesisConfig; fn read(&self) -> anyhow::Result { let prover = required(&self.prover).context("prover")?; + let protocol_version = if let Some(protocol_version) = + &self.genesis_protocol_semantic_version + { + ProtocolSemanticVersion::from_str(protocol_version).context("protocol_version")? + } else { + let minor_version = *required(&self.genesis_protocol_version).context("Either genesis_protocol_version or genesis_protocol_semantic_version should be presented")?; + ProtocolSemanticVersion::new( + (minor_version as u16) + .try_into() + .context("Wrong protocol version")?, + 0.into(), + ) + }; Ok(Self::Type { - protocol_version: Some( - required(&self.genesis_protocol_semantic_version) - .and_then(|x| ProtocolSemanticVersion::from_str(x).map_err(Into::into)) - .context("protocol_version")?, - ), + protocol_version: Some(protocol_version), genesis_root_hash: Some( required(&self.genesis_root) .and_then(|x| parse_h256(x)) @@ -98,6 +107,7 @@ impl ProtoRepr for proto::Genesis { genesis_root: this.genesis_root_hash.map(|x| format!("{:?}", x)), genesis_rollup_leaf_index: this.rollup_last_leaf_index, genesis_batch_commitment: this.genesis_commitment.map(|x| format!("{:?}", x)), + genesis_protocol_version: this.protocol_version.map(|x| x.minor as u64), genesis_protocol_semantic_version: this.protocol_version.map(|x| x.to_string()), default_aa_hash: this.default_aa_hash.map(|x| format!("{:?}", x)), bootloader_hash: this.bootloader_hash.map(|x| format!("{:?}", x)), diff --git a/core/lib/protobuf_config/src/proto/config/genesis.proto b/core/lib/protobuf_config/src/proto/config/genesis.proto index 5a5e7f1d539d..be3c420b6ab1 100644 --- a/core/lib/protobuf_config/src/proto/config/genesis.proto +++ b/core/lib/protobuf_config/src/proto/config/genesis.proto @@ -17,17 +17,17 @@ message Prover { message Genesis { - optional string genesis_root = 1; // optional; h256 - optional uint64 genesis_rollup_leaf_index = 2; // optional; - optional string genesis_batch_commitment = 3; // optional; h256 - optional string default_aa_hash = 5; // optional; h256 - optional string bootloader_hash = 6; // optional; h256 - optional uint64 l1_chain_id = 7; // optional; - optional uint64 l2_chain_id = 8; // optional; + optional string genesis_root = 1; // required; h256 + optional uint64 genesis_rollup_leaf_index = 2; // required; + optional string genesis_batch_commitment = 3; // required; h256 + optional uint64 genesis_protocol_version = 4; // optional; + optional string default_aa_hash = 5; // required; h256 + optional string bootloader_hash = 6; // required; h256 + optional uint64 l1_chain_id = 7; // required; + optional uint64 l2_chain_id = 8; // required; optional string fee_account = 9; // h160 optional Prover prover = 10; optional L1BatchCommitDataGeneratorMode l1_batch_commit_data_generator_mode = 29; // optional, default to rollup optional string genesis_protocol_semantic_version = 12; // optional; - reserved 4; reserved "genesis_protocol_version"; reserved 11; reserved "shared_bridge"; } diff --git a/etc/env/file_based/genesis.yaml b/etc/env/file_based/genesis.yaml index 49197c1f4aa5..e3513a8b6421 100644 --- a/etc/env/file_based/genesis.yaml +++ b/etc/env/file_based/genesis.yaml @@ -2,6 +2,8 @@ genesis_root: 0xabdb766b18a479a5c783a4b80e12686bc8ea3cc2d8a3050491b701d72370ebb5 genesis_rollup_leaf_index: 54 genesis_batch_commitment: 0x2d00e5f8d77afcebf58a6b82ae56ba967566fe7dfbcb6760319fb0d215d18ffd genesis_protocol_semantic_version: '0.24.0' +# deprecated +genesis_protocol_version: 24 default_aa_hash: 0x01000563374c277a2c1e34659a2a1e87371bb6d852ce142022d497bfb50b9e32 bootloader_hash: 0x010008e742608b21bf7eb23c1a9d0602047e3618b464c9b59c0fba3b3d7ab66e l1_chain_id: 9