diff --git a/evm_arithmetization/src/cpu/columns/general.rs b/evm_arithmetization/src/cpu/columns/general.rs index 5ab033b82..97f8b8f49 100644 --- a/evm_arithmetization/src/cpu/columns/general.rs +++ b/evm_arithmetization/src/cpu/columns/general.rs @@ -95,7 +95,7 @@ impl CpuGeneralColumnsView { /// View of the column for context pruning. /// SAFETY: Each view is a valid interpretation of the underlying array. - pub(crate) fn context_pruning(&self) -> &CpuContextPruningView { + pub(crate) const fn context_pruning(&self) -> &CpuContextPruningView { unsafe { &self.context_pruning } } diff --git a/evm_arithmetization/src/cpu/kernel/interpreter.rs b/evm_arithmetization/src/cpu/kernel/interpreter.rs index f6e9b67ed..12384b3a8 100644 --- a/evm_arithmetization/src/cpu/kernel/interpreter.rs +++ b/evm_arithmetization/src/cpu/kernel/interpreter.rs @@ -427,7 +427,7 @@ impl Interpreter { } /// Returns the max number of CPU cycles. - pub(crate) fn get_max_cpu_len_log(&self) -> Option { + pub(crate) const fn get_max_cpu_len_log(&self) -> Option { self.max_cpu_len_log } diff --git a/evm_arithmetization/src/generation/linked_list.rs b/evm_arithmetization/src/generation/linked_list.rs index a89e49657..d8a313c90 100644 --- a/evm_arithmetization/src/generation/linked_list.rs +++ b/evm_arithmetization/src/generation/linked_list.rs @@ -32,14 +32,14 @@ pub(crate) fn empty_list_mem(segment: Segment) -> [Option; } impl<'a, const N: usize> LinkedList<'a, N> { - pub fn from_mem_and_segment( + pub const fn from_mem_and_segment( mem: &'a [Option], segment: Segment, ) -> Result { Self::from_mem_len_and_segment(mem, segment) } - pub fn from_mem_len_and_segment( + pub const fn from_mem_len_and_segment( mem: &'a [Option], segment: Segment, ) -> Result { diff --git a/evm_arithmetization/src/generation/mpt.rs b/evm_arithmetization/src/generation/mpt.rs index 36f520d9f..adb89b5a6 100644 --- a/evm_arithmetization/src/generation/mpt.rs +++ b/evm_arithmetization/src/generation/mpt.rs @@ -133,7 +133,7 @@ fn parse_storage_value(value_rlp: &[u8]) -> Result, ProgramError> { Ok(vec![value]) } -fn parse_storage_value_no_return(_value_rlp: &[u8]) -> Result, ProgramError> { +const fn parse_storage_value_no_return(_value_rlp: &[u8]) -> Result, ProgramError> { Ok(vec![]) } diff --git a/evm_arithmetization/src/generation/segments.rs b/evm_arithmetization/src/generation/segments.rs index 424ace9ad..cc90154dc 100644 --- a/evm_arithmetization/src/generation/segments.rs +++ b/evm_arithmetization/src/generation/segments.rs @@ -33,7 +33,7 @@ pub struct GenerationSegmentData { impl GenerationSegmentData { /// Retrieves the index of this segment. - pub fn segment_index(&self) -> usize { + pub const fn segment_index(&self) -> usize { self.segment_index } } diff --git a/evm_arithmetization/src/proof.rs b/evm_arithmetization/src/proof.rs index 6c59b9deb..27f71f8c1 100644 --- a/evm_arithmetization/src/proof.rs +++ b/evm_arithmetization/src/proof.rs @@ -925,7 +925,7 @@ pub enum BurnAddrTarget { } impl BurnAddrTarget { - pub fn get_size() -> usize { + pub const fn get_size() -> usize { match cfg!(feature = "cdk_erigon") { true => 8, false => 0, diff --git a/proof_gen/src/proof_types.rs b/proof_gen/src/proof_types.rs index ddca989da..20be552d9 100644 --- a/proof_gen/src/proof_types.rs +++ b/proof_gen/src/proof_types.rs @@ -125,7 +125,7 @@ impl BatchAggregatableProof { } } - pub(crate) fn is_agg(&self) -> bool { + pub(crate) const fn is_agg(&self) -> bool { match self { BatchAggregatableProof::Segment(_) => false, BatchAggregatableProof::Txn(_) => false, @@ -133,7 +133,7 @@ impl BatchAggregatableProof { } } - pub(crate) fn intern(&self) -> &PlonkyProofIntern { + pub(crate) const fn intern(&self) -> &PlonkyProofIntern { match self { BatchAggregatableProof::Segment(info) => &info.intern, BatchAggregatableProof::Txn(info) => &info.intern, diff --git a/trace_decoder/src/typed_mpt.rs b/trace_decoder/src/typed_mpt.rs index 8409e74c0..5a49966a6 100644 --- a/trace_decoder/src/typed_mpt.rs +++ b/trace_decoder/src/typed_mpt.rs @@ -58,7 +58,7 @@ impl TypedMpt { let bytes = self.inner.get(key.into_nibbles())?; Some(rlp::decode(bytes).expect(Self::PANIC_MSG)) } - fn as_hashed_partial_trie(&self) -> &HashedPartialTrie { + const fn as_hashed_partial_trie(&self) -> &HashedPartialTrie { &self.inner } fn as_mut_hashed_partial_trie_unchecked(&mut self) -> &mut HashedPartialTrie { @@ -198,7 +198,7 @@ impl TransactionTrie { pub fn root(&self) -> H256 { self.untyped.hash() } - pub fn as_hashed_partial_trie(&self) -> &mpt_trie::partial_trie::HashedPartialTrie { + pub const fn as_hashed_partial_trie(&self) -> &mpt_trie::partial_trie::HashedPartialTrie { &self.untyped } } @@ -224,7 +224,7 @@ impl ReceiptTrie { pub fn root(&self) -> H256 { self.untyped.hash() } - pub fn as_hashed_partial_trie(&self) -> &mpt_trie::partial_trie::HashedPartialTrie { + pub const fn as_hashed_partial_trie(&self) -> &mpt_trie::partial_trie::HashedPartialTrie { &self.untyped } } @@ -259,7 +259,7 @@ impl StateMpt { .iter() .map(|(key, rlp)| (key.into_hash().expect("key is always H256"), rlp)) } - pub fn as_hashed_partial_trie(&self) -> &mpt_trie::partial_trie::HashedPartialTrie { + pub const fn as_hashed_partial_trie(&self) -> &mpt_trie::partial_trie::HashedPartialTrie { self.typed.as_hashed_partial_trie() } pub fn root(&self) -> H256 { @@ -392,7 +392,7 @@ impl StorageTrie { pub fn root(&self) -> H256 { self.untyped.hash() } - pub fn as_hashed_partial_trie(&self) -> &HashedPartialTrie { + pub const fn as_hashed_partial_trie(&self) -> &HashedPartialTrie { &self.untyped }