From 9ad99e78a28371d49022068d5cd67b7f74758244 Mon Sep 17 00:00:00 2001 From: "sm.wu" Date: Tue, 20 Jun 2023 12:50:17 +0800 Subject: [PATCH] add int decomposition type --- .../src/evm_circuit/execution/balance.rs | 13 +----- .../src/evm_circuit/execution/begin_tx.rs | 13 +----- .../src/evm_circuit/execution/create.rs | 1 - .../execution/error_oog_memory_copy.rs | 13 ++---- .../execution/error_write_protection.rs | 12 ++---- .../src/evm_circuit/execution/extcodecopy.rs | 1 - .../src/evm_circuit/execution/extcodehash.rs | 1 - .../src/evm_circuit/execution/extcodesize.rs | 1 - .../src/evm_circuit/execution/jump.rs | 13 +----- .../src/evm_circuit/execution/memory.rs | 12 ++---- .../src/evm_circuit/execution/origin.rs | 11 +---- .../evm_circuit/execution/returndatacopy.rs | 14 ++---- zkevm-circuits/src/evm_circuit/util.rs | 43 +++---------------- .../src/evm_circuit/util/common_gadget.rs | 11 ++--- .../evm_circuit/util/constraint_builder.rs | 17 ++------ .../src/evm_circuit/util/math_gadget/rlp.rs | 18 +++++--- .../src/evm_circuit/util/memory_gadget.rs | 16 +++---- zkevm-circuits/src/util.rs | 1 + 18 files changed, 54 insertions(+), 157 deletions(-) diff --git a/zkevm-circuits/src/evm_circuit/execution/balance.rs b/zkevm-circuits/src/evm_circuit/execution/balance.rs index 8d173810c07..ff9ff8e0bc3 100644 --- a/zkevm-circuits/src/evm_circuit/execution/balance.rs +++ b/zkevm-circuits/src/evm_circuit/execution/balance.rs @@ -1,7 +1,6 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::N_BYTES_ACCOUNT_ADDRESS, step::ExecutionState, util::{ common_gadget::SameContextGadget, @@ -20,7 +19,7 @@ use crate::{ Expr, }, }; -use eth_types::{evm_types::GasCost, Field, ToLittleEndian, ToWord}; +use eth_types::{evm_types::GasCost, Field, ToWord}; use halo2_proofs::{circuit::Value, plonk::Error}; #[derive(Clone, Debug)] @@ -119,15 +118,7 @@ impl ExecutionGadget for BalanceGadget { self.same_context.assign_exec_step(region, offset, step)?; let address = block.get_rws(step, 0).stack_value(); - self.address.assign( - region, - offset, - Some( - address.to_le_bytes()[0..N_BYTES_ACCOUNT_ADDRESS] - .try_into() - .unwrap(), - ), - )?; + self.address.assign_u256(region, offset, address)?; self.tx_id .assign(region, offset, Value::known(F::from(tx.id as u64)))?; diff --git a/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs b/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs index 2da417f80f1..457a68ffbaa 100644 --- a/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs +++ b/zkevm-circuits/src/evm_circuit/execution/begin_tx.rs @@ -34,7 +34,6 @@ use halo2_proofs::{ circuit::Value, plonk::{Error, Expression}, }; -use itertools::Itertools; #[derive(Clone, Debug)] pub(crate) struct BeginTxGadget { @@ -252,7 +251,6 @@ impl ExecutionGadget for BeginTxGadget { .to_vec() .try_into() .unwrap(), - 256.expr(), ) .to_word(), ); @@ -554,21 +552,14 @@ impl ExecutionGadget for BeginTxGadget { )?; self.tx_callee_address .assign_h160(region, offset, tx.callee_address)?; - self.call_callee_address.assign( + self.call_callee_address.assign_h160( region, offset, if tx.is_create { get_contract_address(tx.caller_address, tx.nonce) } else { tx.callee_address - } - .to_fixed_bytes() - .iter() - .rev() - .copied() - .collect_vec() - .try_into() - .ok(), + }, )?; self.is_caller_callee_equal.assign( region, diff --git a/zkevm-circuits/src/evm_circuit/execution/create.rs b/zkevm-circuits/src/evm_circuit/execution/create.rs index 6e7dc1b1aa2..acc57bb7598 100644 --- a/zkevm-circuits/src/evm_circuit/execution/create.rs +++ b/zkevm-circuits/src/evm_circuit/execution/create.rs @@ -109,7 +109,6 @@ impl ExecutionGadget< .to_vec() .try_into() .unwrap(), - 256.expr(), ); // stack operations diff --git a/zkevm-circuits/src/evm_circuit/execution/error_oog_memory_copy.rs b/zkevm-circuits/src/evm_circuit/execution/error_oog_memory_copy.rs index 61ab95a83d1..81d142dc663 100644 --- a/zkevm-circuits/src/evm_circuit/execution/error_oog_memory_copy.rs +++ b/zkevm-circuits/src/evm_circuit/execution/error_oog_memory_copy.rs @@ -1,7 +1,7 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::{N_BYTES_ACCOUNT_ADDRESS, N_BYTES_GAS, N_BYTES_MEMORY_WORD_SIZE}, + param::{N_BYTES_GAS, N_BYTES_MEMORY_WORD_SIZE}, step::ExecutionState, util::{ common_gadget::CommonErrorGadget, @@ -20,7 +20,7 @@ use crate::{ }; use eth_types::{ evm_types::{GasCost, OpcodeId}, - Field, ToLittleEndian, U256, + Field, U256, }; use halo2_proofs::{circuit::Value, plonk::Error}; @@ -186,13 +186,8 @@ impl ExecutionGadget for ErrorOOGMemoryCopyGadget { .assign(region, offset, Value::known(F::from(u64::from(is_warm))))?; self.tx_id .assign(region, offset, Value::known(F::from(transaction.id as u64)))?; - self.external_address.assign( - region, - offset, - external_address.to_le_bytes()[0..N_BYTES_ACCOUNT_ADDRESS] - .try_into() - .ok(), - )?; + self.external_address + .assign_u256(region, offset, external_address)?; self.src_offset.assign_u256(region, offset, src_offset)?; let memory_addr = self .dst_memory_addr diff --git a/zkevm-circuits/src/evm_circuit/execution/error_write_protection.rs b/zkevm-circuits/src/evm_circuit/execution/error_write_protection.rs index b4652250a75..f68b1d71bd7 100644 --- a/zkevm-circuits/src/evm_circuit/execution/error_write_protection.rs +++ b/zkevm-circuits/src/evm_circuit/execution/error_write_protection.rs @@ -1,7 +1,6 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::N_BYTES_ACCOUNT_ADDRESS, step::ExecutionState, util::{ common_gadget::CommonErrorGadget, @@ -17,7 +16,7 @@ use crate::{ Expr, }, }; -use eth_types::{evm_types::OpcodeId, Field, ToLittleEndian, U256}; +use eth_types::{evm_types::OpcodeId, Field, U256}; use halo2_proofs::{circuit::Value, plonk::Error}; #[derive(Clone, Debug)] @@ -120,13 +119,8 @@ impl ExecutionGadget for ErrorWriteProtectionGadget { } self.gas.assign_u256(region, offset, gas)?; - self.code_address.assign( - region, - offset, - code_address.to_le_bytes()[0..N_BYTES_ACCOUNT_ADDRESS] - .try_into() - .ok(), - )?; + self.code_address + .assign_u256(region, offset, code_address)?; self.value.assign_u256(region, offset, value)?; self.is_call.assign( diff --git a/zkevm-circuits/src/evm_circuit/execution/extcodecopy.rs b/zkevm-circuits/src/evm_circuit/execution/extcodecopy.rs index 746199bac81..2b80d9dcf65 100644 --- a/zkevm-circuits/src/evm_circuit/execution/extcodecopy.rs +++ b/zkevm-circuits/src/evm_circuit/execution/extcodecopy.rs @@ -58,7 +58,6 @@ impl ExecutionGadget for ExtcodecopyGadget { .to_vec() .try_into() .unwrap(), - 256.expr(), ); let code_size = cb.query_cell(); diff --git a/zkevm-circuits/src/evm_circuit/execution/extcodehash.rs b/zkevm-circuits/src/evm_circuit/execution/extcodehash.rs index 6ead857b45a..38f729808eb 100644 --- a/zkevm-circuits/src/evm_circuit/execution/extcodehash.rs +++ b/zkevm-circuits/src/evm_circuit/execution/extcodehash.rs @@ -44,7 +44,6 @@ impl ExecutionGadget for ExtcodehashGadget { .to_vec() .try_into() .unwrap(), - 256.expr(), ); let tx_id = cb.call_context(None, CallContextFieldTag::TxId); diff --git a/zkevm-circuits/src/evm_circuit/execution/extcodesize.rs b/zkevm-circuits/src/evm_circuit/execution/extcodesize.rs index efbaba82fb2..273bec425f5 100644 --- a/zkevm-circuits/src/evm_circuit/execution/extcodesize.rs +++ b/zkevm-circuits/src/evm_circuit/execution/extcodesize.rs @@ -47,7 +47,6 @@ impl ExecutionGadget for ExtcodesizeGadget { .to_vec() .try_into() .unwrap(), - 256.expr(), ); cb.stack_pop_word(address_word.to_word()); diff --git a/zkevm-circuits/src/evm_circuit/execution/jump.rs b/zkevm-circuits/src/evm_circuit/execution/jump.rs index 632fda33d68..af644d01ab7 100644 --- a/zkevm-circuits/src/evm_circuit/execution/jump.rs +++ b/zkevm-circuits/src/evm_circuit/execution/jump.rs @@ -1,7 +1,6 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::N_BYTES_PROGRAM_COUNTER, step::ExecutionState, util::{ common_gadget::SameContextGadget, @@ -15,7 +14,7 @@ use crate::{ }, util::{word::WordExpr, Expr}, }; -use eth_types::{evm_types::OpcodeId, Field, ToLittleEndian}; +use eth_types::{evm_types::OpcodeId, Field}; use halo2_proofs::plonk::Error; #[derive(Clone, Debug)] @@ -67,15 +66,7 @@ impl ExecutionGadget for JumpGadget { self.same_context.assign_exec_step(region, offset, step)?; let destination = block.get_rws(step, 0).stack_value(); - self.destination.assign( - region, - offset, - Some( - destination.to_le_bytes()[..N_BYTES_PROGRAM_COUNTER] - .try_into() - .unwrap(), - ), - )?; + self.destination.assign_u256(region, offset, destination)?; Ok(()) } diff --git a/zkevm-circuits/src/evm_circuit/execution/memory.rs b/zkevm-circuits/src/evm_circuit/execution/memory.rs index b1edb0b4202..e120e4be065 100644 --- a/zkevm-circuits/src/evm_circuit/execution/memory.rs +++ b/zkevm-circuits/src/evm_circuit/execution/memory.rs @@ -1,7 +1,7 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::{N_BYTES_MEMORY_ADDRESS, N_BYTES_MEMORY_WORD_SIZE}, + param::N_BYTES_MEMORY_WORD_SIZE, step::ExecutionState, util::{ common_gadget::SameContextGadget, @@ -20,7 +20,7 @@ use crate::{ Expr, }, }; -use eth_types::{evm_types::OpcodeId, Field, ToLittleEndian}; +use eth_types::{evm_types::OpcodeId, Field}; use halo2_proofs::plonk::Error; #[derive(Clone, Debug)] @@ -129,13 +129,7 @@ impl ExecutionGadget for MemoryGadget { // Inputs/Outputs let [address, value] = [0, 1].map(|index| block.get_rws(step, index).stack_value()); - self.address.assign( - region, - offset, - address.to_le_bytes()[0..N_BYTES_MEMORY_ADDRESS] - .try_into() - .ok(), - )?; + self.address.assign_u256(region, offset, address)?; self.value.assign_u256(region, offset, value)?; // Check if this is an MLOAD diff --git a/zkevm-circuits/src/evm_circuit/execution/origin.rs b/zkevm-circuits/src/evm_circuit/execution/origin.rs index 6507583e747..27f201fabf3 100644 --- a/zkevm-circuits/src/evm_circuit/execution/origin.rs +++ b/zkevm-circuits/src/evm_circuit/execution/origin.rs @@ -1,7 +1,6 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::N_BYTES_ACCOUNT_ADDRESS, step::ExecutionState, util::{ common_gadget::SameContextGadget, @@ -14,7 +13,7 @@ use crate::{ util::{word::WordExpr, Expr}, }; use bus_mapping::evm::OpcodeId; -use eth_types::{Field, ToLittleEndian}; +use eth_types::Field; use halo2_proofs::{circuit::Value, plonk::Error}; #[derive(Clone, Debug)] @@ -79,13 +78,7 @@ impl ExecutionGadget for OriginGadget { .assign(region, offset, Value::known(F::from(tx.id as u64)))?; // Assign Origin addr. - self.origin.assign( - region, - offset, - origin.to_le_bytes()[..N_BYTES_ACCOUNT_ADDRESS] - .try_into() - .ok(), - )?; + self.origin.assign_u256(region, offset, origin)?; // Assign SameContextGadget witnesses. self.same_context.assign_exec_step(region, offset, step)?; diff --git a/zkevm-circuits/src/evm_circuit/execution/returndatacopy.rs b/zkevm-circuits/src/evm_circuit/execution/returndatacopy.rs index 51e934ae5b5..6bda0ef5708 100644 --- a/zkevm-circuits/src/evm_circuit/execution/returndatacopy.rs +++ b/zkevm-circuits/src/evm_circuit/execution/returndatacopy.rs @@ -1,7 +1,7 @@ use crate::{ evm_circuit::{ execution::ExecutionGadget, - param::{N_BYTES_MEMORY_ADDRESS, N_BYTES_MEMORY_WORD_SIZE}, + param::N_BYTES_MEMORY_WORD_SIZE, step::ExecutionState, util::{ common_gadget::SameContextGadget, @@ -22,7 +22,7 @@ use crate::{ }, }; use bus_mapping::{circuit_input_builder::CopyDataType, evm::OpcodeId}; -use eth_types::{evm_types::GasCost, Field, ToLittleEndian, ToScalar}; +use eth_types::{evm_types::GasCost, Field, ToScalar}; use gadgets::util::not; use halo2_proofs::{circuit::Value, plonk::Error}; @@ -176,15 +176,7 @@ impl ExecutionGadget for ReturnDataCopyGadget { let [dest_offset, data_offset, size] = [0, 1, 2].map(|index| block.get_rws(step, index).stack_value()); - self.data_offset.assign( - region, - offset, - Some( - data_offset.to_le_bytes()[..N_BYTES_MEMORY_ADDRESS] - .try_into() - .unwrap(), - ), - )?; + self.data_offset.assign_u256(region, offset, data_offset)?; let [last_callee_id, return_data_offset, return_data_size] = [ (3, CallContextFieldTag::LastCalleeId), diff --git a/zkevm-circuits/src/evm_circuit/util.rs b/zkevm-circuits/src/evm_circuit/util.rs index f623edcdf42..672c7960877 100644 --- a/zkevm-circuits/src/evm_circuit/util.rs +++ b/zkevm-circuits/src/evm_circuit/util.rs @@ -10,6 +10,7 @@ use crate::{ }, table::Table, }, + util::int_decomposition::IntDecomposition, witness::{Block, ExecStep, Rw, RwMap}, }; use bus_mapping::state_db::CodeDB; @@ -36,7 +37,7 @@ pub use gadgets::util::{and, not, or, select, sum}; use super::param::{N_BYTES_ACCOUNT_ADDRESS, N_BYTES_U64}; #[derive(Clone, Debug)] -pub(crate) struct Cell { +pub struct Cell { // expression for constraint expression: Expression, column: Column, @@ -490,6 +491,7 @@ pub struct RandomLinearCombination { impl RandomLinearCombination { const N_BYTES: usize = N; + /// XXX for randomness 256.expr(), consider using IntDecomposition instead pub(crate) fn new(cells: [Cell; N], randomness: Expression) -> Self { Self { expression: rlc::expr(&cells.clone().map(|cell| cell.expr()), randomness), @@ -521,44 +523,11 @@ impl Expr for RandomLinearCombination { } } -pub(crate) type MemoryAddress = RandomLinearCombination; +pub(crate) type MemoryAddress = IntDecomposition; -impl WordExpr for MemoryAddress { - fn to_word(&self) -> Word> { - Word::from_lo_unchecked(self.expr()) - } -} - -pub(crate) type AccountAddress = RandomLinearCombination; - -impl WordExpr for AccountAddress { - fn to_word(&self) -> Word> { - Word::new([ - rlc::expr( - &self.cells[0..16] - .iter() - .map(|cell| cell.expr()) - .collect_vec(), - 256.expr(), - ), - rlc::expr( - &self.cells[16..] - .iter() - .map(|cell| cell.expr()) - .collect_vec(), - 256.expr(), - ), - ]) - } -} - -pub(crate) type U64Cell = RandomLinearCombination; +pub(crate) type AccountAddress = IntDecomposition; -impl WordExpr for U64Cell { - fn to_word(&self) -> Word> { - Word::from_lo_unchecked(self.expr()) - } -} +pub(crate) type U64Cell = IntDecomposition; /// Decodes a field element from its byte representation in little endian order pub(crate) mod from_bytes { diff --git a/zkevm-circuits/src/evm_circuit/util/common_gadget.rs b/zkevm-circuits/src/evm_circuit/util/common_gadget.rs index d62600d854c..536b5558ad6 100644 --- a/zkevm-circuits/src/evm_circuit/util/common_gadget.rs +++ b/zkevm-circuits/src/evm_circuit/util/common_gadget.rs @@ -7,7 +7,7 @@ use super::{ }; use crate::{ evm_circuit::{ - param::{N_BYTES_ACCOUNT_ADDRESS, N_BYTES_GAS, N_BYTES_MEMORY_WORD_SIZE}, + param::{N_BYTES_GAS, N_BYTES_MEMORY_WORD_SIZE}, step::ExecutionState, table::{FixedTableTag, Lookup}, util::{ @@ -756,13 +756,8 @@ impl CommonCallGadget callee_code_hash: U256, ) -> Result { self.gas.assign_u256(region, offset, gas)?; - self.callee_address_word.assign( - region, - offset, - callee_address.to_le_bytes()[0..N_BYTES_ACCOUNT_ADDRESS] - .try_into() - .ok(), - )?; + self.callee_address_word + .assign_u256(region, offset, callee_address)?; self.value.assign_u256(region, offset, value)?; if IS_SUCCESS_CALL { self.is_success diff --git a/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs b/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs index 3347e76385f..65ce6106ca7 100644 --- a/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs +++ b/zkevm-circuits/src/evm_circuit/util/constraint_builder.rs @@ -477,15 +477,15 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { } pub(crate) fn query_u64(&mut self) -> U64Cell { - U64Cell::new(self.query_bytes(), 256u64.expr()) + U64Cell::new(self.query_bytes()) } pub(crate) fn query_account_address(&mut self) -> AccountAddress { - AccountAddress::::new(self.query_bytes(), 256u64.expr()) + AccountAddress::::new(self.query_bytes()) } pub(crate) fn query_memory_address(&mut self) -> MemoryAddress { - MemoryAddress::::new(self.query_bytes(), 256u64.expr()) + MemoryAddress::::new(self.query_bytes()) } pub(crate) fn query_bytes(&mut self) -> [Cell; N] { @@ -751,17 +751,6 @@ impl<'a, F: Field> EVMConstraintBuilder<'a, F> { word } - pub(crate) fn tx_context_as_account_address( - &mut self, - id: Expression, - field_tag: TxContextFieldTag, - index: Option>, - ) -> AccountAddress { - let word = self.query_account_address(); - self.tx_context_lookup_word(id, field_tag, index, word.to_word()); - word - } - pub(crate) fn tx_context_lookup_word( &mut self, id: Expression, diff --git a/zkevm-circuits/src/evm_circuit/util/math_gadget/rlp.rs b/zkevm-circuits/src/evm_circuit/util/math_gadget/rlp.rs index ede317c32f5..b9efe251ed3 100644 --- a/zkevm-circuits/src/evm_circuit/util/math_gadget/rlp.rs +++ b/zkevm-circuits/src/evm_circuit/util/math_gadget/rlp.rs @@ -1,4 +1,7 @@ -use crate::util::word::{Word32Cell, WordExpr}; +use crate::{ + evm_circuit::util::rlc, + util::word::{Word32Cell, WordExpr}, +}; use eth_types::{Address, Field, ToScalar, Word}; use gadgets::util::{and, expr_from_bytes, not, select, sum, Expr}; use halo2_proofs::{ @@ -217,7 +220,7 @@ pub struct ContractCreateGadget { impl ContractCreateGadget { /// Configure and construct the gadget. pub(crate) fn construct(cb: &mut EVMConstraintBuilder) -> Self { - let caller_address = cb.query_keccak_rlc(); + let caller_address = cb.query_account_address(); let nonce = RlpU64Gadget::construct(cb); let code_hash = cb.query_word32(); let salt = cb.query_word32(); @@ -322,8 +325,11 @@ impl ContractCreateGadget { } /// Caller address' RLC value. - pub(crate) fn caller_address_rlc(&self) -> Expression { - self.caller_address.expr() + pub(crate) fn caller_address_rlc(&self, cb: &EVMConstraintBuilder) -> Expression { + rlc::expr( + &self.caller_address.limbs.clone().map(|x| x.expr()), + cb.challenges().keccak_input(), + ) } /// Caller nonce's RLC value. @@ -361,13 +367,13 @@ impl ContractCreateGadget { let challenge_power_64 = challenge_power_32.clone().square(); let challenge_power_84 = challenge_power_64.clone() * challenge_power_20; (0xff.expr() * challenge_power_84) - + (self.caller_address_rlc() * challenge_power_64) + + (self.caller_address_rlc(cb) * challenge_power_64) + (self.salt_keccak_rlc(cb) * challenge_power_32) + self.code_hash_keccak_rlc(cb) } else { // RLC(RLP([caller_address, caller_nonce])) let challenge_power_21 = challenges[20].clone(); - ((self.caller_address_rlc() + ((self.caller_address_rlc(cb) + (148.expr() * challenge_power_20) + ((213.expr() + self.nonce.rlp_length()) * challenge_power_21)) * self.nonce.challenge_power_rlp_length(cb)) diff --git a/zkevm-circuits/src/evm_circuit/util/memory_gadget.rs b/zkevm-circuits/src/evm_circuit/util/memory_gadget.rs index cbb18bf4818..1779f219aa1 100644 --- a/zkevm-circuits/src/evm_circuit/util/memory_gadget.rs +++ b/zkevm-circuits/src/evm_circuit/util/memory_gadget.rs @@ -1,4 +1,6 @@ -use super::{constraint_builder::ConstrainBuilderCommon, CachedRegion, MemoryAddress, WordExpr}; +use super::{ + constraint_builder::ConstrainBuilderCommon, from_bytes, CachedRegion, MemoryAddress, WordExpr, +}; use crate::{ evm_circuit::{ param::{N_BYTES_GAS, N_BYTES_MEMORY_ADDRESS, N_BYTES_MEMORY_WORD_SIZE}, @@ -87,7 +89,7 @@ impl MemoryAddressGadget { memory_offset_word: WordCell, memory_length: MemoryAddress, ) -> Self { - let memory_length_is_zero = IsZeroGadget::construct(cb, sum::expr(&memory_length.cells)); + let memory_length_is_zero = IsZeroGadget::construct(cb, memory_length.expr()); let memory_offset_bytes = cb.query_memory_address(); let has_length = 1.expr() - memory_length_is_zero.expr(); @@ -130,15 +132,13 @@ impl MemoryAddressGadget { )?; self.memory_offset_word .assign_u256(region, offset, memory_offset)?; - self.memory_length.assign( + self.memory_length + .assign_u256(region, offset, memory_length)?; + self.memory_length_is_zero.assign( region, offset, - memory_length_bytes[..N_BYTES_MEMORY_ADDRESS] - .try_into() - .ok(), + from_bytes::value(&memory_length_bytes), )?; - self.memory_length_is_zero - .assign(region, offset, sum::value(&memory_length_bytes))?; Ok(if memory_length_is_zero { 0 } else { diff --git a/zkevm-circuits/src/util.rs b/zkevm-circuits/src/util.rs index b669e5e2c80..6eea1764ed4 100644 --- a/zkevm-circuits/src/util.rs +++ b/zkevm-circuits/src/util.rs @@ -1,4 +1,5 @@ //! Common utility traits and functions. +pub mod int_decomposition; pub mod word; use bus_mapping::evm::OpcodeId;