From dbd8ff96f712080c29309d7ec1c9a263bd33cb9d Mon Sep 17 00:00:00 2001 From: rakita Date: Fri, 21 Jun 2024 13:22:02 +0200 Subject: [PATCH 01/11] feat(Prague): Skeleton for EIP-7702 --- crates/interpreter/src/gas/calc.rs | 9 ++ crates/interpreter/src/gas/constants.rs | 3 + crates/primitives/src/env.rs | 133 +++++++++++------- crates/primitives/src/result.rs | 6 + crates/revm/src/context/evm_context.rs | 2 + crates/revm/src/context/inner_evm_context.rs | 6 + .../src/handler/mainnet/post_execution.rs | 18 ++- crates/revm/src/handler/mainnet/validation.rs | 14 +- 8 files changed, 133 insertions(+), 58 deletions(-) diff --git a/crates/interpreter/src/gas/calc.rs b/crates/interpreter/src/gas/calc.rs index dd434fcd27..0b5d914912 100644 --- a/crates/interpreter/src/gas/calc.rs +++ b/crates/interpreter/src/gas/calc.rs @@ -1,3 +1,5 @@ +use revm_primitives::SpecId::PRAGUE; + use super::constants::*; use crate::{ num_words, @@ -358,6 +360,8 @@ pub fn validate_initial_tx_gas( input: &[u8], is_create: bool, access_list: &[(Address, Vec)], + // TODO authorization list items. + authorization_list_num: u64, ) -> u64 { let mut initial_gas = 0; let zero_data_len = input.iter().filter(|v| **v == 0).count() as u64; @@ -400,5 +404,10 @@ pub fn validate_initial_tx_gas( initial_gas += initcode_cost(input.len() as u64) } + // EIP-7702 + if spec_id.is_enabled_in(PRAGUE) { + initial_gas += authorization_list_num * PER_CONTRACT_CODE_BASE_COST; + } + initial_gas } diff --git a/crates/interpreter/src/gas/constants.rs b/crates/interpreter/src/gas/constants.rs index 7d7956a4e5..bf672864af 100644 --- a/crates/interpreter/src/gas/constants.rs +++ b/crates/interpreter/src/gas/constants.rs @@ -47,6 +47,9 @@ pub const COLD_ACCOUNT_ACCESS_COST: u64 = 2600; pub const WARM_STORAGE_READ_COST: u64 = 100; pub const WARM_SSTORE_RESET: u64 = SSTORE_RESET - COLD_SLOAD_COST; +/// EIP-7702 +pub const PER_CONTRACT_CODE_BASE_COST: u64 = 2400; + /// EIP-3860 : Limit and meter initcode pub const INITCODE_WORD_COST: u64 = 2; diff --git a/crates/primitives/src/env.rs b/crates/primitives/src/env.rs index fde04c5734..7a42bd4688 100644 --- a/crates/primitives/src/env.rs +++ b/crates/primitives/src/env.rs @@ -92,6 +92,25 @@ impl Env { /// Return initial spend gas (Gas needed to execute transaction). #[inline] pub fn validate_tx(&self) -> Result<(), InvalidTransaction> { + // Check if the transaction's chain id is correct + if let Some(tx_chain_id) = self.tx.chain_id { + if tx_chain_id != self.cfg.chain_id { + return Err(InvalidTransaction::InvalidChainId); + } + } + + // Check if gas_limit is more than block_gas_limit + if !self.cfg.is_block_gas_limit_disabled() + && U256::from(self.tx.gas_limit) > self.block.gas_limit + { + return Err(InvalidTransaction::CallerGasLimitMoreThanBlock); + } + + // Check that access list is empty for transactions before BERLIN + if !SPEC::enabled(SpecId::BERLIN) && !self.tx.access_list.is_empty() { + return Err(InvalidTransaction::AccessListNotSupported); + } + // BASEFEE tx check if SPEC::enabled(SpecId::LONDON) { if let Some(priority_fee) = self.tx.gas_priority_fee { @@ -109,13 +128,6 @@ impl Env { } } - // Check if gas_limit is more than block_gas_limit - if !self.cfg.is_block_gas_limit_disabled() - && U256::from(self.tx.gas_limit) > self.block.gas_limit - { - return Err(InvalidTransaction::CallerGasLimitMoreThanBlock); - } - // EIP-3860: Limit and meter initcode if SPEC::enabled(SpecId::SHANGHAI) && self.tx.transact_to.is_create() { let max_initcode_size = self @@ -128,65 +140,66 @@ impl Env { } } - // Check if the transaction's chain id is correct - if let Some(tx_chain_id) = self.tx.chain_id { - if tx_chain_id != self.cfg.chain_id { - return Err(InvalidTransaction::InvalidChainId); - } - } - - // Check that access list is empty for transactions before BERLIN - if !SPEC::enabled(SpecId::BERLIN) && !self.tx.access_list.is_empty() { - return Err(InvalidTransaction::AccessListNotSupported); + // - For before CANCUN, check that `blob_hashes` and `max_fee_per_blob_gas` are empty / not set + if !SPEC::enabled(SpecId::CANCUN) + && (self.tx.max_fee_per_blob_gas.is_some() || !self.tx.blob_hashes.is_empty()) + { + return Err(InvalidTransaction::BlobVersionedHashesNotSupported); } - // - For CANCUN and later, check that the gas price is not more than the tx max - // - For before CANCUN, check that `blob_hashes` and `max_fee_per_blob_gas` are empty / not set - if SPEC::enabled(SpecId::CANCUN) { - // Presence of max_fee_per_blob_gas means that this is blob transaction. - if let Some(max) = self.tx.max_fee_per_blob_gas { - // ensure that the user was willing to at least pay the current blob gasprice - let price = self.block.get_blob_gasprice().expect("already checked"); - if U256::from(price) > max { - return Err(InvalidTransaction::BlobGasPriceGreaterThanMax); - } + // Presence of max_fee_per_blob_gas means that this is blob transaction. + if let Some(max) = self.tx.max_fee_per_blob_gas { + // ensure that the user was willing to at least pay the current blob gasprice + let price = self.block.get_blob_gasprice().expect("already checked"); + if U256::from(price) > max { + return Err(InvalidTransaction::BlobGasPriceGreaterThanMax); + } - // there must be at least one blob - if self.tx.blob_hashes.is_empty() { - return Err(InvalidTransaction::EmptyBlobs); - } + // there must be at least one blob + if self.tx.blob_hashes.is_empty() { + return Err(InvalidTransaction::EmptyBlobs); + } - // The field `to` deviates slightly from the semantics with the exception - // that it MUST NOT be nil and therefore must always represent - // a 20-byte address. This means that blob transactions cannot - // have the form of a create transaction. - if self.tx.transact_to.is_create() { - return Err(InvalidTransaction::BlobCreateTransaction); - } + // The field `to` deviates slightly from the semantics with the exception + // that it MUST NOT be nil and therefore must always represent + // a 20-byte address. This means that blob transactions cannot + // have the form of a create transaction. + if self.tx.transact_to.is_create() { + return Err(InvalidTransaction::BlobCreateTransaction); + } - // all versioned blob hashes must start with VERSIONED_HASH_VERSION_KZG - for blob in self.tx.blob_hashes.iter() { - if blob[0] != VERSIONED_HASH_VERSION_KZG { - return Err(InvalidTransaction::BlobVersionNotSupported); - } + // all versioned blob hashes must start with VERSIONED_HASH_VERSION_KZG + for blob in self.tx.blob_hashes.iter() { + if blob[0] != VERSIONED_HASH_VERSION_KZG { + return Err(InvalidTransaction::BlobVersionNotSupported); } + } - // ensure the total blob gas spent is at most equal to the limit - // assert blob_gas_used <= MAX_BLOB_GAS_PER_BLOCK - let num_blobs = self.tx.blob_hashes.len(); - if num_blobs > MAX_BLOB_NUMBER_PER_BLOCK as usize { - return Err(InvalidTransaction::TooManyBlobs { - have: num_blobs, - max: MAX_BLOB_NUMBER_PER_BLOCK as usize, - }); - } + // ensure the total blob gas spent is at most equal to the limit + // assert blob_gas_used <= MAX_BLOB_GAS_PER_BLOCK + let num_blobs = self.tx.blob_hashes.len(); + if num_blobs > MAX_BLOB_NUMBER_PER_BLOCK as usize { + return Err(InvalidTransaction::TooManyBlobs { + have: num_blobs, + max: MAX_BLOB_NUMBER_PER_BLOCK as usize, + }); } } else { + // if max_fee_per_blob_gas is not set, then blob_hashes must be empty if !self.tx.blob_hashes.is_empty() { return Err(InvalidTransaction::BlobVersionedHashesNotSupported); } - if self.tx.max_fee_per_blob_gas.is_some() { - return Err(InvalidTransaction::MaxFeePerBlobGasNotSupported); + } + + // check if EIP-7702 transaction is enabled. + if !SPEC::enabled(SpecId::PRAGUE) && self.tx.authorization_list.is_some() { + return Err(InvalidTransaction::AuthorizationListNotSupported); + } + + if self.tx.authorization_list.is_some() { + // Check if other fields are unset. + if self.tx.max_fee_per_blob_gas.is_some() || !self.tx.blob_hashes.is_empty() { + return Err(InvalidTransaction::AuthorizationListInvalidFields); } } @@ -509,6 +522,7 @@ pub struct TxEnv { pub value: U256, /// The data of the transaction. pub data: Bytes, + /// The nonce of the transaction. /// /// Caution: If set to `None`, then nonce validation against the account's nonce is skipped: [InvalidTransaction::NonceTooHigh] and [InvalidTransaction::NonceTooLow] @@ -550,6 +564,16 @@ pub struct TxEnv { /// [EIP-4844]: https://eips.ethereum.org/EIPS/eip-4844 pub max_fee_per_blob_gas: Option, + /// List of authorizations, that contains the signature that authorizes this + /// caller to place the code to signer account. + /// + /// Set EOA account code for one transaction + /// + /// [EIP-Set EOA account code for one transaction](https://eips.ethereum.org/EIPS/eip-7702) + /// + /// TODO: include from alloy/eips crate. + pub authorization_list: Option>, + #[cfg_attr(feature = "serde", serde(flatten))] #[cfg(feature = "optimism")] /// Optimism fields. @@ -594,6 +618,7 @@ impl Default for TxEnv { access_list: Vec::new(), blob_hashes: Vec::new(), max_fee_per_blob_gas: None, + authorization_list: None, #[cfg(feature = "optimism")] optimism: OptimismFields::default(), } diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index 2a61883a89..4ea5bf4cb4 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -252,6 +252,10 @@ pub enum InvalidTransaction { BlobVersionNotSupported, /// EOF crate should have `to` address EofCrateShouldHaveToAddress, + /// EIP-7702 is not enabled. + AuthorizationListNotSupported, + /// EIP-7702 transaction has invalid fields set. + AuthorizationListInvalidFields, /// System transactions are not supported post-regolith hardfork. /// /// Before the Regolith hardfork, there was a special field in the `Deposit` transaction @@ -343,6 +347,8 @@ impl fmt::Display for InvalidTransaction { } Self::BlobVersionNotSupported => write!(f, "blob version not supported"), Self::EofCrateShouldHaveToAddress => write!(f, "EOF crate should have `to` address"), + Self::AuthorizationListNotSupported => write!(f, "authorization list not supported"), + Self::AuthorizationListInvalidFields => write!(f, "authorization list tx has invalid fields"), #[cfg(feature = "optimism")] Self::DepositSystemTxPostRegolith => { write!( diff --git a/crates/revm/src/context/evm_context.rs b/crates/revm/src/context/evm_context.rs index e297579b46..7acc0de159 100644 --- a/crates/revm/src/context/evm_context.rs +++ b/crates/revm/src/context/evm_context.rs @@ -284,6 +284,7 @@ pub(crate) mod test_utils { journaled_state: JournaledState::new(SpecId::CANCUN, HashSet::new()), db, error: Ok(()), + valid_authorizations: Vec::new(), #[cfg(feature = "optimism")] l1_block_info: None, }, @@ -299,6 +300,7 @@ pub(crate) mod test_utils { journaled_state: JournaledState::new(SpecId::CANCUN, HashSet::new()), db, error: Ok(()), + valid_authorizations: Default::default(), #[cfg(feature = "optimism")] l1_block_info: None, }, diff --git a/crates/revm/src/context/inner_evm_context.rs b/crates/revm/src/context/inner_evm_context.rs index c166295148..4b10323baa 100644 --- a/crates/revm/src/context/inner_evm_context.rs +++ b/crates/revm/src/context/inner_evm_context.rs @@ -29,6 +29,8 @@ pub struct InnerEvmContext { pub db: DB, /// Error that happened during execution. pub error: Result<(), EVMError>, + /// EIP-7702 Authorization list of accounts that needs to be cleared. + pub valid_authorizations: Vec
, /// Used as temporary value holder to store L1 block info. #[cfg(feature = "optimism")] pub l1_block_info: Option, @@ -44,6 +46,7 @@ where journaled_state: self.journaled_state.clone(), db: self.db.clone(), error: self.error.clone(), + valid_authorizations: self.valid_authorizations.clone(), #[cfg(feature = "optimism")] l1_block_info: self.l1_block_info.clone(), } @@ -57,6 +60,7 @@ impl InnerEvmContext { journaled_state: JournaledState::new(SpecId::LATEST, HashSet::new()), db, error: Ok(()), + valid_authorizations: Default::default(), #[cfg(feature = "optimism")] l1_block_info: None, } @@ -70,6 +74,7 @@ impl InnerEvmContext { journaled_state: JournaledState::new(SpecId::LATEST, HashSet::new()), db, error: Ok(()), + valid_authorizations: Default::default(), #[cfg(feature = "optimism")] l1_block_info: None, } @@ -85,6 +90,7 @@ impl InnerEvmContext { journaled_state: self.journaled_state, db, error: Ok(()), + valid_authorizations: Default::default(), #[cfg(feature = "optimism")] l1_block_info: self.l1_block_info, } diff --git a/crates/revm/src/handler/mainnet/post_execution.rs b/crates/revm/src/handler/mainnet/post_execution.rs index 0e5cb4e187..9e02234b95 100644 --- a/crates/revm/src/handler/mainnet/post_execution.rs +++ b/crates/revm/src/handler/mainnet/post_execution.rs @@ -1,7 +1,8 @@ use crate::{ interpreter::{Gas, SuccessOrHalt}, primitives::{ - db::Database, EVMError, ExecutionResult, ResultAndState, Spec, SpecId::LONDON, U256, + db::Database, EVMError, ExecutionResult, ResultAndState, Spec, SpecId::LONDON, + KECCAK_EMPTY, U256, }, Context, FrameResult, }; @@ -21,6 +22,9 @@ pub fn clear(context: &mut Context) { // clear error and journaled state. let _ = context.evm.take_error(); context.evm.inner.journaled_state.clear(); + // Clear valid authorizations after each transaction. + // If transaction is valid they are consumed in `output` handler. + context.evm.inner.valid_authorizations.clear(); } /// Reward beneficiary with gas fee. @@ -92,7 +96,17 @@ pub fn output( let instruction_result = result.into_interpreter_result(); // reset journal and return present state. - let (state, logs) = context.evm.journaled_state.finalize(); + let (mut state, logs) = context.evm.journaled_state.finalize(); + + // clear code of authorized accounts. + for authorized in core::mem::take(&mut context.evm.inner.valid_authorizations).into_iter() { + let account = state + .get_mut(&authorized) + .expect("Authorized account must exist"); + account.info.code = None; + account.info.code_hash = KECCAK_EMPTY; + account.storage.clear(); + } let result = match instruction_result.result.into() { SuccessOrHalt::Success(reason) => ExecutionResult::Success { diff --git a/crates/revm/src/handler/mainnet/validation.rs b/crates/revm/src/handler/mainnet/validation.rs index 176e0e8282..fe39c7d263 100644 --- a/crates/revm/src/handler/mainnet/validation.rs +++ b/crates/revm/src/handler/mainnet/validation.rs @@ -42,9 +42,19 @@ pub fn validate_initial_tx_gas( let input = &env.tx.data; let is_create = env.tx.transact_to.is_create(); let access_list = &env.tx.access_list; + let authorization_list_num = env.tx + .authorization_list + .as_ref() + .map(|l| l.len() as u64) + .unwrap_or_default(); - let initial_gas_spend = - gas::validate_initial_tx_gas(SPEC::SPEC_ID, input, is_create, access_list); + let initial_gas_spend = gas::validate_initial_tx_gas( + SPEC::SPEC_ID, + input, + is_create, + access_list, + authorization_list_num, + ); // Additional check to see if limit is big enough to cover initial gas. if initial_gas_spend > env.tx.gas_limit { From d5e4cdb72594960f50991dcaa7f8089c35c38dfc Mon Sep 17 00:00:00 2001 From: rakita Date: Sat, 22 Jun 2024 21:53:24 +0200 Subject: [PATCH 02/11] fmt --- crates/interpreter/src/gas/constants.rs | 2 +- crates/primitives/src/result.rs | 4 +++- crates/revm/src/handler/mainnet/validation.rs | 11 ++++++----- 3 files changed, 10 insertions(+), 7 deletions(-) diff --git a/crates/interpreter/src/gas/constants.rs b/crates/interpreter/src/gas/constants.rs index bf672864af..c32abcfae7 100644 --- a/crates/interpreter/src/gas/constants.rs +++ b/crates/interpreter/src/gas/constants.rs @@ -47,7 +47,7 @@ pub const COLD_ACCOUNT_ACCESS_COST: u64 = 2600; pub const WARM_STORAGE_READ_COST: u64 = 100; pub const WARM_SSTORE_RESET: u64 = SSTORE_RESET - COLD_SLOAD_COST; -/// EIP-7702 +/// EIP-7702 pub const PER_CONTRACT_CODE_BASE_COST: u64 = 2400; /// EIP-3860 : Limit and meter initcode diff --git a/crates/primitives/src/result.rs b/crates/primitives/src/result.rs index 4ea5bf4cb4..99d06644eb 100644 --- a/crates/primitives/src/result.rs +++ b/crates/primitives/src/result.rs @@ -348,7 +348,9 @@ impl fmt::Display for InvalidTransaction { Self::BlobVersionNotSupported => write!(f, "blob version not supported"), Self::EofCrateShouldHaveToAddress => write!(f, "EOF crate should have `to` address"), Self::AuthorizationListNotSupported => write!(f, "authorization list not supported"), - Self::AuthorizationListInvalidFields => write!(f, "authorization list tx has invalid fields"), + Self::AuthorizationListInvalidFields => { + write!(f, "authorization list tx has invalid fields") + } #[cfg(feature = "optimism")] Self::DepositSystemTxPostRegolith => { write!( diff --git a/crates/revm/src/handler/mainnet/validation.rs b/crates/revm/src/handler/mainnet/validation.rs index fe39c7d263..f8840de42c 100644 --- a/crates/revm/src/handler/mainnet/validation.rs +++ b/crates/revm/src/handler/mainnet/validation.rs @@ -42,11 +42,12 @@ pub fn validate_initial_tx_gas( let input = &env.tx.data; let is_create = env.tx.transact_to.is_create(); let access_list = &env.tx.access_list; - let authorization_list_num = env.tx - .authorization_list - .as_ref() - .map(|l| l.len() as u64) - .unwrap_or_default(); + let authorization_list_num = env + .tx + .authorization_list + .as_ref() + .map(|l| l.len() as u64) + .unwrap_or_default(); let initial_gas_spend = gas::validate_initial_tx_gas( SPEC::SPEC_ID, From 4db0e5f3b7061485890a8a761c76645c58c60f33 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 13:42:11 +0200 Subject: [PATCH 03/11] load authorizations --- crates/primitives/src/env.rs | 2 +- .../revm/src/handler/mainnet/pre_execution.rs | 52 ++++++++++++++++++- crates/revm/src/journaled_state.rs | 17 ++++-- 3 files changed, 65 insertions(+), 6 deletions(-) diff --git a/crates/primitives/src/env.rs b/crates/primitives/src/env.rs index 9fd1fe10b2..8b91fc9929 100644 --- a/crates/primitives/src/env.rs +++ b/crates/primitives/src/env.rs @@ -572,7 +572,7 @@ pub struct TxEnv { /// [EIP-Set EOA account code for one transaction](https://eips.ethereum.org/EIPS/eip-7702) /// /// TODO: include from alloy/eips crate. - pub authorization_list: Option>, + pub authorization_list: Option>, #[cfg_attr(feature = "serde", serde(flatten))] #[cfg(feature = "optimism")] diff --git a/crates/revm/src/handler/mainnet/pre_execution.rs b/crates/revm/src/handler/mainnet/pre_execution.rs index 3cc1d89a61..9269cb8a47 100644 --- a/crates/revm/src/handler/mainnet/pre_execution.rs +++ b/crates/revm/src/handler/mainnet/pre_execution.rs @@ -8,7 +8,7 @@ use crate::{ db::Database, Account, EVMError, Env, Spec, SpecId::{CANCUN, PRAGUE, SHANGHAI}, - TxKind, BLOCKHASH_STORAGE_ADDRESS, U256, + TxKind, BLOCKHASH_STORAGE_ADDRESS, KECCAK_EMPTY, U256, }, Context, ContextPrecompiles, }; @@ -47,6 +47,56 @@ pub fn load_accounts( )?; } + // EIP-7702. Load bytecode to authorized accounts. + if SPEC::enabled(PRAGUE) { + if let Some(authorization_list) = context.evm.inner.env.tx.authorization_list.as_ref() { + let mut valid_auths = Vec::with_capacity(authorization_list.len()); + for (authority, authorized) in authorization_list.iter() { + // TODO EIP-7702 do verification of authorizations. + // Recover authority and authorized addresses. + + // warm authority account and check nonce. + let (authority_acc, _) = context + .evm + .inner + .journaled_state + .load_account(*authority, &mut context.evm.inner.db)?; + + // TODO 2. Verify the chain id is either 0 or the chain's current ID. + + // 3. Verify that the code of authority is empty. + // In case of multiple same authorities this step will skip loading of + // authorized account. + if authority_acc.info.code_hash() != KECCAK_EMPTY { + continue; + } + + // TODO 4. If nonce list item is length one, verify the nonce of authority is equal to nonce. + + // warm code account and get the code. + // 6. Add the authority account to accessed_addresses + let (account, _) = context + .evm + .inner + .journaled_state + .load_code(*authorized, &mut context.evm.inner.db)?; + let code = account.info.code.clone(); + let code_hash = account.info.code_hash; + + // 5. Set the code of authority to code associated with address. + context.evm.inner.journaled_state.set_code_with_hash( + *authority, + code.unwrap_or_default(), + code_hash, + ); + + valid_auths.push(*authority); + } + + context.evm.inner.valid_authorizations = valid_auths; + } + } + context.evm.load_access_list()?; Ok(()) } diff --git a/crates/revm/src/journaled_state.rs b/crates/revm/src/journaled_state.rs index 81ecc09f18..cb4bf69c3e 100644 --- a/crates/revm/src/journaled_state.rs +++ b/crates/revm/src/journaled_state.rs @@ -143,10 +143,11 @@ impl JournaledState { self.depth as u64 } - /// use it only if you know that acc is warm - /// Assume account is warm + /// Set code and its hash to the account. + /// + /// Note: Assume account is warm and that hash is calculated from code. #[inline] - pub fn set_code(&mut self, address: Address, code: Bytecode) { + pub fn set_code_with_hash(&mut self, address: Address, code: Bytecode, hash: B256) { let account = self.state.get_mut(&address).unwrap(); Self::touch_account(self.journal.last_mut().unwrap(), &address, account); @@ -155,10 +156,18 @@ impl JournaledState { .unwrap() .push(JournalEntry::CodeChange { address }); - account.info.code_hash = code.hash_slow(); + account.info.code_hash = hash; account.info.code = Some(code); } + /// use it only if you know that acc is warm + /// Assume account is warm + #[inline] + pub fn set_code(&mut self, address: Address, code: Bytecode) { + let hash = code.hash_slow(); + self.set_code_with_hash(address, code, hash) + } + #[inline] pub fn inc_nonce(&mut self, address: Address) -> Option { let account = self.state.get_mut(&address).unwrap(); From 5fedacf38aa48eb8592b0ae005220f36ec2e26ac Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 13:57:41 +0200 Subject: [PATCH 04/11] include Vec and B256 --- crates/revm/src/handler/mainnet/pre_execution.rs | 1 + crates/revm/src/journaled_state.rs | 5 ++--- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/revm/src/handler/mainnet/pre_execution.rs b/crates/revm/src/handler/mainnet/pre_execution.rs index 9269cb8a47..58682dd408 100644 --- a/crates/revm/src/handler/mainnet/pre_execution.rs +++ b/crates/revm/src/handler/mainnet/pre_execution.rs @@ -12,6 +12,7 @@ use crate::{ }, Context, ContextPrecompiles, }; +use std::vec::Vec; /// Main precompile load #[inline] diff --git a/crates/revm/src/journaled_state.rs b/crates/revm/src/journaled_state.rs index cb4bf69c3e..7a9330b867 100644 --- a/crates/revm/src/journaled_state.rs +++ b/crates/revm/src/journaled_state.rs @@ -1,12 +1,11 @@ use crate::interpreter::{InstructionResult, SelfDestructResult}; use crate::primitives::{ db::Database, hash_map::Entry, Account, Address, Bytecode, EVMError, EvmState, EvmStorageSlot, - HashMap, HashSet, Log, SpecId::*, TransientStorage, KECCAK_EMPTY, PRECOMPILE3, U256, + HashMap, HashSet, Log, SpecId::*, TransientStorage, B256, KECCAK_EMPTY, PRECOMPILE3, U256, }; use core::mem; use revm_interpreter::primitives::SpecId; use revm_interpreter::{LoadAccountResult, SStoreResult}; -use revm_precompile::B256; use std::vec::Vec; /// JournalState is internal EVM state that is used to contain state and track changes to that state. @@ -144,7 +143,7 @@ impl JournaledState { } /// Set code and its hash to the account. - /// + /// /// Note: Assume account is warm and that hash is calculated from code. #[inline] pub fn set_code_with_hash(&mut self, address: Address, code: Bytecode, hash: B256) { From 652c7297bbde1a7c44d56f3a292d50409e6e0093 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 16:46:50 +0200 Subject: [PATCH 05/11] fmt and no_std import --- crates/primitives/src/env.rs | 2 +- crates/revm/src/context/inner_evm_context.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/primitives/src/env.rs b/crates/primitives/src/env.rs index 8b91fc9929..8e48f2eba9 100644 --- a/crates/primitives/src/env.rs +++ b/crates/primitives/src/env.rs @@ -572,7 +572,7 @@ pub struct TxEnv { /// [EIP-Set EOA account code for one transaction](https://eips.ethereum.org/EIPS/eip-7702) /// /// TODO: include from alloy/eips crate. - pub authorization_list: Option>, + pub authorization_list: Option>, #[cfg_attr(feature = "serde", serde(flatten))] #[cfg(feature = "optimism")] diff --git a/crates/revm/src/context/inner_evm_context.rs b/crates/revm/src/context/inner_evm_context.rs index 40d9221040..b011f22d35 100644 --- a/crates/revm/src/context/inner_evm_context.rs +++ b/crates/revm/src/context/inner_evm_context.rs @@ -15,7 +15,7 @@ use crate::{ }, FrameOrResult, JournalCheckpoint, CALL_STACK_LIMIT, }; -use std::{boxed::Box, sync::Arc}; +use std::{boxed::Box, sync::Arc, vec::Vec}; /// EVM contexts contains data that EVM needs for execution. #[derive(Debug)] From 2b035122118f7ab22eb58086417e58d2d7651f25 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 21:18:04 +0200 Subject: [PATCH 06/11] Integrate alloy-eips Authorizations types --- Cargo.lock | 21 +++++++--- Cargo.toml | 3 ++ crates/primitives/Cargo.toml | 4 +- crates/primitives/src/env.rs | 8 ++-- crates/primitives/src/env/eip7702.rs | 31 +++++++++++++++ .../revm/src/handler/mainnet/pre_execution.rs | 38 ++++++++++++++----- 6 files changed, 83 insertions(+), 22 deletions(-) create mode 100644 crates/primitives/src/env/eip7702.rs diff --git a/Cargo.lock b/Cargo.lock index 838a95ac93..b617da3e8a 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -63,7 +63,7 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.1", "c-kzg", "serde", ] @@ -71,12 +71,11 @@ dependencies = [ [[package]] name = "alloy-eips" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "32d6d8118b83b0489cfb7e6435106948add2b35217f4a5004ef895f613f60299" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-primitives", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.2", "arbitrary", "c-kzg", "once_cell", @@ -110,7 +109,7 @@ dependencies = [ "alloy-json-rpc", "alloy-primitives", "alloy-rpc-types-eth", - "alloy-serde", + "alloy-serde 0.1.1", "alloy-signer", "alloy-sol-types", "async-trait", @@ -231,7 +230,7 @@ dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", - "alloy-serde", + "alloy-serde 0.1.1", "alloy-sol-types", "itertools 0.13.0", "serde", @@ -244,6 +243,16 @@ name = "alloy-serde" version = "0.1.1" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2c224916316519558d8c2b6a60dc7626688c08f1b8951774702562dbcb8666ee" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-serde" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-primitives", "arbitrary", diff --git a/Cargo.toml b/Cargo.toml index 426d6e403f..9539fa8b63 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -22,3 +22,6 @@ debug = true [profile.ethtests] inherits = "test" opt-level = 3 + +[patch.crates-io] +alloy-eips = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } \ No newline at end of file diff --git a/crates/primitives/Cargo.toml b/crates/primitives/Cargo.toml index a6a0225ac1..5f5748011c 100644 --- a/crates/primitives/Cargo.toml +++ b/crates/primitives/Cargo.toml @@ -22,7 +22,7 @@ rust_2018_idioms = "deny" all = "warn" [dependencies] -alloy-eips = { version = "0.1", default-features = false } +alloy-eips = { version = "0.1", default-features = false, features = ["k256"]} alloy-primitives = { version = "0.7.2", default-features = false, features = [ "rlp", ] } @@ -104,4 +104,4 @@ optional_beneficiary_reward = [] rand = ["alloy-primitives/rand"] # See comments in `revm-precompile` -c-kzg = ["dep:c-kzg", "dep:once_cell", "dep:derive_more"] +c-kzg = ["dep:c-kzg", "dep:once_cell", "dep:derive_more"] \ No newline at end of file diff --git a/crates/primitives/src/env.rs b/crates/primitives/src/env.rs index 8e48f2eba9..1ec9c717f8 100644 --- a/crates/primitives/src/env.rs +++ b/crates/primitives/src/env.rs @@ -1,6 +1,7 @@ +pub mod eip7702; pub mod handler_cfg; -use alloy_primitives::TxKind; +pub use eip7702::AuthorizationList; pub use handler_cfg::{CfgEnvWithHandlerCfg, EnvWithHandlerCfg, HandlerCfg}; use crate::{ @@ -8,6 +9,7 @@ use crate::{ Spec, SpecId, B256, GAS_PER_BLOB, KECCAK_EMPTY, MAX_BLOB_NUMBER_PER_BLOCK, MAX_INITCODE_SIZE, U256, VERSIONED_HASH_VERSION_KZG, }; +use alloy_primitives::TxKind; use core::cmp::{min, Ordering}; use core::hash::Hash; use std::boxed::Box; @@ -570,9 +572,7 @@ pub struct TxEnv { /// Set EOA account code for one transaction /// /// [EIP-Set EOA account code for one transaction](https://eips.ethereum.org/EIPS/eip-7702) - /// - /// TODO: include from alloy/eips crate. - pub authorization_list: Option>, + pub authorization_list: Option, #[cfg_attr(feature = "serde", serde(flatten))] #[cfg(feature = "optimism")] diff --git a/crates/primitives/src/env/eip7702.rs b/crates/primitives/src/env/eip7702.rs new file mode 100644 index 0000000000..63800698e5 --- /dev/null +++ b/crates/primitives/src/env/eip7702.rs @@ -0,0 +1,31 @@ +use alloy_eips::eip7702::{RecoveredAuthorization, SignedAuthorization}; +use alloy_primitives::Signature; +use std::vec::Vec; + +/// Authorization list for EIP-7702 transaction type. +#[derive(Clone, Debug, Eq, PartialEq)] +#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))] +pub enum AuthorizationList { + Signed(Vec>), + Recovered(Vec), +} + +impl AuthorizationList { + /// Returns length of the authorization list. + pub fn len(&self) -> usize { + match self { + Self::Signed(signed) => signed.len(), + Self::Recovered(recovered) => recovered.len(), + } + } + + /// Returns iterator of recovered Authorizations. + pub fn recovered_iter<'a>(&'a self) -> Box + 'a> { + match self { + Self::Signed(signed) => { + Box::new(signed.iter().map(|signed| signed.clone().into_recovered())) + } + Self::Recovered(recovered) => Box::new(recovered.clone().into_iter()), + } + } +} diff --git a/crates/revm/src/handler/mainnet/pre_execution.rs b/crates/revm/src/handler/mainnet/pre_execution.rs index bf09c9e511..36559049fe 100644 --- a/crates/revm/src/handler/mainnet/pre_execution.rs +++ b/crates/revm/src/handler/mainnet/pre_execution.rs @@ -52,18 +52,25 @@ pub fn load_accounts( if SPEC::enabled(PRAGUE) { if let Some(authorization_list) = context.evm.inner.env.tx.authorization_list.as_ref() { let mut valid_auths = Vec::with_capacity(authorization_list.len()); - for (authority, authorized) in authorization_list.iter() { - // TODO EIP-7702 do verification of authorizations. - // Recover authority and authorized addresses. + for authorization in authorization_list.recovered_iter() { + // 1. recover authority and authorized addresses. + let Some(authority) = authorization.authority() else { + continue; + }; + + // 2. Verify the chain id is either 0 or the chain's current ID. + if authorization.chain_id() != 0 + && authorization.chain_id() != context.evm.inner.env.cfg.chain_id + { + continue; + } // warm authority account and check nonce. let (authority_acc, _) = context .evm .inner .journaled_state - .load_account(*authority, &mut context.evm.inner.db)?; - - // TODO 2. Verify the chain id is either 0 or the chain's current ID. + .load_account(authority.clone(), &mut context.evm.inner.db)?; // 3. Verify that the code of authority is empty. // In case of multiple same authorities this step will skip loading of @@ -72,7 +79,12 @@ pub fn load_accounts( continue; } - // TODO 4. If nonce list item is length one, verify the nonce of authority is equal to nonce. + // 4. If nonce list item is length one, verify the nonce of authority is equal to nonce. + if let Some(nonce) = authorization.nonce() { + if nonce != authority_acc.info.nonce { + continue; + } + } // warm code account and get the code. // 6. Add the authority account to accessed_addresses @@ -80,18 +92,24 @@ pub fn load_accounts( .evm .inner .journaled_state - .load_code(*authorized, &mut context.evm.inner.db)?; + .load_code(authority.clone(), &mut context.evm.inner.db)?; let code = account.info.code.clone(); let code_hash = account.info.code_hash; + // If code is empty no need to set code or add it to valid + // authorizations, as it is a noop operation. + if code_hash == KECCAK_EMPTY { + continue; + } + // 5. Set the code of authority to code associated with address. context.evm.inner.journaled_state.set_code_with_hash( - *authority, + authority, code.unwrap_or_default(), code_hash, ); - valid_auths.push(*authority); + valid_auths.push(authority); } context.evm.inner.valid_authorizations = valid_auths; From 137bddd78b471f5abae8d6dfc7df0f3074723100 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 21:26:08 +0200 Subject: [PATCH 07/11] Add box --- crates/primitives/src/env/eip7702.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/primitives/src/env/eip7702.rs b/crates/primitives/src/env/eip7702.rs index 63800698e5..1ed3aa6b59 100644 --- a/crates/primitives/src/env/eip7702.rs +++ b/crates/primitives/src/env/eip7702.rs @@ -1,6 +1,6 @@ use alloy_eips::eip7702::{RecoveredAuthorization, SignedAuthorization}; use alloy_primitives::Signature; -use std::vec::Vec; +use std::{boxed::Box, vec::Vec}; /// Authorization list for EIP-7702 transaction type. #[derive(Clone, Debug, Eq, PartialEq)] From 6d312d95f799d3f3a6bda035722fa243190934b3 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 21:28:55 +0200 Subject: [PATCH 08/11] disable alloy --- crates/revm/Cargo.toml | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index bae8199148..272982c85e 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -98,13 +98,13 @@ negate-optimism-default-handler = [ ethersdb = ["std", "dep:tokio", "dep:ethers-providers", "dep:ethers-core"] -alloydb = [ - "std", - "dep:tokio", - "dep:alloy-provider", - "dep:alloy-eips", - "dep:alloy-transport", -] +# alloydb = [ +# "std", +# "dep:tokio", +# "dep:alloy-provider", +# "dep:alloy-eips", +# "dep:alloy-transport", +# ] dev = [ "memory_limit", From 5785fb84acbb51a0d3c85e5a31bb2c188fccd111 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 24 Jun 2024 21:33:32 +0200 Subject: [PATCH 09/11] clippy nits --- crates/primitives/src/env/eip7702.rs | 5 +++++ crates/revm/src/handler/mainnet/pre_execution.rs | 6 +++--- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/crates/primitives/src/env/eip7702.rs b/crates/primitives/src/env/eip7702.rs index 1ed3aa6b59..96a685d5be 100644 --- a/crates/primitives/src/env/eip7702.rs +++ b/crates/primitives/src/env/eip7702.rs @@ -19,6 +19,11 @@ impl AuthorizationList { } } + /// Returns true if the authorization list is empty. + pub fn is_empty(&self) -> bool { + self.len() == 0 + } + /// Returns iterator of recovered Authorizations. pub fn recovered_iter<'a>(&'a self) -> Box + 'a> { match self { diff --git a/crates/revm/src/handler/mainnet/pre_execution.rs b/crates/revm/src/handler/mainnet/pre_execution.rs index 36559049fe..75bb2d454f 100644 --- a/crates/revm/src/handler/mainnet/pre_execution.rs +++ b/crates/revm/src/handler/mainnet/pre_execution.rs @@ -70,7 +70,7 @@ pub fn load_accounts( .evm .inner .journaled_state - .load_account(authority.clone(), &mut context.evm.inner.db)?; + .load_account(authority, &mut context.evm.inner.db)?; // 3. Verify that the code of authority is empty. // In case of multiple same authorities this step will skip loading of @@ -92,11 +92,11 @@ pub fn load_accounts( .evm .inner .journaled_state - .load_code(authority.clone(), &mut context.evm.inner.db)?; + .load_code(authority, &mut context.evm.inner.db)?; let code = account.info.code.clone(); let code_hash = account.info.code_hash; - // If code is empty no need to set code or add it to valid + // If code is empty no need to set code or add it to valid // authorizations, as it is a noop operation. if code_hash == KECCAK_EMPTY { continue; From 1449a0a76ef8bc1de3af3cefa8310bfd36792bdc Mon Sep 17 00:00:00 2001 From: rakita Date: Tue, 25 Jun 2024 12:30:43 +0200 Subject: [PATCH 10/11] patch alloy --- Cargo.lock | 60 ++++++++++++++---------------------------- Cargo.toml | 4 ++- crates/revm/Cargo.toml | 14 +++++----- 3 files changed, 30 insertions(+), 48 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index b617da3e8a..9ec6cde596 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,14 +56,13 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3cc7579e4fb5558af44810f542c90d1145dba8b92c08211c215196160c48d2ea" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-eips", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.1", + "alloy-serde", "c-kzg", "serde", ] @@ -75,7 +74,7 @@ source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d dependencies = [ "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.2", + "alloy-serde", "arbitrary", "c-kzg", "once_cell", @@ -87,9 +86,8 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d06d33b79246313c4103ef9596c721674a926f1ddc8b605aa2bac4d8ba94ee34" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-primitives", "serde", @@ -100,16 +98,15 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ef742b478a2db5c27063cde82128dfbecffcd38237d7f682a91d3ecf6aa1836c" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-json-rpc", "alloy-primitives", "alloy-rpc-types-eth", - "alloy-serde 0.1.1", + "alloy-serde", "alloy-signer", "alloy-sol-types", "async-trait", @@ -148,8 +145,7 @@ dependencies = [ [[package]] name = "alloy-provider" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d5af289798fe8783acd0c5f10644d9d26f54a12bc52a083e4f3b31718e9bf92" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-chains", "alloy-consensus", @@ -201,9 +197,8 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "328a6a14aba6152ddf6d01bac5e17a70dbe9d6f343bf402b995c30bac63a1fbf" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -222,15 +217,14 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bce0676f144be1eae71122d1d417885a3b063add0353b35e46cdf1440d6b33b1" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-consensus", "alloy-eips", "alloy-primitives", "alloy-rlp", - "alloy-serde 0.1.1", + "alloy-serde", "alloy-sol-types", "itertools 0.13.0", "serde", @@ -238,17 +232,6 @@ dependencies = [ "thiserror", ] -[[package]] -name = "alloy-serde" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2c224916316519558d8c2b6a60dc7626688c08f1b8951774702562dbcb8666ee" -dependencies = [ - "alloy-primitives", - "serde", - "serde_json", -] - [[package]] name = "alloy-serde" version = "0.1.2" @@ -264,9 +247,8 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "227c5fd0ed6e06e1ccc30593f8ff6d9fb907ac5f03a709a6d687f0943494a229" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-primitives", "async-trait", @@ -338,8 +320,7 @@ dependencies = [ [[package]] name = "alloy-transport" version = "0.1.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "245af9541f0a0dbd5258669c80dfe3af118164cacec978a520041fc130550deb" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -355,9 +336,8 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.1.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2f35d34e7a51503c9ff267404a5850bd58f991b7ab524b892f364901e3576376" +version = "0.1.2" +source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" dependencies = [ "alloy-json-rpc", "alloy-transport", diff --git a/Cargo.toml b/Cargo.toml index 9539fa8b63..64c321edd8 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -24,4 +24,6 @@ inherits = "test" opt-level = 3 [patch.crates-io] -alloy-eips = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } \ No newline at end of file +alloy-eips = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } +alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } +alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } \ No newline at end of file diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 272982c85e..bae8199148 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -98,13 +98,13 @@ negate-optimism-default-handler = [ ethersdb = ["std", "dep:tokio", "dep:ethers-providers", "dep:ethers-core"] -# alloydb = [ -# "std", -# "dep:tokio", -# "dep:alloy-provider", -# "dep:alloy-eips", -# "dep:alloy-transport", -# ] +alloydb = [ + "std", + "dep:tokio", + "dep:alloy-provider", + "dep:alloy-eips", + "dep:alloy-transport", +] dev = [ "memory_limit", From 6032991407237c8ec23fc3c5f115f2ae4e26a99a Mon Sep 17 00:00:00 2001 From: rakita Date: Fri, 28 Jun 2024 12:24:38 +0200 Subject: [PATCH 11/11] bump new alloy --- Cargo.lock | 55 ++++++++++++++++++++++++++++++++---------------------- Cargo.toml | 8 ++++---- 2 files changed, 37 insertions(+), 26 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 9ec6cde596..148e67d1ce 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,8 +56,9 @@ dependencies = [ [[package]] name = "alloy-consensus" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f63a6c9eb45684a5468536bc55379a2af0f45ffa5d756e4e4964532737e1836" dependencies = [ "alloy-eips", "alloy-primitives", @@ -69,8 +70,9 @@ dependencies = [ [[package]] name = "alloy-eips" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa4b0fc6a572ef2eebda0a31a5e393d451abda703fec917c75d9615d8c978cf2" dependencies = [ "alloy-primitives", "alloy-rlp", @@ -86,8 +88,9 @@ dependencies = [ [[package]] name = "alloy-json-rpc" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d484c2a934d0a4d86f8ad4db8113cb1d607707a6c54f6e78f4f1b4451b47aa70" dependencies = [ "alloy-primitives", "serde", @@ -98,8 +101,9 @@ dependencies = [ [[package]] name = "alloy-network" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a20eba9bc551037f0626d6d29e191888638d979943fa4e842e9e6fc72bf0565" dependencies = [ "alloy-consensus", "alloy-eips", @@ -144,8 +148,9 @@ dependencies = [ [[package]] name = "alloy-provider" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad5d89acb7339fad13bc69e7b925232f242835bfd91c82fcb9326b36481bd0f0" dependencies = [ "alloy-chains", "alloy-consensus", @@ -197,8 +202,9 @@ dependencies = [ [[package]] name = "alloy-rpc-client" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "479ce003e8c74bbbc7d4235131c1d6b7eaf14a533ae850295b90d240340989cb" dependencies = [ "alloy-json-rpc", "alloy-transport", @@ -217,8 +223,9 @@ dependencies = [ [[package]] name = "alloy-rpc-types-eth" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13bd7aa9ff9e67f1ba7ee0dd8cebfc95831d1649b0e4eeefae940dc3681079fa" dependencies = [ "alloy-consensus", "alloy-eips", @@ -234,8 +241,9 @@ dependencies = [ [[package]] name = "alloy-serde" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8913f9e825068d77c516188c221c44f78fd814fce8effe550a783295a2757d19" dependencies = [ "alloy-primitives", "arbitrary", @@ -247,8 +255,9 @@ dependencies = [ [[package]] name = "alloy-signer" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f740e13eb4c6a0e4d0e49738f1e86f31ad2d7ef93be499539f492805000f7237" dependencies = [ "alloy-primitives", "async-trait", @@ -319,8 +328,9 @@ dependencies = [ [[package]] name = "alloy-transport" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dd9773e4ec6832346171605c776315544bd06e40f803e7b5b7824b325d5442ca" dependencies = [ "alloy-json-rpc", "base64 0.22.1", @@ -336,8 +346,9 @@ dependencies = [ [[package]] name = "alloy-transport-http" -version = "0.1.2" -source = "git+https://github.com/alloy-rs/alloy.git?rev=41d4c7c#41d4c7cad5576b9d310b7c1a321155026adbcdba" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff8ef947b901c0d4e97370f9fa25844cf8b63b1a58fd4011ee82342dc8a9fc6b" dependencies = [ "alloy-json-rpc", "alloy-transport", diff --git a/Cargo.toml b/Cargo.toml index 64c321edd8..ad5a6ccdc5 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -23,7 +23,7 @@ debug = true inherits = "test" opt-level = 3 -[patch.crates-io] -alloy-eips = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } -alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } -alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } \ No newline at end of file +# [patch.crates-io] +# alloy-eips = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } +# alloy-provider = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } +# alloy-transport = { git = "https://github.com/alloy-rs/alloy.git", rev = "41d4c7c" } \ No newline at end of file