diff --git a/evm/src/cpu/kernel/global_metadata.rs b/evm/src/cpu/kernel/global_metadata.rs index b6daf7e6..ddc3c839 100644 --- a/evm/src/cpu/kernel/global_metadata.rs +++ b/evm/src/cpu/kernel/global_metadata.rs @@ -18,7 +18,7 @@ pub(crate) enum GlobalMetadata { TransactionTrieRoot = 5, /// A pointer to the root of the receipt trie within the `TrieData` buffer. ReceiptTrieRoot = 6, - /// The number of storage tries involved in this transaction. I.e. the number of values in + /// The number of storage tries involved in these transactions. I.e. the number of values in /// `StorageTrieAddresses`, `StorageTriePointers` and `StorageTrieCheckpointPointers`. NumStorageTries = 7, diff --git a/evm/src/generation/mod.rs b/evm/src/generation/mod.rs index 7b54ea29..67b65c31 100644 --- a/evm/src/generation/mod.rs +++ b/evm/src/generation/mod.rs @@ -23,20 +23,20 @@ pub(crate) mod state; pub struct GenerationInputs { pub signed_txns: Vec>, - /// A partial version of the state trie prior to this transaction. It should include all nodes - /// that will be accessed by this transaction. + /// A partial version of the state trie prior to these transactions. It should include all nodes + /// that will be accessed by these transactions. pub state_trie: PartialTrie, - /// A partial version of the transaction trie prior to this transaction. It should include all - /// nodes that will be accessed by this transaction. + /// A partial version of the transaction trie prior to these transactions. It should include all + /// nodes that will be accessed by these transactions. pub transactions_trie: PartialTrie, - /// A partial version of the receipt trie prior to this transaction. It should include all nodes - /// that will be accessed by this transaction. + /// A partial version of the receipt trie prior to these transactions. It should include all nodes + /// that will be accessed by these transactions. pub receipts_trie: PartialTrie, - /// A partial version of each storage trie prior to this transaction. It should include all - /// storage tries, and nodes therein, that will be accessed by this transaction. + /// A partial version of each storage trie prior to these transactions. It should include all + /// storage tries, and nodes therein, that will be accessed by these transactions. pub storage_tries: Vec<(Address, PartialTrie)>, pub block_metadata: BlockMetadata, diff --git a/evm/src/proof.rs b/evm/src/proof.rs index 6cb47d33..81512c78 100644 --- a/evm/src/proof.rs +++ b/evm/src/proof.rs @@ -65,12 +65,13 @@ pub struct TrieRoots { #[derive(Debug, Clone, Default)] pub struct BlockMetadata { - pub block_coinbase: Address, + pub block_beneficiary: Address, pub block_timestamp: U256, pub block_number: U256, pub block_difficulty: U256, pub block_gaslimit: U256, pub block_chain_id: U256, + pub block_base_fee: U256, } /// Memory values which are public. @@ -88,12 +89,13 @@ pub struct TrieRootsTarget { } pub struct BlockMetadataTarget { - pub block_coinbase: [Target; 5], + pub block_beneficiary: [Target; 5], pub block_timestamp: Target, pub block_number: Target, pub block_difficulty: Target, pub block_gaslimit: Target, pub block_chain_id: Target, + pub block_base_fee: Target, } pub(crate) struct AllProofChallengesTarget { diff --git a/evm/src/recursive_verifier.rs b/evm/src/recursive_verifier.rs index a86ff06e..217a07f7 100644 --- a/evm/src/recursive_verifier.rs +++ b/evm/src/recursive_verifier.rs @@ -355,19 +355,21 @@ pub fn add_virtual_trie_roots, const D: usize>( pub fn add_virtual_block_metadata, const D: usize>( builder: &mut CircuitBuilder, ) -> BlockMetadataTarget { - let block_coinbase = builder.add_virtual_target_arr(); + let block_beneficiary = builder.add_virtual_target_arr(); let block_timestamp = builder.add_virtual_target(); let block_number = builder.add_virtual_target(); let block_difficulty = builder.add_virtual_target(); let block_gaslimit = builder.add_virtual_target(); let block_chain_id = builder.add_virtual_target(); + let block_base_fee = builder.add_virtual_target(); BlockMetadataTarget { - block_coinbase, + block_beneficiary, block_timestamp, block_number, block_difficulty, block_gaslimit, block_chain_id, + block_base_fee, } } @@ -524,8 +526,8 @@ pub fn set_block_metadata_target( W: Witness, { witness.set_target_arr( - block_metadata_target.block_coinbase, - h160_limbs(block_metadata.block_coinbase), + block_metadata_target.block_beneficiary, + h160_limbs(block_metadata.block_beneficiary), ); witness.set_target( block_metadata_target.block_timestamp, @@ -547,4 +549,8 @@ pub fn set_block_metadata_target( block_metadata_target.block_chain_id, F::from_canonical_u64(block_metadata.block_chain_id.as_u64()), ); + witness.set_target( + block_metadata_target.block_base_fee, + F::from_canonical_u64(block_metadata.block_base_fee.as_u64()), + ); } diff --git a/evm/src/util.rs b/evm/src/util.rs index 5b75c999..ae5281db 100644 --- a/evm/src/util.rs +++ b/evm/src/util.rs @@ -47,7 +47,7 @@ pub(crate) fn u256_limbs(u256: U256) -> [F; 8] { u256.0 .into_iter() .flat_map(|limb_64| { - let lo = (limb_64 & 0xFFFFFFFF) as u32; + let lo = limb_64 as u32; let hi = (limb_64 >> 32) as u32; [lo, hi] })