From 49a19674ec9d7175c7fdfed8197b9112844a6157 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:40:34 -0300 Subject: [PATCH 01/54] add errors --- crates/vm/levm/src/errors.rs | 34 ++++++++++++++++++++++++++++++++++ 1 file changed, 34 insertions(+) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index 943f3c55b..7f46ef2b6 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -72,6 +72,40 @@ pub enum VMError { // Internal #[error("Internal error: {0}")] Internal(#[from] InternalError), + #[error("Transaction validation error: {0}")] + TxValidation(#[from] TxValidationError), +} + +#[derive(Debug, Clone, PartialEq, Eq, thiserror::Error, Serialize, Deserialize)] +pub enum TxValidationError { + #[error("Sender account should not have bytecode")] + SenderNotEOA, + #[error("Insufficient account founds")] + InsufficientAccountFunds, + #[error("Nonce is max (overflow)")] + NonceIsMax, + #[error("Initcode size exceeded")] + InitcodeSizeExceeded, + #[error("Priority fee greater than max fee per gas")] + PriorityGreaterThanMaxFeePerGas, + #[error("Intrinsic gas too low")] + IntrinsicGasTooLow, + #[error("Gas allowance exceeded")] + GasAllowanceExceeded, + #[error("Insufficient max fee per gas")] + InsufficientMaxFeePerGas, + #[error("Insufficient max fee per blob gas")] + InsufficientMaxFeePerBlobGas, + #[error("Type3TxZeroBlobs")] + Type3TxZeroBlobs, + #[error("Type3TxInvalidBlobVersionedHash")] + Type3TxInvalidBlobVersionedHash, + #[error("Type3TxBlobCountExceeded")] + Type3TxBlobCountExceeded, + #[error("Type3TxContractCreation")] + Type3TxContractCreation, + #[error("Undefined state")] + UndefinedState(i32), // This error is temporarily for things that cause an undefined state. } #[derive(Debug, Clone, PartialEq, Eq, Hash, thiserror::Error, Serialize, Deserialize)] From 8c0088a273c2ef86cc140883712f4bcb1b07c0a7 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:42:18 -0300 Subject: [PATCH 02/54] add is_internal function to vmerror --- crates/vm/levm/src/errors.rs | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index 7f46ef2b6..02854d61d 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -76,6 +76,12 @@ pub enum VMError { TxValidation(#[from] TxValidationError), } +impl VMError { + pub fn is_internal(&self) -> bool { + matches!(self, VMError::Internal(_)) + } +} + #[derive(Debug, Clone, PartialEq, Eq, thiserror::Error, Serialize, Deserialize)] pub enum TxValidationError { #[error("Sender account should not have bytecode")] From cfeee5057a615c38616a94eb41c376dbb78da786 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:44:08 -0300 Subject: [PATCH 03/54] remove previous validate_transaction --- crates/vm/levm/src/vm.rs | 69 ---------------------------------------- 1 file changed, 69 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index dd0fcf7dc..697d5db7a 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -337,73 +337,6 @@ impl VM { self.env.refunded_gas = backup_refunded_gas; } - // let account = self.db.accounts.get(&self.env.origin).ok_or(VMError::FatalUnwrap)?; - /// Based on Ethereum yellow paper's initial tests of intrinsic validity (Section 6). The last version is - /// Shanghai, so there are probably missing Cancun validations. The intrinsic validations are: - /// - /// (1) The transaction is well-formed RLP, with no additional trailing bytes; - /// (2) The transaction signature is valid; - /// (3) The transaction nonce is valid (equivalent to the sender account's - /// current nonce); - /// (4) The sender account has no contract code deployed (see EIP-3607). - /// (5) The gas limit is no smaller than the intrinsic gas, used by the - /// transaction; - /// (6) The sender account balance contains at least the cost, required in - /// up-front payment; - /// (7) The max fee per gas, in the case of type 2 transactions, or gasPrice, - /// in the case of type 0 and type 1 transactions, is greater than or equal to - /// the block’s base fee; - /// (8) For type 2 transactions, max priority fee per fas, must be no larger - /// than max fee per fas. - fn validate_transaction(&mut self) -> Result<(), VMError> { - // Validations (1), (2), (3), (5), and (8) are assumed done in upper layers. - - let call_frame = self - .call_frames - .last() - .ok_or(VMError::Internal( - InternalError::CouldNotAccessLastCallframe, - ))? - .clone(); - - if self.is_create() { - // If address is already in db, there's an error - let new_address_acc = self.db.get_account_info(call_frame.to); - if !new_address_acc.is_empty() { - return Err(VMError::AddressAlreadyOccupied); - } - } - - let origin = self.env.origin; - - let mut sender_account = self.get_account(&origin); - - // See if it's raised in upper layers - sender_account.info.nonce = sender_account - .info - .nonce - .checked_add(1) - .ok_or(VMError::Internal(InternalError::NonceOverflowed))?; - - // (4) - if sender_account.has_code()? { - return Err(VMError::SenderAccountShouldNotHaveBytecode); - } - - // (6) - if sender_account.info.balance < call_frame.msg_value { - return Err(VMError::SenderBalanceShouldContainTransferValue); - } - - self.cache.add_account(&origin, &sender_account); - - // (7) - if self.env.gas_price < self.env.base_fee_per_gas { - return Err(VMError::GasPriceIsLowerThanBaseFee); - } - Ok(()) - } - fn is_create(&self) -> bool { matches!(self.tx_kind, TxKind::Create) } @@ -440,8 +373,6 @@ impl VM { } pub fn transact(&mut self) -> Result { - self.validate_transaction()?; - let initial_gas = Default::default(); self.env.consumed_gas = initial_gas; From 3167f2c21ee891ac6f51e1098c358ad869b5c1d3 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:47:54 -0300 Subject: [PATCH 04/54] change execute, mainly for propagating internal errors --- crates/vm/levm/src/vm.rs | 36 +++++++++++++++--------------------- 1 file changed, 15 insertions(+), 21 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 697d5db7a..2a3c09128 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -154,7 +154,10 @@ impl VM { // TODO: https://github.com/lambdaclass/ethrex/issues/1088 } - pub fn execute(&mut self, current_call_frame: &mut CallFrame) -> TransactionReport { + pub fn execute( + &mut self, + current_call_frame: &mut CallFrame, + ) -> Result { // Backup of Database, Substate and Gas Refunds if sub-context is reverted let (backup_db, backup_substate, backup_refunded_gas) = ( self.cache.clone(), @@ -163,20 +166,7 @@ impl VM { ); loop { - let opcode = match current_call_frame.next_opcode() { - Ok(opt) => opt.unwrap_or(Opcode::STOP), - Err(e) => { - return TransactionReport { - result: TxResult::Revert(e), - new_state: self.cache.accounts.clone(), - gas_used: current_call_frame.gas_used.low_u64(), - gas_refunded: self.env.refunded_gas.low_u64(), - output: current_call_frame.returndata.clone(), // Bytes::new() if error is not RevertOpcode - logs: current_call_frame.logs.clone(), - created_address: None, - }; - } - }; + let opcode = current_call_frame.next_opcode()?.unwrap_or(Opcode::STOP); // This will execute opcode stop if there are no more opcodes, there are other ways of solving this but this is the simplest and doesn't change VM behavior. // Note: This is commented because it's used for debugging purposes in development. // dbg!(¤t_call_frame.gas_used); @@ -287,7 +277,7 @@ impl VM { Ok(OpcodeSuccess::Continue) => {} Ok(OpcodeSuccess::Result(_)) => { self.call_frames.push(current_call_frame.clone()); - return TransactionReport { + return Ok(TransactionReport { result: TxResult::Success, new_state: self.cache.accounts.clone(), gas_used: current_call_frame.gas_used.low_u64(), @@ -295,11 +285,15 @@ impl VM { output: current_call_frame.returndata.clone(), logs: current_call_frame.logs.clone(), created_address: None, - }; + }); } Err(error) => { self.call_frames.push(current_call_frame.clone()); + if error.is_internal() { + return Err(error); + } + // Unless error is from Revert opcode, all gas is consumed if error != VMError::RevertOpcode { let left_gas = current_call_frame @@ -312,7 +306,7 @@ impl VM { self.restore_state(backup_db, backup_substate, backup_refunded_gas); - return TransactionReport { + return Ok(TransactionReport { result: TxResult::Revert(error), new_state: self.cache.accounts.clone(), gas_used: current_call_frame.gas_used.low_u64(), @@ -320,7 +314,7 @@ impl VM { output: current_call_frame.returndata.clone(), // Bytes::new() if error is not RevertOpcode logs: current_call_frame.logs.clone(), created_address: None, - }; + }); } } } @@ -382,7 +376,7 @@ impl VM { .pop() .ok_or(VMError::Internal(InternalError::CouldNotPopCallframe))?; - let mut report = self.execute(&mut current_call_frame); + let mut report = self.execute(&mut current_call_frame)?; let initial_call_frame = self .call_frames @@ -631,7 +625,7 @@ impl VM { self.cache.add_account(&to, &recipient_account); // self.call_frames.push(new_call_frame.clone()); - let tx_report = self.execute(&mut new_call_frame); + let tx_report = self.execute(&mut new_call_frame)?; // Add gas used by the sub-context to the current one after it's execution. current_call_frame.gas_used = current_call_frame From 74e492307349c596fb050d2a74741f59ec89b5ad Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:54:35 -0300 Subject: [PATCH 05/54] add validate_transaction (not working yet) and gas_price_or_max_fee_per_gas --- crates/vm/levm/src/errors.rs | 2 + crates/vm/levm/src/vm.rs | 158 ++++++++++++++++++++++++++++++++++- 2 files changed, 159 insertions(+), 1 deletion(-) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index 02854d61d..b4ca5afa3 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -112,6 +112,8 @@ pub enum TxValidationError { Type3TxContractCreation, #[error("Undefined state")] UndefinedState(i32), // This error is temporarily for things that cause an undefined state. + #[error("Gas limit price product overflow")] + GasLimitPriceProductOverflow, } #[derive(Debug, Clone, PartialEq, Eq, Hash, thiserror::Error, Serialize, Deserialize)] diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 2a3c09128..1cdfe2cc0 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -6,7 +6,7 @@ use crate::{ environment::Environment, errors::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, - VMError, + TxValidationError, VMError, }, gas_cost, opcodes::Opcode, @@ -366,6 +366,162 @@ impl VM { Ok(()) } + // If transaction is Type 2 then it returns max fee per gas, otherwise it returns gas price + pub fn gas_price_or_max_fee_per_gas(&self) -> U256 { + self.env.tx_max_fee_per_gas.unwrap_or(self.env.gas_price) + } + + /// ## Description + /// This method performs validations and returns an error if any of the validations fail. + /// It also makes initial changes alongside the validations: + /// - It increases sender nonce + /// - It substracts up-front-cost from sender balance. + /// - It calculates and adds intrinsic gas to the 'gas used' of callframe and environment. + /// See 'docs' for more information about validations. + fn validate_transaction(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { + //TODO: This should revert the transaction, not throw an error. And I don't know if it should be done here... + // if self.is_create() { + // // If address is already in db, there's an error + // let new_address_acc = self.db.get_account_info(call_frame.to); + // if !new_address_acc.is_empty() { + // return Err(VMError::AddressAlreadyOccupied); + // } + // } + let sender_address = self.env.origin; + let mut sender_account = self.get_account(&sender_address); + + // (1) GASLIMIT_PRICE_PRODUCT_OVERFLOW + let gaslimit_price_product = self + .gas_price_or_max_fee_per_gas() + .checked_mul(self.env.gas_limit) + .ok_or(VMError::TxValidation( + TxValidationError::GasLimitPriceProductOverflow, + ))?; + + // Up front cost is the maximum amount of wei that a user is willing to pay for. + let up_front_cost = gaslimit_price_product + .checked_add(initial_call_frame.msg_value) + .ok_or(VMError::TxValidation( + TxValidationError::InsufficientAccountFunds, + ))?; + + // (2) INSUFFICIENT_ACCOUNT_FUNDS + sender_account.info.balance = sender_account + .info + .balance + .checked_sub(up_front_cost) + .ok_or(VMError::TxValidation( + TxValidationError::InsufficientAccountFunds, + ))?; + + // (3) INSUFFICIENT_MAX_FEE_PER_GAS + if self.gas_price_or_max_fee_per_gas() < self.env.base_fee_per_gas { + return Err(VMError::TxValidation( + TxValidationError::InsufficientMaxFeePerGas, + )); + } + + // (4) INITCODE_SIZE_EXCEEDED + if self.is_create() { + // INITCODE_SIZE_EXCEEDED + if initial_call_frame.calldata.len() > INIT_CODE_MAX_SIZE { + return Err(VMError::TxValidation( + TxValidationError::InitcodeSizeExceeded, + )); + } + } + + // (5) INTRINSIC_GAS_TOO_LOW + self.add_intrinsic_gas(initial_call_frame)?; + + // (6) NONCE_IS_MAX + sender_account.info.nonce = sender_account + .info + .nonce + .checked_add(1) + .ok_or(VMError::TxValidation(TxValidationError::NonceIsMax))?; + + // Update cache with account with incremented nonce + self.cache.add_account(&sender_address, &sender_account); + + // (7) PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS + if let (Some(tx_max_priority_fee), Some(tx_max_fee_per_gas)) = ( + self.env.tx_max_priority_fee_per_gas, + self.env.tx_max_fee_per_gas, + ) { + if tx_max_priority_fee > tx_max_fee_per_gas { + return Err(VMError::TxValidation( + TxValidationError::PriorityGreaterThanMaxFeePerGas, + )); + } + } + + // (8) SENDER_NOT_EOA + if sender_account.has_code() { + return Err(VMError::TxValidation(TxValidationError::SenderNotEOA)); + } + + // (9) GAS_ALLOWANCE_EXCEEDED + if self.env.gas_limit > self.env.block_gas_limit { + return Err(VMError::TxValidation( + TxValidationError::GasAllowanceExceeded, + )); + } + + // (10) INSUFFICIENT_MAX_FEE_PER_BLOB_GAS + if let Some(tx_max_fee_per_blob_gas) = self.env.tx_max_fee_per_blob_gas { + if tx_max_fee_per_blob_gas < self.env.base_fee_per_gas { + return Err(VMError::TxValidation( + TxValidationError::InsufficientMaxFeePerGas, + )); + } + } + + //TODO: Implement the rest of the validations (TYPE_3) + + // (11) TYPE_3_TX_ZERO_BLOBS + if let Some(tx_blob_hashes) = &self.env.tx_blob_hashes { + if tx_blob_hashes.is_empty() { + return Err(VMError::TxValidation(TxValidationError::Type3TxZeroBlobs)); + } + } + + // (12) TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH + if let Some(tx_blob_hashes) = &self.env.tx_blob_hashes { + for blob_hash in tx_blob_hashes { + let blob_hash = blob_hash.as_bytes(); + if let Some(first_byte) = blob_hash.first() { + if !VALID_BLOB_PREFIXES.contains(first_byte) { + return Err(VMError::TxValidation( + TxValidationError::Type3TxInvalidBlobVersionedHash, + )); + } + } + } + } + + // (13) TYPE_3_TX_PRE_FORK -> This is not necessary for now because we are not supporting pre-cancun transactions yet. But we should somehow be able to tell the current context. + + // (14) TYPE_3_TX_BLOB_COUNT_EXCEEDED + if let Some(tx_blob_hashes) = &self.env.tx_blob_hashes { + if tx_blob_hashes.len() > MAX_BLOB_COUNT { + return Err(VMError::TxValidation( + TxValidationError::Type3TxBlobCountExceeded, + )); + } + } + + // (15) TYPE_3_TX_CONTRACT_CREATION + // The current way of checking if the transaction is a Type 3 Tx is by checking if the tx_blob_hashes is Some. + if self.env.tx_blob_hashes.is_some() && self.is_create() { + return Err(VMError::TxValidation( + TxValidationError::Type3TxContractCreation, + )); + } + + Ok(()) + } + pub fn transact(&mut self) -> Result { let initial_gas = Default::default(); From 1e0449d837349052acc6c64254666fa39ad1f71c Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:56:15 -0300 Subject: [PATCH 06/54] change return type of has_code in Account --- crates/vm/levm/src/account.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vm/levm/src/account.rs b/crates/vm/levm/src/account.rs index a374ac463..522bfc275 100644 --- a/crates/vm/levm/src/account.rs +++ b/crates/vm/levm/src/account.rs @@ -59,8 +59,8 @@ impl Account { } } - pub fn has_code(&self) -> Result { - Ok(!(self.info.bytecode.is_empty() || self.bytecode_hash() == EMPTY_CODE_HASH)) + pub fn has_code(&self) -> bool { + !(self.info.bytecode.is_empty() || self.bytecode_hash() == EMPTY_CODE_HASH) } pub fn bytecode_hash(&self) -> H256 { From c62cfad414c93c479da1c82c2eb2b1a2821b67a2 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 16:58:41 -0300 Subject: [PATCH 07/54] add intrinsic gas function --- crates/vm/levm/src/vm.rs | 61 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 1cdfe2cc0..8162b68c9 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -371,6 +371,67 @@ impl VM { self.env.tx_max_fee_per_gas.unwrap_or(self.env.gas_price) } + /// Adds intrinsic gas to the consumed gas of the current call frame and the environment. + // Intrinsic gas is the gas consumed by the transaction before the execution of the opcodes. Section 6.2 in the Yellow Paper. + pub fn add_intrinsic_gas(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { + // Intrinsic Gas = Calldata cost + Create cost + Base cost + Access list cost + let mut intrinsic_gas: U256 = U256::zero(); + + // Calldata Cost + // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. + let mut calldata_cost: U256 = U256::zero(); + for byte in &initial_call_frame.calldata { + if *byte != 0 { + calldata_cost = calldata_cost + .checked_add(U256::from(16)) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + } else { + calldata_cost = calldata_cost + .checked_add(U256::from(4)) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + } + } + + intrinsic_gas = intrinsic_gas + .checked_add(calldata_cost) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + + // Base Cost + intrinsic_gas = intrinsic_gas + .checked_add(TX_BASE_COST) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + + // Create Cost + if self.is_create() { + intrinsic_gas = intrinsic_gas + .checked_add(CREATE_BASE_COST) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + + let number_of_words: u64 = initial_call_frame + .calldata + .chunks(WORD_SIZE) + .len() + .try_into() + .map_err(|_| VMError::Internal(InternalError::ConversionError))?; + + intrinsic_gas = intrinsic_gas + .checked_add( + U256::from(number_of_words) + .checked_mul(U256::from(2)) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?, + ) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + } + + // Access List Cost + // TODO: Implement access list cost. + + self.increase_consumed_gas(initial_call_frame, intrinsic_gas) + .map_err(|_| VMError::TxValidation(TxValidationError::IntrinsicGasTooLow))?; + + Ok(()) + } + /// ## Description /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: From f4566c97afd5c48906eb5eedbc3c1be2a56991ba Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 17:02:59 -0300 Subject: [PATCH 08/54] add necessary constants --- crates/vm/levm/src/constants.rs | 4 +++- crates/vm/levm/src/vm.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/crates/vm/levm/src/constants.rs b/crates/vm/levm/src/constants.rs index 6b07e6e87..0d83303a2 100644 --- a/crates/vm/levm/src/constants.rs +++ b/crates/vm/levm/src/constants.rs @@ -22,6 +22,7 @@ pub const MEMORY_EXPANSION_QUOTIENT: usize = 512; pub const TX_BASE_COST: U256 = U256([21000, 0, 0, 0]); pub const MAX_CODE_SIZE: usize = 0x6000; +pub const INIT_CODE_MAX_SIZE: usize = 49152; pub const MAX_CREATE_CODE_SIZE: usize = 2 * MAX_CODE_SIZE; pub const INVALID_CONTRACT_PREFIX: u8 = 0xef; @@ -41,7 +42,8 @@ pub const MAX_BLOB_NUMBER_PER_BLOCK: usize = 6; pub const TARGET_BLOB_GAS_PER_BLOCK: U256 = U256([393216, 0, 0, 0]); // TARGET_BLOB_NUMBER_PER_BLOCK * GAS_PER_BLOB pub const MIN_BASE_FEE_PER_BLOB_GAS: U256 = U256([1, 0, 0, 0]); pub const BLOB_BASE_FEE_UPDATE_FRACTION: U256 = U256([3338477, 0, 0, 0]); - +pub const MAX_BLOB_COUNT: usize = 6; +pub const VALID_BLOB_PREFIXES: [u8; 2] = [0x01, 0x02]; // Storage constants pub const COLD_STORAGE_ACCESS_COST: U256 = U256([2100, 0, 0, 0]); pub const WARM_ADDRESS_ACCESS_COST: U256 = U256([100, 0, 0, 0]); diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 8162b68c9..080093877 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -8,7 +8,7 @@ use crate::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, TxValidationError, VMError, }, - gas_cost, + gas_cost::{self, CREATE_BASE_COST}, opcodes::Opcode, }; use bytes::Bytes; From d24ec115506fe0736a4ade35235dab47525d2d7b Mon Sep 17 00:00:00 2001 From: JereSalo Date: Wed, 27 Nov 2024 18:28:29 -0300 Subject: [PATCH 09/54] add some fields to environment and think of gas_price as effective gas price --- crates/vm/levm/src/environment.rs | 8 ++++++++ crates/vm/levm/src/vm.rs | 20 ++++++++------------ 2 files changed, 16 insertions(+), 12 deletions(-) diff --git a/crates/vm/levm/src/environment.rs b/crates/vm/levm/src/environment.rs index 3e57703f2..1c48c563b 100644 --- a/crates/vm/levm/src/environment.rs +++ b/crates/vm/levm/src/environment.rs @@ -19,6 +19,10 @@ pub struct Environment { pub block_excess_blob_gas: Option, pub block_blob_gas_used: Option, pub tx_blob_hashes: Option>, + pub tx_max_priority_fee_per_gas: Option, + pub tx_max_fee_per_gas: Option, + pub tx_max_fee_per_blob_gas: Option, + pub block_gas_limit: U256, } impl Environment { @@ -38,6 +42,10 @@ impl Environment { block_excess_blob_gas: Default::default(), block_blob_gas_used: Default::default(), tx_blob_hashes: Default::default(), + tx_max_priority_fee_per_gas: Default::default(), + tx_max_fee_per_gas: Default::default(), + tx_max_fee_per_blob_gas: Default::default(), + block_gas_limit: Default::default(), } } } diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 080093877..3d20c165e 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -366,11 +366,6 @@ impl VM { Ok(()) } - // If transaction is Type 2 then it returns max fee per gas, otherwise it returns gas price - pub fn gas_price_or_max_fee_per_gas(&self) -> U256 { - self.env.tx_max_fee_per_gas.unwrap_or(self.env.gas_price) - } - /// Adds intrinsic gas to the consumed gas of the current call frame and the environment. // Intrinsic gas is the gas consumed by the transaction before the execution of the opcodes. Section 6.2 in the Yellow Paper. pub fn add_intrinsic_gas(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { @@ -452,12 +447,13 @@ impl VM { let mut sender_account = self.get_account(&sender_address); // (1) GASLIMIT_PRICE_PRODUCT_OVERFLOW - let gaslimit_price_product = self - .gas_price_or_max_fee_per_gas() - .checked_mul(self.env.gas_limit) - .ok_or(VMError::TxValidation( - TxValidationError::GasLimitPriceProductOverflow, - ))?; + let gaslimit_price_product = + self.env + .gas_price + .checked_mul(self.env.gas_limit) + .ok_or(VMError::TxValidation( + TxValidationError::GasLimitPriceProductOverflow, + ))?; // Up front cost is the maximum amount of wei that a user is willing to pay for. let up_front_cost = gaslimit_price_product @@ -476,7 +472,7 @@ impl VM { ))?; // (3) INSUFFICIENT_MAX_FEE_PER_GAS - if self.gas_price_or_max_fee_per_gas() < self.env.base_fee_per_gas { + if self.env.gas_price < self.env.base_fee_per_gas { return Err(VMError::TxValidation( TxValidationError::InsufficientMaxFeePerGas, )); From 6ac5c20cd15d335ed1d54e32c90ad8548ce122c7 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 09:31:28 -0300 Subject: [PATCH 10/54] add unwraps to execute --- .../vm/levm/bench/revm_comparison/src/lib.rs | 4 +- crates/vm/levm/src/environment.rs | 2 +- crates/vm/levm/tests/edge_case_tests.rs | 44 +-- crates/vm/levm/tests/tests.rs | 370 +++++++++--------- 4 files changed, 210 insertions(+), 210 deletions(-) diff --git a/crates/vm/levm/bench/revm_comparison/src/lib.rs b/crates/vm/levm/bench/revm_comparison/src/lib.rs index 1a224d4bd..f93516107 100644 --- a/crates/vm/levm/bench/revm_comparison/src/lib.rs +++ b/crates/vm/levm/bench/revm_comparison/src/lib.rs @@ -23,13 +23,13 @@ pub fn run_with_levm(program: &str, runs: usize, number_of_iterations: u32) { let mut vm = new_vm_with_bytecode(Bytes::new()).unwrap(); *vm.current_call_frame_mut().unwrap() = call_frame.clone(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = black_box(vm.execute(&mut current_call_frame)); + let tx_report = black_box(vm.execute(&mut current_call_frame).unwrap()); assert!(tx_report.result == TxResult::Success); } let mut vm = new_vm_with_bytecode(Bytes::new()).unwrap(); *vm.current_call_frame_mut().unwrap() = call_frame.clone(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = black_box(vm.execute(&mut current_call_frame)); + let tx_report = black_box(vm.execute(&mut current_call_frame).unwrap()); assert!(tx_report.result == TxResult::Success); match tx_report.result { diff --git a/crates/vm/levm/src/environment.rs b/crates/vm/levm/src/environment.rs index 1c48c563b..0bb6b21bb 100644 --- a/crates/vm/levm/src/environment.rs +++ b/crates/vm/levm/src/environment.rs @@ -15,7 +15,7 @@ pub struct Environment { pub prev_randao: Option, pub chain_id: U256, pub base_fee_per_gas: U256, - pub gas_price: U256, + pub gas_price: U256, // Effective gas price pub block_excess_blob_gas: Option, pub block_blob_gas_used: Option, pub tx_blob_hashes: Option>, diff --git a/crates/vm/levm/tests/edge_case_tests.rs b/crates/vm/levm/tests/edge_case_tests.rs index b4a522840..125da5a4f 100644 --- a/crates/vm/levm/tests/edge_case_tests.rs +++ b/crates/vm/levm/tests/edge_case_tests.rs @@ -17,14 +17,14 @@ fn test_extcodecopy_memory_allocation() { let mut current_call_frame = vm.call_frames.pop().unwrap(); current_call_frame.gas_limit = U256::from(100_000_000); vm.env.gas_price = U256::from(10_000); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_overflow_mcopy() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[90, 90, 90, 94])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] @@ -32,56 +32,56 @@ fn test_overflow_call() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[61, 48, 56, 54, 51, 51, 51, 241])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_usize_overflow_revert() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[61, 63, 61, 253])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_overflow_returndatacopy() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[50, 49, 48, 51, 62])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_overflow_keccak256() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[51, 63, 61, 32])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_arithmetic_operation_overflow_selfdestruct() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[50, 255])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_overflow_swap() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[48, 144])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_end_of_range_swap() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[58, 50, 50, 51, 57])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_usize_overflow_blobhash() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[71, 73])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] @@ -93,7 +93,7 @@ fn add_op() { ]) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.current_call_frame_mut().unwrap().pc(), 34); } @@ -102,14 +102,14 @@ fn add_op() { fn test_is_negative() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[58, 63, 58, 5])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); } #[test] fn test_non_compliance_keccak256() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[88, 88, 32, 89])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( *current_call_frame.stack.stack.first().unwrap(), U256::from_str("0xc5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470") @@ -130,7 +130,7 @@ fn test_sdiv_zero_dividend_and_negative_divisor() { ])) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(current_call_frame.stack.pop().unwrap(), U256::zero()); } @@ -139,7 +139,7 @@ fn test_non_compliance_returndatacopy() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[56, 56, 56, 56, 56, 56, 62, 56])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let txreport = vm.execute(&mut current_call_frame); + let txreport = vm.execute(&mut current_call_frame).unwrap(); assert_eq!(txreport.result, TxResult::Revert(VMError::VeryLargeNumber)); } @@ -147,7 +147,7 @@ fn test_non_compliance_returndatacopy() { fn test_non_compliance_extcodecopy() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[88, 88, 88, 89, 60, 89])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(current_call_frame.stack.stack.pop().unwrap(), U256::zero()); } @@ -158,7 +158,7 @@ fn test_non_compliance_extcodecopy_memory_resize() { ])) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(current_call_frame.stack.pop().unwrap(), U256::from(32)); } @@ -167,7 +167,7 @@ fn test_non_compliance_calldatacopy_memory_resize() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[0x60, 34, 0x5f, 0x5f, 55, 89])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( *current_call_frame.stack.stack.first().unwrap(), U256::from(64) @@ -183,7 +183,7 @@ fn test_non_compliance_addmod() { ])) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( current_call_frame.stack.stack.first().unwrap(), &U256::zero() @@ -205,7 +205,7 @@ fn test_non_compliance_addmod2() { ])) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( current_call_frame.stack.stack.first().unwrap(), &U256::from("0xfc7490ee00fc74a0ee00fc7490ee00fc7490ee5") @@ -219,7 +219,7 @@ fn test_non_compliance_codecopy() { ])) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( current_call_frame.stack.stack.first().unwrap(), &U256::zero() @@ -231,7 +231,7 @@ fn test_non_compliance_smod() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[0x60, 1, 0x60, 1, 0x19, 0x07])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( current_call_frame.stack.stack.first().unwrap(), &U256::zero() diff --git a/crates/vm/levm/tests/tests.rs b/crates/vm/levm/tests/tests.rs index 24b81cd64..4e8c8d1ad 100644 --- a/crates/vm/levm/tests/tests.rs +++ b/crates/vm/levm/tests/tests.rs @@ -58,7 +58,7 @@ fn add_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); assert!(vm.current_call_frame_mut().unwrap().pc() == 68); @@ -75,7 +75,7 @@ fn mul_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(8)); } @@ -91,7 +91,7 @@ fn sub_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(2)); } @@ -108,7 +108,7 @@ fn div_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(5)); @@ -122,7 +122,7 @@ fn div_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::zero()); } @@ -139,7 +139,7 @@ fn sdiv_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(2)); } @@ -156,7 +156,7 @@ fn mod_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(1)); } @@ -174,7 +174,7 @@ fn smod_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -204,7 +204,7 @@ fn smod_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let c = U256::from_str_radix( "0xfffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffffe", @@ -228,7 +228,7 @@ fn addmod_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(4)); } @@ -246,7 +246,7 @@ fn mulmod_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(4)); } @@ -263,7 +263,7 @@ fn exp_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(100)); } @@ -280,7 +280,7 @@ fn sign_extend_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::from(0x7F)); // Case 2: Input: 0, 0xFF. Output: 0xFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFFF @@ -293,7 +293,7 @@ fn sign_extend_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::MAX); } @@ -309,7 +309,7 @@ fn lt_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); } @@ -326,7 +326,7 @@ fn gt_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); } @@ -343,7 +343,7 @@ fn slt_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); } @@ -360,7 +360,7 @@ fn sgt_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); } @@ -377,7 +377,7 @@ fn eq_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); // Case 2: Input: 10, 20. Output: 0 (false) @@ -390,7 +390,7 @@ fn eq_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::zero()); } @@ -405,7 +405,7 @@ fn is_zero_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::one()); // Case 2: Input is non-zero (e.g., 10), Output should be 0 (since 10 != 0 is false) @@ -417,7 +417,7 @@ fn is_zero_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!(vm.current_call_frame_mut().unwrap().stack.pop().unwrap() == U256::zero()); } @@ -432,7 +432,7 @@ fn and_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b1000)); @@ -452,7 +452,7 @@ fn and_binary_with_zero() { TX_BASE_COST + gas_cost::AND + gas_cost::PUSHN.checked_mul(U256::from(2)).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -470,7 +470,7 @@ fn and_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF0F0)); @@ -485,7 +485,7 @@ fn and_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF000)); @@ -500,7 +500,7 @@ fn and_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b1000000000000)); @@ -518,7 +518,7 @@ fn or_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b1110)); @@ -533,7 +533,7 @@ fn or_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b1010)); @@ -548,7 +548,7 @@ fn or_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xFFFFFFFFFFFFFFFF_u64)); @@ -566,7 +566,7 @@ fn or_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xFFFF)); @@ -581,7 +581,7 @@ fn or_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF0F0)); @@ -596,7 +596,7 @@ fn or_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b1011111100101111)); @@ -614,7 +614,7 @@ fn xor_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b110)); @@ -629,7 +629,7 @@ fn xor_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b1010)); @@ -644,7 +644,7 @@ fn xor_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(u64::MAX)); @@ -659,7 +659,7 @@ fn xor_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -677,7 +677,7 @@ fn xor_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xFF)); @@ -692,7 +692,7 @@ fn xor_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -707,7 +707,7 @@ fn xor_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF0F)); @@ -722,7 +722,7 @@ fn xor_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF0)); @@ -737,7 +737,7 @@ fn xor_with_hex_numbers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0b111011001000100)); @@ -754,7 +754,7 @@ fn not() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let expected = !U256::from(0b1010); @@ -769,7 +769,7 @@ fn not() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -783,7 +783,7 @@ fn not() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::MAX); @@ -797,7 +797,7 @@ fn not() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::MAX - 1); @@ -815,7 +815,7 @@ fn byte_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF1)); @@ -830,7 +830,7 @@ fn byte_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x33)); @@ -848,7 +848,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xFF)); @@ -863,7 +863,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xFF)); @@ -878,7 +878,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x0D)); @@ -893,7 +893,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -908,7 +908,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -923,7 +923,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -944,7 +944,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x90)); @@ -959,7 +959,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x57)); @@ -974,7 +974,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xDD)); @@ -989,7 +989,7 @@ fn byte_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x40)); @@ -1007,7 +1007,7 @@ fn shl_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xDDDD)); @@ -1022,7 +1022,7 @@ fn shl_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x2468acf0)); @@ -1037,7 +1037,7 @@ fn shl_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(4886718336_u64)); @@ -1052,7 +1052,7 @@ fn shl_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xFF << 4)); @@ -1070,7 +1070,7 @@ fn shl_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -1085,7 +1085,7 @@ fn shl_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -1100,7 +1100,7 @@ fn shl_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::MAX - 1); @@ -1118,7 +1118,7 @@ fn shr_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xDDDD)); @@ -1133,7 +1133,7 @@ fn shr_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x91a2b3c)); @@ -1148,7 +1148,7 @@ fn shr_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x1234567)); @@ -1163,7 +1163,7 @@ fn shr_basic() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0xF)); @@ -1181,7 +1181,7 @@ fn shr_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -1196,7 +1196,7 @@ fn shr_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::zero()); @@ -1211,7 +1211,7 @@ fn shr_edge_cases() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::MAX >> 1); @@ -1229,7 +1229,7 @@ fn sar_shift_by_0() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x12345678)); @@ -1253,7 +1253,7 @@ fn sar_shifting_large_value_with_all_bits_set() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let expected = U256::from_big_endian(&[ @@ -1282,7 +1282,7 @@ fn sar_shifting_negative_value_and_small_shift() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let expected = U256::from_big_endian(&[ @@ -1305,7 +1305,7 @@ fn sar_shift_positive_value() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(result, U256::from(0x07FFFF)); @@ -1329,7 +1329,7 @@ fn sar_shift_negative_value() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let result = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let expected = U256::from_big_endian(&[ @@ -1362,7 +1362,7 @@ fn keccak256_zero_offset_size_four() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -1392,7 +1392,7 @@ fn keccak256_zero_offset_size_bigger_than_actual_memory() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap() @@ -1414,7 +1414,7 @@ fn keccak256_zero_offset_zero_size() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -1444,7 +1444,7 @@ fn keccak256_offset_four_size_four() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -1466,7 +1466,7 @@ fn mstore() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -1488,7 +1488,7 @@ fn mstore_saves_correct_value() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let stored_value = vm.current_call_frame_mut().unwrap().memory.load(0).unwrap(); @@ -1511,7 +1511,7 @@ fn mstore8() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let stored_value = vm.current_call_frame_mut().unwrap().memory.load(0).unwrap(); @@ -1539,7 +1539,7 @@ fn mcopy() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let copied_value = vm .current_call_frame_mut() @@ -1568,7 +1568,7 @@ fn mload() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let loaded_value = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(loaded_value, U256::from(0x33333)); @@ -1582,7 +1582,7 @@ fn msize() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let initial_size = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(initial_size, U256::from(0)); @@ -1599,7 +1599,7 @@ fn msize() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let after_store_size = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(after_store_size, U256::from(32)); @@ -1616,7 +1616,7 @@ fn msize() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let final_size = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(final_size, U256::from(96)); @@ -1638,7 +1638,7 @@ fn mstore_mload_offset_not_multiple_of_32() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let memory_size = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let loaded_value = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); @@ -1662,7 +1662,7 @@ fn mstore_mload_offset_not_multiple_of_32() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let memory_size = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let loaded_value = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); @@ -1684,7 +1684,7 @@ fn mload_uninitialized_memory() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let memory_size = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); let loaded_value = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); @@ -1733,7 +1733,7 @@ fn call_returns_if_bytecode_empty() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let success = vm.current_call_frame_mut().unwrap().stack.pop().unwrap(); assert_eq!(success, U256::one()); @@ -1777,7 +1777,7 @@ fn call_changes_callframe_and_stores() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -1879,7 +1879,7 @@ fn nested_calls() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -1951,7 +1951,7 @@ fn staticcall_changes_callframe_is_static() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let mut current_call_frame = vm.call_frames[0].clone(); @@ -1973,7 +1973,7 @@ fn pop_on_empty_stack() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); // result should be a Halt with error VMError::StackUnderflow @@ -1990,7 +1990,7 @@ fn pc_op() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2010,7 +2010,7 @@ fn pc_op_with_push_offset() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2070,7 +2070,7 @@ fn pc_op_with_push_offset() { // current_call_frame.to = Address::from_low_u64_be(U256::from(5).low_u64()); // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // let storage_slot = vm.cache.get_storage_slot( // Address::from_low_u64_be(U256::from(1).low_u64()), @@ -2134,7 +2134,7 @@ fn pc_op_with_push_offset() { // current_call_frame.to = Address::from_low_u64_be(U256::from(5).low_u64()); // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // let storage_slot = vm.cache.get_storage_slot(callee_address, U256::zero()); // let slot = StorageSlot { @@ -2196,7 +2196,7 @@ fn pc_op_with_push_offset() { // current_call_frame.to = Address::from_low_u64_be(U256::from(5).low_u64()); // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -2253,7 +2253,7 @@ fn pc_op_with_push_offset() { // ); // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // let current_call_frame = vm.call_frames[0].clone(); @@ -2286,7 +2286,7 @@ fn jump_position_bigger_than_program_bytecode_size() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, TxResult::Revert(VMError::InvalidJump) @@ -2308,7 +2308,7 @@ fn jumpi_not_zero() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2333,7 +2333,7 @@ fn jumpi_for_zero() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2404,7 +2404,7 @@ fn calldataload() { vm.current_call_frame_mut().unwrap().calldata = calldata; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -2477,7 +2477,7 @@ fn calldataload_being_set_by_parent() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -2502,7 +2502,7 @@ fn calldatasize() { vm.current_call_frame_mut().unwrap().calldata = calldata; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); let top_of_stack = current_call_frame.stack.pop().unwrap(); @@ -2525,7 +2525,7 @@ fn calldatacopy() { vm.current_call_frame_mut().unwrap().calldata = calldata; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); let memory = current_call_frame.memory.load_range(0, 2).unwrap(); @@ -2542,7 +2542,7 @@ fn returndatasize() { vm.current_call_frame_mut().unwrap().sub_return_data = returndata; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); let top_of_stack = current_call_frame.stack.pop().unwrap(); @@ -2565,7 +2565,7 @@ fn returndatacopy() { vm.current_call_frame_mut().unwrap().sub_return_data = returndata; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); let memory = current_call_frame.memory.load_range(0, 2).unwrap(); @@ -2614,7 +2614,7 @@ fn returndatacopy_being_set_by_parent() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -2651,7 +2651,7 @@ fn blockhash_op() { vm.env.block_number = current_block_number; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2683,7 +2683,7 @@ fn blockhash_same_block_number() { vm.env.block_number = current_block_number; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2719,7 +2719,7 @@ fn blockhash_block_number_not_from_recent_256() { vm.env.block_number = current_block_number; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2738,7 +2738,7 @@ fn coinbase_op() { vm.env.coinbase = Address::from_low_u64_be(coinbase_address); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2757,7 +2757,7 @@ fn timestamp_op() { vm.env.timestamp = timestamp; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2776,7 +2776,7 @@ fn number_op() { vm.env.block_number = block_number; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2795,7 +2795,7 @@ fn prevrandao_op() { vm.env.prev_randao = Some(prevrandao); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2814,7 +2814,7 @@ fn gaslimit_op() { vm.env.gas_limit = gas_limit; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2833,7 +2833,7 @@ fn chain_id_op() { vm.env.chain_id = chain_id; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2852,7 +2852,7 @@ fn basefee_op() { vm.env.base_fee_per_gas = base_fee_per_gas; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2871,7 +2871,7 @@ fn blobbasefee_op() { vm.env.block_blob_gas_used = Some(U256::zero()); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2890,7 +2890,7 @@ fn blobbasefee_minimum_cost() { vm.env.block_blob_gas_used = Some(U256::zero()); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2911,7 +2911,7 @@ fn pop_op() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2934,7 +2934,7 @@ fn jump_op() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -2957,7 +2957,7 @@ fn jump_not_jumpdest_position() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, TxResult::Revert(VMError::InvalidJump) @@ -2984,7 +2984,7 @@ fn sstore_op() { vm.current_call_frame_mut().unwrap().code_address = sender_address; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); // Convert key in U256 to H256 let mut bytes = [0u8; 32]; @@ -3010,7 +3010,7 @@ fn sstore_reverts_when_called_in_static() { let mut vm = new_vm_with_ops(&operations).unwrap(); vm.current_call_frame_mut().unwrap().is_static = true; let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, @@ -3039,7 +3039,7 @@ fn sload_op() { vm.current_call_frame_mut().unwrap().msg_sender = sender_address; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( value, @@ -3060,7 +3060,7 @@ fn sload_untouched_key_of_storage() { vm.current_call_frame_mut().unwrap().msg_sender = sender_address; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( U256::zero(), @@ -3078,7 +3078,7 @@ fn sload_on_not_existing_account() { vm.current_call_frame_mut().unwrap().msg_sender = sender_address; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( U256::zero(), @@ -3102,7 +3102,7 @@ fn log0() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let data = [0xff_u8; 32].as_slice(); @@ -3132,7 +3132,7 @@ fn log1() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let data = [0xff_u8; 32].as_slice(); @@ -3165,7 +3165,7 @@ fn log2() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let data = [0xff_u8; 32].as_slice(); @@ -3204,7 +3204,7 @@ fn log3() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let data = [0xff_u8; 32].as_slice(); @@ -3250,7 +3250,7 @@ fn log4() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let data = [0xff_u8; 32].as_slice(); @@ -3284,7 +3284,7 @@ fn log_with_0_data_size() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; assert_eq!(logs.len(), 1); @@ -3310,7 +3310,7 @@ fn cant_create_log_in_static_context() { let mut vm: VM = new_vm_with_ops(&operations).unwrap(); vm.current_call_frame_mut().unwrap().is_static = true; let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, @@ -3334,7 +3334,7 @@ fn log_with_data_in_memory_smaller_than_size() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let mut data = vec![0_u8; 16]; @@ -3369,7 +3369,7 @@ fn multiple_logs_of_different_types() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let logs = &vm.current_call_frame_mut().unwrap().logs; let data = [0xff_u8; 32].as_slice(); @@ -3428,7 +3428,7 @@ fn logs_from_multiple_callers() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(current_call_frame.logs.len(), 2) } @@ -3473,7 +3473,7 @@ fn logs_from_multiple_callers() { // vm.db.add_account(callee_address, callee_account); // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // assert_eq!( // vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -3486,7 +3486,7 @@ fn push0_ok() { let mut vm = new_vm_with_ops(&[Operation::Push0, Operation::Stop]).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.stack[0], @@ -3502,7 +3502,7 @@ fn push1_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.current_call_frame_mut().unwrap().stack.stack[0], to_push); assert_eq!(vm.current_call_frame_mut().unwrap().pc(), 3); @@ -3515,7 +3515,7 @@ fn push5_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.current_call_frame_mut().unwrap().stack.stack[0], to_push); assert_eq!(vm.current_call_frame_mut().unwrap().pc(), 7); @@ -3528,7 +3528,7 @@ fn push31_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.current_call_frame_mut().unwrap().stack.stack[0], to_push); assert_eq!(vm.current_call_frame_mut().unwrap().pc(), 33); @@ -3541,7 +3541,7 @@ fn push32_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.current_call_frame_mut().unwrap().stack.stack[0], to_push); assert_eq!(vm.current_call_frame_mut().unwrap().pc(), 34); @@ -3558,7 +3558,7 @@ fn dup1_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let stack_len = vm.current_call_frame_mut().unwrap().stack.len(); @@ -3584,7 +3584,7 @@ fn dup16_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let stack_len = vm.current_call_frame_mut().unwrap().stack.len(); @@ -3606,7 +3606,7 @@ fn dup_halts_if_stack_underflow() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, @@ -3626,7 +3626,7 @@ fn swap1_ok() { ]; let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.current_call_frame_mut().unwrap().stack.len(), 2); assert_eq!(vm.current_call_frame_mut().unwrap().pc(), 6); @@ -3646,7 +3646,7 @@ fn swap16_ok() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let stack_len = vm.current_call_frame_mut().unwrap().stack.len(); assert_eq!(stack_len, 17); @@ -3667,7 +3667,7 @@ fn swap_halts_if_stack_underflow() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, @@ -3694,7 +3694,7 @@ fn transient_store() { assert!(current_call_frame.transient_storage.is_empty()); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let current_call_frame = vm.current_call_frame_mut().unwrap(); @@ -3719,7 +3719,7 @@ fn transient_store_stack_underflow() { .is_empty()); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, @@ -3748,7 +3748,7 @@ fn transient_load() { .insert((caller, key), value); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( *vm.current_call_frame_mut() @@ -3794,7 +3794,7 @@ fn create_happy_path() { vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let call_frame = vm.current_call_frame_mut().unwrap(); let returned_address = call_frame.stack.pop().unwrap(); @@ -3841,7 +3841,7 @@ fn cant_create_with_size_longer_than_max_code_size() { vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let call_frame = vm.current_call_frame_mut().unwrap(); let create_return_value = call_frame.stack.pop().unwrap(); @@ -3876,7 +3876,7 @@ fn cant_create_on_static_contexts() { vm.current_call_frame_mut().unwrap().is_static = true; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let call_frame = vm.current_call_frame_mut().unwrap(); let create_return_value = call_frame.stack.pop().unwrap(); @@ -3910,7 +3910,7 @@ fn cant_create_if_transfer_value_bigger_than_balance() { vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let call_frame = vm.current_call_frame_mut().unwrap(); let create_return_value = call_frame.stack.pop().unwrap(); @@ -3944,7 +3944,7 @@ fn cant_create_if_sender_nonce_would_overflow() { vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let call_frame = vm.current_call_frame_mut().unwrap(); let create_return_value = call_frame.stack.pop().unwrap(); @@ -3988,7 +3988,7 @@ fn cant_create_if_sender_nonce_would_overflow() { // vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // let call_frame = vm.current_call_frame_mut().unwrap(); @@ -4016,7 +4016,7 @@ fn cant_create_if_sender_nonce_would_overflow() { // new_vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; // let mut current_call_frame = new_vm.call_frames.pop().unwrap(); -// new_vm.execute(&mut current_call_frame); +// new_vm.execute(&mut current_call_frame).unwrap(); // let call_frame = new_vm.current_call_frame_mut().unwrap(); // let return_of_created_callframe = call_frame.stack.pop().unwrap(); // assert_eq!(return_of_created_callframe, U256::from(REVERT_FOR_CREATE)); @@ -4066,7 +4066,7 @@ fn create2_happy_path() { vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); let call_frame = vm.current_call_frame_mut().unwrap(); let returned_address = call_frame.stack.pop().unwrap(); @@ -4111,7 +4111,7 @@ fn create2_happy_path() { // vm.current_call_frame_mut().unwrap().msg_sender = sender_addr; // let mut current_call_frame = vm.call_frames.pop().unwrap(); -// vm.execute(&mut current_call_frame); +// vm.execute(&mut current_call_frame).unwrap(); // assert_eq!(vm.db.accounts.len(), 4); // } @@ -4147,7 +4147,7 @@ fn caller_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -4188,7 +4188,7 @@ fn origin_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -4217,7 +4217,7 @@ fn balance_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -4256,7 +4256,7 @@ fn address_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -4301,7 +4301,7 @@ fn selfbalance_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -4343,7 +4343,7 @@ fn callvalue_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), @@ -4384,7 +4384,7 @@ fn codesize_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), U256::from(2) @@ -4424,7 +4424,7 @@ fn gasprice_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), U256::from(0x9876) @@ -4480,7 +4480,7 @@ fn codecopy_op() { .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().memory.load(0).unwrap(), @@ -4510,7 +4510,7 @@ fn extcodesize_existing_account() { let mut vm = new_vm_with_ops_db(&operations, db).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), 23.into() @@ -4530,7 +4530,7 @@ fn extcodesize_non_existing_account() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), 0.into() @@ -4561,7 +4561,7 @@ fn extcodecopy_existing_account() { let mut vm = new_vm_with_ops_db(&operations, db).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut() .unwrap() @@ -4590,7 +4590,7 @@ fn extcodecopy_non_existing_account() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut() .unwrap() @@ -4617,7 +4617,7 @@ fn extcodehash_account_with_empty_code() { let mut vm = new_vm_with_ops_db(&operations, db).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470".into() @@ -4637,7 +4637,7 @@ fn extcodehash_non_existing_account() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( vm.current_call_frame_mut().unwrap().stack.pop().unwrap(), "c5d2460186f7233c927e7db2dcc703c0e500b653ca82273b7bfad8045d85a470".into() @@ -4652,7 +4652,7 @@ fn invalid_opcode() { let mut vm = new_vm_with_ops(&operations).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert!(matches!( tx_report.result, @@ -4675,7 +4675,7 @@ fn revert_opcode() { let mut vm = new_vm_with_ops(&ops).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - let tx_report = vm.execute(&mut current_call_frame); + let tx_report = vm.execute(&mut current_call_frame).unwrap(); assert_eq!(U256::from_big_endian(&tx_report.output), U256::from(0xA)); assert!(matches!( @@ -4706,7 +4706,7 @@ fn revert_sstore() { // Cache state before the SSTORE let cache_backup = vm.cache.clone(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!(vm.cache, cache_backup); } From b01ec9765006cedc03ba8bc378128cabfdcdb530 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 09:37:43 -0300 Subject: [PATCH 11/54] change blob hashes type and add other paremeters in vm.rs --- crates/vm/levm/src/environment.rs | 2 +- crates/vm/vm.rs | 5 ++++- 2 files changed, 5 insertions(+), 2 deletions(-) diff --git a/crates/vm/levm/src/environment.rs b/crates/vm/levm/src/environment.rs index 0bb6b21bb..c7398a369 100644 --- a/crates/vm/levm/src/environment.rs +++ b/crates/vm/levm/src/environment.rs @@ -18,7 +18,7 @@ pub struct Environment { pub gas_price: U256, // Effective gas price pub block_excess_blob_gas: Option, pub block_blob_gas_used: Option, - pub tx_blob_hashes: Option>, + pub tx_blob_hashes: Vec, pub tx_max_priority_fee_per_gas: Option, pub tx_max_fee_per_gas: Option, pub tx_max_fee_per_blob_gas: Option, diff --git a/crates/vm/vm.rs b/crates/vm/vm.rs index 78f58d251..232400527 100644 --- a/crates/vm/vm.rs +++ b/crates/vm/vm.rs @@ -181,7 +181,10 @@ cfg_if::cfg_if! { gas_price, block_excess_blob_gas: block_header.excess_blob_gas.map(U256::from), block_blob_gas_used: block_header.blob_gas_used.map(U256::from), - tx_blob_hashes: None, + tx_blob_hashes: tx.blob_versioned_hashes(), + tx_max_priority_fee_per_gas: tx.max_priority_fee().map(U256::from), + tx_max_fee_per_gas: tx.max_fee_per_gas().map(U256::from), + tx_max_fee_per_blob_gas: tx.max_fee_per_blob_gas().map(U256::from), }; let mut vm = VM::new( From e5196ec1177387d7fd69db3f1bdb6c70007ba7cc Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 09:43:30 -0300 Subject: [PATCH 12/54] make small changes in type 3 validations --- crates/vm/levm/src/vm.rs | 41 ++++++++++++++++++++-------------------- crates/vm/vm.rs | 1 + 2 files changed, 22 insertions(+), 20 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 3d20c165e..7d43f6506 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -12,7 +12,10 @@ use crate::{ opcodes::Opcode, }; use bytes::Bytes; -use ethrex_core::{types::TxKind, Address, H256, U256}; +use ethrex_core::{ + types::{blobs_bundle, TxKind}, + Address, H256, U256, +}; use ethrex_rlp; use ethrex_rlp::encode::RLPEncode; use keccak_hash::keccak; @@ -536,16 +539,17 @@ impl VM { //TODO: Implement the rest of the validations (TYPE_3) - // (11) TYPE_3_TX_ZERO_BLOBS - if let Some(tx_blob_hashes) = &self.env.tx_blob_hashes { - if tx_blob_hashes.is_empty() { + // Transaction is type 3 if tx_max_fee_per_blob_gas is Some + if self.env.tx_max_fee_per_blob_gas.is_some() { + let blob_hashes = &self.env.tx_blob_hashes; + + // (11) TYPE_3_TX_ZERO_BLOBS + if blob_hashes.is_empty() { return Err(VMError::TxValidation(TxValidationError::Type3TxZeroBlobs)); } - } - // (12) TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH - if let Some(tx_blob_hashes) = &self.env.tx_blob_hashes { - for blob_hash in tx_blob_hashes { + // (12) TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH + for blob_hash in blob_hashes { let blob_hash = blob_hash.as_bytes(); if let Some(first_byte) = blob_hash.first() { if !VALID_BLOB_PREFIXES.contains(first_byte) { @@ -555,25 +559,22 @@ impl VM { } } } - } - // (13) TYPE_3_TX_PRE_FORK -> This is not necessary for now because we are not supporting pre-cancun transactions yet. But we should somehow be able to tell the current context. + // (13) TYPE_3_TX_PRE_FORK -> This is not necessary for now because we are not supporting pre-cancun transactions yet. But we should somehow be able to tell the current context. - // (14) TYPE_3_TX_BLOB_COUNT_EXCEEDED - if let Some(tx_blob_hashes) = &self.env.tx_blob_hashes { - if tx_blob_hashes.len() > MAX_BLOB_COUNT { + // (14) TYPE_3_TX_BLOB_COUNT_EXCEEDED + if blob_hashes.len() > MAX_BLOB_COUNT { return Err(VMError::TxValidation( TxValidationError::Type3TxBlobCountExceeded, )); } - } - // (15) TYPE_3_TX_CONTRACT_CREATION - // The current way of checking if the transaction is a Type 3 Tx is by checking if the tx_blob_hashes is Some. - if self.env.tx_blob_hashes.is_some() && self.is_create() { - return Err(VMError::TxValidation( - TxValidationError::Type3TxContractCreation, - )); + // (15) TYPE_3_TX_CONTRACT_CREATION + if self.is_create() { + return Err(VMError::TxValidation( + TxValidationError::Type3TxContractCreation, + )); + } } Ok(()) diff --git a/crates/vm/vm.rs b/crates/vm/vm.rs index 232400527..2e0d131f1 100644 --- a/crates/vm/vm.rs +++ b/crates/vm/vm.rs @@ -185,6 +185,7 @@ cfg_if::cfg_if! { tx_max_priority_fee_per_gas: tx.max_priority_fee().map(U256::from), tx_max_fee_per_gas: tx.max_fee_per_gas().map(U256::from), tx_max_fee_per_blob_gas: tx.max_fee_per_blob_gas().map(U256::from), + block_gas_limit: block_header.gas_limit.into(), }; let mut vm = VM::new( From 99a1e215819673bac84804d23f0b98f7425900d6 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 09:49:16 -0300 Subject: [PATCH 13/54] fix behavior for op_blobhash --- crates/vm/levm/src/opcode_handlers/block.rs | 28 ++++++++------------- 1 file changed, 11 insertions(+), 17 deletions(-) diff --git a/crates/vm/levm/src/opcode_handlers/block.rs b/crates/vm/levm/src/opcode_handlers/block.rs index d252b4d4a..72c47c425 100644 --- a/crates/vm/levm/src/opcode_handlers/block.rs +++ b/crates/vm/levm/src/opcode_handlers/block.rs @@ -7,7 +7,7 @@ use crate::{ }; use ethrex_core::{ types::{BLOB_BASE_FEE_UPDATE_FRACTION, MIN_BASE_FEE_PER_BLOB_GAS}, - H256, U256, + U256, }; // Block Information (11) @@ -170,22 +170,16 @@ impl VM { .try_into() .map_err(|_err| VMError::VeryLargeNumber)?; - let blob_hash: H256 = match &self.env.tx_blob_hashes { - Some(vec) => match vec.get(index) { - Some(el) => *el, - None => { - return Err(VMError::BlobHashIndexOutOfBounds); - } - }, - None => { - return Err(VMError::MissingBlobHashes); - } - }; - - // Could not find a better way to translate from H256 to U256 - let u256_blob = U256::from(blob_hash.as_bytes()); - - current_call_frame.stack.push(u256_blob)?; + let blob_hashes = &self.env.tx_blob_hashes; + + blob_hashes + .get(index) + .map(|el| { + current_call_frame + .stack + .push(U256::from_big_endian(el.as_bytes())) + }) + .unwrap_or_else(|| current_call_frame.stack.push(U256::zero()))?; Ok(OpcodeSuccess::Continue) } From 40b6b8ab59c1fda5dd32c1f9188fb190cfc036d6 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 09:59:44 -0300 Subject: [PATCH 14/54] fix ef_tests environment for levm --- cmd/ef_tests/levm/runner/levm_runner.rs | 28 ++++++++++++++----------- crates/vm/levm/src/vm.rs | 2 +- 2 files changed, 17 insertions(+), 13 deletions(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index 44406b02d..7a4eae3a8 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -19,6 +19,8 @@ use ethrex_vm::db::StoreWrapper; use keccak_hash::keccak; use std::{collections::HashMap, sync::Arc}; +use super::revm_runner::effective_gas_price; + pub fn run_ef_test(test: &EFTest) -> Result { let mut ef_test_report = EFTestReport::new( test.name.clone(), @@ -72,31 +74,33 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result Date: Thu, 28 Nov 2024 10:38:12 -0300 Subject: [PATCH 15/54] stop using effective gas price in levm --- cmd/ef_tests/levm/runner/levm_runner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index 7a4eae3a8..9c2521e3b 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -90,7 +90,7 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result Date: Thu, 28 Nov 2024 11:24:42 -0300 Subject: [PATCH 16/54] comment some stuff in validate transaction --- crates/vm/levm/src/vm.rs | 24 ++++++++++++++---------- 1 file changed, 14 insertions(+), 10 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 0dfc04225..1d231e3df 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -434,8 +434,8 @@ impl VM { /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: /// - It increases sender nonce - /// - It substracts up-front-cost from sender balance. - /// - It calculates and adds intrinsic gas to the 'gas used' of callframe and environment. + /// - It substracts up-front-cost from sender balance. (Not doing this for now) + /// - It calculates and adds intrinsic gas to the 'gas used' of callframe and environment. (Not doing this for now) /// See 'docs' for more information about validations. fn validate_transaction(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { //TODO: This should revert the transaction, not throw an error. And I don't know if it should be done here... @@ -466,13 +466,14 @@ impl VM { ))?; // (2) INSUFFICIENT_ACCOUNT_FUNDS - sender_account.info.balance = sender_account - .info - .balance - .checked_sub(up_front_cost) - .ok_or(VMError::TxValidation( - TxValidationError::InsufficientAccountFunds, - ))?; + // NOT DOING THIS FOR NOW + // sender_account.info.balance = sender_account + // .info + // .balance + // .checked_sub(up_front_cost) + // .ok_or(VMError::TxValidation( + // TxValidationError::InsufficientAccountFunds, + // ))?; // (3) INSUFFICIENT_MAX_FEE_PER_GAS if self.env.gas_price < self.env.base_fee_per_gas { @@ -492,7 +493,8 @@ impl VM { } // (5) INTRINSIC_GAS_TOO_LOW - self.add_intrinsic_gas(initial_call_frame)?; + // TODO: Not doing this for now + // self.add_intrinsic_gas(initial_call_frame)?; // (6) NONCE_IS_MAX sender_account.info.nonce = sender_account @@ -590,6 +592,8 @@ impl VM { .pop() .ok_or(VMError::Internal(InternalError::CouldNotPopCallframe))?; + self.validate_transaction(&mut current_call_frame)?; + let mut report = self.execute(&mut current_call_frame)?; let initial_call_frame = self From d94a98a9a98711eb35c760b63b82e9a72b88e915 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 13:05:07 -0300 Subject: [PATCH 17/54] delete add_intrinsic_gas (out of scope), and change some things in validation --- cmd/ef_tests/levm/runner/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ef_tests/levm/runner/mod.rs b/cmd/ef_tests/levm/runner/mod.rs index a0fff006f..104bd61b8 100644 --- a/cmd/ef_tests/levm/runner/mod.rs +++ b/cmd/ef_tests/levm/runner/mod.rs @@ -54,7 +54,7 @@ pub fn run_ef_tests( if reports.is_empty() { run_with_levm(&mut reports, &ef_tests)?; } - re_run_with_revm(&mut reports, &ef_tests)?; + // re_run_with_revm(&mut reports, &ef_tests)?; write_report(&reports) } From 2f71d268aca16df18db45abe1c6ab9bc433b158b Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 13:06:51 -0300 Subject: [PATCH 18/54] last commit was wrong, this one is the real one :) --- cmd/ef_tests/levm/runner/mod.rs | 2 +- crates/vm/levm/src/vm.rs | 87 +++++---------------------------- 2 files changed, 13 insertions(+), 76 deletions(-) diff --git a/cmd/ef_tests/levm/runner/mod.rs b/cmd/ef_tests/levm/runner/mod.rs index 104bd61b8..a0fff006f 100644 --- a/cmd/ef_tests/levm/runner/mod.rs +++ b/cmd/ef_tests/levm/runner/mod.rs @@ -54,7 +54,7 @@ pub fn run_ef_tests( if reports.is_empty() { run_with_levm(&mut reports, &ef_tests)?; } - // re_run_with_revm(&mut reports, &ef_tests)?; + re_run_with_revm(&mut reports, &ef_tests)?; write_report(&reports) } diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 1d231e3df..ae6d28b9e 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -8,14 +8,11 @@ use crate::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, TxValidationError, VMError, }, - gas_cost::{self, CREATE_BASE_COST}, + gas_cost::{self}, opcodes::Opcode, }; use bytes::Bytes; -use ethrex_core::{ - types::{blobs_bundle, TxKind}, - Address, H256, U256, -}; +use ethrex_core::{types::TxKind, Address, H256, U256}; use ethrex_rlp; use ethrex_rlp::encode::RLPEncode; use keccak_hash::keccak; @@ -369,67 +366,6 @@ impl VM { Ok(()) } - /// Adds intrinsic gas to the consumed gas of the current call frame and the environment. - // Intrinsic gas is the gas consumed by the transaction before the execution of the opcodes. Section 6.2 in the Yellow Paper. - pub fn add_intrinsic_gas(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { - // Intrinsic Gas = Calldata cost + Create cost + Base cost + Access list cost - let mut intrinsic_gas: U256 = U256::zero(); - - // Calldata Cost - // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. - let mut calldata_cost: U256 = U256::zero(); - for byte in &initial_call_frame.calldata { - if *byte != 0 { - calldata_cost = calldata_cost - .checked_add(U256::from(16)) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; - } else { - calldata_cost = calldata_cost - .checked_add(U256::from(4)) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; - } - } - - intrinsic_gas = intrinsic_gas - .checked_add(calldata_cost) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; - - // Base Cost - intrinsic_gas = intrinsic_gas - .checked_add(TX_BASE_COST) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; - - // Create Cost - if self.is_create() { - intrinsic_gas = intrinsic_gas - .checked_add(CREATE_BASE_COST) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; - - let number_of_words: u64 = initial_call_frame - .calldata - .chunks(WORD_SIZE) - .len() - .try_into() - .map_err(|_| VMError::Internal(InternalError::ConversionError))?; - - intrinsic_gas = intrinsic_gas - .checked_add( - U256::from(number_of_words) - .checked_mul(U256::from(2)) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?, - ) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; - } - - // Access List Cost - // TODO: Implement access list cost. - - self.increase_consumed_gas(initial_call_frame, intrinsic_gas) - .map_err(|_| VMError::TxValidation(TxValidationError::IntrinsicGasTooLow))?; - - Ok(()) - } - /// ## Description /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: @@ -466,14 +402,15 @@ impl VM { ))?; // (2) INSUFFICIENT_ACCOUNT_FUNDS - // NOT DOING THIS FOR NOW - // sender_account.info.balance = sender_account - // .info - // .balance - // .checked_sub(up_front_cost) - // .ok_or(VMError::TxValidation( - // TxValidationError::InsufficientAccountFunds, - // ))?; + // NOT CHANGING SENDER BALANCE HERE FOR NOW + // sender_account.info.balance = + sender_account + .info + .balance + .checked_sub(up_front_cost) + .ok_or(VMError::TxValidation( + TxValidationError::InsufficientAccountFunds, + ))?; // (3) INSUFFICIENT_MAX_FEE_PER_GAS if self.env.gas_price < self.env.base_fee_per_gas { @@ -485,7 +422,7 @@ impl VM { // (4) INITCODE_SIZE_EXCEEDED if self.is_create() { // INITCODE_SIZE_EXCEEDED - if initial_call_frame.calldata.len() > INIT_CODE_MAX_SIZE { + if initial_call_frame.calldata.len() >= INIT_CODE_MAX_SIZE { return Err(VMError::TxValidation( TxValidationError::InitcodeSizeExceeded, )); From d13cf3be4f63a7e8032399662081b8c25c591065 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 13:09:55 -0300 Subject: [PATCH 19/54] remove import gas price --- cmd/ef_tests/levm/runner/levm_runner.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index 9c2521e3b..71d6b2e42 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -19,8 +19,6 @@ use ethrex_vm::db::StoreWrapper; use keccak_hash::keccak; use std::{collections::HashMap, sync::Arc}; -use super::revm_runner::effective_gas_price; - pub fn run_ef_test(test: &EFTest) -> Result { let mut ef_test_report = EFTestReport::new( test.name.clone(), From 68a3191ca205ebd96f6f73f60be9e76253763912 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 13:42:21 -0300 Subject: [PATCH 20/54] add unwrap() to execute in edge cases tests --- crates/vm/levm/tests/edge_case_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/levm/tests/edge_case_tests.rs b/crates/vm/levm/tests/edge_case_tests.rs index 5701c3842..992dcd4c8 100644 --- a/crates/vm/levm/tests/edge_case_tests.rs +++ b/crates/vm/levm/tests/edge_case_tests.rs @@ -245,7 +245,7 @@ fn test_non_compliance_extcodecopy_size_and_destoffset() { ])) .unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( current_call_frame.stack.stack.first().unwrap(), &U256::from(64) From 8e882bc3b8192c659a3464ce6472e62dc3112dfd Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 14:22:16 -0300 Subject: [PATCH 21/54] return error when not finding transaction levm_runner --- cmd/ef_tests/levm/runner/levm_runner.rs | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index 1cd264326..1d9be36d2 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -73,7 +73,12 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result Date: Thu, 28 Nov 2024 14:24:56 -0300 Subject: [PATCH 22/54] remove storage constants that were not used --- crates/vm/levm/src/constants.rs | 4 ---- 1 file changed, 4 deletions(-) diff --git a/crates/vm/levm/src/constants.rs b/crates/vm/levm/src/constants.rs index f90915c30..8fdc24d2d 100644 --- a/crates/vm/levm/src/constants.rs +++ b/crates/vm/levm/src/constants.rs @@ -47,10 +47,6 @@ pub const MIN_BASE_FEE_PER_BLOB_GAS: U256 = U256([1, 0, 0, 0]); pub const BLOB_BASE_FEE_UPDATE_FRACTION: U256 = U256([3338477, 0, 0, 0]); pub const MAX_BLOB_COUNT: usize = 6; pub const VALID_BLOB_PREFIXES: [u8; 2] = [0x01, 0x02]; -// Storage constants -pub const COLD_STORAGE_ACCESS_COST: U256 = U256([2100, 0, 0, 0]); -pub const WARM_ADDRESS_ACCESS_COST: U256 = U256([100, 0, 0, 0]); -pub const BALANCE_COLD_ADDRESS_ACCESS_COST: U256 = U256([2600, 0, 0, 0]); // Block constants pub const LAST_AVAILABLE_BLOCK_LIMIT: U256 = U256([256, 0, 0, 0]); From c9b747f7990ea6239daa17cf57bc9f459687b24d Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 14:26:09 -0300 Subject: [PATCH 23/54] remove comment from revert create --- crates/vm/levm/src/vm.rs | 3 --- 1 file changed, 3 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 0e977c78a..83be8be8a 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -366,9 +366,6 @@ impl VM { return Err(VMError::AddressDoesNotMatchAnAccount); // Should not be this error } - // Should revert this? - // sender_account.info.balance -= self.call_frames.first().ok_or(VMError::FatalUnwrap)?.msg_value; - Ok(()) } From ba57edf457339ad576e9233b2842b38e73312d8a Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 15:05:38 -0300 Subject: [PATCH 24/54] fix clippy lint in execute --- crates/vm/levm/tests/edge_case_tests.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/levm/tests/edge_case_tests.rs b/crates/vm/levm/tests/edge_case_tests.rs index 01093c8af..e00eeb0b4 100644 --- a/crates/vm/levm/tests/edge_case_tests.rs +++ b/crates/vm/levm/tests/edge_case_tests.rs @@ -256,7 +256,7 @@ fn test_non_compliance_extcodecopy_size_and_destoffset() { fn test_non_compliance_log() { let mut vm = new_vm_with_bytecode(Bytes::copy_from_slice(&[95, 97, 89, 0, 160, 89])).unwrap(); let mut current_call_frame = vm.call_frames.pop().unwrap(); - vm.execute(&mut current_call_frame); + vm.execute(&mut current_call_frame).unwrap(); assert_eq!( current_call_frame.stack.stack.first().unwrap(), &U256::zero() From f80c90092d5b07ca2fc3cd69f5193d9deba6e236 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 16:11:22 -0300 Subject: [PATCH 25/54] merge --- crates/l2/contracts/Cargo.lock | 4807 ++++++++++++++++++++++++++++++++ 1 file changed, 4807 insertions(+) create mode 100644 crates/l2/contracts/Cargo.lock diff --git a/crates/l2/contracts/Cargo.lock b/crates/l2/contracts/Cargo.lock new file mode 100644 index 000000000..e89f3e74c --- /dev/null +++ b/crates/l2/contracts/Cargo.lock @@ -0,0 +1,4807 @@ +# This file is automatically @generated by Cargo. +# It is not intended for manual editing. +version = 3 + +[[package]] +name = "addr2line" +version = "0.24.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dfbe277e56a376000877090da837660b4427aad530e3028d44e0bffe4f89a1c1" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "512761e0bb2578dd7380c6baaa0f4ce03e84f95e960231d1dec8bf4d7d6e2627" + +[[package]] +name = "aes" +version = "0.8.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b169f7a6d4742236a0a00c541b845991d0ac43e546831af1249753ab4c3aa3a0" +dependencies = [ + "cfg-if", + "cipher", + "cpufeatures", +] + +[[package]] +name = "ahash" +version = "0.8.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e89da841a80418a9b391ebaea17f5c112ffaaa96f621d2c285b5174da76b9011" +dependencies = [ + "cfg-if", + "once_cell", + "version_check", + "zerocopy", +] + +[[package]] +name = "aho-corasick" +version = "1.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e60d3430d3a69478ad0993f19238d2df97c507009a52b3c10addcd7f6bcb916" +dependencies = [ + "memchr", +] + +[[package]] +name = "alloy-consensus" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "705687d5bfd019fee57cf9e206b27b30a9a9617535d5590a02b171e813208f8e" +dependencies = [ + "alloy-eips", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "auto_impl", + "c-kzg", + "derive_more", + "serde", +] + +[[package]] +name = "alloy-eip2930" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0069cf0642457f87a01a014f6dc29d5d893cd4fd8fddf0c3cdfad1bb3ebafc41" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "serde", +] + +[[package]] +name = "alloy-eip7702" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea59dc42102bc9a1905dc57901edc6dd48b9f38115df86c7d252acba70d71d04" +dependencies = [ + "alloy-primitives", + "alloy-rlp", + "k256", + "serde", +] + +[[package]] +name = "alloy-eips" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6ffb906284a1e1f63c4607da2068c8197458a352d0b3e9796e67353d72a9be85" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "c-kzg", + "derive_more", + "once_cell", + "serde", + "sha2 0.10.8", +] + +[[package]] +name = "alloy-json-abi" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b5671117c38b1c2306891f97ad3828d85487087f54ebe2c7591a055ea5bcea7" +dependencies = [ + "alloy-primitives", + "alloy-sol-type-parser", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-network-primitives" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "801492711d4392b2ccf5fc0bc69e299fa1aab15167d74dcaa9aab96a54f684bd" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-primitives", + "alloy-serde", + "serde", +] + +[[package]] +name = "alloy-primitives" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c71738eb20c42c5fb149571e76536a0f309d142f3957c28791662b96baf77a3d" +dependencies = [ + "alloy-rlp", + "bytes", + "cfg-if", + "const-hex", + "derive_more", + "foldhash", + "hashbrown 0.15.0", + "hex-literal", + "indexmap", + "itoa", + "k256", + "keccak-asm", + "paste", + "proptest", + "rand", + "ruint", + "rustc-hash 2.0.0", + "serde", + "sha3", + "tiny-keccak", +] + +[[package]] +name = "alloy-rlp" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da0822426598f95e45dd1ea32a738dac057529a709ee645fcc516ffa4cbde08f" +dependencies = [ + "alloy-rlp-derive", + "arrayvec", + "bytes", +] + +[[package]] +name = "alloy-rlp-derive" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b09cae092c27b6f1bde952653a22708691802e57bfef4a2973b80bea21efd3f" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "alloy-rpc-types-eth" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413f4aa3ccf2c3e4234a047c5fa4727916d7daf25a89f9b765df0ba09784fd87" +dependencies = [ + "alloy-consensus", + "alloy-eips", + "alloy-network-primitives", + "alloy-primitives", + "alloy-rlp", + "alloy-serde", + "alloy-sol-types", + "derive_more", + "itertools 0.13.0", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-rpc-types-trace" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "017cad3e5793c5613588c1f9732bcbad77e820ba7d0feaba3527749f856fdbc5" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-serde", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "alloy-serde" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9dff0ab1cdd43ca001e324dc27ee0e8606bd2161d6623c63e0e0b8c4dfc13600" +dependencies = [ + "alloy-primitives", + "serde", + "serde_json", +] + +[[package]] +name = "alloy-sol-macro" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0900b83f4ee1f45c640ceee596afbc118051921b9438fdb5a3175c1a7e05f8b" +dependencies = [ + "alloy-sol-macro-expander", + "alloy-sol-macro-input", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "alloy-sol-macro-expander" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a41b1e78dde06b5e12e6702fa8c1d30621bf07728ba75b801fb801c9c6a0ba10" +dependencies = [ + "alloy-sol-macro-input", + "const-hex", + "heck 0.5.0", + "indexmap", + "proc-macro-error2", + "proc-macro2", + "quote", + "syn 2.0.85", + "syn-solidity", + "tiny-keccak", +] + +[[package]] +name = "alloy-sol-macro-input" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91dc311a561a306664393407b88d3e53ae58581624128afd8a15faa5de3627dc" +dependencies = [ + "const-hex", + "dunce", + "heck 0.5.0", + "proc-macro2", + "quote", + "syn 2.0.85", + "syn-solidity", +] + +[[package]] +name = "alloy-sol-type-parser" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45d1fbee9e698f3ba176b6e7a145f4aefe6d2b746b611e8bb246fe11a0e9f6c4" +dependencies = [ + "serde", + "winnow", +] + +[[package]] +name = "alloy-sol-types" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "086f41bc6ebcd8cb15f38ba20e47be38dd03692149681ce8061c35d960dbf850" +dependencies = [ + "alloy-json-abi", + "alloy-primitives", + "alloy-sol-macro", + "const-hex", + "serde", +] + +[[package]] +name = "anstyle" +version = "1.0.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bec1de6f59aedf83baf9ff929c98f2ad654b97c9510f4e70cf6f661d49fd5b1" + +[[package]] +name = "anyhow" +version = "1.0.91" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c042108f3ed77fd83760a5fd79b53be043192bb3b9dba91d8c574c0ada7850c8" + +[[package]] +name = "ark-bn254" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a22f4561524cd949590d78d7d4c5df8f592430d221f7f3c9497bbafd8972120f" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-crypto-primitives" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3a13b34da09176a8baba701233fdffbaa7c1b1192ce031a3da4e55ce1f1a56" +dependencies = [ + "ark-ec", + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-snark", + "ark-std 0.4.0", + "blake2", + "derivative", + "digest 0.10.7", + "sha2 0.10.8", +] + +[[package]] +name = "ark-ec" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "defd9a439d56ac24968cca0571f598a61bc8c55f71d50a89cda591cb750670ba" +dependencies = [ + "ark-ff 0.4.2", + "ark-poly", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", + "itertools 0.10.5", + "num-traits", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6b3235cc41ee7a12aaaf2c575a2ad7b46713a8a50bda2fc3b003a04845c05dd6" +dependencies = [ + "ark-ff-asm 0.3.0", + "ark-ff-macros 0.3.0", + "ark-serialize 0.3.0", + "ark-std 0.3.0", + "derivative", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.3.3", + "zeroize", +] + +[[package]] +name = "ark-ff" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec847af850f44ad29048935519032c33da8aa03340876d351dfab5660d2966ba" +dependencies = [ + "ark-ff-asm 0.4.2", + "ark-ff-macros 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "digest 0.10.7", + "itertools 0.10.5", + "num-bigint", + "num-traits", + "paste", + "rustc_version 0.4.1", + "zeroize", +] + +[[package]] +name = "ark-ff-asm" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db02d390bf6643fb404d3d22d31aee1c4bc4459600aef9113833d17e786c6e44" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-asm" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ed4aa4fe255d0bc6d79373f7e31d2ea147bcf486cba1be5ba7ea85abdb92348" +dependencies = [ + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "db2fd794a08ccb318058009eefdf15bcaaaaf6f8161eb3345f907222bac38b20" +dependencies = [ + "num-bigint", + "num-traits", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-ff-macros" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7abe79b0e4288889c4574159ab790824d0033b9fdcb2a112a3182fac2e514565" +dependencies = [ + "num-bigint", + "num-traits", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-groth16" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "20ceafa83848c3e390f1cbf124bc3193b3e639b3f02009e0e290809a501b95fc" +dependencies = [ + "ark-crypto-primitives", + "ark-ec", + "ark-ff 0.4.2", + "ark-poly", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-poly" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d320bfc44ee185d899ccbadfa8bc31aab923ce1558716e1997a1e74057fe86bf" +dependencies = [ + "ark-ff 0.4.2", + "ark-serialize 0.4.2", + "ark-std 0.4.0", + "derivative", + "hashbrown 0.13.2", +] + +[[package]] +name = "ark-relations" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00796b6efc05a3f48225e59cb6a2cda78881e7c390872d5786aaf112f31fb4f0" +dependencies = [ + "ark-ff 0.4.2", + "ark-std 0.4.0", + "tracing", + "tracing-subscriber 0.2.25", +] + +[[package]] +name = "ark-serialize" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d6c2b318ee6e10f8c2853e73a83adc0ccb88995aa978d8a3408d492ab2ee671" +dependencies = [ + "ark-std 0.3.0", + "digest 0.9.0", +] + +[[package]] +name = "ark-serialize" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adb7b85a02b83d2f22f89bd5cac66c9c89474240cb6207cb1efc16d098e822a5" +dependencies = [ + "ark-serialize-derive", + "ark-std 0.4.0", + "digest 0.10.7", + "num-bigint", +] + +[[package]] +name = "ark-serialize-derive" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae3281bc6d0fd7e549af32b52511e1302185bd688fd3359fa36423346ff682ea" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "ark-snark" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "84d3cc6833a335bb8a600241889ead68ee89a3cf8448081fb7694c0fe503da63" +dependencies = [ + "ark-ff 0.4.2", + "ark-relations", + "ark-serialize 0.4.2", + "ark-std 0.4.0", +] + +[[package]] +name = "ark-std" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1df2c09229cbc5a028b1d70e00fdb2acee28b1055dfb5ca73eea49c5a25c4e7c" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "ark-std" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94893f1e0c6eeab764ade8dc4c0db24caf4fe7cbbaafc0eba0a9030f447b5185" +dependencies = [ + "num-traits", + "rand", +] + +[[package]] +name = "arrayref" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76a2e8124351fda1ef8aaaa3bbd7ebbcb486bbcd4225aca0aa0d84bb2db8fecb" + +[[package]] +name = "arrayvec" +version = "0.7.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7c02d123df017efcdfbd739ef81735b36c5ba83ec3c59c80a9d7ecc718f92e50" + +[[package]] +name = "async-trait" +version = "0.1.83" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "721cae7de5c34fbb2acd27e21e6d2cf7b886dce0c27388d46c4e6c47ea4318dd" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "atomic-waker" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1505bd5d3d116872e7271a6d4e16d81d0c8570876c8de68093a09ac269d8aac0" + +[[package]] +name = "aurora-engine-modexp" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0aef7712851e524f35fbbb74fa6599c5cd8692056a1c36f9ca0d2001b670e7e5" +dependencies = [ + "hex", + "num", +] + +[[package]] +name = "auto_impl" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c87f3f15e7794432337fc718554eaa4dc8f04c9677a950ffe366f20a162ae42" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "autocfg" +version = "1.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ace50bade8e6234aa140d9a2f552bbee1db4d353f69b8217bc503490fc1a9f26" + +[[package]] +name = "axum" +version = "0.7.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "504e3947307ac8326a5437504c517c4b56716c9d98fac0028c2acc7ca47d70ae" +dependencies = [ + "async-trait", + "axum-core", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-util", + "itoa", + "matchit", + "memchr", + "mime", + "percent-encoding", + "pin-project-lite", + "rustversion", + "serde", + "serde_json", + "serde_path_to_error", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "tokio", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-core" +version = "0.4.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09f2bd6146b97ae3359fa0cc6d6b376d9539582c7b4220f041a33ec24c226199" +dependencies = [ + "async-trait", + "bytes", + "futures-util", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "rustversion", + "sync_wrapper 1.0.1", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "axum-extra" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73c3220b188aea709cf1b6c5f9b01c3bd936bb08bd2b5184a12b35ac8131b1f9" +dependencies = [ + "axum", + "axum-core", + "bytes", + "futures-util", + "headers", + "http", + "http-body", + "http-body-util", + "mime", + "pin-project-lite", + "serde", + "tower", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "backtrace" +version = "0.3.74" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d82cb332cdfaed17ae235a638438ac4d4839913cc2af585c3c6746e8f8bee1a" +dependencies = [ + "addr2line", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", + "windows-targets 0.52.6", +] + +[[package]] +name = "base16ct" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4c7f02d4ea65f2c1853089ffd8d2787bdbc63de2f0d29dedbcf8ccdfa0ccd4cf" + +[[package]] +name = "base64" +version = "0.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" + +[[package]] +name = "base64" +version = "0.21.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" + +[[package]] +name = "base64" +version = "0.22.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" + +[[package]] +name = "base64ct" +version = "1.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c3c1a368f70d6cf7302d78f8f7093da241fb8e8807c05cc9e51a125895a6d5b" + +[[package]] +name = "bincode" +version = "1.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b1f45e9417d87227c7a56d22e471c6206462cba514c7590c09aff4cf6d1ddcad" +dependencies = [ + "serde", +] + +[[package]] +name = "bindgen" +version = "0.70.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f49d8fed880d473ea71efb9bf597651e77201bdd4893efe54c9e5d65ae04ce6f" +dependencies = [ + "bitflags 2.6.0", + "cexpr", + "clang-sys", + "itertools 0.13.0", + "proc-macro2", + "quote", + "regex", + "rustc-hash 1.1.0", + "shlex", + "syn 2.0.85", +] + +[[package]] +name = "bit-set" +version = "0.5.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0700ddab506f33b20a03b13996eccd309a48e5ff77d0d95926aa0210fb4e95f1" +dependencies = [ + "bit-vec", +] + +[[package]] +name = "bit-vec" +version = "0.6.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "349f9b6a179ed607305526ca489b34ad0a41aed5f7980fa90eb03160b69598fb" + +[[package]] +name = "bitflags" +version = "1.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" + +[[package]] +name = "bitflags" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b048fb63fd8b5923fc5aa7b340d8e156aec7ec02f0c78fa8a6ddc2613f6f71de" +dependencies = [ + "serde", +] + +[[package]] +name = "bitvec" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bc2832c24239b0141d5674bb9174f9d68a8b5b3f2753311927c172ca46f7e9c" +dependencies = [ + "funty", + "radium", + "serde", + "tap", + "wyz", +] + +[[package]] +name = "blake2" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "46502ad458c9a52b69d4d4d32775c788b7a1b85e8bc9d482d92250fc0e3f8efe" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "block" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d8c1fef690941d3e7788d328517591fecc684c084084702d6ff1641e993699a" + +[[package]] +name = "block-buffer" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4152116fd6e9dadb291ae18fc1ec3575ed6d84c29642d97890f4b4a3417297e4" +dependencies = [ + "generic-array", +] + +[[package]] +name = "block-buffer" +version = "0.10.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3078c7629b62d3f0439517fa394996acacc5cbc91c5a20d8c658e77abd503a71" +dependencies = [ + "generic-array", +] + +[[package]] +name = "blst" +version = "0.3.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4378725facc195f1a538864863f6de233b500a8862747e7f165078a419d5e874" +dependencies = [ + "cc", + "glob", + "threadpool", + "zeroize", +] + +[[package]] +name = "bonsai-sdk" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94032d3eece78099780ba07605d8ba6943e47ee152f76d73f1682e2f40cf889c" +dependencies = [ + "duplicate", + "maybe-async", + "reqwest", + "serde", + "thiserror", +] + +[[package]] +name = "borsh" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a6362ed55def622cddc70a4746a68554d7b687713770de539e59a739b249f8ed" +dependencies = [ + "borsh-derive", + "cfg_aliases", +] + +[[package]] +name = "borsh-derive" +version = "1.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ef8005764f53cd4dca619f5bf64cafd4664dada50ece25e4d81de54c80cc0b" +dependencies = [ + "once_cell", + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 2.0.85", + "syn_derive", +] + +[[package]] +name = "bumpalo" +version = "3.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "79296716171880943b8470b5f8d03aa55eb2e645a4874bdbb28adb49162e012c" + +[[package]] +name = "byte-slice-cast" +version = "1.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3ac9f8b63eca6fd385229b3675f6cc0dc5c8a5c8a54a59d4f52ffd670d87b0c" + +[[package]] +name = "bytemuck" +version = "1.19.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8334215b81e418a0a7bdb8ef0849474f40bb10c8b71f1c4ed315cff49f32494d" +dependencies = [ + "bytemuck_derive", +] + +[[package]] +name = "bytemuck_derive" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bcfcc3cd946cb52f0bbfdbbcfa2f4e24f75ebb6c0e1002f7c25904fada18b9ec" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "byteorder" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1fd0f2584146f6f2ef48085050886acf353beff7305ebd1ae69500e27c67f64b" + +[[package]] +name = "bytes" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ac0150caa2ae65ca5bd83f25c7de183dea78d4d366469f148435e2acfbad0da" +dependencies = [ + "serde", +] + +[[package]] +name = "c-kzg" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0307f72feab3300336fb803a57134159f6e20139af1357f36c54cb90d8e8928" +dependencies = [ + "blst", + "cc", + "glob", + "hex", + "libc", + "once_cell", + "serde", +] + +[[package]] +name = "camino" +version = "1.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b96ec4966b5813e2c0507c1f86115c8c5abaadc3980879c3424042a02fd1ad3" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo-platform" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24b1f0365a6c6bb4020cd05806fd0d33c44d38046b8bd7f0e40814b9763cabfc" +dependencies = [ + "serde", +] + +[[package]] +name = "cargo_metadata" +version = "0.18.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d886547e41f740c616ae73108f6eb70afe6d940c7bc697cb30f13daec073037" +dependencies = [ + "camino", + "cargo-platform", + "semver 1.0.23", + "serde", + "serde_json", + "thiserror", +] + +[[package]] +name = "cc" +version = "1.1.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e7962b54006dcfcc61cb72735f4d89bb97061dd6a7ed882ec6b8ee53714c6f" +dependencies = [ + "shlex", +] + +[[package]] +name = "cexpr" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fac387a98bb7c37292057cffc56d62ecb629900026402633ae9160df93a8766" +dependencies = [ + "nom", +] + +[[package]] +name = "cfg-if" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" + +[[package]] +name = "cfg_aliases" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "613afe47fcd5fac7ccf1db93babcb082c5994d996f20b8b159f2ad1658eb5724" + +[[package]] +name = "cipher" +version = "0.4.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773f3b9af64447d2ce9850330c473515014aa235e6a783b02db81ff39e4a3dad" +dependencies = [ + "crypto-common", + "inout", +] + +[[package]] +name = "clang-sys" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b023947811758c97c59bf9d1c188fd619ad4718dcaa767947df1cadb14f39f4" +dependencies = [ + "glob", + "libc", + "libloading", +] + +[[package]] +name = "colorchoice" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3fd119d74b830634cea2a0f58bbd0d54540518a14397557951e79340abc28c0" + +[[package]] +name = "concat-kdf" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d72c1252426a83be2092dd5884a5f6e3b8e7180f6891b6263d2c21b92ec8816" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "const-hex" +version = "1.13.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0121754e84117e65f9d90648ee6aa4882a6e63110307ab73967a4c5e7e69e586" +dependencies = [ + "cfg-if", + "cpufeatures", + "hex", + "proptest", + "serde", +] + +[[package]] +name = "const-oid" +version = "0.9.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" + +[[package]] +name = "core-foundation" +version = "0.9.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "91e195e091a93c46f7102ec7818a2aa394e1e1771c3ab4825963fa03e45afb8f" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "core-foundation-sys" +version = "0.8.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "773648b94d0e5d620f64f280777445740e61fe701025087ec8b57f45c791888b" + +[[package]] +name = "core-graphics-types" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45390e6114f68f718cc7a830514a96f903cccd70d02a8f6d9f643ac4ba45afaf" +dependencies = [ + "bitflags 1.3.2", + "core-foundation", + "libc", +] + +[[package]] +name = "cpufeatures" +version = "0.2.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "608697df725056feaccfa42cffdaeeec3fccc4ffc38358ecd19b243e716a78e0" +dependencies = [ + "libc", +] + +[[package]] +name = "crc32fast" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a97769d94ddab943e4510d138150169a2758b5ef3eb191a9ee688de3e23ef7b3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "crunchy" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" + +[[package]] +name = "crypto-bigint" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dc92fb57ca44df6db8059111ab3af99a63d5d0f8375d9972e319a379c6bab76" +dependencies = [ + "generic-array", + "rand_core", + "subtle", + "zeroize", +] + +[[package]] +name = "crypto-common" +version = "0.1.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1bfb12502f3fc46cca1bb51ac28df9d618d813cdc3d2f25b9fe775a34af26bb3" +dependencies = [ + "generic-array", + "typenum", +] + +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + +[[package]] +name = "ctr" +version = "0.9.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0369ee1ad671834580515889b80f2ea915f23b8be8d0daa4bbaf2ac5c7590835" +dependencies = [ + "cipher", +] + +[[package]] +name = "der" +version = "0.7.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f55bf8e7b65898637379c1b74eb1551107c8294ed26d855ceb9fd1a09cfc9bc0" +dependencies = [ + "const-oid", + "zeroize", +] + +[[package]] +name = "deranged" +version = "0.3.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" +dependencies = [ + "powerfmt", +] + +[[package]] +name = "derivative" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fcc3dd5e9e9c0b295d6e1e4d811fb6f157d5ffd784b8d202fc62eac8035a770b" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "derive_more" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4a9b99b9cbbe49445b21764dc0625032a89b145a2642e67603e1c936f5458d05" +dependencies = [ + "derive_more-impl", +] + +[[package]] +name = "derive_more-impl" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb7330aeadfbe296029522e6c40f315320aba36fc43a5b3632f3795348f3bd22" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", + "unicode-xid", +] + +[[package]] +name = "digest" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3dd60d1080a57a05ab032377049e0591415d2b31afd7028356dbf3cc6dcb066" +dependencies = [ + "generic-array", +] + +[[package]] +name = "digest" +version = "0.10.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" +dependencies = [ + "block-buffer 0.10.4", + "const-oid", + "crypto-common", + "subtle", +] + +[[package]] +name = "dirs" +version = "5.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "44c45a9d03d6676652bcb5e724c7e988de1acad23a711b5217ab9cbecbec2225" +dependencies = [ + "dirs-sys", +] + +[[package]] +name = "dirs-sys" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "520f05a5cbd335fae5a99ff7a6ab8627577660ee5cfd6a94a6a929b52ff0321c" +dependencies = [ + "libc", + "option-ext", + "redox_users", + "windows-sys 0.48.0", +] + +[[package]] +name = "docker-generate" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ccf673e0848ef09fa4aeeba78e681cf651c0c7d35f76ee38cec8e55bc32fa111" + +[[package]] +name = "downcast-rs" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75b325c5dbd37f80359721ad39aca5a29fb04c89279657cffdda8736d0c0b9d2" + +[[package]] +name = "dunce" +version = "1.0.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "92773504d58c093f6de2459af4af33faa518c13451eb8f2b5698ed3d36e7c813" + +[[package]] +name = "duplicate" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "de78e66ac9061e030587b2a2e75cc88f22304913c907b11307bca737141230cb" +dependencies = [ + "heck 0.4.1", + "proc-macro-error", +] + +[[package]] +name = "dyn-clone" +version = "1.0.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0d6ef0072f8a535281e4876be788938b528e9a1d43900b82c2569af7da799125" + +[[package]] +name = "ecdsa" +version = "0.16.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee27f32b5c5292967d2d4a9d7f1e0b0aed2c15daded5a60300e4abb9d8020bca" +dependencies = [ + "der", + "digest 0.10.7", + "elliptic-curve", + "rfc6979", + "signature", + "spki", +] + +[[package]] +name = "either" +version = "1.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "60b1af1c220855b6ceac025d3f6ecdd2b7c4894bfe9cd9bda4fbb4bc7c0d4cf0" + +[[package]] +name = "elf" +version = "0.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4445909572dbd556c457c849c4ca58623d84b27c8fff1e74b0b4227d8b90d17b" + +[[package]] +name = "elliptic-curve" +version = "0.13.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5e6043086bf7973472e0c7dff2142ea0b680d30e18d9cc40f267efbf222bd47" +dependencies = [ + "base16ct", + "crypto-bigint", + "digest 0.10.7", + "ff", + "generic-array", + "group", + "hkdf", + "pkcs8", + "rand_core", + "sec1", + "subtle", + "zeroize", +] + +[[package]] +name = "encoding_rs" +version = "0.8.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75030f3c4f45dafd7586dd6780965a8c7e8e285a5ecb86713e63a79c5b2766f3" +dependencies = [ + "cfg-if", +] + +[[package]] +name = "enumn" +version = "0.1.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2f9ed6b3789237c8a0c1c505af1c7eb2c560df6186f01b098c3a1064ea532f38" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "envy" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f47e0157f2cb54f5ae1bd371b30a2ae4311e1c028f575cd4e81de7353215965" +dependencies = [ + "serde", +] + +[[package]] +name = "equivalent" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5443807d6dff69373d433ab9ef5378ad8df50ca6298caf15de6e52e24aaf54d5" + +[[package]] +name = "errno" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "534c5cf6194dfab3db3242765c03bbe257cf92f22b38f6bc0c58d59108a820ba" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "ethbloom" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c22d4b5885b6aa2fe5e8b9329fb8d232bf739e434e6b87347c63bdd00c120f60" +dependencies = [ + "crunchy", + "fixed-hash", + "impl-rlp", + "impl-serde", + "tiny-keccak", +] + +[[package]] +name = "ethereum-types" +version = "0.14.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "02d215cbf040552efcbe99a38372fe80ab9d00268e20012b79fcd0f073edd8ee" +dependencies = [ + "ethbloom", + "fixed-hash", + "impl-rlp", + "impl-serde", + "primitive-types", + "uint", +] + +[[package]] +name = "ethereum_rust-blockchain" +version = "0.1.0" +dependencies = [ + "bytes", + "ethereum_rust-core", + "ethereum_rust-rlp", + "ethereum_rust-storage", + "ethereum_rust-vm", + "sha3", + "thiserror", + "tracing", +] + +[[package]] +name = "ethereum_rust-core" +version = "0.1.0" +dependencies = [ + "bytes", + "crc32fast", + "ethereum-types", + "ethereum_rust-rlp", + "ethereum_rust-trie", + "hex", + "keccak-hash", + "lazy_static", + "secp256k1", + "serde", + "serde_json", + "sha3", + "thiserror", + "tinyvec", +] + +[[package]] +name = "ethereum_rust-dev" +version = "0.1.0" +dependencies = [ + "bytes", + "envy", + "ethereum-types", + "ethereum_rust-rpc", + "hex", + "jsonwebtoken", + "reqwest", + "serde", + "serde_json", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "ethereum_rust-l2" +version = "0.1.0" +dependencies = [ + "bytes", + "envy", + "ethereum-types", + "ethereum_rust-blockchain", + "ethereum_rust-core", + "ethereum_rust-dev", + "ethereum_rust-rlp", + "ethereum_rust-rpc", + "ethereum_rust-storage", + "hex", + "jsonwebtoken", + "keccak-hash", + "libsecp256k1", + "reqwest", + "risc0-zkvm", + "serde", + "serde_json", + "thiserror", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "ethereum_rust-net" +version = "0.1.0" +dependencies = [ + "aes", + "bytes", + "concat-kdf", + "ctr", + "ethereum_rust-core", + "ethereum_rust-rlp", + "ethereum_rust-storage", + "hex", + "hmac 0.12.1", + "k256", + "rand", + "sha3", + "snap", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "ethereum_rust-rlp" +version = "0.1.0" +dependencies = [ + "bytes", + "ethereum-types", + "hex", + "lazy_static", + "thiserror", + "tinyvec", +] + +[[package]] +name = "ethereum_rust-rpc" +version = "0.1.0" +dependencies = [ + "axum", + "axum-extra", + "bytes", + "ethereum_rust-blockchain", + "ethereum_rust-core", + "ethereum_rust-net", + "ethereum_rust-rlp", + "ethereum_rust-storage", + "ethereum_rust-vm", + "hex", + "jsonwebtoken", + "rand", + "reqwest", + "serde", + "serde_json", + "tokio", + "tokio-util", + "tracing", + "tracing-subscriber 0.3.18", +] + +[[package]] +name = "ethereum_rust-storage" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytes", + "ethereum-types", + "ethereum_rust-core", + "ethereum_rust-rlp", + "ethereum_rust-trie", + "hex", + "libmdbx", + "serde", + "serde_json", + "sha3", + "thiserror", + "tracing", +] + +[[package]] +name = "ethereum_rust-trie" +version = "0.1.0" +dependencies = [ + "anyhow", + "bytes", + "digest 0.10.7", + "ethereum-types", + "ethereum_rust-rlp", + "hex", + "lazy_static", + "libmdbx", + "serde", + "serde_json", + "sha3", + "smallvec", + "thiserror", + "tracing", +] + +[[package]] +name = "ethereum_rust-vm" +version = "0.1.0" +dependencies = [ + "bincode", + "bytes", + "cfg-if", + "ethereum_rust-core", + "ethereum_rust-storage", + "hex", + "lazy_static", + "revm", + "revm-inspectors", + "revm-primitives", + "serde", + "thiserror", +] + +[[package]] +name = "ethereum_rust_l2-deployer" +version = "0.1.0" +dependencies = [ + "bytes", + "ethereum-types", + "ethereum_rust-core", + "ethereum_rust-l2", + "hex", + "keccak-hash", + "libsecp256k1", + "tokio", +] + +[[package]] +name = "fastrand" +version = "2.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e8c02a5121d4ea3eb16a80748c74f5549a5665e4c21333c6098f283870fbdea6" + +[[package]] +name = "fastrlp" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "139834ddba373bbdd213dffe02c8d110508dcf1726c2be27e8d1f7d7e1856418" +dependencies = [ + "arrayvec", + "auto_impl", + "bytes", +] + +[[package]] +name = "ff" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ded41244b729663b1e574f1b4fb731469f69f79c17667b5d776b16cda0479449" +dependencies = [ + "rand_core", + "subtle", +] + +[[package]] +name = "fixed-hash" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "835c052cb0c08c1acf6ffd71c022172e18723949c8282f2b9f27efbc51e64534" +dependencies = [ + "byteorder", + "rand", + "rustc-hex", + "static_assertions", +] + +[[package]] +name = "fnv" +version = "1.0.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" + +[[package]] +name = "foldhash" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f81ec6369c545a7d40e4589b5597581fa1c441fe1cce96dd1de43159910a36a2" + +[[package]] +name = "foreign-types" +version = "0.3.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6f339eb8adc052cd2ca78910fda869aefa38d22d5cb648e6485e4d3fc06f3b1" +dependencies = [ + "foreign-types-shared 0.1.1", +] + +[[package]] +name = "foreign-types" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d737d9aa519fb7b749cbc3b962edcf310a8dd1f4b67c91c4f83975dbdd17d965" +dependencies = [ + "foreign-types-macros", + "foreign-types-shared 0.3.1", +] + +[[package]] +name = "foreign-types-macros" +version = "0.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1a5c6c585bc94aaf2c7b51dd4c2ba22680844aba4c687be581871a6f518c5742" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "foreign-types-shared" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0228411908ca8685dba7fc2cdd70ec9990a6e753e89b6ac91a84c40fbaf4b" + +[[package]] +name = "foreign-types-shared" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aa9a19cbb55df58761df49b23516a86d432839add4af60fc256da840f66ed35b" + +[[package]] +name = "form_urlencoded" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e13624c2627564efccf4934284bdd98cbaa14e79b0b5a141218e507b3a823456" +dependencies = [ + "percent-encoding", +] + +[[package]] +name = "funty" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6d5a32815ae3f33302d95fdcb2ce17862f8c65363dcfd29360480ba1001fc9c" + +[[package]] +name = "futures-channel" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2dff15bf788c671c1934e366d07e30c1814a8ef514e1af724a602e8a2fbe1b10" +dependencies = [ + "futures-core", + "futures-sink", +] + +[[package]] +name = "futures-core" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f29059c0c2090612e8d742178b0580d2dc940c837851ad723096f87af6663e" + +[[package]] +name = "futures-io" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9e5c1b78ca4aae1ac06c48a526a655760685149f0d465d21f37abfe57ce075c6" + +[[package]] +name = "futures-macro" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "162ee34ebcb7c64a8abebc059ce0fee27c2262618d7b60ed8faf72fef13c3650" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "futures-sink" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e575fab7d1e0dcb8d0c7bcf9a63ee213816ab51902e6d244a95819acacf1d4f7" + +[[package]] +name = "futures-task" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f90f7dce0722e95104fcb095585910c0977252f286e354b5e3bd38902cd99988" + +[[package]] +name = "futures-util" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9fa08315bb612088cc391249efdc3bc77536f16c91f6cf495e6fbe85b20a4a81" +dependencies = [ + "futures-core", + "futures-io", + "futures-macro", + "futures-sink", + "futures-task", + "memchr", + "pin-project-lite", + "pin-utils", + "slab", +] + +[[package]] +name = "generic-array" +version = "0.14.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "85649ca51fd72272d7821adaf274ad91c288277713d9c18820d8499a7ff69e9a" +dependencies = [ + "typenum", + "version_check", + "zeroize", +] + +[[package]] +name = "getrandom" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c4567c8db10ae91089c99af84c68c38da3ec2f087c3f82960bcdbf3656b6f4d7" +dependencies = [ + "cfg-if", + "js-sys", + "libc", + "wasi", + "wasm-bindgen", +] + +[[package]] +name = "gimli" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07e28edb80900c19c28f1072f2e8aeca7fa06b23cd4169cefe1af5aa3260783f" + +[[package]] +name = "glob" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d2fabcfbdc87f4758337ca535fb41a6d701b65693ce38287d856d1674551ec9b" + +[[package]] +name = "group" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f9ef7462f7c099f518d754361858f86d8a07af53ba9af0fe635bbccb151a63" +dependencies = [ + "ff", + "rand_core", + "subtle", +] + +[[package]] +name = "h2" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "524e8ac6999421f49a846c2d4411f337e53497d8ec55d67753beffa43c5d9205" +dependencies = [ + "atomic-waker", + "bytes", + "fnv", + "futures-core", + "futures-sink", + "http", + "indexmap", + "slab", + "tokio", + "tokio-util", + "tracing", +] + +[[package]] +name = "hashbrown" +version = "0.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43a3c133739dddd0d2990f9a4bdf8eb4b21ef50e4851ca85ab661199821d510e" +dependencies = [ + "ahash", +] + +[[package]] +name = "hashbrown" +version = "0.14.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5274423e17b7c9fc20b6e7e208532f9b19825d82dfd615708b70edd83df41f1" + +[[package]] +name = "hashbrown" +version = "0.15.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e087f84d4f86bf4b218b927129862374b72199ae7d8657835f1e89000eea4fb" +dependencies = [ + "foldhash", + "serde", +] + +[[package]] +name = "headers" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "322106e6bd0cba2d5ead589ddb8150a13d7c4217cf80d7c4f682ca994ccc6aa9" +dependencies = [ + "base64 0.21.7", + "bytes", + "headers-core", + "http", + "httpdate", + "mime", + "sha1", +] + +[[package]] +name = "headers-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "54b4a22553d4242c49fddb9ba998a99962b5cc6f22cb5a3482bec22522403ce4" +dependencies = [ + "http", +] + +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + +[[package]] +name = "heck" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2304e00983f87ffb38b55b444b5e3b60a884b5d30c0fca7d82fe33449bbe55ea" + +[[package]] +name = "hermit-abi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d231dfb89cfffdbc30e7fc41579ed6066ad03abda9e567ccafae602b97ec5024" + +[[package]] +name = "hex" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" +dependencies = [ + "serde", +] + +[[package]] +name = "hex-literal" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6fe2267d4ed49bc07b63801559be28c718ea06c4738b7a03c94df7386d2cde46" + +[[package]] +name = "hkdf" +version = "0.12.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" +dependencies = [ + "hmac 0.12.1", +] + +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac", + "digest 0.9.0", +] + +[[package]] +name = "hmac" +version = "0.12.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6c49c37c09c17a53d937dfbb742eb3a961d65a994e6bcdcf37e7399d0cc8ab5e" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ + "digest 0.9.0", + "generic-array", + "hmac 0.8.1", +] + +[[package]] +name = "http" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21b9ddb458710bc376481b842f5da65cdf31522de232c1ca8146abce2a358258" +dependencies = [ + "bytes", + "fnv", + "itoa", +] + +[[package]] +name = "http-body" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1efedce1fb8e6913f23e0c92de8e62cd5b772a67e7b3946df930a62566c93184" +dependencies = [ + "bytes", + "http", +] + +[[package]] +name = "http-body-util" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793429d76616a256bcb62c2a2ec2bed781c8307e797e2598c50010f2bee2544f" +dependencies = [ + "bytes", + "futures-util", + "http", + "http-body", + "pin-project-lite", +] + +[[package]] +name = "httparse" +version = "1.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7d71d3574edd2771538b901e6549113b4006ece66150fb69c0fb6d9a2adae946" + +[[package]] +name = "httpdate" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "df3b46402a9d5adb4c86a0cf463f42e19994e3ee891101b1841f30a545cb49a9" + +[[package]] +name = "hyper" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbbff0a806a4728c99295b254c8838933b5b082d75e3cb70c8dab21fdfbcfa9a" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "h2", + "http", + "http-body", + "httparse", + "httpdate", + "itoa", + "pin-project-lite", + "smallvec", + "tokio", + "want", +] + +[[package]] +name = "hyper-rustls" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08afdbb5c31130e3034af566421053ab03787c640246a446327f550d11bcb333" +dependencies = [ + "futures-util", + "http", + "hyper", + "hyper-util", + "rustls", + "rustls-pki-types", + "tokio", + "tokio-rustls", + "tower-service", + "webpki-roots", +] + +[[package]] +name = "hyper-tls" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "70206fc6890eaca9fde8a0bf71caa2ddfc9fe045ac9e5c70df101a7dbde866e0" +dependencies = [ + "bytes", + "http-body-util", + "hyper", + "hyper-util", + "native-tls", + "tokio", + "tokio-native-tls", + "tower-service", +] + +[[package]] +name = "hyper-util" +version = "0.1.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "41296eb09f183ac68eec06e03cdbea2e759633d4067b2f6552fc2e009bcad08b" +dependencies = [ + "bytes", + "futures-channel", + "futures-util", + "http", + "http-body", + "hyper", + "pin-project-lite", + "socket2", + "tokio", + "tower-service", + "tracing", +] + +[[package]] +name = "idna" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "634d9b1461af396cad843f47fdba5597a4f9e6ddd4bfb6ff5d85028c25cb12f6" +dependencies = [ + "unicode-bidi", + "unicode-normalization", +] + +[[package]] +name = "impl-codec" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba6a270039626615617f3f36d15fc827041df3b78c439da2cadfa47455a77f2f" +dependencies = [ + "parity-scale-codec", +] + +[[package]] +name = "impl-rlp" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f28220f89297a075ddc7245cd538076ee98b01f2a9c23a53a4f1105d5a322808" +dependencies = [ + "rlp", +] + +[[package]] +name = "impl-serde" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc88fc67028ae3db0c853baa36269d398d5f45b6982f95549ff5def78c935cd" +dependencies = [ + "serde", +] + +[[package]] +name = "impl-trait-for-tuples" +version = "0.2.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" +dependencies = [ + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "impls" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7a46645bbd70538861a90d0f26c31537cdf1e44aae99a794fb75a664b70951bc" + +[[package]] +name = "indexmap" +version = "2.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "707907fe3c25f5424cce2cb7e1cbcafee6bdbe735ca90ef77c29e84591e5b9da" +dependencies = [ + "equivalent", + "hashbrown 0.15.0", + "serde", +] + +[[package]] +name = "inout" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a0c10553d664a4d0bcff9f4215d0aac67a639cc68ef660840afe309b807bc9f5" +dependencies = [ + "generic-array", +] + +[[package]] +name = "ipnet" +version = "2.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ddc24109865250148c2e0f3d25d4f0f479571723792d3802153c60922a4fb708" + +[[package]] +name = "itertools" +version = "0.10.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b0fd2260e829bddf4cb6ea802289de2f86d6a7a690192fbe91b3f46e0f2c8473" +dependencies = [ + "either", +] + +[[package]] +name = "itertools" +version = "0.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186" +dependencies = [ + "either", +] + +[[package]] +name = "itoa" +version = "1.0.11" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "49f1f14873335454500d59611f1cf4a4b0f786f9ac11f4312a78e4cf2566695b" + +[[package]] +name = "js-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6a88f1bda2bd75b0452a14784937d796722fdebfe50df998aeb3f0b7603019a9" +dependencies = [ + "wasm-bindgen", +] + +[[package]] +name = "jsonwebtoken" +version = "9.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b9ae10193d25051e74945f1ea2d0b42e03cc3b890f7e4cc5faa44997d808193f" +dependencies = [ + "base64 0.21.7", + "js-sys", + "pem", + "ring", + "serde", + "serde_json", + "simple_asn1", +] + +[[package]] +name = "k256" +version = "0.13.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6e3919bbaa2945715f0bb6d3934a173d1e9a59ac23767fbaaef277265a7411b" +dependencies = [ + "cfg-if", + "ecdsa", + "elliptic-curve", + "once_cell", + "sha2 0.10.8", + "signature", +] + +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + +[[package]] +name = "keccak-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "505d1856a39b200489082f90d897c3f07c455563880bc5952e38eabf731c83b6" +dependencies = [ + "digest 0.10.7", + "sha3-asm", +] + +[[package]] +name = "keccak-hash" +version = "0.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4b286e6b663fb926e1eeb68528e69cb70ed46c6d65871a21b2215ae8154c6d3c" +dependencies = [ + "primitive-types", + "tiny-keccak", +] + +[[package]] +name = "lazy-regex" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8d8e41c97e6bc7ecb552016274b99fbb5d035e8de288c582d9b933af6677bfda" +dependencies = [ + "lazy-regex-proc_macros", + "once_cell", + "regex", +] + +[[package]] +name = "lazy-regex-proc_macros" +version = "3.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76e1d8b05d672c53cb9c7b920bbba8783845ae4f0b076e02a3db1d02c81b4163" +dependencies = [ + "proc-macro2", + "quote", + "regex", + "syn 2.0.85", +] + +[[package]] +name = "lazy_static" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbd2bcb4c963f2ddae06a2efc7e9f3591312473c50c6685e1f298068316e66fe" +dependencies = [ + "spin", +] + +[[package]] +name = "libc" +version = "0.2.161" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9489c2807c139ffd9c1794f4af0ebe86a828db53ecdc7fea2111d0fed085d1" + +[[package]] +name = "libloading" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4979f22fdb869068da03c9f7528f8297c6fd2606bc3a4affe42e6a823fdb8da4" +dependencies = [ + "cfg-if", + "windows-targets 0.52.6", +] + +[[package]] +name = "libm" +version = "0.2.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ec2a862134d2a7d32d7983ddcdd1c4923530833c9f2ea1a44fc5fa473989058" + +[[package]] +name = "libmdbx" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "afaecaddb5d9fb8b12a9f1998a079dd8c07c913a92902d414984b1b4608f066b" +dependencies = [ + "anyhow", + "arrayref", + "arrayvec", + "bitflags 2.6.0", + "derive_more", + "impls", + "indexmap", + "libc", + "mdbx-sys", + "parking_lot", + "sealed", + "tempfile", + "thiserror", +] + +[[package]] +name = "libredox" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c0ff37bd590ca25063e35af745c343cb7a0271906fb7b37e4813e8f79f00268d" +dependencies = [ + "bitflags 2.6.0", + "libc", +] + +[[package]] +name = "libsecp256k1" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +dependencies = [ + "arrayref", + "base64 0.13.1", + "digest 0.9.0", + "hmac-drbg", + "libsecp256k1-core", + "libsecp256k1-gen-ecmult", + "libsecp256k1-gen-genmult", + "rand", + "serde", + "sha2 0.9.9", + "typenum", +] + +[[package]] +name = "libsecp256k1-core" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5be9b9bb642d8522a44d533eab56c16c738301965504753b03ad1de3425d5451" +dependencies = [ + "crunchy", + "digest 0.9.0", + "subtle", +] + +[[package]] +name = "libsecp256k1-gen-ecmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3038c808c55c87e8a172643a7d87187fc6c4174468159cb3090659d55bcb4809" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "libsecp256k1-gen-genmult" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3db8d6ba2cec9eacc40e6e8ccc98931840301f1006e95647ceb2dd5c3aa06f7c" +dependencies = [ + "libsecp256k1-core", +] + +[[package]] +name = "linux-raw-sys" +version = "0.4.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78b3ae25bc7c8c38cec158d1f2757ee79e9b3740fbc7ccf0e59e4b08d793fa89" + +[[package]] +name = "lock_api" +version = "0.4.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "07af8b9cdd281b7915f413fa73f29ebd5d55d0d3f0155584dade1ff18cea1b17" +dependencies = [ + "autocfg", + "scopeguard", +] + +[[package]] +name = "log" +version = "0.4.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7a70ba024b9dc04c27ea2f0c0548feb474ec5c54bba33a7f72f873a39d07b24" + +[[package]] +name = "malloc_buf" +version = "0.0.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "62bb907fe88d54d8d9ce32a3cceab4218ed2f6b7d35617cafe9adf84e43919cb" +dependencies = [ + "libc", +] + +[[package]] +name = "matchit" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" + +[[package]] +name = "maybe-async" +version = "0.2.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5cf92c10c7e361d6b99666ec1c6f9805b0bea2c3bd8c78dc6fe98ac5bd78db11" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "mdbx-sys" +version = "12.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3df87547d61cd51660237fb9657a69e2204ad525a22c78e8f8b6cec647ce17c8" +dependencies = [ + "bindgen", + "cc", + "libc", +] + +[[package]] +name = "memchr" +version = "2.7.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "78ca9ab1a0babb1e7d5695e3530886289c18cf2f87ec19a575a0abdce112e3a3" + +[[package]] +name = "metal" +version = "0.29.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7ecfd3296f8c56b7c1f6fbac3c71cefa9d78ce009850c45000015f206dc7fa21" +dependencies = [ + "bitflags 2.6.0", + "block", + "core-graphics-types", + "foreign-types 0.5.0", + "log", + "objc", + "paste", +] + +[[package]] +name = "mime" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" + +[[package]] +name = "minimal-lexical" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "68354c5c6bd36d73ff3feceb05efa59b6acb7626617f4962be322a825e61f79a" + +[[package]] +name = "miniz_oxide" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e2d80299ef12ff69b16a84bb182e3b9df68b5a91574d3d4fa6e41b65deec4df1" +dependencies = [ + "adler2", +] + +[[package]] +name = "mio" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "80e04d1dcff3aae0704555fe5fee3bcfaf3d1fdf8a7e521d5b9d2b42acb52cec" +dependencies = [ + "hermit-abi", + "libc", + "wasi", + "windows-sys 0.52.0", +] + +[[package]] +name = "native-tls" +version = "0.2.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a8614eb2c83d59d1c8cc974dd3f920198647674a0a035e1af1fa58707e317466" +dependencies = [ + "libc", + "log", + "openssl", + "openssl-probe", + "openssl-sys", + "schannel", + "security-framework", + "security-framework-sys", + "tempfile", +] + +[[package]] +name = "nom" +version = "7.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d273983c5a657a70a3e8f2a01329822f3b8c8172b73826411a55751e404a0a4a" +dependencies = [ + "memchr", + "minimal-lexical", +] + +[[package]] +name = "nu-ansi-term" +version = "0.46.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77a8165726e8236064dbb45459242600304b42a5ea24ee2948e18e023bf7ba84" +dependencies = [ + "overload", + "winapi", +] + +[[package]] +name = "num" +version = "0.4.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "35bd024e8b2ff75562e5f34e7f4905839deb4b22955ef5e73d2fea1b9813cb23" +dependencies = [ + "num-bigint", + "num-complex", + "num-integer", + "num-iter", + "num-rational", + "num-traits", +] + +[[package]] +name = "num-bigint" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a5e44f723f1133c9deac646763579fdb3ac745e418f2a7af9cd0c431da1f20b9" +dependencies = [ + "num-integer", + "num-traits", +] + +[[package]] +name = "num-complex" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "73f88a1307638156682bada9d7604135552957b7818057dcef22705b4d509495" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-conv" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "51d515d32fb182ee37cda2ccdcb92950d6a3c2893aa280e540671c2cd0f3b1d9" + +[[package]] +name = "num-integer" +version = "0.1.46" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7969661fd2958a5cb096e56c8e1ad0444ac2bbcd0061bd28660485a44879858f" +dependencies = [ + "num-traits", +] + +[[package]] +name = "num-iter" +version = "0.1.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1429034a0490724d0075ebb2bc9e875d6503c3cf69e235a8941aa757d83ef5bf" +dependencies = [ + "autocfg", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-rational" +version = "0.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f83d14da390562dca69fc84082e73e548e1ad308d24accdedd2720017cb37824" +dependencies = [ + "num-bigint", + "num-integer", + "num-traits", +] + +[[package]] +name = "num-traits" +version = "0.2.19" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "071dfc062690e90b734c0b2273ce72ad0ffa95f0c74596bc250dcfd960262841" +dependencies = [ + "autocfg", + "libm", +] + +[[package]] +name = "num_cpus" +version = "1.16.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" +dependencies = [ + "hermit-abi", + "libc", +] + +[[package]] +name = "objc" +version = "0.2.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915b1b472bc21c53464d6c8461c9d3af805ba1ef837e1cac254428f4a77177b1" +dependencies = [ + "malloc_buf", +] + +[[package]] +name = "object" +version = "0.36.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "aedf0a2d09c573ed1d8d85b30c119153926a2b36dce0ab28322c09a117a4683e" +dependencies = [ + "memchr", +] + +[[package]] +name = "once_cell" +version = "1.20.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1261fe7e33c73b354eab43b1273a57c8f967d0391e80353e51f764ac02cf6775" + +[[package]] +name = "opaque-debug" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c08d65885ee38876c4f86fa503fb49d7b507c2b62552df7c70b2fce627e06381" + +[[package]] +name = "openssl" +version = "0.10.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6174bc48f102d208783c2c84bf931bb75927a617866870de8a4ea85597f871f5" +dependencies = [ + "bitflags 2.6.0", + "cfg-if", + "foreign-types 0.3.2", + "libc", + "once_cell", + "openssl-macros", + "openssl-sys", +] + +[[package]] +name = "openssl-macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "openssl-probe" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" + +[[package]] +name = "openssl-sys" +version = "0.9.104" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "45abf306cbf99debc8195b66b7346498d7b10c210de50418b5ccd7ceba08c741" +dependencies = [ + "cc", + "libc", + "pkg-config", + "vcpkg", +] + +[[package]] +name = "option-ext" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "04744f49eae99ab78e0d5c0b603ab218f515ea8cfe5a456d7629ad883a3b6e7d" + +[[package]] +name = "overload" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b15813163c1d831bf4a13c3610c05c0d03b39feb07f7e09fa234dac9b15aaf39" + +[[package]] +name = "parity-scale-codec" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "306800abfa29c7f16596b5970a588435e3d5b3149683d00c12b699cc19f895ee" +dependencies = [ + "arrayvec", + "bitvec", + "byte-slice-cast", + "impl-trait-for-tuples", + "parity-scale-codec-derive", + "serde", +] + +[[package]] +name = "parity-scale-codec-derive" +version = "3.6.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d830939c76d294956402033aee57a6da7b438f2294eb94864c37b0569053a42c" +dependencies = [ + "proc-macro-crate", + "proc-macro2", + "quote", + "syn 1.0.109", +] + +[[package]] +name = "parking_lot" +version = "0.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f1bf18183cf54e8d6059647fc3063646a1801cf30896933ec2311622cc4b9a27" +dependencies = [ + "lock_api", + "parking_lot_core", +] + +[[package]] +name = "parking_lot_core" +version = "0.9.10" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e401f977ab385c9e4e3ab30627d6f26d00e2c73eef317493c4ec6d468726cf8" +dependencies = [ + "cfg-if", + "libc", + "redox_syscall", + "smallvec", + "windows-targets 0.52.6", +] + +[[package]] +name = "paste" +version = "1.0.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "57c0d7b74b563b49d38dae00a0c37d4d6de9b432382b2892f0574ddcae73fd0a" + +[[package]] +name = "pem" +version = "3.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e459365e590736a54c3fa561947c84837534b8e9af6fc5bf781307e82658fae" +dependencies = [ + "base64 0.22.1", + "serde", +] + +[[package]] +name = "percent-encoding" +version = "2.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3148f5046208a5d56bcfc03053e3ca6334e51da8dfb19b6cdc8b306fae3283e" + +[[package]] +name = "pest" +version = "2.7.14" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "879952a81a83930934cbf1786752d6dedc3b1f29e8f8fb2ad1d0a36f377cf442" +dependencies = [ + "memchr", + "thiserror", + "ucd-trie", +] + +[[package]] +name = "pin-project-lite" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "915a1e146535de9163f3987b8944ed8cf49a18bb0056bcebcdcece385cece4ff" + +[[package]] +name = "pin-utils" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b870d8c151b6f2fb93e84a13146138f05d02ed11c7e7c54f8826aaaf7c9f184" + +[[package]] +name = "pkcs8" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f950b2377845cebe5cf8b5165cb3cc1a5e0fa5cfa3e1f7f55707d8fd82e0a7b7" +dependencies = [ + "der", + "spki", +] + +[[package]] +name = "pkg-config" +version = "0.3.31" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "953ec861398dccce10c670dfeaf3ec4911ca479e9c02154b3a215178c5f566f2" + +[[package]] +name = "powerfmt" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "439ee305def115ba05938db6eb1644ff94165c5ab5e9420d1c1bcedbba909391" + +[[package]] +name = "ppv-lite86" +version = "0.2.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77957b295656769bb8ad2b6a6b09d897d94f05c41b069aede1fcdaa675eaea04" +dependencies = [ + "zerocopy", +] + +[[package]] +name = "primitive-types" +version = "0.12.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b34d9fd68ae0b74a41b21c03c2f62847aa0ffea044eee893b4c140b37e244e2" +dependencies = [ + "fixed-hash", + "impl-codec", + "impl-rlp", + "impl-serde", + "uint", +] + +[[package]] +name = "proc-macro-crate" +version = "3.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecf48c7ca261d60b74ab1a7b20da18bede46776b2e55535cb958eb595c5fa7b" +dependencies = [ + "toml_edit", +] + +[[package]] +name = "proc-macro-error" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" +dependencies = [ + "proc-macro-error-attr", + "proc-macro2", + "quote", + "syn 1.0.109", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr" +version = "1.0.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" +dependencies = [ + "proc-macro2", + "quote", + "version_check", +] + +[[package]] +name = "proc-macro-error-attr2" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "96de42df36bb9bba5542fe9f1a054b8cc87e172759a1868aa05c1f3acc89dfc5" +dependencies = [ + "proc-macro2", + "quote", +] + +[[package]] +name = "proc-macro-error2" +version = "2.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "11ec05c52be0a07b08061f7dd003e7d7092e0472bc731b4af7bb1ef876109802" +dependencies = [ + "proc-macro-error-attr2", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "proc-macro2" +version = "1.0.89" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f139b0662de085916d1fb67d2b4169d1addddda1919e696f3252b740b629986e" +dependencies = [ + "unicode-ident", +] + +[[package]] +name = "proptest" +version = "1.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4c2511913b88df1637da85cc8d96ec8e43a3f8bb8ccb71ee1ac240d6f3df58d" +dependencies = [ + "bit-set", + "bit-vec", + "bitflags 2.6.0", + "lazy_static", + "num-traits", + "rand", + "rand_chacha", + "rand_xorshift", + "regex-syntax", + "rusty-fork", + "tempfile", + "unarray", +] + +[[package]] +name = "prost" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7b0487d90e047de87f984913713b85c601c05609aad5b0df4b4573fbf69aa13f" +dependencies = [ + "bytes", + "prost-derive", +] + +[[package]] +name = "prost-derive" +version = "0.13.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e9552f850d5f0964a4e4d0bf306459ac29323ddfbae05e35a7c0d35cb0803cc5" +dependencies = [ + "anyhow", + "itertools 0.13.0", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "quick-error" +version = "1.2.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" + +[[package]] +name = "quinn" +version = "0.11.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c7c5fdde3cdae7203427dc4f0a68fe0ed09833edc525a03456b153b79828684" +dependencies = [ + "bytes", + "pin-project-lite", + "quinn-proto", + "quinn-udp", + "rustc-hash 2.0.0", + "rustls", + "socket2", + "thiserror", + "tokio", + "tracing", +] + +[[package]] +name = "quinn-proto" +version = "0.11.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fadfaed2cd7f389d0161bb73eeb07b7b78f8691047a6f3e73caaeae55310a4a6" +dependencies = [ + "bytes", + "rand", + "ring", + "rustc-hash 2.0.0", + "rustls", + "slab", + "thiserror", + "tinyvec", + "tracing", +] + +[[package]] +name = "quinn-udp" +version = "0.5.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4fe68c2e9e1a1234e218683dbdf9f9dfcb094113c5ac2b938dfcb9bab4c4140b" +dependencies = [ + "libc", + "once_cell", + "socket2", + "tracing", + "windows-sys 0.59.0", +] + +[[package]] +name = "quote" +version = "1.0.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b5b9d34b8991d19d98081b46eacdd8eb58c6f2b201139f7c5f643cc155a633af" +dependencies = [ + "proc-macro2", +] + +[[package]] +name = "radium" +version = "0.7.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc33ff2d4973d518d823d61aa239014831e521c75da58e3df4840d3f47749d09" + +[[package]] +name = "rand" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" +dependencies = [ + "libc", + "rand_chacha", + "rand_core", + "serde", +] + +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core", +] + +[[package]] +name = "rand_core" +version = "0.6.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ec0be4795e2f6a28069bec0b5ff3e2ac9bafc99e6a9a7dc3547996c5c816922c" +dependencies = [ + "getrandom", +] + +[[package]] +name = "rand_xorshift" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d25bf25ec5ae4a3f1b92f929810509a2f53d7dca2f50b794ff57e3face536c8f" +dependencies = [ + "rand_core", +] + +[[package]] +name = "redox_syscall" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b6dfecf2c74bce2466cabf93f6664d6998a69eb21e39f4207930065b27b771f" +dependencies = [ + "bitflags 2.6.0", +] + +[[package]] +name = "redox_users" +version = "0.4.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ba009ff324d1fc1b900bd1fdb31564febe58a8ccc8a6fdbb93b543d33b13ca43" +dependencies = [ + "getrandom", + "libredox", + "thiserror", +] + +[[package]] +name = "regex" +version = "1.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b544ef1b4eac5dc2db33ea63606ae9ffcfac26c1416a2806ae0bf5f56b201191" +dependencies = [ + "aho-corasick", + "memchr", + "regex-automata", + "regex-syntax", +] + +[[package]] +name = "regex-automata" +version = "0.4.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "368758f23274712b504848e9d5a6f010445cc8b87a7cdb4d7cbee666c1288da3" +dependencies = [ + "aho-corasick", + "memchr", + "regex-syntax", +] + +[[package]] +name = "regex-syntax" +version = "0.8.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b15c43186be67a4fd63bee50d0303afffcef381492ebe2c5d87f324e1b8815c" + +[[package]] +name = "reqwest" +version = "0.12.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f713147fbe92361e52392c73b8c9e48c04c6625bce969ef54dc901e58e042a7b" +dependencies = [ + "base64 0.22.1", + "bytes", + "encoding_rs", + "futures-channel", + "futures-core", + "futures-util", + "h2", + "http", + "http-body", + "http-body-util", + "hyper", + "hyper-rustls", + "hyper-tls", + "hyper-util", + "ipnet", + "js-sys", + "log", + "mime", + "native-tls", + "once_cell", + "percent-encoding", + "pin-project-lite", + "quinn", + "rustls", + "rustls-pemfile", + "rustls-pki-types", + "serde", + "serde_json", + "serde_urlencoded", + "sync_wrapper 1.0.1", + "system-configuration", + "tokio", + "tokio-native-tls", + "tokio-rustls", + "tokio-util", + "tower-service", + "url", + "wasm-bindgen", + "wasm-bindgen-futures", + "wasm-streams", + "web-sys", + "webpki-roots", + "windows-registry", +] + +[[package]] +name = "revm" +version = "14.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "641702b12847f9ed418d552f4fcabe536d867a2c980e96b6e7e25d7b992f929f" +dependencies = [ + "auto_impl", + "cfg-if", + "dyn-clone", + "revm-interpreter", + "revm-precompile", + "serde", + "serde_json", +] + +[[package]] +name = "revm-inspectors" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "43c44af0bf801f48d25f7baf25cf72aff4c02d610f83b428175228162fef0246" +dependencies = [ + "alloy-primitives", + "alloy-rpc-types-eth", + "alloy-rpc-types-trace", + "alloy-sol-types", + "anstyle", + "colorchoice", + "revm", + "serde_json", + "thiserror", +] + +[[package]] +name = "revm-interpreter" +version = "10.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2e5e14002afae20b5bf1566f22316122f42f57517000e559c55b25bf7a49cba2" +dependencies = [ + "revm-primitives", + "serde", +] + +[[package]] +name = "revm-precompile" +version = "11.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3198c06247e8d4ad0d1312591edf049b0de4ddffa9fecb625c318fd67db8639b" +dependencies = [ + "aurora-engine-modexp", + "blst", + "c-kzg", + "cfg-if", + "k256", + "once_cell", + "revm-primitives", + "ripemd", + "secp256k1", + "sha2 0.10.8", + "substrate-bn", +] + +[[package]] +name = "revm-primitives" +version = "10.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6f1525851a03aff9a9d6a1d018b414d76252d6802ab54695b27093ecd7e7a101" +dependencies = [ + "alloy-eip2930", + "alloy-eip7702", + "alloy-primitives", + "auto_impl", + "bitflags 2.6.0", + "bitvec", + "c-kzg", + "cfg-if", + "dyn-clone", + "enumn", + "hex", + "serde", +] + +[[package]] +name = "rfc6979" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f8dd2a808d456c4a54e300a23e9f5a67e122c3024119acbfd73e3bf664491cb2" +dependencies = [ + "hmac 0.12.1", + "subtle", +] + +[[package]] +name = "ring" +version = "0.17.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c17fa4cb658e3583423e915b9f3acc01cceaee1860e33d59ebae66adc3a2dc0d" +dependencies = [ + "cc", + "cfg-if", + "getrandom", + "libc", + "spin", + "untrusted", + "windows-sys 0.52.0", +] + +[[package]] +name = "ripemd" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bd124222d17ad93a644ed9d011a40f4fb64aa54275c08cc216524a9ea82fb09f" +dependencies = [ + "digest 0.10.7", +] + +[[package]] +name = "risc0-binfmt" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "543230f7117ce0e6b92b4797fbb3da722575973258cc38a48e28af8d3cf3a26d" +dependencies = [ + "anyhow", + "borsh", + "elf", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-build" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c328bea983ffed4cf3721c92b06fa5076cc38c9e326e1488a9ae792e67a054c7" +dependencies = [ + "anyhow", + "cargo_metadata", + "dirs", + "docker-generate", + "hex", + "risc0-binfmt", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "serde_json", + "tempfile", +] + +[[package]] +name = "risc0-circuit-recursion" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436c762db677faf2cd616c55a69012d6b4f46c426b7d553c1b3d717e0c7e9438" +dependencies = [ + "anyhow", + "bytemuck", + "hex", + "metal", + "risc0-core", + "risc0-zkp", + "tracing", +] + +[[package]] +name = "risc0-circuit-rv32im" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "21f81638d4349eb5a816f3fd6ea12b314007572fc63d45cdb83891bed64e2a2a" +dependencies = [ + "anyhow", + "metal", + "risc0-binfmt", + "risc0-core", + "risc0-zkp", + "risc0-zkvm-platform", + "serde", + "tracing", +] + +[[package]] +name = "risc0-core" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1714b8968a5e4583a15018dc2ae95878c76f4cdbc643268a34670fde5b08252a" +dependencies = [ + "bytemuck", + "rand_core", +] + +[[package]] +name = "risc0-groth16" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e5f11beecdcabeac264fb868e0b5db22c7e2db5fa2ce68fd482d8ab9ffb88e5d" +dependencies = [ + "anyhow", + "ark-bn254", + "ark-ec", + "ark-groth16", + "ark-serialize 0.4.2", + "bytemuck", + "hex", + "num-bigint", + "num-traits", + "risc0-binfmt", + "risc0-zkp", + "serde", +] + +[[package]] +name = "risc0-zkp" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "285aa3993827b4a646d70e68240e138f71574680a02d2e97ad30b1db80efda80" +dependencies = [ + "anyhow", + "blake2", + "borsh", + "bytemuck", + "cfg-if", + "digest 0.10.7", + "hex", + "hex-literal", + "metal", + "paste", + "rand_core", + "risc0-core", + "risc0-zkvm-platform", + "serde", + "sha2 0.10.8", + "tracing", +] + +[[package]] +name = "risc0-zkvm" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "614fad8046130321e3be9ca3a36d9edad6ff4c538549ae191ec4d82576bb3893" +dependencies = [ + "anyhow", + "bincode", + "bonsai-sdk", + "borsh", + "bytemuck", + "bytes", + "getrandom", + "hex", + "lazy-regex", + "prost", + "risc0-binfmt", + "risc0-build", + "risc0-circuit-recursion", + "risc0-circuit-rv32im", + "risc0-core", + "risc0-groth16", + "risc0-zkp", + "risc0-zkvm-platform", + "rrs-lib", + "semver 1.0.23", + "serde", + "sha2 0.10.8", + "stability", + "tempfile", + "tracing", +] + +[[package]] +name = "risc0-zkvm-platform" +version = "1.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6acf0b0d7a55578f892e0460ed1f2ca06d0380e32440531d80ca82530d41272" +dependencies = [ + "bytemuck", + "getrandom", + "libm", + "stability", +] + +[[package]] +name = "rlp" +version = "0.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bb919243f34364b6bd2fc10ef797edbfa75f33c252e7998527479c6d6b47e1ec" +dependencies = [ + "bytes", + "rustc-hex", +] + +[[package]] +name = "rrs-lib" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b4382d3af3a4ebdae7f64ba6edd9114fff92c89808004c4943b393377a25d001" +dependencies = [ + "downcast-rs", + "paste", +] + +[[package]] +name = "ruint" +version = "1.12.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c3cc4c2511671f327125da14133d0c5c5d137f006a1017a16f557bc85b16286" +dependencies = [ + "alloy-rlp", + "ark-ff 0.3.0", + "ark-ff 0.4.2", + "bytes", + "fastrlp", + "num-bigint", + "num-traits", + "parity-scale-codec", + "primitive-types", + "proptest", + "rand", + "rlp", + "ruint-macro", + "serde", + "valuable", + "zeroize", +] + +[[package]] +name = "ruint-macro" +version = "1.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "48fd7bd8a6377e15ad9d42a8ec25371b94ddc67abe7c8b9127bec79bebaaae18" + +[[package]] +name = "rustc-demangle" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "719b953e2095829ee67db738b3bfa9fa368c94900df327b3f07fe6e794d2fe1f" + +[[package]] +name = "rustc-hash" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "08d43f7aa6b08d49f382cde6a7982047c3426db949b1424bc4b7ec9ae12c6ce2" + +[[package]] +name = "rustc-hash" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "583034fd73374156e66797ed8e5b0d5690409c9226b22d87cb7f19821c05d152" + +[[package]] +name = "rustc-hex" +version = "2.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3e75f6a532d0fd9f7f13144f392b6ad56a32696bfcd9c78f797f16bbb6f072d6" + +[[package]] +name = "rustc_version" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0dfe2087c51c460008730de8b57e6a320782fbfb312e1f4d520e6c6fae155ee" +dependencies = [ + "semver 0.11.0", +] + +[[package]] +name = "rustc_version" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfcb3a22ef46e85b45de6ee7e79d063319ebb6594faafcf1c225ea92ab6e9b92" +dependencies = [ + "semver 1.0.23", +] + +[[package]] +name = "rustix" +version = "0.38.37" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8acb788b847c24f28525660c4d7758620a7210875711f79e7f663cc152726811" +dependencies = [ + "bitflags 2.6.0", + "errno", + "libc", + "linux-raw-sys", + "windows-sys 0.52.0", +] + +[[package]] +name = "rustls" +version = "0.23.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5fbb44d7acc4e873d613422379f69f237a1b141928c02f6bc6ccfddddc2d7993" +dependencies = [ + "once_cell", + "ring", + "rustls-pki-types", + "rustls-webpki", + "subtle", + "zeroize", +] + +[[package]] +name = "rustls-pemfile" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dce314e5fee3f39953d46bb63bb8a46d40c2f8fb7cc5a3b6cab2bde9721d6e50" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "rustls-pki-types" +version = "1.10.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "16f1201b3c9a7ee8039bcadc17b7e605e2945b27eee7631788c1bd2b0643674b" + +[[package]] +name = "rustls-webpki" +version = "0.102.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "64ca1bc8749bd4cf37b5ce386cc146580777b4e8572c7b97baf22c83f444bee9" +dependencies = [ + "ring", + "rustls-pki-types", + "untrusted", +] + +[[package]] +name = "rustversion" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e819f2bc632f285be6d7cd36e25940d45b2391dd6d9b939e79de557f7014248" + +[[package]] +name = "rusty-fork" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" +dependencies = [ + "fnv", + "quick-error", + "tempfile", + "wait-timeout", +] + +[[package]] +name = "ryu" +version = "1.0.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f3cb5ba0dc43242ce17de99c180e96db90b235b8a9fdc9543c96d2209116bd9f" + +[[package]] +name = "schannel" +version = "0.1.26" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "01227be5826fa0690321a2ba6c5cd57a19cf3f6a09e76973b58e61de6ab9d1c1" +dependencies = [ + "windows-sys 0.59.0", +] + +[[package]] +name = "scopeguard" +version = "1.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "94143f37725109f92c262ed2cf5e59bce7498c01bcc1502d7b9afe439a4e9f49" + +[[package]] +name = "sealed" +version = "0.5.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4a8caec23b7800fb97971a1c6ae365b6239aaeddfb934d6265f8505e795699d" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sec1" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3e97a565f76233a6003f9f5c54be1d9c5bdfa3eccfb189469f11ec4901c47dc" +dependencies = [ + "base16ct", + "der", + "generic-array", + "pkcs8", + "subtle", + "zeroize", +] + +[[package]] +name = "secp256k1" +version = "0.29.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9465315bc9d4566e1724f0fffcbcc446268cb522e60f9a27bcded6b19c108113" +dependencies = [ + "rand", + "secp256k1-sys", +] + +[[package]] +name = "secp256k1-sys" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d4387882333d3aa8cb20530a17c69a3752e97837832f34f6dccc760e715001d9" +dependencies = [ + "cc", +] + +[[package]] +name = "security-framework" +version = "2.11.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "897b2245f0b511c87893af39b033e5ca9cce68824c4d7e7630b5a1d339658d02" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "core-foundation-sys", + "libc", + "security-framework-sys", +] + +[[package]] +name = "security-framework-sys" +version = "2.12.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ea4a292869320c0272d7bc55a5a6aafaff59b4f63404a003887b679a2e05b4b6" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "semver" +version = "0.11.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f301af10236f6df4160f7c3f04eec6dbc70ace82d23326abad5edee88801c6b6" +dependencies = [ + "semver-parser", +] + +[[package]] +name = "semver" +version = "1.0.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61697e0a1c7e512e84a621326239844a24d8207b4669b41bc18b32ea5cbf988b" +dependencies = [ + "serde", +] + +[[package]] +name = "semver-parser" +version = "0.10.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "00b0bef5b7f9e0df16536d3961cfb6e84331c065b4066afb39768d0e319411f7" +dependencies = [ + "pest", +] + +[[package]] +name = "serde" +version = "1.0.213" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3ea7893ff5e2466df8d720bb615088341b295f849602c6956047f8f80f0e9bc1" +dependencies = [ + "serde_derive", +] + +[[package]] +name = "serde_derive" +version = "1.0.213" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "7e85ad2009c50b58e87caa8cd6dac16bdf511bbfb7af6c33df902396aa480fa5" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "serde_json" +version = "1.0.132" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d726bfaff4b320266d395898905d0eba0345aae23b54aee3a737e260fd46db03" +dependencies = [ + "indexmap", + "itoa", + "memchr", + "ryu", + "serde", +] + +[[package]] +name = "serde_path_to_error" +version = "0.1.16" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af99884400da37c88f5e9146b7f1fd0fbcae8f6eec4e9da38b67d05486f814a6" +dependencies = [ + "itoa", + "serde", +] + +[[package]] +name = "serde_urlencoded" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d3491c14715ca2294c4d6a88f15e84739788c1d030eed8c110436aafdaa2f3fd" +dependencies = [ + "form_urlencoded", + "itoa", + "ryu", + "serde", +] + +[[package]] +name = "sha1" +version = "0.10.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e3bf829a2d51ab4a5ddf1352d8470c140cadc8301b2ae1789db023f01cedd6ba" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha2" +version = "0.9.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4d58a1e1bf39749807d89cf2d98ac2dfa0ff1cb3faa38fbb64dd88ac8013d800" +dependencies = [ + "block-buffer 0.9.0", + "cfg-if", + "cpufeatures", + "digest 0.9.0", + "opaque-debug", +] + +[[package]] +name = "sha2" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "793db75ad2bcafc3ffa7c68b215fee268f537982cd901d132f89c6343f3a3dc8" +dependencies = [ + "cfg-if", + "cpufeatures", + "digest 0.10.7", +] + +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + +[[package]] +name = "sha3-asm" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c28efc5e327c837aa837c59eae585fc250715ef939ac32881bcc11677cd02d46" +dependencies = [ + "cc", + "cfg-if", +] + +[[package]] +name = "sharded-slab" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f40ca3c46823713e0d4209592e8d6e826aa57e928f09752619fc696c499637f6" +dependencies = [ + "lazy_static", +] + +[[package]] +name = "shlex" +version = "1.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0fda2ff0d084019ba4d7c6f371c95d8fd75ce3524c3cb8fb653a3023f6323e64" + +[[package]] +name = "signal-hook-registry" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a9e9e0b4211b72e7b8b6e85c807d36c212bdb33ea8587f7569562a84df5465b1" +dependencies = [ + "libc", +] + +[[package]] +name = "signature" +version = "2.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "77549399552de45a898a580c1b41d445bf730df867cc44e6c0233bbc4b8329de" +dependencies = [ + "digest 0.10.7", + "rand_core", +] + +[[package]] +name = "simple_asn1" +version = "0.6.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "adc4e5204eb1910f40f9cfa375f6f05b68c3abac4b6fd879c8ff5e7ae8a0a085" +dependencies = [ + "num-bigint", + "num-traits", + "thiserror", + "time", +] + +[[package]] +name = "slab" +version = "0.4.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f92a496fb766b417c996b9c5e57daf2f7ad3b0bebe1ccfca4856390e3d3bb67" +dependencies = [ + "autocfg", +] + +[[package]] +name = "smallvec" +version = "1.13.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c5e1a9a646d36c3599cd173a41282daf47c44583ad367b8e6837255952e5c67" + +[[package]] +name = "snap" +version = "1.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b6b67fb9a61334225b5b790716f609cd58395f895b3fe8b328786812a40bc3b" + +[[package]] +name = "socket2" +version = "0.5.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce305eb0b4296696835b71df73eb912e0f1ffd2556a501fcede6e0c50349191c" +dependencies = [ + "libc", + "windows-sys 0.52.0", +] + +[[package]] +name = "spin" +version = "0.9.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "6980e8d7511241f8acf4aebddbb1ff938df5eebe98691418c4468d0b72a96a67" + +[[package]] +name = "spki" +version = "0.7.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" +dependencies = [ + "base64ct", + "der", +] + +[[package]] +name = "stability" +version = "0.2.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d904e7009df136af5297832a3ace3370cd14ff1546a232f4f185036c2736fcac" +dependencies = [ + "quote", + "syn 2.0.85", +] + +[[package]] +name = "static_assertions" +version = "1.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a2eb9349b6444b326872e140eb1cf5e7c522154d69e7a0ffb0fb81c06b37543f" + +[[package]] +name = "substrate-bn" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b5bbfa79abbae15dd642ea8176a21a635ff3c00059961d1ea27ad04e5b441c" +dependencies = [ + "byteorder", + "crunchy", + "lazy_static", + "rand", + "rustc-hex", +] + +[[package]] +name = "subtle" +version = "2.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "13c2bddecc57b384dee18652358fb23172facb8a2c51ccc10d74c157bdea3292" + +[[package]] +name = "syn" +version = "1.0.109" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn" +version = "2.0.85" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5023162dfcd14ef8f32034d8bcd4cc5ddc61ef7a247c024a33e24e1f24d21b56" +dependencies = [ + "proc-macro2", + "quote", + "unicode-ident", +] + +[[package]] +name = "syn-solidity" +version = "0.8.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9d5e0c2ea8db64b2898b62ea2fbd60204ca95e0b2c6bdf53ff768bbe916fbe4d" +dependencies = [ + "paste", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "syn_derive" +version = "0.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1329189c02ff984e9736652b1631330da25eaa6bc639089ed4915d25446cbe7b" +dependencies = [ + "proc-macro-error", + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "sync_wrapper" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2047c6ded9c721764247e62cd3b03c09ffc529b2ba5b10ec482ae507a4a70160" + +[[package]] +name = "sync_wrapper" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a7065abeca94b6a8a577f9bd45aa0867a2238b74e8eb67cf10d492bc39351394" +dependencies = [ + "futures-core", +] + +[[package]] +name = "system-configuration" +version = "0.6.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c879d448e9d986b661742763247d3693ed13609438cf3d006f51f5368a5ba6b" +dependencies = [ + "bitflags 2.6.0", + "core-foundation", + "system-configuration-sys", +] + +[[package]] +name = "system-configuration-sys" +version = "0.6.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e1d1b10ced5ca923a1fcb8d03e96b8d3268065d724548c0211415ff6ac6bac4" +dependencies = [ + "core-foundation-sys", + "libc", +] + +[[package]] +name = "tap" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" + +[[package]] +name = "tempfile" +version = "3.13.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f0f2c9fc62d0beef6951ccffd757e241266a2c833136efbe35af6cd2567dca5b" +dependencies = [ + "cfg-if", + "fastrand", + "once_cell", + "rustix", + "windows-sys 0.59.0", +] + +[[package]] +name = "thiserror" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5d11abd9594d9b38965ef50805c5e469ca9cc6f197f883f717e0269a3057b3d5" +dependencies = [ + "thiserror-impl", +] + +[[package]] +name = "thiserror-impl" +version = "1.0.65" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ae71770322cbd277e69d762a16c444af02aa0575ac0d174f0b9562d3b37f8602" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "thread_local" +version = "1.1.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8b9ef9bad013ada3808854ceac7b46812a6465ba368859a37e2100283d2d719c" +dependencies = [ + "cfg-if", + "once_cell", +] + +[[package]] +name = "threadpool" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d050e60b33d41c19108b32cea32164033a9013fe3b46cbd4457559bfbf77afaa" +dependencies = [ + "num_cpus", +] + +[[package]] +name = "time" +version = "0.3.36" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5dfd88e563464686c916c7e46e623e520ddc6d79fa6641390f2e3fa86e83e885" +dependencies = [ + "deranged", + "itoa", + "num-conv", + "powerfmt", + "serde", + "time-core", + "time-macros", +] + +[[package]] +name = "time-core" +version = "0.1.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" + +[[package]] +name = "time-macros" +version = "0.2.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3f252a68540fde3a3877aeea552b832b40ab9a69e318efd078774a01ddee1ccf" +dependencies = [ + "num-conv", + "time-core", +] + +[[package]] +name = "tiny-keccak" +version = "2.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c9d3793400a45f954c52e73d068316d76b6f4e36977e3fcebb13a2721e80237" +dependencies = [ + "crunchy", +] + +[[package]] +name = "tinyvec" +version = "1.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "445e881f4f6d382d5f27c034e25eb92edd7c784ceab92a0937db7f2e9471b938" +dependencies = [ + "tinyvec_macros", +] + +[[package]] +name = "tinyvec_macros" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" + +[[package]] +name = "tokio" +version = "1.41.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "145f3413504347a2be84393cc8a7d2fb4d863b375909ea59f2158261aa258bbb" +dependencies = [ + "backtrace", + "bytes", + "libc", + "mio", + "parking_lot", + "pin-project-lite", + "signal-hook-registry", + "socket2", + "tokio-macros", + "windows-sys 0.52.0", +] + +[[package]] +name = "tokio-macros" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "693d596312e88961bc67d7f1f97af8a70227d9f90c31bba5806eec004978d752" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tokio-native-tls" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bbae76ab933c85776efabc971569dd6119c580d8f5d448769dec1764bf796ef2" +dependencies = [ + "native-tls", + "tokio", +] + +[[package]] +name = "tokio-rustls" +version = "0.26.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0c7bc40d0e5a97695bb96e27995cd3a08538541b0a846f65bba7a359f36700d4" +dependencies = [ + "rustls", + "rustls-pki-types", + "tokio", +] + +[[package]] +name = "tokio-util" +version = "0.7.12" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "61e7c3654c13bcd040d4a03abee2c75b1d14a37b423cf5a813ceae1cc903ec6a" +dependencies = [ + "bytes", + "futures-core", + "futures-sink", + "futures-util", + "hashbrown 0.14.5", + "pin-project-lite", + "tokio", +] + +[[package]] +name = "toml_datetime" +version = "0.6.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0dd7358ecb8fc2f8d014bf86f6f638ce72ba252a2c3a2572f2a795f1d23efb41" + +[[package]] +name = "toml_edit" +version = "0.22.22" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4ae48d6208a266e853d946088ed816055e556cc6028c5e8e2b84d9fa5dd7c7f5" +dependencies = [ + "indexmap", + "toml_datetime", + "winnow", +] + +[[package]] +name = "tower" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2873938d487c3cfb9aed7546dc9f2711d867c9f90c46b889989a2cb84eba6b4f" +dependencies = [ + "futures-core", + "futures-util", + "pin-project-lite", + "sync_wrapper 0.1.2", + "tokio", + "tower-layer", + "tower-service", + "tracing", +] + +[[package]] +name = "tower-layer" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "121c2a6cda46980bb0fcd1647ffaf6cd3fc79a013de288782836f6df9c48780e" + +[[package]] +name = "tower-service" +version = "0.3.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8df9b6e13f2d32c91b9bd719c00d1958837bc7dec474d94952798cc8e69eeec3" + +[[package]] +name = "tracing" +version = "0.1.40" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c3523ab5a71916ccf420eebdf5521fcef02141234bbc0b8a49f2fdc4544364ef" +dependencies = [ + "log", + "pin-project-lite", + "tracing-attributes", + "tracing-core", +] + +[[package]] +name = "tracing-attributes" +version = "0.1.27" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "tracing-core" +version = "0.1.32" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c06d3da6113f116aaee68e4d601191614c9053067f9ab7f6edbcb161237daa54" +dependencies = [ + "once_cell", + "valuable", +] + +[[package]] +name = "tracing-log" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" +dependencies = [ + "log", + "once_cell", + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.2.25" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0e0d2eaa99c3c2e41547cfa109e910a68ea03823cccad4a0525dcbc9b01e8c71" +dependencies = [ + "tracing-core", +] + +[[package]] +name = "tracing-subscriber" +version = "0.3.18" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ad0f048c97dbd9faa9b7df56362b8ebcaa52adb06b498c050d2f4e32f90a7a8b" +dependencies = [ + "nu-ansi-term", + "sharded-slab", + "smallvec", + "thread_local", + "tracing-core", + "tracing-log", +] + +[[package]] +name = "try-lock" +version = "0.2.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" + +[[package]] +name = "typenum" +version = "1.17.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" + +[[package]] +name = "ucd-trie" +version = "0.1.7" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2896d95c02a80c6d6a5d6e953d479f5ddf2dfdb6a244441010e373ac0fb88971" + +[[package]] +name = "uint" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "76f64bba2c53b04fcab63c01a7d7427eadc821e3bc48c34dc9ba29c501164b52" +dependencies = [ + "byteorder", + "crunchy", + "hex", + "static_assertions", +] + +[[package]] +name = "unarray" +version = "0.1.4" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "eaea85b334db583fe3274d12b4cd1880032beab409c0d774be044d4480ab9a94" + +[[package]] +name = "unicode-bidi" +version = "0.3.17" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5ab17db44d7388991a428b2ee655ce0c212e862eff1768a455c58f9aad6e7893" + +[[package]] +name = "unicode-ident" +version = "1.0.13" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e91b56cd4cadaeb79bbf1a5645f6b4f8dc5bde8834ad5894a8db35fda9efa1fe" + +[[package]] +name = "unicode-normalization" +version = "0.1.24" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5033c97c4262335cded6d6fc3e5c18ab755e1a3dc96376350f3d8e9f009ad956" +dependencies = [ + "tinyvec", +] + +[[package]] +name = "unicode-xid" +version = "0.2.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ebc1c04c71510c7f702b52b7c350734c9ff1295c464a03335b00bb84fc54f853" + +[[package]] +name = "untrusted" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8ecb6da28b8a351d773b68d5825ac39017e680750f980f3a1a85cd8dd28a47c1" + +[[package]] +name = "url" +version = "2.5.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "22784dbdf76fdde8af1aeda5622b546b422b6fc585325248a2bf9f5e41e94d6c" +dependencies = [ + "form_urlencoded", + "idna", + "percent-encoding", +] + +[[package]] +name = "valuable" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "830b7e5d4d90034032940e4ace0d9a9a057e7a45cd94e6c007832e39edb82f6d" + +[[package]] +name = "vcpkg" +version = "0.2.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "accd4ea62f7bb7a82fe23066fb0957d48ef677f6eeb8215f372f52e48bb32426" + +[[package]] +name = "version_check" +version = "0.9.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b928f33d975fc6ad9f86c8f283853ad26bdd5b10b7f1542aa2fa15e2289105a" + +[[package]] +name = "wait-timeout" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9f200f5b12eb75f8c1ed65abd4b2db8a6e1b138a20de009dacee265a2498f3f6" +dependencies = [ + "libc", +] + +[[package]] +name = "want" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" +dependencies = [ + "try-lock", +] + +[[package]] +name = "wasi" +version = "0.11.0+wasi-snapshot-preview1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" + +[[package]] +name = "wasm-bindgen" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "128d1e363af62632b8eb57219c8fd7877144af57558fb2ef0368d0087bddeb2e" +dependencies = [ + "cfg-if", + "once_cell", + "wasm-bindgen-macro", +] + +[[package]] +name = "wasm-bindgen-backend" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cb6dd4d3ca0ddffd1dd1c9c04f94b868c37ff5fac97c30b97cff2d74fce3a358" +dependencies = [ + "bumpalo", + "log", + "once_cell", + "proc-macro2", + "quote", + "syn 2.0.85", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-futures" +version = "0.4.45" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cc7ec4f8827a71586374db3e87abdb5a2bb3a15afed140221307c3ec06b1f63b" +dependencies = [ + "cfg-if", + "js-sys", + "wasm-bindgen", + "web-sys", +] + +[[package]] +name = "wasm-bindgen-macro" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e79384be7f8f5a9dd5d7167216f022090cf1f9ec128e6e6a482a2cb5c5422c56" +dependencies = [ + "quote", + "wasm-bindgen-macro-support", +] + +[[package]] +name = "wasm-bindgen-macro-support" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "26c6ab57572f7a24a4985830b120de1594465e5d500f24afe89e16b4e833ef68" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", + "wasm-bindgen-backend", + "wasm-bindgen-shared", +] + +[[package]] +name = "wasm-bindgen-shared" +version = "0.2.95" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "65fc09f10666a9f147042251e0dda9c18f166ff7de300607007e96bdebc1068d" + +[[package]] +name = "wasm-streams" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4e072d4e72f700fb3443d8fe94a39315df013eef1104903cdb0a2abd322bbecd" +dependencies = [ + "futures-util", + "js-sys", + "wasm-bindgen", + "wasm-bindgen-futures", + "web-sys", +] + +[[package]] +name = "web-sys" +version = "0.3.72" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f6488b90108c040df0fe62fa815cbdee25124641df01814dd7282749234c6112" +dependencies = [ + "js-sys", + "wasm-bindgen", +] + +[[package]] +name = "webpki-roots" +version = "0.26.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "841c67bff177718f1d4dfefde8d8f0e78f9b6589319ba88312f567fc5841a958" +dependencies = [ + "rustls-pki-types", +] + +[[package]] +name = "winapi" +version = "0.3.9" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5c839a674fcd7a98952e593242ea400abe93992746761e38641405d28b00f419" +dependencies = [ + "winapi-i686-pc-windows-gnu", + "winapi-x86_64-pc-windows-gnu", +] + +[[package]] +name = "winapi-i686-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ac3b87c63620426dd9b991e5ce0329eff545bccbbb34f3be09ff6fb6ab51b7b6" + +[[package]] +name = "winapi-x86_64-pc-windows-gnu" +version = "0.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" + +[[package]] +name = "windows-registry" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e400001bb720a623c1c69032f8e3e4cf09984deec740f007dd2b03ec864804b0" +dependencies = [ + "windows-result", + "windows-strings", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-result" +version = "0.2.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1d1043d8214f791817bab27572aaa8af63732e11bf84aa21a45a78d6c317ae0e" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-strings" +version = "0.1.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4cd9b125c486025df0eabcb585e62173c6c9eddcec5d117d3b6e8c30e2ee4d10" +dependencies = [ + "windows-result", + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.48.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" +dependencies = [ + "windows-targets 0.48.5", +] + +[[package]] +name = "windows-sys" +version = "0.52.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "282be5f36a8ce781fad8c8ae18fa3f9beff57ec1b52cb3de0789201425d9a33d" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-sys" +version = "0.59.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e38bc4d79ed67fd075bcc251a1c39b32a1776bbe92e5bef1f0bf1f8c531853b" +dependencies = [ + "windows-targets 0.52.6", +] + +[[package]] +name = "windows-targets" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9a2fa6e2155d7247be68c096456083145c183cbbbc2764150dda45a87197940c" +dependencies = [ + "windows_aarch64_gnullvm 0.48.5", + "windows_aarch64_msvc 0.48.5", + "windows_i686_gnu 0.48.5", + "windows_i686_msvc 0.48.5", + "windows_x86_64_gnu 0.48.5", + "windows_x86_64_gnullvm 0.48.5", + "windows_x86_64_msvc 0.48.5", +] + +[[package]] +name = "windows-targets" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "9b724f72796e036ab90c1021d4780d4d3d648aca59e491e6b98e725b84e99973" +dependencies = [ + "windows_aarch64_gnullvm 0.52.6", + "windows_aarch64_msvc 0.52.6", + "windows_i686_gnu 0.52.6", + "windows_i686_gnullvm", + "windows_i686_msvc 0.52.6", + "windows_x86_64_gnu 0.52.6", + "windows_x86_64_gnullvm 0.52.6", + "windows_x86_64_msvc 0.52.6", +] + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2b38e32f0abccf9987a4e3079dfb67dcd799fb61361e53e2882c3cbaf0d905d8" + +[[package]] +name = "windows_aarch64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "32a4622180e7a0ec044bb555404c800bc9fd9ec262ec147edd5989ccd0c02cd3" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "dc35310971f3b2dbbf3f0690a219f40e2d9afcf64f9ab7cc1be722937c26b4bc" + +[[package]] +name = "windows_aarch64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "09ec2a7bb152e2252b53fa7803150007879548bc709c039df7627cabbd05d469" + +[[package]] +name = "windows_i686_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "a75915e7def60c94dcef72200b9a8e58e5091744960da64ec734a6c6e9b3743e" + +[[package]] +name = "windows_i686_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8e9b5ad5ab802e97eb8e295ac6720e509ee4c243f69d781394014ebfe8bbfa0b" + +[[package]] +name = "windows_i686_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0eee52d38c090b3caa76c563b86c3a4bd71ef1a819287c19d586d7334ae8ed66" + +[[package]] +name = "windows_i686_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8f55c233f70c4b27f66c523580f78f1004e8b5a8b659e05a4eb49d4166cca406" + +[[package]] +name = "windows_i686_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "240948bc05c5e7c6dabba28bf89d89ffce3e303022809e73deaefe4f6ec56c66" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "53d40abd2583d23e4718fddf1ebec84dbff8381c07cae67ff7768bbf19c6718e" + +[[package]] +name = "windows_x86_64_gnu" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "147a5c80aabfbf0c7d901cb5895d1de30ef2907eb21fbbab29ca94c5b08b1a78" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "0b7b52767868a23d5bab768e390dc5f5c55825b6d30b86c844ff2dc7414044cc" + +[[package]] +name = "windows_x86_64_gnullvm" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "24d5b23dc417412679681396f2b49f3de8c1473deb516bd34410872eff51ed0d" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.48.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ed94fce61571a4006852b7389a063ab983c02eb1bb37b47f8272ce92d06d9538" + +[[package]] +name = "windows_x86_64_msvc" +version = "0.52.6" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "589f6da84c646204747d1270a2a5661ea66ed1cced2631d546fdfb155959f9ec" + +[[package]] +name = "winnow" +version = "0.6.20" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "36c1fec1a2bb5866f07c25f68c26e565c4c200aebb96d7e55710c19d3e8ac49b" +dependencies = [ + "memchr", +] + +[[package]] +name = "wyz" +version = "0.5.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "05f360fc0b24296329c78fda852a1e9ae82de9cf7b27dae4b7f62f118f77b9ed" +dependencies = [ + "tap", +] + +[[package]] +name = "zerocopy" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1b9b4fd18abc82b8136838da5d50bae7bdea537c574d8dc1a34ed098d6c166f0" +dependencies = [ + "byteorder", + "zerocopy-derive", +] + +[[package]] +name = "zerocopy-derive" +version = "0.7.35" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "fa4f8080344d4671fb4e831a13ad1e68092748387dfc4f55e356242fae12ce3e" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] + +[[package]] +name = "zeroize" +version = "1.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ced3678a2879b30306d323f4542626697a464a97c0a07c9aebf7ebca65cd4dde" +dependencies = [ + "zeroize_derive", +] + +[[package]] +name = "zeroize_derive" +version = "1.4.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ce36e65b0d2999d2aafac989fb249189a141aee1f53c612c1f37d72631959f69" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.85", +] From 7455a1d69f922e9622ca2d1f8ab3416fc82a713c Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 16:14:09 -0300 Subject: [PATCH 26/54] change rust version levm workflow --- .github/workflows/ci_levm.yaml | 2 +- crates/vm/levm/rust-toolchain.toml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci_levm.yaml b/.github/workflows/ci_levm.yaml index 8f22d994b..47978ac67 100644 --- a/.github/workflows/ci_levm.yaml +++ b/.github/workflows/ci_levm.yaml @@ -15,7 +15,7 @@ concurrency: env: CARGO_TERM_COLOR: always - RUST_VERSION: 1.79.0 + RUST_VERSION: 1.81.0 jobs: ef-test: diff --git a/crates/vm/levm/rust-toolchain.toml b/crates/vm/levm/rust-toolchain.toml index 628740b12..1de01fa45 100644 --- a/crates/vm/levm/rust-toolchain.toml +++ b/crates/vm/levm/rust-toolchain.toml @@ -1,2 +1,2 @@ [toolchain] -channel = "1.79.0" +channel = "1.81.0" From d9cd1ddc4896e0266a84b220de8f632d4b5c6850 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 16:25:45 -0300 Subject: [PATCH 27/54] add docs for validations --- crates/vm/levm/docs/validations.md | 17 +++++++++++++++++ 1 file changed, 17 insertions(+) create mode 100644 crates/vm/levm/docs/validations.md diff --git a/crates/vm/levm/docs/validations.md b/crates/vm/levm/docs/validations.md new file mode 100644 index 000000000..85b2033df --- /dev/null +++ b/crates/vm/levm/docs/validations.md @@ -0,0 +1,17 @@ +## Transaction Validation + +1. **GASLIMIT_PRICE_PRODUCT_OVERFLOW**: The product of gas limit and gas price is too high. +2. **INSUFFICIENT_ACCOUNT_FUNDS**: Sender does not have enough funds to pay for the gas. +3. **INSUFFICIENT_MAX_FEE_PER_GAS**: The max fee per gas is lower than the base fee per gas. +4. **INITCODE_SIZE_EXCEEDED**: The size of the initcode is too big. +5. **INTRINSIC_GAS_TOO_LOW**: The gas limit is lower than the intrinsic gas. +6. **NONCE_IS_MAX**: The nonce of the sender is at its maximum value. +7. **PRIORITY_GREATER_THAN_MAX_FEE_PER_GAS**: The priority fee is greater than the max fee per gas. +8. **SENDER_NOT_EOA**: The sender is not an EOA (it has code). +9. **GAS_ALLOWANCE_EXCEEDED**: The gas limit is higher than the block gas limit. +10. **INSUFFICIENT_MAX_FEE_PER_BLOB_GAS**: The max fee per blob gas is lower than the base fee per gas. +11. **TYPE_3_TX_ZERO_BLOBS**: The transaction has zero blobs. +12. **TYPE_3_TX_INVALID_BLOB_VERSIONED_HASH**: The blob versioned hash is invalid. +13. **TYPE_3_TX_PRE_FORK**: The transaction is a pre-cancun transaction. +14. **TYPE_3_TX_BLOB_COUNT_EXCEEDED**: The blob count is higher than the max allowed. +15. **TYPE_3_TX_CONTRACT_CREATION**: The type 3 transaction is a contract creation. From 707303db07bcaf40ec01db11e45378aa701d8cfc Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 16:37:45 -0300 Subject: [PATCH 28/54] comment revm re_run for developing --- cmd/ef_tests/levm/runner/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ef_tests/levm/runner/mod.rs b/cmd/ef_tests/levm/runner/mod.rs index 72aca963b..5738e837d 100644 --- a/cmd/ef_tests/levm/runner/mod.rs +++ b/cmd/ef_tests/levm/runner/mod.rs @@ -59,7 +59,7 @@ pub fn run_ef_tests( if opts.summary { return Ok(()); } - re_run_with_revm(&mut reports, &ef_tests)?; + // re_run_with_revm(&mut reports, &ef_tests)?; //TODO: Uncomment before merging write_report(&reports) } From 292d7feb22c6c50f10d61a085f454de983a20eec Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 17:12:46 -0300 Subject: [PATCH 29/54] start cleaning transact --- crates/vm/levm/src/vm.rs | 20 +++++--------------- 1 file changed, 5 insertions(+), 15 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 83be8be8a..974974ad1 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -516,29 +516,18 @@ impl VM { } pub fn transact(&mut self) -> Result { - let initial_gas = Default::default(); - - self.env.consumed_gas = initial_gas; - - let mut current_call_frame = self + let mut initial_call_frame = self .call_frames .pop() .ok_or(VMError::Internal(InternalError::CouldNotPopCallframe))?; - self.validate_transaction(&mut current_call_frame)?; - - let mut report = self.execute(&mut current_call_frame)?; + self.validate_transaction(&mut initial_call_frame)?; - let initial_call_frame = self - .call_frames - .last() - .ok_or(VMError::Internal( - InternalError::CouldNotAccessLastCallframe, - ))? - .clone(); + let mut report = self.execute(&mut initial_call_frame)?; let sender = initial_call_frame.msg_sender; + //TODO: Calldata cost is part of intrinsic gas, so it should be calculated before executing the transaction. Not added to report. let calldata_cost = gas_cost::tx_calldata(&initial_call_frame.calldata).map_err(VMError::OutOfGas)?; @@ -546,6 +535,7 @@ impl VM { .gas_used .checked_add(calldata_cost) .ok_or(VMError::OutOfGas(OutOfGasError::GasUsedOverflow))?; + // End TODO if self.is_create() { // If create should check if transaction failed. If failed should revert (delete created contract, ) From 651b13a7577961b9b1edf0fd5a1f6ef870768286 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 17:32:36 -0300 Subject: [PATCH 30/54] start making changes to gas consumption --- crates/vm/levm/src/gas_cost.rs | 8 ++-- crates/vm/levm/src/vm.rs | 72 ++++++++++++++++++++++++++-------- crates/vm/vm.rs | 2 +- 3 files changed, 61 insertions(+), 21 deletions(-) diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs index f73dcb1df..214978568 100644 --- a/crates/vm/levm/src/gas_cost.rs +++ b/crates/vm/levm/src/gas_cost.rs @@ -471,18 +471,18 @@ pub fn selfdestruct(address_was_cold: bool, account_is_empty: bool) -> Result Result { +pub fn tx_calldata(calldata: &Bytes) -> Result { // This cost applies both for call and create // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. - let mut calldata_cost: u64 = 0; + let mut calldata_cost: U256 = U256::zero(); for byte in calldata { if *byte != 0 { calldata_cost = calldata_cost - .checked_add(16) + .checked_add(U256::from(16)) .ok_or(OutOfGasError::GasUsedOverflow)?; } else { calldata_cost = calldata_cost - .checked_add(4) + .checked_add(U256::from(4)) .ok_or(OutOfGasError::GasUsedOverflow)?; } } diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 974974ad1..de033698b 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -8,7 +8,7 @@ use crate::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, TxValidationError, VMError, }, - gas_cost::{self}, + gas_cost::{self, CREATE_BASE_COST}, opcodes::Opcode, AccountInfo, }; @@ -106,7 +106,7 @@ impl VM { calldata.clone(), false, env.gas_limit.min(MAX_BLOCK_GAS_LIMIT), - TX_BASE_COST, + U256::zero(), 0, ); @@ -149,7 +149,7 @@ impl VM { Bytes::new(), false, env.gas_limit.min(MAX_BLOCK_GAS_LIMIT), - TX_BASE_COST, + U256::zero(), 0, ); @@ -369,12 +369,63 @@ impl VM { Ok(()) } + fn add_intrinsic_gas(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { + // Intrinsic gas is the gas consumed by the transaction before the execution of the opcodes. Section 6.2 in the Yellow Paper. + + // Intrinsic Gas = Calldata cost + Create cost + Base cost + Access list cost + let mut intrinsic_gas: U256 = U256::zero(); + + // Calldata Cost + // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. + let calldata_cost = + gas_cost::tx_calldata(&initial_call_frame.calldata).map_err(VMError::OutOfGas)?; + + intrinsic_gas = intrinsic_gas + .checked_add(calldata_cost) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + + // Base Cost + intrinsic_gas = intrinsic_gas + .checked_add(TX_BASE_COST) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + + // Create Cost + if self.is_create() { + intrinsic_gas = intrinsic_gas + .checked_add(CREATE_BASE_COST) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + + let number_of_words: u64 = initial_call_frame + .calldata + .chunks(WORD_SIZE) + .len() + .try_into() + .map_err(|_| VMError::Internal(InternalError::ConversionError))?; + + intrinsic_gas = intrinsic_gas + .checked_add( + U256::from(number_of_words) + .checked_mul(U256::from(2)) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?, + ) + .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + } + + // Access List Cost + // TODO: Implement access list cost. + + self.increase_consumed_gas(initial_call_frame, intrinsic_gas) + .map_err(|_| VMError::TxValidation(TxValidationError::IntrinsicGasTooLow))?; + + Ok(()) + } + /// ## Description /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: /// - It increases sender nonce /// - It substracts up-front-cost from sender balance. (Not doing this for now) - /// - It calculates and adds intrinsic gas to the 'gas used' of callframe and environment. (Not doing this for now) + /// - It calculates and adds intrinsic gas to the 'gas used' of callframe and environment. /// See 'docs' for more information about validations. fn validate_transaction(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { //TODO: This should revert the transaction, not throw an error. And I don't know if it should be done here... @@ -433,8 +484,7 @@ impl VM { } // (5) INTRINSIC_GAS_TOO_LOW - // TODO: Not doing this for now - // self.add_intrinsic_gas(initial_call_frame)?; + self.add_intrinsic_gas(initial_call_frame)?; // (6) NONCE_IS_MAX self.increment_account_nonce(sender_address)?; @@ -527,16 +577,6 @@ impl VM { let sender = initial_call_frame.msg_sender; - //TODO: Calldata cost is part of intrinsic gas, so it should be calculated before executing the transaction. Not added to report. - let calldata_cost = - gas_cost::tx_calldata(&initial_call_frame.calldata).map_err(VMError::OutOfGas)?; - - report.gas_used = report - .gas_used - .checked_add(calldata_cost) - .ok_or(VMError::OutOfGas(OutOfGasError::GasUsedOverflow))?; - // End TODO - if self.is_create() { // If create should check if transaction failed. If failed should revert (delete created contract, ) if let TxResult::Revert(error) = report.result { diff --git a/crates/vm/vm.rs b/crates/vm/vm.rs index 36fe2b863..bb8ae3a7e 100644 --- a/crates/vm/vm.rs +++ b/crates/vm/vm.rs @@ -169,7 +169,7 @@ cfg_if::cfg_if! { let env = Environment { origin: tx.sender(), - consumed_gas: U256::from(21000), // Base gas cost for a transaction + consumed_gas: U256::zero(), // Base gas cost for a transaction refunded_gas: U256::zero(), gas_limit: tx.gas_limit().into(), block_number: block_header.number.into(), From 485ea4c88cac6c30eb7a48a1c21df2804b02971d Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 18:30:23 -0300 Subject: [PATCH 31/54] modify add_gas_with_max for report --- crates/vm/levm/src/errors.rs | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index 2f6a4300a..ff96533ff 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -211,8 +211,13 @@ pub struct TransactionReport { impl TransactionReport { /// Function to add gas to report without exceeding the maximum gas limit - pub fn add_gas_with_max(&mut self, gas: u64, max: u64) { - self.gas_used = self.gas_used.saturating_add(gas).min(max); + pub fn add_gas_with_max(&mut self, gas: u64, max: u64) -> Result<(), VMError> { + self.gas_used = self + .gas_used + .checked_add(gas) + .ok_or(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))? + .min(max); + Ok(()) } pub fn is_success(&self) -> bool { From 54f058aeae7686b13564e24f6a899b69d0d0583d Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 18:32:44 -0300 Subject: [PATCH 32/54] create function for post execution changes in creatae --- crates/vm/levm/src/vm.rs | 44 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index de033698b..498dd579d 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -668,6 +668,50 @@ impl VM { )) } + fn create_post_execution( + &mut self, + initial_call_frame: &mut CallFrame, + report: &mut TransactionReport, + ) -> Result<(), VMError> { + if self.is_create() { + if let TxResult::Revert(error) = &report.result { + return Err(error.clone()); + } + + let contract_code = report.clone().output; + + // (6) + if contract_code.len() > MAX_CODE_SIZE { + return Err(VMError::ContractOutputTooBig); + } + + // If contract code is not empty then the first byte should not be 0xef + if *contract_code.first().unwrap_or(&0) == INVALID_CONTRACT_PREFIX { + return Err(VMError::InvalidInitialByte); + } + + let max_gas = self.env.gas_limit.low_u64(); + + // If initialization code is successful, code-deposit cost is paid. + let code_length: u64 = contract_code + .len() + .try_into() + .map_err(|_| VMError::Internal(InternalError::ConversionError))?; + let code_deposit_cost = code_length.checked_mul(200).ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?; + + report.add_gas_with_max(code_deposit_cost, max_gas)?; + // Charge 22100 gas for each storage variable set (???) + + // Assign bytecode to the new contract + let contract_address = initial_call_frame.to; + + self.update_account_bytecode(contract_address, contract_code)?; + } + Ok(()) + } + // TODO: Improve and test REVERT behavior for XCALL opcodes. Issue: https://github.com/lambdaclass/ethrex/issues/1061 #[allow(clippy::too_many_arguments)] pub fn generic_call( From 37b2a679b487f199f1f5f298e03ec64d17e691dd Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 18:34:08 -0300 Subject: [PATCH 33/54] make use of create_post_execution function --- crates/vm/levm/src/vm.rs | 65 ++++++++++------------------------------ 1 file changed, 16 insertions(+), 49 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 498dd579d..3e8c6c7c8 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -2,7 +2,10 @@ use crate::{ account::{Account, StorageSlot}, call_frame::CallFrame, constants::*, - db::{cache, CacheDB, Database}, + db::{ + cache::{self, remove_account}, + CacheDB, Database, + }, environment::Environment, errors::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, @@ -571,62 +574,26 @@ impl VM { .pop() .ok_or(VMError::Internal(InternalError::CouldNotPopCallframe))?; + let cache_before_execution = self.cache.clone(); self.validate_transaction(&mut initial_call_frame)?; let mut report = self.execute(&mut initial_call_frame)?; let sender = initial_call_frame.msg_sender; - if self.is_create() { - // If create should check if transaction failed. If failed should revert (delete created contract, ) - if let TxResult::Revert(error) = report.result { - self.revert_create()?; - return Err(error); - } - let contract_code = report.clone().output; - - // TODO: Is this the expected behavior? - if !contract_code.is_empty() { - // (6) - if contract_code.len() > MAX_CODE_SIZE { - return Err(VMError::ContractOutputTooBig); - } - // Supposing contract code has contents - if *contract_code - .first() - .ok_or(VMError::Internal(InternalError::TriedToIndexEmptyCode))? - == INVALID_CONTRACT_PREFIX - { - return Err(VMError::InvalidInitialByte); + match self.create_post_execution(&mut initial_call_frame, &mut report) { + Ok(_) => {} + Err(error) => { + if error.is_internal() { + return Err(error); + } else { + report.result = TxResult::Revert(error); + report.gas_used = self.env.gas_limit.low_u64(); + self.cache = cache_before_execution; + remove_account(&mut self.cache, &initial_call_frame.to); } } - - // If the initialization code completes successfully, a final contract-creation cost is paid, - // the code-deposit cost, c, proportional to the size of the created contract’s code - let number_of_words: u64 = initial_call_frame - .calldata - .chunks(WORD_SIZE) - .len() - .try_into() - .map_err(|_| VMError::Internal(InternalError::ConversionError))?; - - let code_length: u64 = contract_code - .len() - .try_into() - .map_err(|_| VMError::Internal(InternalError::ConversionError))?; - - let creation_cost = - gas_cost::tx_creation(code_length, number_of_words).map_err(VMError::OutOfGas)?; - report.gas_used = report - .gas_used - .checked_add(creation_cost) - .ok_or(VMError::OutOfGas(OutOfGasError::GasUsedOverflow))?; - // Charge 22100 gas for each storage variable set - - let contract_address = initial_call_frame.to; - - self.update_account_bytecode(contract_address, contract_code)?; - } + }; let coinbase_address = self.env.coinbase; From bc082e4470ab9658e815162f0ae66143a46c9035 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 18:34:57 -0300 Subject: [PATCH 34/54] delete revert_create function --- crates/vm/levm/src/vm.rs | 20 -------------------- 1 file changed, 20 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 3e8c6c7c8..a22c16797 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -352,26 +352,6 @@ impl VM { matches!(self.tx_kind, TxKind::Create) } - fn revert_create(&mut self) -> Result<(), VMError> { - // Note: currently working with copies - let call_frame = self - .call_frames - .last() - .ok_or(VMError::Internal( - InternalError::CouldNotAccessLastCallframe, - ))? - .clone(); - - self.decrement_account_nonce(call_frame.msg_sender)?; - - let new_contract_address = call_frame.to; - if cache::remove_account(&mut self.cache, &new_contract_address).is_none() { - return Err(VMError::AddressDoesNotMatchAnAccount); // Should not be this error - } - - Ok(()) - } - fn add_intrinsic_gas(&mut self, initial_call_frame: &mut CallFrame) -> Result<(), VMError> { // Intrinsic gas is the gas consumed by the transaction before the execution of the opcodes. Section 6.2 in the Yellow Paper. From 35d4116207d4d434f3a9ff0793bc8ba05b3738cc Mon Sep 17 00:00:00 2001 From: JereSalo Date: Thu, 28 Nov 2024 19:29:15 -0300 Subject: [PATCH 35/54] change error type in blob gas exception --- crates/vm/levm/src/vm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index a22c16797..7a686d7e4 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -500,7 +500,7 @@ impl VM { if let Some(tx_max_fee_per_blob_gas) = self.env.tx_max_fee_per_blob_gas { if tx_max_fee_per_blob_gas < self.env.base_fee_per_gas { return Err(VMError::TxValidation( - TxValidationError::InsufficientMaxFeePerGas, + TxValidationError::InsufficientMaxFeePerBlobGas, )); } } From e9fef60998af98a1189dabe8b498129df3d7794b Mon Sep 17 00:00:00 2001 From: JereSalo Date: Fri, 29 Nov 2024 12:08:41 -0300 Subject: [PATCH 36/54] change if in max fee per blob gas validation --- crates/vm/levm/src/vm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 7a686d7e4..493d2c96c 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -498,7 +498,7 @@ impl VM { // (10) INSUFFICIENT_MAX_FEE_PER_BLOB_GAS if let Some(tx_max_fee_per_blob_gas) = self.env.tx_max_fee_per_blob_gas { - if tx_max_fee_per_blob_gas < self.env.base_fee_per_gas { + if tx_max_fee_per_blob_gas.is_zero() { return Err(VMError::TxValidation( TxValidationError::InsufficientMaxFeePerBlobGas, )); From 05dbab08cda2b836b7ffba3684629115caf56f4d Mon Sep 17 00:00:00 2001 From: JereSalo Date: Fri, 29 Nov 2024 13:56:18 -0300 Subject: [PATCH 37/54] change things in validation, up-front-cost and add support for gas cost of type 3 transactions --- cmd/ef_tests/levm/runner/levm_runner.rs | 4 +- crates/vm/levm/src/vm.rs | 50 +++++++++++++++++-------- 2 files changed, 38 insertions(+), 16 deletions(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index ef0958c3e..1369481b3 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -19,6 +19,8 @@ use ethrex_vm::db::StoreWrapper; use keccak_hash::keccak; use std::{collections::HashMap, sync::Arc}; +use super::revm_runner::effective_gas_price; + pub fn run_ef_test(test: &EFTest) -> Result { let mut ef_test_report = EFTestReport::new( test.name.clone(), @@ -94,7 +96,7 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result U256 { + self.env.tx_max_fee_per_gas.unwrap_or(self.env.gas_price) + } + /// ## Description /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: @@ -423,21 +429,36 @@ impl VM { let sender_account = self.get_account(sender_address); // (1) GASLIMIT_PRICE_PRODUCT_OVERFLOW - let gaslimit_price_product = - self.env - .gas_price - .checked_mul(self.env.gas_limit) - .ok_or(VMError::TxValidation( - TxValidationError::GasLimitPriceProductOverflow, - ))?; - - // Up front cost is the maximum amount of wei that a user is willing to pay for. - let up_front_cost = gaslimit_price_product - .checked_add(initial_call_frame.msg_value) + let gaslimit_price_product = self + .max_fee_per_gas_or_gasprice() + .checked_mul(self.env.gas_limit) .ok_or(VMError::TxValidation( - TxValidationError::InsufficientAccountFunds, + TxValidationError::GasLimitPriceProductOverflow, ))?; + // Up front cost is the maximum amount of wei that a user is willing to pay for. Gaslimit * gasprice + value + blob_gas_cost + let value = initial_call_frame.msg_value; + + // blob gas cost = max fee per blob gas * blob gas used + // https://www.blocknative.com/blog/blobsplaining + let blob_gas_used = U256::from(self.env.tx_blob_hashes.len()) + .checked_mul(U256::from(131072)) + .unwrap_or_default(); + + let blob_gas_cost = self + .env + .tx_max_fee_per_blob_gas + .unwrap_or_default() + .checked_mul(blob_gas_used) + .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))?; + + let up_front_cost = gaslimit_price_product + .checked_add(value) + .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))? + .checked_add(blob_gas_cost) + .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))?; + // There is no error specified for overflow in up_front_cost in ef_tests. Maybe we can go with GasLimitPriceProductOverflow or InsufficientAccountFunds. + // (2) INSUFFICIENT_ACCOUNT_FUNDS // NOT CHANGING SENDER BALANCE HERE FOR NOW // This will be increment_account_balance @@ -450,7 +471,7 @@ impl VM { ))?; // (3) INSUFFICIENT_MAX_FEE_PER_GAS - if self.env.gas_price < self.env.base_fee_per_gas { + if self.max_fee_per_gas_or_gasprice() < self.env.base_fee_per_gas { return Err(VMError::TxValidation( TxValidationError::InsufficientMaxFeePerGas, )); @@ -498,6 +519,7 @@ impl VM { // (10) INSUFFICIENT_MAX_FEE_PER_BLOB_GAS if let Some(tx_max_fee_per_blob_gas) = self.env.tx_max_fee_per_blob_gas { + //TODO: This is wrong but I don't know what to compare the max fee per blob gas to. See when it is considered 'insufficient' if tx_max_fee_per_blob_gas.is_zero() { return Err(VMError::TxValidation( TxValidationError::InsufficientMaxFeePerBlobGas, @@ -505,8 +527,6 @@ impl VM { } } - //TODO: Implement the rest of the validations (TYPE_3) - // Transaction is type 3 if tx_max_fee_per_blob_gas is Some if self.env.tx_max_fee_per_blob_gas.is_some() { let blob_hashes = &self.env.tx_blob_hashes; From ea3bb1aa979d32e070a87a77ee916e9882e11f17 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Fri, 29 Nov 2024 14:04:46 -0300 Subject: [PATCH 38/54] change link source of eip --- crates/vm/levm/src/vm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 867f93b53..eaef78c69 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -440,7 +440,7 @@ impl VM { let value = initial_call_frame.msg_value; // blob gas cost = max fee per blob gas * blob gas used - // https://www.blocknative.com/blog/blobsplaining + // https://eips.ethereum.org/EIPS/eip-4844 let blob_gas_used = U256::from(self.env.tx_blob_hashes.len()) .checked_mul(U256::from(131072)) .unwrap_or_default(); From 1d9ce34a21a17aeea9ae25013a3efac3e3913f9b Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 11:06:59 -0300 Subject: [PATCH 39/54] make some comments on blob gas cost --- crates/vm/levm/src/vm.rs | 28 ++++++++++++++++++---------- 1 file changed, 18 insertions(+), 10 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 8a40aa65c..2fc86b89a 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -354,6 +354,7 @@ impl VM { // Intrinsic Gas = Calldata cost + Create cost + Base cost + Access list cost let mut intrinsic_gas: U256 = U256::zero(); + //TODO: Determine whether blob cost should be added to intrinsic gas or not. The thing is that I don't know where to get the actual blob gas cost from. I only have the max blob gas cost that the user is willing to pay. // Calldata Cost // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. @@ -406,6 +407,22 @@ impl VM { self.env.tx_max_fee_per_gas.unwrap_or(self.env.gas_price) } + /// Gets the max blob gas cost for a transaction that a user is willing to pay. + fn get_max_blob_gas_cost(&self) -> Result { + let blob_gas_used = U256::from(self.env.tx_blob_hashes.len()) + .checked_mul(U256::from(131072)) + .unwrap_or_default(); + + let blob_gas_cost = self + .env + .tx_max_fee_per_blob_gas + .unwrap_or_default() + .checked_mul(blob_gas_used) + .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))?; + + Ok(blob_gas_cost) + } + /// ## Description /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: @@ -438,16 +455,7 @@ impl VM { // blob gas cost = max fee per blob gas * blob gas used // https://eips.ethereum.org/EIPS/eip-4844 - let blob_gas_used = U256::from(self.env.tx_blob_hashes.len()) - .checked_mul(U256::from(131072)) - .unwrap_or_default(); - - let blob_gas_cost = self - .env - .tx_max_fee_per_blob_gas - .unwrap_or_default() - .checked_mul(blob_gas_used) - .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))?; + let blob_gas_cost = self.get_max_blob_gas_cost()?; let up_front_cost = gaslimit_price_product .checked_add(value) From c4936fe2751e0a6691a9249de633047cfb4f34f9 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 12:28:15 -0300 Subject: [PATCH 40/54] fix initcode size error --- crates/vm/levm/src/vm.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 2fc86b89a..f8d967c83 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -147,9 +147,9 @@ impl VM { env.origin, new_contract_address, new_contract_address, - code, + code.clone(), value, - Bytes::new(), + code, false, env.gas_limit, U256::zero(), @@ -485,7 +485,7 @@ impl VM { // (4) INITCODE_SIZE_EXCEEDED if self.is_create() { // INITCODE_SIZE_EXCEEDED - if initial_call_frame.calldata.len() >= INIT_CODE_MAX_SIZE { + if initial_call_frame.calldata.len() > INIT_CODE_MAX_SIZE { return Err(VMError::TxValidation( TxValidationError::InitcodeSizeExceeded, )); From f1ff08bc7c742e4109edb4b8fe16e163fc5109cf Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 12:39:26 -0300 Subject: [PATCH 41/54] remove comment --- crates/vm/levm/src/vm.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index f8d967c83..8f21579b7 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -354,7 +354,6 @@ impl VM { // Intrinsic Gas = Calldata cost + Create cost + Base cost + Access list cost let mut intrinsic_gas: U256 = U256::zero(); - //TODO: Determine whether blob cost should be added to intrinsic gas or not. The thing is that I don't know where to get the actual blob gas cost from. I only have the max blob gas cost that the user is willing to pay. // Calldata Cost // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. From 2ce90f797f406b85b9ff15cbbacfe7a9d49a84b4 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 15:59:58 -0300 Subject: [PATCH 42/54] implement get_base_fee_per_blob_gas() --- crates/vm/levm/src/constants.rs | 4 +-- crates/vm/levm/src/gas_cost.rs | 44 ++++++++++++++++++++++++++++++++- crates/vm/levm/src/vm.rs | 15 ++++++++--- 3 files changed, 56 insertions(+), 7 deletions(-) diff --git a/crates/vm/levm/src/constants.rs b/crates/vm/levm/src/constants.rs index 8fdc24d2d..1f5511e52 100644 --- a/crates/vm/levm/src/constants.rs +++ b/crates/vm/levm/src/constants.rs @@ -43,8 +43,8 @@ pub const MAX_BLOB_NUMBER_PER_BLOCK: usize = 6; // Blob constants pub const TARGET_BLOB_GAS_PER_BLOCK: U256 = U256([393216, 0, 0, 0]); // TARGET_BLOB_NUMBER_PER_BLOCK * GAS_PER_BLOB -pub const MIN_BASE_FEE_PER_BLOB_GAS: U256 = U256([1, 0, 0, 0]); -pub const BLOB_BASE_FEE_UPDATE_FRACTION: U256 = U256([3338477, 0, 0, 0]); +pub const MIN_BASE_FEE_PER_BLOB_GAS: u64 = 1; +pub const BLOB_BASE_FEE_UPDATE_FRACTION: u64 = 3338477; pub const MAX_BLOB_COUNT: usize = 6; pub const VALID_BLOB_PREFIXES: [u8; 2] = [0x01, 0x02]; diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs index 4b8ca7507..7ee487a87 100644 --- a/crates/vm/levm/src/gas_cost.rs +++ b/crates/vm/levm/src/gas_cost.rs @@ -1,6 +1,8 @@ use crate::{ call_frame::CallFrame, - constants::{WORD_SIZE, WORD_SIZE_IN_BYTES}, + constants::{ + BLOB_BASE_FEE_UPDATE_FRACTION, MIN_BASE_FEE_PER_BLOB_GAS, WORD_SIZE, WORD_SIZE_IN_BYTES, + }, errors::{InternalError, OutOfGasError, VMError}, memory, StorageSlot, }; @@ -720,3 +722,43 @@ pub fn staticcall( .checked_add(dynamic_gas) .ok_or(OutOfGasError::GasCostOverflow)?) } + +pub fn fake_exponential(factor: u64, numerator: u64, denominator: u64) -> Result { + let mut i = 1; + let mut output: u64 = 0; + + // Initial multiplication: factor * denominator + let mut numerator_accum = factor.checked_mul(denominator).ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?; + + while numerator_accum > 0 { + // Safe addition to output + output = output + .checked_add(numerator_accum) + .ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?; + + // Safe multiplication and division within loop + numerator_accum = numerator_accum + .checked_mul(numerator) + .ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))? + .checked_div(denominator.checked_mul(i).ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?) + .ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?; + + i = i.checked_add(1).ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?; + } + + Ok(U256::from(output.checked_div(denominator).ok_or( + VMError::Internal(InternalError::ArithmeticOperationOverflow), + )?)) +} diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 8f21579b7..b0b3ecbf0 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -11,7 +11,7 @@ use crate::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, TxValidationError, VMError, }, - gas_cost::{self, CREATE_BASE_COST}, + gas_cost::{self, fake_exponential, CREATE_BASE_COST}, opcodes::Opcode, AccountInfo, }; @@ -20,7 +20,7 @@ use ethrex_core::{types::TxKind, Address, H256, U256}; use ethrex_rlp; use ethrex_rlp::encode::RLPEncode; use keccak_hash::keccak; -use sha3::{Digest, Keccak256}; +use sha3::{digest::consts::U2, Digest, Keccak256}; use std::{ collections::{HashMap, HashSet}, sync::Arc, @@ -422,6 +422,14 @@ impl VM { Ok(blob_gas_cost) } + pub fn get_base_fee_per_blob_gas(&self) -> Result { + Ok(fake_exponential( + MIN_BASE_FEE_PER_BLOB_GAS, + self.env.block_excess_blob_gas.unwrap_or_default().low_u64(), //Maybe replace unwrap_or_default for sth else later. + BLOB_BASE_FEE_UPDATE_FRACTION, + )?) + } + /// ## Description /// This method performs validations and returns an error if any of the validations fail. /// It also makes initial changes alongside the validations: @@ -523,8 +531,7 @@ impl VM { // (10) INSUFFICIENT_MAX_FEE_PER_BLOB_GAS if let Some(tx_max_fee_per_blob_gas) = self.env.tx_max_fee_per_blob_gas { - //TODO: This is wrong but I don't know what to compare the max fee per blob gas to. See when it is considered 'insufficient' - if tx_max_fee_per_blob_gas.is_zero() { + if tx_max_fee_per_blob_gas < self.get_base_fee_per_blob_gas()? { return Err(VMError::TxValidation( TxValidationError::InsufficientMaxFeePerBlobGas, )); From d34425454860a4298bb24277ab05bc62d9558ed9 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 16:02:23 -0300 Subject: [PATCH 43/54] fix clippy lints --- crates/vm/levm/src/gas_cost.rs | 4 +--- crates/vm/levm/src/vm.rs | 6 +++--- 2 files changed, 4 insertions(+), 6 deletions(-) diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs index 7ee487a87..772a594fb 100644 --- a/crates/vm/levm/src/gas_cost.rs +++ b/crates/vm/levm/src/gas_cost.rs @@ -1,8 +1,6 @@ use crate::{ call_frame::CallFrame, - constants::{ - BLOB_BASE_FEE_UPDATE_FRACTION, MIN_BASE_FEE_PER_BLOB_GAS, WORD_SIZE, WORD_SIZE_IN_BYTES, - }, + constants::{WORD_SIZE, WORD_SIZE_IN_BYTES}, errors::{InternalError, OutOfGasError, VMError}, memory, StorageSlot, }; diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index b0b3ecbf0..ad91e8d4d 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -20,7 +20,7 @@ use ethrex_core::{types::TxKind, Address, H256, U256}; use ethrex_rlp; use ethrex_rlp::encode::RLPEncode; use keccak_hash::keccak; -use sha3::{digest::consts::U2, Digest, Keccak256}; +use sha3::{Digest, Keccak256}; use std::{ collections::{HashMap, HashSet}, sync::Arc, @@ -423,11 +423,11 @@ impl VM { } pub fn get_base_fee_per_blob_gas(&self) -> Result { - Ok(fake_exponential( + fake_exponential( MIN_BASE_FEE_PER_BLOB_GAS, self.env.block_excess_blob_gas.unwrap_or_default().low_u64(), //Maybe replace unwrap_or_default for sth else later. BLOB_BASE_FEE_UPDATE_FRACTION, - )?) + ) } /// ## Description From d743fd376291aebc5a0f51e5d346bfeceb3dcf5c Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 16:17:06 -0300 Subject: [PATCH 44/54] fix add_gas_with_max for report --- crates/vm/levm/src/errors.rs | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index ff96533ff..f52053973 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -2,7 +2,7 @@ use crate::account::Account; use bytes::Bytes; use ethrex_core::{types::Log, Address}; use serde::{Deserialize, Serialize}; -use std::collections::HashMap; +use std::{collections::HashMap, ops::{Add, AddAssign}}; use thiserror; /// Errors that halt the program @@ -212,11 +212,16 @@ pub struct TransactionReport { impl TransactionReport { /// Function to add gas to report without exceeding the maximum gas limit pub fn add_gas_with_max(&mut self, gas: u64, max: u64) -> Result<(), VMError> { - self.gas_used = self + let new_gas_used = self .gas_used .checked_add(gas) - .ok_or(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))? - .min(max); + .ok_or(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))?; + + if new_gas_used > max { + return Err(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded)); + } + + self.gas_used = new_gas_used; Ok(()) } From bd801b7e38303d00209f43e911b802c701e2515c Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 16:22:38 -0300 Subject: [PATCH 45/54] fix clippy lint --- crates/vm/levm/src/errors.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index f52053973..8873fde9f 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -2,7 +2,7 @@ use crate::account::Account; use bytes::Bytes; use ethrex_core::{types::Log, Address}; use serde::{Deserialize, Serialize}; -use std::{collections::HashMap, ops::{Add, AddAssign}}; +use std::collections::HashMap; use thiserror; /// Errors that halt the program From 3af7fb032110dcb274c9a88dff64bfffdfca281a Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 16:27:57 -0300 Subject: [PATCH 46/54] move effective_gas_price to utils --- cmd/ef_tests/levm/runner/levm_runner.rs | 4 +--- cmd/ef_tests/levm/runner/revm_runner.rs | 19 +++---------------- cmd/ef_tests/levm/utils.rs | 17 +++++++++++++++-- 3 files changed, 19 insertions(+), 21 deletions(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index 1369481b3..5d51faa00 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -2,7 +2,7 @@ use crate::{ report::{EFTestReport, TestVector}, runner::{EFTestRunnerError, InternalError}, types::EFTest, - utils, + utils::{self, effective_gas_price}, }; use ethrex_core::{ types::{code_hash, AccountInfo}, @@ -19,8 +19,6 @@ use ethrex_vm::db::StoreWrapper; use keccak_hash::keccak; use std::{collections::HashMap, sync::Arc}; -use super::revm_runner::effective_gas_price; - pub fn run_ef_test(test: &EFTest) -> Result { let mut ef_test_report = EFTestReport::new( test.name.clone(), diff --git a/cmd/ef_tests/levm/runner/revm_runner.rs b/cmd/ef_tests/levm/runner/revm_runner.rs index ebff7b3c3..ab44686b0 100644 --- a/cmd/ef_tests/levm/runner/revm_runner.rs +++ b/cmd/ef_tests/levm/runner/revm_runner.rs @@ -4,11 +4,11 @@ use crate::{ levm_runner::{self, post_state_root}, EFTestRunnerError, InternalError, }, - types::{EFTest, EFTestTransaction}, - utils::load_initial_state, + types::EFTest, + utils::{effective_gas_price, load_initial_state}, }; use bytes::Bytes; -use ethrex_core::{types::TxKind, Address, H256, U256}; +use ethrex_core::{types::TxKind, Address, H256}; use ethrex_levm::{ errors::{TransactionReport, TxResult}, Account, StorageSlot, @@ -90,19 +90,6 @@ pub fn re_run_failed_ef_test_tx( Ok(()) } -// If gas price is not provided, calculate it with current base fee and priority fee -pub fn effective_gas_price(test: &EFTest, tx: &&EFTestTransaction) -> U256 { - match tx.gas_price { - None => { - let current_base_fee = test.env.current_base_fee.unwrap(); - let priority_fee = tx.max_priority_fee_per_gas.unwrap(); - let max_fee_per_gas = tx.max_fee_per_gas.unwrap(); - std::cmp::min(max_fee_per_gas, current_base_fee + priority_fee) - } - Some(price) => price, - } -} - pub fn prepare_revm_for_tx<'state>( initial_state: &'state mut EvmState, vector: &TestVector, diff --git a/cmd/ef_tests/levm/utils.rs b/cmd/ef_tests/levm/utils.rs index b09944b93..898453be0 100644 --- a/cmd/ef_tests/levm/utils.rs +++ b/cmd/ef_tests/levm/utils.rs @@ -1,5 +1,5 @@ -use crate::types::EFTest; -use ethrex_core::{types::Genesis, H256}; +use crate::types::{EFTest, EFTestTransaction}; +use ethrex_core::{types::Genesis, H256, U256}; use ethrex_storage::{EngineType, Store}; use ethrex_vm::{evm_state, EvmState}; @@ -17,3 +17,16 @@ pub fn load_initial_state(test: &EFTest) -> (EvmState, H256) { genesis.get_block().header.compute_block_hash(), ) } + +// If gas price is not provided, calculate it with current base fee and priority fee +pub fn effective_gas_price(test: &EFTest, tx: &&EFTestTransaction) -> U256 { + match tx.gas_price { + None => { + let current_base_fee = test.env.current_base_fee.unwrap(); + let priority_fee = tx.max_priority_fee_per_gas.unwrap(); + let max_fee_per_gas = tx.max_fee_per_gas.unwrap(); + std::cmp::min(max_fee_per_gas, current_base_fee + priority_fee) + } + Some(price) => price, + } +} From a91e419e223c7f308dd1c6afc80a6f03b2620fb1 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Mon, 2 Dec 2024 16:53:23 -0300 Subject: [PATCH 47/54] uncomment revm re-run --- cmd/ef_tests/levm/runner/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmd/ef_tests/levm/runner/mod.rs b/cmd/ef_tests/levm/runner/mod.rs index 5738e837d..72aca963b 100644 --- a/cmd/ef_tests/levm/runner/mod.rs +++ b/cmd/ef_tests/levm/runner/mod.rs @@ -59,7 +59,7 @@ pub fn run_ef_tests( if opts.summary { return Ok(()); } - // re_run_with_revm(&mut reports, &ef_tests)?; //TODO: Uncomment before merging + re_run_with_revm(&mut reports, &ef_tests)?; write_report(&reports) } From f5dd02ef91a6517c5176d56d514ccbac30ad1634 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 09:56:19 -0300 Subject: [PATCH 48/54] handle errors if fees are not present in transaction when necessary --- cmd/ef_tests/levm/runner/levm_runner.rs | 2 +- cmd/ef_tests/levm/runner/revm_runner.rs | 2 +- cmd/ef_tests/levm/utils.rs | 37 ++++++++++++++++++++----- 3 files changed, 32 insertions(+), 9 deletions(-) diff --git a/cmd/ef_tests/levm/runner/levm_runner.rs b/cmd/ef_tests/levm/runner/levm_runner.rs index 860f12df6..63537d8af 100644 --- a/cmd/ef_tests/levm/runner/levm_runner.rs +++ b/cmd/ef_tests/levm/runner/levm_runner.rs @@ -94,7 +94,7 @@ pub fn prepare_vm_for_tx(vector: &TestVector, test: &EFTest) -> Result( let tx_env = RevmTxEnv { caller: tx.sender.0.into(), gas_limit: tx.gas_limit.as_u64(), - gas_price: RevmU256::from_limbs(effective_gas_price(test, tx).0), + gas_price: RevmU256::from_limbs(effective_gas_price(test, tx)?.0), transact_to: match tx.to { TxKind::Call(to) => RevmTxKind::Call(to.0.into()), TxKind::Create => RevmTxKind::Create, diff --git a/cmd/ef_tests/levm/utils.rs b/cmd/ef_tests/levm/utils.rs index 898453be0..d20ce428d 100644 --- a/cmd/ef_tests/levm/utils.rs +++ b/cmd/ef_tests/levm/utils.rs @@ -1,4 +1,7 @@ -use crate::types::{EFTest, EFTestTransaction}; +use crate::{ + runner::{EFTestRunnerError, InternalError}, + types::{EFTest, EFTestTransaction}, +}; use ethrex_core::{types::Genesis, H256, U256}; use ethrex_storage::{EngineType, Store}; use ethrex_vm::{evm_state, EvmState}; @@ -19,14 +22,34 @@ pub fn load_initial_state(test: &EFTest) -> (EvmState, H256) { } // If gas price is not provided, calculate it with current base fee and priority fee -pub fn effective_gas_price(test: &EFTest, tx: &&EFTestTransaction) -> U256 { +pub fn effective_gas_price( + test: &EFTest, + tx: &&EFTestTransaction, +) -> Result { match tx.gas_price { None => { - let current_base_fee = test.env.current_base_fee.unwrap(); - let priority_fee = tx.max_priority_fee_per_gas.unwrap(); - let max_fee_per_gas = tx.max_fee_per_gas.unwrap(); - std::cmp::min(max_fee_per_gas, current_base_fee + priority_fee) + let current_base_fee = test + .env + .current_base_fee + .ok_or(EFTestRunnerError::Internal( + InternalError::FirstRunInternal("current_base_fee not found".to_string()), + ))?; + let priority_fee = tx + .max_priority_fee_per_gas + .ok_or(EFTestRunnerError::Internal( + InternalError::FirstRunInternal( + "max_priority_fee_per_gas not found".to_string(), + ), + ))?; + let max_fee_per_gas = tx.max_fee_per_gas.ok_or(EFTestRunnerError::Internal( + InternalError::FirstRunInternal("max_fee_per_gas not found".to_string()), + ))?; + + Ok(std::cmp::min( + max_fee_per_gas, + current_base_fee + priority_fee, + )) } - Some(price) => price, + Some(price) => Ok(price), } } From 92e4848a29c731291131fc3b9b3fb353bd38b369 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 10:13:31 -0300 Subject: [PATCH 49/54] nits --- crates/vm/levm/src/errors.rs | 2 +- crates/vm/levm/src/gas_cost.rs | 36 +++++++++++++++++----------------- crates/vm/levm/src/vm.rs | 26 ++++++++++++------------ 3 files changed, 31 insertions(+), 33 deletions(-) diff --git a/crates/vm/levm/src/errors.rs b/crates/vm/levm/src/errors.rs index 5be15d990..c56a3f428 100644 --- a/crates/vm/levm/src/errors.rs +++ b/crates/vm/levm/src/errors.rs @@ -217,7 +217,7 @@ impl TransactionReport { let new_gas_used = self .gas_used .checked_add(gas) - .ok_or(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded))?; + .ok_or(OutOfGasError::MaxGasLimitExceeded)?; if new_gas_used > max { return Err(VMError::OutOfGas(OutOfGasError::MaxGasLimitExceeded)); diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs index 772a594fb..9dce04fea 100644 --- a/crates/vm/levm/src/gas_cost.rs +++ b/crates/vm/levm/src/gas_cost.rs @@ -726,37 +726,37 @@ pub fn fake_exponential(factor: u64, numerator: u64, denominator: u64) -> Result let mut output: u64 = 0; // Initial multiplication: factor * denominator - let mut numerator_accum = factor.checked_mul(denominator).ok_or(VMError::Internal( - InternalError::ArithmeticOperationOverflow, - ))?; + let mut numerator_accum = factor + .checked_mul(denominator) + .ok_or(InternalError::ArithmeticOperationOverflow)?; while numerator_accum > 0 { // Safe addition to output output = output .checked_add(numerator_accum) - .ok_or(VMError::Internal( - InternalError::ArithmeticOperationOverflow, - ))?; + .ok_or(InternalError::ArithmeticOperationOverflow)?; // Safe multiplication and division within loop numerator_accum = numerator_accum .checked_mul(numerator) - .ok_or(VMError::Internal( - InternalError::ArithmeticOperationOverflow, - ))? - .checked_div(denominator.checked_mul(i).ok_or(VMError::Internal( - InternalError::ArithmeticOperationOverflow, - ))?) + .ok_or(InternalError::ArithmeticOperationOverflow)? + .checked_div( + denominator + .checked_mul(i) + .ok_or(InternalError::ArithmeticOperationOverflow)?, + ) .ok_or(VMError::Internal( InternalError::ArithmeticOperationOverflow, ))?; - i = i.checked_add(1).ok_or(VMError::Internal( - InternalError::ArithmeticOperationOverflow, - ))?; + i = i + .checked_add(1) + .ok_or(InternalError::ArithmeticOperationOverflow)?; } - Ok(U256::from(output.checked_div(denominator).ok_or( - VMError::Internal(InternalError::ArithmeticOperationOverflow), - )?)) + Ok(U256::from( + output + .checked_div(denominator) + .ok_or(InternalError::ArithmeticOperationOverflow)?, + )) } diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 3bed409ac..ec038fe65 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -354,7 +354,7 @@ impl VM { // Intrinsic gas is the gas consumed by the transaction before the execution of the opcodes. Section 6.2 in the Yellow Paper. // Intrinsic Gas = Calldata cost + Create cost + Base cost + Access list cost - let mut intrinsic_gas: U256 = U256::zero(); + let mut intrinsic_gas = U256::zero(); // Calldata Cost // 4 gas for each zero byte in the transaction data 16 gas for each non-zero byte in the transaction. @@ -363,40 +363,40 @@ impl VM { intrinsic_gas = intrinsic_gas .checked_add(calldata_cost) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + .ok_or(OutOfGasError::ConsumedGasOverflow)?; // Base Cost intrinsic_gas = intrinsic_gas .checked_add(TX_BASE_COST) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + .ok_or(OutOfGasError::ConsumedGasOverflow)?; // Create Cost if self.is_create() { intrinsic_gas = intrinsic_gas .checked_add(CREATE_BASE_COST) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + .ok_or(OutOfGasError::ConsumedGasOverflow)?; let number_of_words: u64 = initial_call_frame .calldata .chunks(WORD_SIZE) .len() .try_into() - .map_err(|_| VMError::Internal(InternalError::ConversionError))?; + .map_err(|_| InternalError::ConversionError)?; intrinsic_gas = intrinsic_gas .checked_add( U256::from(number_of_words) .checked_mul(U256::from(2)) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?, + .ok_or(OutOfGasError::ConsumedGasOverflow)?, ) - .ok_or(VMError::OutOfGas(OutOfGasError::ConsumedGasOverflow))?; + .ok_or(OutOfGasError::ConsumedGasOverflow)?; } // Access List Cost // TODO: Implement access list cost. self.increase_consumed_gas(initial_call_frame, intrinsic_gas) - .map_err(|_| VMError::TxValidation(TxValidationError::IntrinsicGasTooLow))?; + .map_err(|_| TxValidationError::IntrinsicGasTooLow)?; Ok(()) } @@ -418,7 +418,7 @@ impl VM { .tx_max_fee_per_blob_gas .unwrap_or_default() .checked_mul(blob_gas_used) - .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))?; + .ok_or(TxValidationError::UndefinedState(1))?; Ok(blob_gas_cost) } @@ -467,9 +467,9 @@ impl VM { let up_front_cost = gaslimit_price_product .checked_add(value) - .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))? + .ok_or(TxValidationError::UndefinedState(1))? .checked_add(blob_gas_cost) - .ok_or(VMError::TxValidation(TxValidationError::UndefinedState(1)))?; + .ok_or(TxValidationError::UndefinedState(1))?; // There is no error specified for overflow in up_front_cost in ef_tests. Maybe we can go with GasLimitPriceProductOverflow or InsufficientAccountFunds. // (2) INSUFFICIENT_ACCOUNT_FUNDS @@ -479,9 +479,7 @@ impl VM { .info .balance .checked_sub(up_front_cost) - .ok_or(VMError::TxValidation( - TxValidationError::InsufficientAccountFunds, - ))?; + .ok_or(TxValidationError::InsufficientAccountFunds)?; // (3) INSUFFICIENT_MAX_FEE_PER_GAS if self.max_fee_per_gas_or_gasprice() < self.env.base_fee_per_gas { From 36b8c15b2fa38948bc146d919b5c0499c7cd314f Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 10:16:59 -0300 Subject: [PATCH 50/54] make change in create_post_execution() --- crates/vm/levm/src/vm.rs | 80 ++++++++++++++++++++-------------------- 1 file changed, 40 insertions(+), 40 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index ec038fe65..8843a2b69 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -591,19 +591,21 @@ impl VM { let sender = initial_call_frame.msg_sender; - match self.create_post_execution(&mut initial_call_frame, &mut report) { - Ok(_) => {} - Err(error) => { - if error.is_internal() { - return Err(error); - } else { - report.result = TxResult::Revert(error); - report.gas_used = self.env.gas_limit.low_u64(); - self.cache = cache_before_execution; - remove_account(&mut self.cache, &initial_call_frame.to); + if self.is_create() { + match self.create_post_execution(&mut initial_call_frame, &mut report) { + Ok(_) => {} + Err(error) => { + if error.is_internal() { + return Err(error); + } else { + report.result = TxResult::Revert(error); + report.gas_used = self.env.gas_limit.low_u64(); + self.cache = cache_before_execution; + remove_account(&mut self.cache, &initial_call_frame.to); + } } - } - }; + }; + } let coinbase_address = self.env.coinbase; @@ -652,42 +654,40 @@ impl VM { initial_call_frame: &mut CallFrame, report: &mut TransactionReport, ) -> Result<(), VMError> { - if self.is_create() { - if let TxResult::Revert(error) = &report.result { - return Err(error.clone()); - } + if let TxResult::Revert(error) = &report.result { + return Err(error.clone()); + } - let contract_code = report.clone().output; + let contract_code = report.clone().output; - // (6) - if contract_code.len() > MAX_CODE_SIZE { - return Err(VMError::ContractOutputTooBig); - } + if contract_code.len() > MAX_CODE_SIZE { + return Err(VMError::ContractOutputTooBig); + } - // If contract code is not empty then the first byte should not be 0xef - if *contract_code.first().unwrap_or(&0) == INVALID_CONTRACT_PREFIX { - return Err(VMError::InvalidInitialByte); - } + // If contract code is not empty then the first byte should not be 0xef + if *contract_code.first().unwrap_or(&0) == INVALID_CONTRACT_PREFIX { + return Err(VMError::InvalidInitialByte); + } - let max_gas = self.env.gas_limit.low_u64(); + let max_gas = self.env.gas_limit.low_u64(); - // If initialization code is successful, code-deposit cost is paid. - let code_length: u64 = contract_code - .len() - .try_into() - .map_err(|_| VMError::Internal(InternalError::ConversionError))?; - let code_deposit_cost = code_length.checked_mul(200).ok_or(VMError::Internal( - InternalError::ArithmeticOperationOverflow, - ))?; + // If initialization code is successful, code-deposit cost is paid. + let code_length: u64 = contract_code + .len() + .try_into() + .map_err(|_| VMError::Internal(InternalError::ConversionError))?; + let code_deposit_cost = code_length.checked_mul(200).ok_or(VMError::Internal( + InternalError::ArithmeticOperationOverflow, + ))?; - report.add_gas_with_max(code_deposit_cost, max_gas)?; - // Charge 22100 gas for each storage variable set (???) + report.add_gas_with_max(code_deposit_cost, max_gas)?; + // Charge 22100 gas for each storage variable set (???) - // Assign bytecode to the new contract - let contract_address = initial_call_frame.to; + // Assign bytecode to the new contract + let contract_address = initial_call_frame.to; + + self.update_account_bytecode(contract_address, contract_code)?; - self.update_account_bytecode(contract_address, contract_code)?; - } Ok(()) } From d66679b058cc576f81f98431d827805d391fefe2 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 10:25:55 -0300 Subject: [PATCH 51/54] add constants --- crates/vm/levm/src/gas_cost.rs | 11 +++++++++-- crates/vm/levm/src/vm.rs | 4 ++-- 2 files changed, 11 insertions(+), 4 deletions(-) diff --git a/crates/vm/levm/src/gas_cost.rs b/crates/vm/levm/src/gas_cost.rs index 9dce04fea..0830c3f5d 100644 --- a/crates/vm/levm/src/gas_cost.rs +++ b/crates/vm/levm/src/gas_cost.rs @@ -151,6 +151,13 @@ pub const INIT_CODE_WORD_COST: U256 = U256([2, 0, 0, 0]); pub const CODE_DEPOSIT_COST: U256 = U256([200, 0, 0, 0]); pub const CREATE_BASE_COST: U256 = U256([32000, 0, 0, 0]); +// Calldata costs +pub const CALLDATA_COST_ZERO_BYTE: U256 = U256([4, 0, 0, 0]); +pub const CALLDATA_COST_NON_ZERO_BYTE: U256 = U256([16, 0, 0, 0]); + +// Blob gas costs +pub const BLOB_GAS_PER_BLOB: U256 = U256([131072, 0, 0, 0]); + pub fn exp(exponent_bits: u64) -> Result { let exponent_byte_size = (exponent_bits .checked_add(7) @@ -469,11 +476,11 @@ pub fn tx_calldata(calldata: &Bytes) -> Result { for byte in calldata { if *byte != 0 { calldata_cost = calldata_cost - .checked_add(U256::from(16)) + .checked_add(CALLDATA_COST_NON_ZERO_BYTE) .ok_or(OutOfGasError::GasUsedOverflow)?; } else { calldata_cost = calldata_cost - .checked_add(U256::from(4)) + .checked_add(CALLDATA_COST_ZERO_BYTE) .ok_or(OutOfGasError::GasUsedOverflow)?; } } diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 8843a2b69..5bff5d90a 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -11,7 +11,7 @@ use crate::{ InternalError, OpcodeSuccess, OutOfGasError, ResultReason, TransactionReport, TxResult, TxValidationError, VMError, }, - gas_cost::{self, fake_exponential, CREATE_BASE_COST}, + gas_cost::{self, fake_exponential, BLOB_GAS_PER_BLOB, CREATE_BASE_COST}, opcodes::Opcode, AccountInfo, }; @@ -410,7 +410,7 @@ impl VM { /// Gets the max blob gas cost for a transaction that a user is willing to pay. fn get_max_blob_gas_cost(&self) -> Result { let blob_gas_used = U256::from(self.env.tx_blob_hashes.len()) - .checked_mul(U256::from(131072)) + .checked_mul(BLOB_GAS_PER_BLOB) .unwrap_or_default(); let blob_gas_cost = self From 74162a5e337ea82f25b7dbafe49b367af5b7309d Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 10:29:38 -0300 Subject: [PATCH 52/54] rename calldata and code --- crates/vm/levm/src/vm.rs | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 5bff5d90a..9d3eec2f1 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -127,7 +127,6 @@ impl VM { TxKind::Create => { // CREATE tx - // (2) let new_contract_address = VM::calculate_create_address(env.origin, db.get_account_info(env.origin).nonce) .map_err(|_| { @@ -136,20 +135,18 @@ impl VM { default_touched_accounts.insert(new_contract_address); - // (3) let created_contract = Account::new(value, calldata.clone(), 1, HashMap::new()); cache::insert_account(&mut cache, new_contract_address, created_contract); - // (5) - let code: Bytes = calldata.clone(); + let bytecode: Bytes = calldata.clone(); let initial_call_frame = CallFrame::new( env.origin, new_contract_address, new_contract_address, - code.clone(), + bytecode, value, - code, + calldata, false, env.gas_limit, U256::zero(), From 79fc4e080efffddd4519d476ce1efa9a57e3d77c Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 12:14:22 -0300 Subject: [PATCH 53/54] set calldata to empty and change init_code_max_size validation --- crates/vm/levm/src/vm.rs | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/vm/levm/src/vm.rs b/crates/vm/levm/src/vm.rs index 9d3eec2f1..d5361812d 100644 --- a/crates/vm/levm/src/vm.rs +++ b/crates/vm/levm/src/vm.rs @@ -146,7 +146,7 @@ impl VM { new_contract_address, bytecode, value, - calldata, + Bytes::new(), // Contract creation does not have calldata false, env.gas_limit, U256::zero(), @@ -488,7 +488,7 @@ impl VM { // (4) INITCODE_SIZE_EXCEEDED if self.is_create() { // INITCODE_SIZE_EXCEEDED - if initial_call_frame.calldata.len() > INIT_CODE_MAX_SIZE { + if initial_call_frame.bytecode.len() > INIT_CODE_MAX_SIZE { return Err(VMError::TxValidation( TxValidationError::InitcodeSizeExceeded, )); From 801dad7e06fc2cec6869fe4a775840bc55edb790 Mon Sep 17 00:00:00 2001 From: JereSalo Date: Tue, 3 Dec 2024 12:17:28 -0300 Subject: [PATCH 54/54] remove comment --- crates/vm/vm.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/crates/vm/vm.rs b/crates/vm/vm.rs index 34feb4392..6480299a6 100644 --- a/crates/vm/vm.rs +++ b/crates/vm/vm.rs @@ -169,7 +169,7 @@ cfg_if::cfg_if! { let env = Environment { origin: tx.sender(), - consumed_gas: U256::zero(), // Base gas cost for a transaction + consumed_gas: U256::zero(), refunded_gas: U256::zero(), gas_limit: tx.gas_limit().into(), block_number: block_header.number.into(),