From 4a121b7255aa49e380433f482ef01aaa8732c0b0 Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Tue, 2 Jul 2024 14:52:57 +0800 Subject: [PATCH 1/7] update gas oracle slot --- eth-types/src/l2_predeployed.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/eth-types/src/l2_predeployed.rs b/eth-types/src/l2_predeployed.rs index 41b4edec91..6e7770ec7b 100644 --- a/eth-types/src/l2_predeployed.rs +++ b/eth-types/src/l2_predeployed.rs @@ -39,12 +39,12 @@ pub mod l1_gas_price_oracle { /// THe following 3 slots plus `BASE_FEE_SLOT` will be used for l1 fee after curie fork /// L1 BlobBaseFee slot in L1GasPriceOracle after Curie fork - pub static L1_BLOB_BASEFEE_SLOT: LazyLock = LazyLock::new(|| U256::from(5)); + pub static L1_BLOB_BASEFEE_SLOT: LazyLock = LazyLock::new(|| U256::from(6)); /// L1 commitScalar slot in L1GasPriceOracle after Curie fork - pub static COMMIT_SCALAR_SLOT: LazyLock = LazyLock::new(|| U256::from(6)); + pub static COMMIT_SCALAR_SLOT: LazyLock = LazyLock::new(|| U256::from(7)); /// L1 blob_scalar slot in L1GasPriceOracle after Curie fork - pub static BLOB_SCALAR_SLOT: LazyLock = LazyLock::new(|| U256::from(7)); - pub static IS_CURIE_SLOT: LazyLock = LazyLock::new(|| U256::from(8)); + pub static BLOB_SCALAR_SLOT: LazyLock = LazyLock::new(|| U256::from(8)); + pub static IS_CURIE_SLOT: LazyLock = LazyLock::new(|| U256::from(9)); pub static INITIAL_COMMIT_SCALAR: LazyLock = LazyLock::new(|| U256::from(230759955285u64)); pub static INITIAL_BLOB_SCALAR: LazyLock = LazyLock::new(|| U256::from(417565260)); From b2e34aec8dfabee05944d80d473febf664368850 Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Wed, 3 Jul 2024 15:33:26 +0800 Subject: [PATCH 2/7] fix upgrade logic --- .../src/circuit_input_builder/curie.rs | 78 +++++++++---------- eth-types/src/forks.rs | 31 +++++--- .../evm_circuit/util/common_gadget/curie.rs | 30 +++---- 3 files changed, 73 insertions(+), 66 deletions(-) diff --git a/bus-mapping/src/circuit_input_builder/curie.rs b/bus-mapping/src/circuit_input_builder/curie.rs index e504030d43..cce6e346c2 100644 --- a/bus-mapping/src/circuit_input_builder/curie.rs +++ b/bus-mapping/src/circuit_input_builder/curie.rs @@ -38,48 +38,48 @@ pub fn is_curie_fork_block(chain_id: u64, blk: u64) -> bool { } /// Insert needed rws for the contract upgrade -/// Num of rws: 7 +/// Num of rws: 3 pub fn apply_curie(state: &mut CircuitInputStateRef, step: &mut ExecStep) -> Result<(), Error> { // The chunk should not includes other txs. - let v1_codesize = l1_gas_price_oracle::V1_BYTECODE.len(); - let v1_codehash = hash_code(&l1_gas_price_oracle::V1_BYTECODE); - let v1_keccak_codehash = hash_code_keccak(&l1_gas_price_oracle::V1_BYTECODE); - log::debug!("l1_oracle poseidon codehash {:?}", v1_codehash); - log::debug!("l1_oracle keccak codehash {:?}", v1_keccak_codehash); - let v2_codesize = l1_gas_price_oracle::V2_BYTECODE.len(); - let v2_codehash = hash_code(&l1_gas_price_oracle::V2_BYTECODE); - let v2_keccak_codehash = hash_code_keccak(&l1_gas_price_oracle::V2_BYTECODE); + // let v1_codesize = l1_gas_price_oracle::V1_BYTECODE.len(); + // let v1_codehash = hash_code(&l1_gas_price_oracle::V1_BYTECODE); + // let v1_keccak_codehash = hash_code_keccak(&l1_gas_price_oracle::V1_BYTECODE); + // log::debug!("l1_oracle poseidon codehash {:?}", v1_codehash); + // log::debug!("l1_oracle keccak codehash {:?}", v1_keccak_codehash); + // let v2_codesize = l1_gas_price_oracle::V2_BYTECODE.len(); + // let v2_codehash = hash_code(&l1_gas_price_oracle::V2_BYTECODE); + // let v2_keccak_codehash = hash_code_keccak(&l1_gas_price_oracle::V2_BYTECODE); - state.push_op( - step, - RW::WRITE, - AccountOp { - address: *l1_gas_price_oracle::ADDRESS, - field: AccountField::CodeHash, - value_prev: v1_codehash.to_word(), - value: v2_codehash.to_word(), - }, - )?; - state.push_op( - step, - RW::WRITE, - AccountOp { - address: *l1_gas_price_oracle::ADDRESS, - field: AccountField::KeccakCodeHash, - value_prev: v1_keccak_codehash.to_word(), - value: v2_keccak_codehash.to_word(), - }, - )?; - state.push_op( - step, - RW::WRITE, - AccountOp { - address: *l1_gas_price_oracle::ADDRESS, - field: AccountField::CodeSize, - value_prev: v1_codesize.to_word(), - value: v2_codesize.to_word(), - }, - )?; + // state.push_op( + // step, + // RW::WRITE, + // AccountOp { + // address: *l1_gas_price_oracle::ADDRESS, + // field: AccountField::CodeHash, + // value_prev: v1_codehash.to_word(), + // value: v2_codehash.to_word(), + // }, + // )?; + // state.push_op( + // step, + // RW::WRITE, + // AccountOp { + // address: *l1_gas_price_oracle::ADDRESS, + // field: AccountField::KeccakCodeHash, + // value_prev: v1_keccak_codehash.to_word(), + // value: v2_keccak_codehash.to_word(), + // }, + // )?; + // state.push_op( + // step, + // RW::WRITE, + // AccountOp { + // address: *l1_gas_price_oracle::ADDRESS, + // field: AccountField::CodeSize, + // value_prev: v1_codesize.to_word(), + // value: v2_codesize.to_word(), + // }, + // )?; for (slot, value) in [ (*l1_gas_price_oracle::IS_CURIE_SLOT, Word::from(1)), diff --git a/eth-types/src/forks.rs b/eth-types/src/forks.rs index 829a865b5e..d7b46e5e20 100644 --- a/eth-types/src/forks.rs +++ b/eth-types/src/forks.rs @@ -1,5 +1,4 @@ //! Hardfork related codes for Scroll networks - use crate::constants::read_env_var; /// Hardfork ID for scroll networks @@ -9,23 +8,31 @@ pub enum HardforkId { Curie = 3, } -/// Scroll devnet chain id -pub const SCROLL_DEVNET_CHAIN_ID: u64 = 222222; -/// Scroll testnet chain id -pub const SCROLL_TESTNET_CHAIN_ID: u64 = 534351; -/// Scroll mainnet chain id -pub const SCROLL_MAINNET_CHAIN_ID: u64 = 534352; +/// Morph devnet and qanet chain id +pub const MORPH_DEVNET_CHAIN_ID: u64 = 53077; +/// Morph testnet chain id +pub const MORPH_TESTNET_CHAIN_ID: u64 = 2710; +/// Morph mainnet chain id +pub const MORPH_MAINNET_CHAIN_ID: u64 = 2818; -/// Get hardforks of Scroll networks. +/// Get hardforks of Morph networks. /// Returns a list of triplets of (hardfork id, chain id, block number) pub fn hardfork_heights() -> Vec<(HardforkId, u64, u64)> { vec![ - (HardforkId::Curie, SCROLL_DEVNET_CHAIN_ID, 5), // devnet - (HardforkId::Curie, SCROLL_TESTNET_CHAIN_ID, 4740239), // testnet ( HardforkId::Curie, - SCROLL_MAINNET_CHAIN_ID, - read_env_var("SCROLL_MAINNET_CURIE_BLOCK", 6924036), + MORPH_DEVNET_CHAIN_ID, + read_env_var("MORPH_DEVNET_CURIE_BLOCK", u64::MAX), + ), // devnet and qanet + ( + HardforkId::Curie, + MORPH_TESTNET_CHAIN_ID, + read_env_var("MORPH_TESTNET_CURIE_BLOCK", u64::MAX), + ), // testnet + ( + HardforkId::Curie, + MORPH_MAINNET_CHAIN_ID, + read_env_var("MORPH_MAINNET_CURIE_BLOCK", u64::MAX), ), // mainnet ] } diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs index 639aab241a..847311b339 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs @@ -12,7 +12,7 @@ use crate::{ }; use eth_types::forks::{ - HardforkId, SCROLL_DEVNET_CHAIN_ID, SCROLL_MAINNET_CHAIN_ID, SCROLL_TESTNET_CHAIN_ID, + HardforkId, MORPH_DEVNET_CHAIN_ID, MORPH_MAINNET_CHAIN_ID, MORPH_TESTNET_CHAIN_ID, }; use gadgets::util::not; use halo2_proofs::{ @@ -23,8 +23,8 @@ use halo2_proofs::{ #[derive(Clone, Debug)] pub(crate) struct CurieGadget { chain_id: Cell, - /// Scroll chains have non-zero curie hard fork block number - is_scroll_chain: IsZeroGadget, + /// Morph chains have non-zero curie hard fork block number + is_morph_chain: IsZeroGadget, /// The block height at which curie hard fork happens curie_fork_block_num: Cell, pub(crate) is_before_curie: LtGadget, // block num is u64 @@ -41,18 +41,18 @@ impl CurieGadget { ); // TODO: refactor - // is_scoll_chain means (chain_id - 534352) * (chain_id - 222222) == 0 - let is_scroll_chain = IsZeroGadget::construct( + // is_morph_chain means (chain_id - 53077) * (chain_id - 2710) == 0 + let is_morph_chain = IsZeroGadget::construct( cb, - (chain_id.expr() - SCROLL_MAINNET_CHAIN_ID.expr()) - * (chain_id.expr() - SCROLL_DEVNET_CHAIN_ID.expr()), + (chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr()) + * (chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()), ); - // For Scroll Networks (mainnet, testnet, devnet), + // For Morph Networks (mainnet, testnet, devnet), // curie_fork_block_num should be pre-defined. // For other chain ids, it should be 0. let curie_fork_block_num = cb.query_cell(); - cb.condition(is_scroll_chain.expr(), |cb| { + cb.condition(is_morph_chain.expr(), |cb| { cb.add_lookup( "Hardfork lookup", Lookup::Fixed { @@ -65,7 +65,7 @@ impl CurieGadget { }, ); }); - cb.condition(not::expr(is_scroll_chain.expr()), |cb| { + cb.condition(not::expr(is_morph_chain.expr()), |cb| { cb.require_zero("enable curie since genesis", curie_fork_block_num.expr()); }); @@ -76,7 +76,7 @@ impl CurieGadget { ); Self { chain_id, - is_scroll_chain, + is_morph_chain, curie_fork_block_num, is_before_curie, } @@ -91,13 +91,13 @@ impl CurieGadget { ) -> Result<(), Error> { self.chain_id .assign(region, offset, Value::known(F::from(chain_id)))?; - self.is_scroll_chain.assign( + self.is_morph_chain.assign( region, offset, - (F::from(chain_id) - F::from(SCROLL_MAINNET_CHAIN_ID)) - * (F::from(chain_id) - F::from(SCROLL_DEVNET_CHAIN_ID)), + (F::from(chain_id) - F::from(MORPH_MAINNET_CHAIN_ID)) + * (F::from(chain_id) - F::from(MORPH_DEVNET_CHAIN_ID)), )?; - let curie_fork_block_num = if chain_id == SCROLL_TESTNET_CHAIN_ID { + let curie_fork_block_num = if chain_id == MORPH_TESTNET_CHAIN_ID { 0 } else { bus_mapping::circuit_input_builder::curie::get_curie_fork_block(chain_id) From 99db66682c39e635e865b6ec23fc213fecd2a22d Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:17:27 +0800 Subject: [PATCH 3/7] fix clippy --- bus-mapping/src/circuit_input_builder/curie.rs | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/bus-mapping/src/circuit_input_builder/curie.rs b/bus-mapping/src/circuit_input_builder/curie.rs index cce6e346c2..d6bf1f9d67 100644 --- a/bus-mapping/src/circuit_input_builder/curie.rs +++ b/bus-mapping/src/circuit_input_builder/curie.rs @@ -1,13 +1,10 @@ // Adapted from https://github.com/scroll-tech/go-ethereum/blob/8dc419a70b94f5ca185dcf818a48a3bd2eefc392/consensus/misc/curie.go -use eth_types::{ - utils::{hash_code, hash_code_keccak}, - ToWord, Word, -}; +use eth_types::Word; use crate::{ l2_predeployed::l1_gas_price_oracle, - operation::{AccountField, AccountOp, StorageOp, RW}, + operation::{StorageOp, RW}, Error, }; From 2de247477cfba16f111ecc536e527231c8d821f1 Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:38:46 +0800 Subject: [PATCH 4/7] fix test --- zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs | 3 ++- .../src/evm_circuit/util/common_gadget/tx_l1_fee.rs | 2 +- zkevm-circuits/src/witness/l1_msg.rs | 4 ++-- 3 files changed, 5 insertions(+), 4 deletions(-) diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs index 847311b339..534271af0b 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs @@ -41,10 +41,11 @@ impl CurieGadget { ); // TODO: refactor - // is_morph_chain means (chain_id - 53077) * (chain_id - 2710) == 0 + // is_morph_chain means (chain_id - 2818) * (chain_id - 2710) * (chain_id - 53077) == 0 let is_morph_chain = IsZeroGadget::construct( cb, (chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr()) + * (chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr()) * (chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()), ); diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget/tx_l1_fee.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget/tx_l1_fee.rs index 041e597db9..7afabe4018 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget/tx_l1_fee.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget/tx_l1_fee.rs @@ -466,7 +466,7 @@ mod tests { [6, 7, 8, 9, 10, 11].map(|i| witnesses[i].as_u64()); let l1_fee = TxL1Fee { - chain_id: eth_types::forks::SCROLL_DEVNET_CHAIN_ID, + chain_id: eth_types::forks::MORPH_DEVNET_CHAIN_ID, // block_number 5 is starting number for curie in test devnet. block_number: if is_curie == 1 { 5 + 1 } else { 1 }, base_fee: if is_curie == 1 { diff --git a/zkevm-circuits/src/witness/l1_msg.rs b/zkevm-circuits/src/witness/l1_msg.rs index a19a50eaa1..b1e3bc1417 100644 --- a/zkevm-circuits/src/witness/l1_msg.rs +++ b/zkevm-circuits/src/witness/l1_msg.rs @@ -42,7 +42,7 @@ pub fn rom_table_rows() -> Vec { mod tests { use bus_mapping::circuit_input_builder::TxL1Fee; use eth_types::{ - evm_types::gas_utils::tx_data_gas_cost, forks::SCROLL_MAINNET_CHAIN_ID, Transaction, + evm_types::gas_utils::tx_data_gas_cost, forks::MORPH_MAINNET_CHAIN_ID, Transaction, }; #[test] @@ -85,7 +85,7 @@ mod tests { ).unwrap(); let l1fee = TxL1Fee { - chain_id: SCROLL_MAINNET_CHAIN_ID, + chain_id: MORPH_MAINNET_CHAIN_ID, block_number: 1, base_fee: 0x64, fee_overhead: 0x17d4, From 48a6e27bee70504fbd3aecaf7e663475c6774e0f Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Thu, 4 Jul 2024 11:59:47 +0800 Subject: [PATCH 5/7] cargo fmt --- aggregator/src/core.rs | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/aggregator/src/core.rs b/aggregator/src/core.rs index c0b49f8914..6c44d0ad81 100644 --- a/aggregator/src/core.rs +++ b/aggregator/src/core.rs @@ -37,7 +37,7 @@ use crate::{ }, util::{assert_conditional_equal, assert_equal, parse_hash_preimage_cells}, RlcConfig, BITS, CHUNK_DATA_HASH_INDEX, CHUNK_TX_DATA_HASH_INDEX, LIMBS, POST_STATE_ROOT_INDEX, - PREV_STATE_ROOT_INDEX, WITHDRAW_ROOT_INDEX, SEQUENCER_ROOT_INDEX, + PREV_STATE_ROOT_INDEX, SEQUENCER_ROOT_INDEX, WITHDRAW_ROOT_INDEX, }; /// Subroutine for the witness generations. @@ -428,7 +428,7 @@ pub(crate) fn assign_keccak_table( // (2) chunk[i].piHash preimage = // (chain id || // chunk[i].prevStateRoot || chunk[i].postStateRoot || - // chunk[i].withdrawRoot || chunk[i].sequencerRoot || + // chunk[i].withdrawRoot || chunk[i].sequencerRoot || // chunk[i].datahash) // (3) batchDataHash preimage = // (chunk[0].dataHash || ... || chunk[k-1].dataHash) @@ -583,8 +583,7 @@ fn copy_constraints( )?; region.constrain_equal( batch_pi_hash_preimage[i + SEQUENCER_ROOT_INDEX].cell(), - chunk_pi_hash_preimages[N_SNARKS - 1][i + SEQUENCER_ROOT_INDEX] - .cell(), + chunk_pi_hash_preimages[N_SNARKS - 1][i + SEQUENCER_ROOT_INDEX].cell(), )?; } From 40484f96a462aa6cf6b3e24b71663873abc34882 Mon Sep 17 00:00:00 2001 From: Voidkai <825839697@qq.com> Date: Thu, 4 Jul 2024 12:51:23 +0800 Subject: [PATCH 6/7] refactor --- .../evm_circuit/util/common_gadget/curie.rs | 22 +++++++++---------- 1 file changed, 11 insertions(+), 11 deletions(-) diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs index 534271af0b..81ff6a3507 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs @@ -4,7 +4,7 @@ use crate::{ table::{FixedTableTag, Lookup}, util::{ constraint_builder::{ConstrainBuilderCommon, EVMConstraintBuilder}, - math_gadget::{IsZeroGadget, LtGadget}, + math_gadget::{LtGadget, BatchedIsZeroGadget}, }, }, table::BlockContextFieldTag, @@ -24,7 +24,7 @@ use halo2_proofs::{ pub(crate) struct CurieGadget { chain_id: Cell, /// Morph chains have non-zero curie hard fork block number - is_morph_chain: IsZeroGadget, + is_morph_chain: BatchedIsZeroGadget, /// The block height at which curie hard fork happens curie_fork_block_num: Cell, pub(crate) is_before_curie: LtGadget, // block num is u64 @@ -42,12 +42,13 @@ impl CurieGadget { // TODO: refactor // is_morph_chain means (chain_id - 2818) * (chain_id - 2710) * (chain_id - 53077) == 0 - let is_morph_chain = IsZeroGadget::construct( - cb, - (chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr()) - * (chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr()) - * (chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()), - ); + // let is_morph_chain = IsZeroGadget::construct( + // cb, + // (chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr()) + // * (chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr()) + // * (chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()), + // ); + let is_morph_chain = BatchedIsZeroGadget::construct(cb, [chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr(), chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr(), chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()]); // For Morph Networks (mainnet, testnet, devnet), // curie_fork_block_num should be pre-defined. @@ -95,8 +96,7 @@ impl CurieGadget { self.is_morph_chain.assign( region, offset, - (F::from(chain_id) - F::from(MORPH_MAINNET_CHAIN_ID)) - * (F::from(chain_id) - F::from(MORPH_DEVNET_CHAIN_ID)), + [F::from(chain_id) - F::from(MORPH_MAINNET_CHAIN_ID), F::from(chain_id) - F::from(MORPH_TESTNET_CHAIN_ID), F::from(chain_id) - F::from(MORPH_DEVNET_CHAIN_ID)] )?; let curie_fork_block_num = if chain_id == MORPH_TESTNET_CHAIN_ID { 0 @@ -116,4 +116,4 @@ impl CurieGadget { )?; Ok(()) } -} +} \ No newline at end of file From fc782beec4d302d38fdd6120be56a76d212b630e Mon Sep 17 00:00:00 2001 From: chengwenxi <22697326+chengwenxi@users.noreply.github.com> Date: Thu, 4 Jul 2024 14:52:48 +0800 Subject: [PATCH 7/7] cargo fmt --- .../evm_circuit/util/common_gadget/curie.rs | 21 ++++++++++++++----- 1 file changed, 16 insertions(+), 5 deletions(-) diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs index 81ff6a3507..dc4c075d9c 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget/curie.rs @@ -4,7 +4,7 @@ use crate::{ table::{FixedTableTag, Lookup}, util::{ constraint_builder::{ConstrainBuilderCommon, EVMConstraintBuilder}, - math_gadget::{LtGadget, BatchedIsZeroGadget}, + math_gadget::{BatchedIsZeroGadget, LtGadget}, }, }, table::BlockContextFieldTag, @@ -24,7 +24,7 @@ use halo2_proofs::{ pub(crate) struct CurieGadget { chain_id: Cell, /// Morph chains have non-zero curie hard fork block number - is_morph_chain: BatchedIsZeroGadget, + is_morph_chain: BatchedIsZeroGadget, /// The block height at which curie hard fork happens curie_fork_block_num: Cell, pub(crate) is_before_curie: LtGadget, // block num is u64 @@ -48,7 +48,14 @@ impl CurieGadget { // * (chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr()) // * (chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()), // ); - let is_morph_chain = BatchedIsZeroGadget::construct(cb, [chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr(), chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr(), chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr()]); + let is_morph_chain = BatchedIsZeroGadget::construct( + cb, + [ + chain_id.expr() - MORPH_MAINNET_CHAIN_ID.expr(), + chain_id.expr() - MORPH_TESTNET_CHAIN_ID.expr(), + chain_id.expr() - MORPH_DEVNET_CHAIN_ID.expr(), + ], + ); // For Morph Networks (mainnet, testnet, devnet), // curie_fork_block_num should be pre-defined. @@ -96,7 +103,11 @@ impl CurieGadget { self.is_morph_chain.assign( region, offset, - [F::from(chain_id) - F::from(MORPH_MAINNET_CHAIN_ID), F::from(chain_id) - F::from(MORPH_TESTNET_CHAIN_ID), F::from(chain_id) - F::from(MORPH_DEVNET_CHAIN_ID)] + [ + F::from(chain_id) - F::from(MORPH_MAINNET_CHAIN_ID), + F::from(chain_id) - F::from(MORPH_TESTNET_CHAIN_ID), + F::from(chain_id) - F::from(MORPH_DEVNET_CHAIN_ID), + ], )?; let curie_fork_block_num = if chain_id == MORPH_TESTNET_CHAIN_ID { 0 @@ -116,4 +127,4 @@ impl CurieGadget { )?; Ok(()) } -} \ No newline at end of file +}