From d7a8b1d679d63af7a32e098f37da375214f52a96 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Wed, 7 Jun 2023 23:12:38 +0300 Subject: [PATCH 01/24] Add stack memory profiling --- Cargo.lock | 24 +++++++++++++++++++++ crates/interpreter/Cargo.toml | 2 ++ crates/interpreter/src/instructions/host.rs | 2 ++ crates/revm/Cargo.toml | 1 + crates/revm/src/inspector/customprinter.rs | 6 ++++-- 5 files changed, 33 insertions(+), 2 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 417733ae61..4b483343ec 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1517,6 +1517,15 @@ dependencies = [ "syn 0.15.44", ] +[[package]] +name = "psm" +version = "0.1.21" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" +dependencies = [ + "cc", +] + [[package]] name = "quick-error" version = "1.2.3" @@ -1674,6 +1683,7 @@ dependencies = [ "revm-precompile", "serde", "serde_json", + "stacker", "tokio", ] @@ -1689,6 +1699,7 @@ dependencies = [ "revm-primitives", "serde", "sha3", + "stacker", ] [[package]] @@ -2132,6 +2143,19 @@ dependencies = [ "der", ] +[[package]] +name = "stacker" +version = "0.1.15" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" +dependencies = [ + "cc", + "cfg-if", + "libc", + "psm", + "winapi", +] + [[package]] name = "static_assertions" version = "1.1.0" diff --git a/crates/interpreter/Cargo.toml b/crates/interpreter/Cargo.toml index a5c4fec52f..740b64d7f7 100644 --- a/crates/interpreter/Cargo.toml +++ b/crates/interpreter/Cargo.toml @@ -16,6 +16,8 @@ revm-primitives = { path = "../primitives", version="1.1.2", default-features = derive_more = "0.99" enumn = "0.1" +stacker = "0.1.15" + # sha3 keccak hasher sha3 = { version = "0.10", default-features = false, features = [] } diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index cfc62c5814..0cab34865e 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -322,6 +322,7 @@ pub fn create( } pub fn call(interpreter: &mut Interpreter, host: &mut dyn Host) { + println!("Stack in host::call: {}", stacker::remaining_stack().unwrap()); call_inner::(interpreter, CallScheme::Call, host); } @@ -342,6 +343,7 @@ pub fn call_inner( scheme: CallScheme, host: &mut dyn Host, ) { + println!("Stack in host::call_inner: {}", stacker::remaining_stack().unwrap()); match scheme { CallScheme::DelegateCall => check!(interpreter, SPEC::enabled(HOMESTEAD)), // EIP-7: DELEGATECALL CallScheme::StaticCall => check!(interpreter, SPEC::enabled(BYZANTIUM)), // EIP-214: New opcode STATICCALL diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index fcca760ab6..0b20042a4b 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -14,6 +14,7 @@ revm-precompile = { path = "../precompile", version = "2.0.2", default-features revm-interpreter = { path = "../interpreter", version = "1.1.2", default-features = false } auto_impl = { version = "1.0", default-features = false } +stacker = { version = "0.1.15" } # Optional serde = { version = "1.0", features = ["derive", "rc"], optional = true } diff --git a/crates/revm/src/inspector/customprinter.rs b/crates/revm/src/inspector/customprinter.rs index 0d028fecf7..17510feeeb 100644 --- a/crates/revm/src/inspector/customprinter.rs +++ b/crates/revm/src/inspector/customprinter.rs @@ -26,10 +26,11 @@ impl Inspector for CustomPrintTracer { let opcode_str = opcode::OPCODE_JUMPMAP[opcode as usize]; let gas_remaining = self.gas_inspector.gas_remaining(); + let depth = data.journaled_state.depth(); println!( - "depth:{}, PC:{}, gas:{:#x}({}), OPCODE: {:?}({:?}) refund:{:#x}({}) Stack:{:?}, Data size:{}", - data.journaled_state.depth(), + "depth:{}, PC:{}, gas:{:#x}({}), OPCODE: {:?}({:?}) refund:{:#x}({}) Stack:{:?}, Data size:{} Free stack:{}", + depth, interp.program_counter(), gas_remaining, gas_remaining, @@ -39,6 +40,7 @@ impl Inspector for CustomPrintTracer { interp.gas.refunded(), interp.stack.data(), interp.memory.data().len(), + stacker::remaining_stack().unwrap() ); self.gas_inspector.step(interp, data); From 4a1d5f1cfca6e2e8dd94dc313d3f809ef40037b6 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Fri, 9 Jun 2023 18:19:29 +0300 Subject: [PATCH 02/24] Move the CallInputs preparation into a separate function This makes the stack footprint of the solidity function calls much smaller --- crates/interpreter/src/instructions/host.rs | 58 +++++++++++++++------ 1 file changed, 42 insertions(+), 16 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index 0cab34865e..6a0732a2b2 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -338,19 +338,14 @@ pub fn static_call(interpreter: &mut Interpreter, host: &mut dyn Hos call_inner::(interpreter, CallScheme::StaticCall, host); } -pub fn call_inner( +fn prepare_call_inputs( interpreter: &mut Interpreter, scheme: CallScheme, host: &mut dyn Host, + result_len: &mut usize, + result_offset: &mut usize, + result_call_inputs: &mut Option<*mut CallInputs> ) { - println!("Stack in host::call_inner: {}", stacker::remaining_stack().unwrap()); - match scheme { - CallScheme::DelegateCall => check!(interpreter, SPEC::enabled(HOMESTEAD)), // EIP-7: DELEGATECALL - CallScheme::StaticCall => check!(interpreter, SPEC::enabled(BYZANTIUM)), // EIP-214: New opcode STATICCALL - _ => (), - } - interpreter.return_data_buffer = Bytes::new(); - pop!(interpreter, local_gas_limit); pop_address!(interpreter, to); let local_gas_limit = u64::try_from(local_gas_limit).unwrap_or(u64::MAX); @@ -383,14 +378,14 @@ pub fn call_inner( Bytes::new() }; - let out_len = as_usize_or_fail!(interpreter, out_len, InstructionResult::InvalidOperandOOG); - let out_offset = if out_len != 0 { + *result_len = as_usize_or_fail!(interpreter, out_len, InstructionResult::InvalidOperandOOG); + *result_offset = if *result_len != 0 { let out_offset = as_usize_or_fail!( interpreter, out_offset, InstructionResult::InvalidOperandOOG ); - memory_resize!(interpreter, out_offset, out_len); + memory_resize!(interpreter, out_offset, *result_len); out_offset } else { usize::MAX //unrealistic value so we are sure it is not used @@ -478,16 +473,47 @@ pub fn call_inner( } let is_static = matches!(scheme, CallScheme::StaticCall) || interpreter.is_static; - let mut call_input = CallInputs { + let call_inputs = Box::new(CallInputs { contract: to, transfer, input, gas_limit, context, - is_static, - }; + is_static + }); + + // Return a pointer to the allocated struct, so that we can transfer the ownership + // in the parent function + *result_call_inputs = Some(Box::into_raw(call_inputs)); +} + +pub fn call_inner( + interpreter: &mut Interpreter, + scheme: CallScheme, + host: &mut dyn Host, +) { + println!("Stack in host::call_inner: {}", stacker::remaining_stack().unwrap()); + match scheme { + CallScheme::DelegateCall => check!(interpreter, SPEC::enabled(HOMESTEAD)), // EIP-7: DELEGATECALL + CallScheme::StaticCall => check!(interpreter, SPEC::enabled(BYZANTIUM)), // EIP-214: New opcode STATICCALL + _ => (), + } + interpreter.return_data_buffer = Bytes::new(); + + let mut out_offset: usize = 0; + let mut out_len: usize = 0; + let mut call_input: Option<*mut CallInputs> = None; + prepare_call_inputs::(interpreter, scheme, host, &mut out_len, &mut out_offset, &mut call_input); + + if call_input.is_none() { + return; + } + + // Discard the Option, as it's not needed from this point on and + // instantiate the boxed call inputs created earlier + let mut call_input = unsafe { Box::from_raw(call_input.unwrap()) }; - // Call host to interuct with target contract + // Call host to interact with target contract let (reason, gas, return_data) = host.call(&mut call_input); interpreter.return_data_buffer = return_data; From 5beac17c004a1325db07ae653079e6863996c921 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Wed, 14 Jun 2023 17:42:35 +0300 Subject: [PATCH 03/24] Simplified the call_inner functions in Host and EVMImpl Simplification of the functions ensures that the stack is being kept more lean. Also boxed some variables. These changes allow running the currently blowing transactions with the default stack size. --- crates/interpreter/src/instructions/host.rs | 75 ++++++++++----------- crates/revm/src/evm_impl.rs | 9 +-- 2 files changed, 42 insertions(+), 42 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index 6a0732a2b2..cfbcc8e49e 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -1,5 +1,5 @@ use crate::primitives::{Bytes, Spec, SpecId::*, B160, B256, U256}; -use crate::MAX_INITCODE_SIZE; +use crate::{MAX_INITCODE_SIZE, Gas}; use crate::{ alloc::vec::Vec, gas::{self, COLD_ACCOUNT_ACCESS_COST, WARM_STORAGE_READ_COST}, @@ -344,7 +344,7 @@ fn prepare_call_inputs( host: &mut dyn Host, result_len: &mut usize, result_offset: &mut usize, - result_call_inputs: &mut Option<*mut CallInputs> + result_call_inputs: &mut Option> ) { pop!(interpreter, local_gas_limit); pop_address!(interpreter, to); @@ -473,50 +473,18 @@ fn prepare_call_inputs( } let is_static = matches!(scheme, CallScheme::StaticCall) || interpreter.is_static; - let call_inputs = Box::new(CallInputs { + *result_call_inputs = Some(Box::new(CallInputs { contract: to, transfer, input, gas_limit, context, is_static - }); - - // Return a pointer to the allocated struct, so that we can transfer the ownership - // in the parent function - *result_call_inputs = Some(Box::into_raw(call_inputs)); + })); } -pub fn call_inner( - interpreter: &mut Interpreter, - scheme: CallScheme, - host: &mut dyn Host, -) { - println!("Stack in host::call_inner: {}", stacker::remaining_stack().unwrap()); - match scheme { - CallScheme::DelegateCall => check!(interpreter, SPEC::enabled(HOMESTEAD)), // EIP-7: DELEGATECALL - CallScheme::StaticCall => check!(interpreter, SPEC::enabled(BYZANTIUM)), // EIP-214: New opcode STATICCALL - _ => (), - } - interpreter.return_data_buffer = Bytes::new(); - - let mut out_offset: usize = 0; - let mut out_len: usize = 0; - let mut call_input: Option<*mut CallInputs> = None; - prepare_call_inputs::(interpreter, scheme, host, &mut out_len, &mut out_offset, &mut call_input); - - if call_input.is_none() { - return; - } - - // Discard the Option, as it's not needed from this point on and - // instantiate the boxed call inputs created earlier - let mut call_input = unsafe { Box::from_raw(call_input.unwrap()) }; - - // Call host to interact with target contract - let (reason, gas, return_data) = host.call(&mut call_input); - - interpreter.return_data_buffer = return_data; +fn handle_call_result(interpreter: &mut Interpreter, out_offset: usize, out_len: usize, reason: &InstructionResult, gas: &Gas, return_data: &Bytes) { + interpreter.return_data_buffer = return_data.clone(); let target_len = min(out_len, interpreter.return_data_buffer.len()); @@ -549,3 +517,34 @@ pub fn call_inner( } } } + +pub fn call_inner( + interpreter: &mut Interpreter, + scheme: CallScheme, + host: &mut dyn Host, +) { + println!("Stack in host::call_inner: {}", stacker::remaining_stack().unwrap()); + match scheme { + CallScheme::DelegateCall => check!(interpreter, SPEC::enabled(HOMESTEAD)), // EIP-7: DELEGATECALL + CallScheme::StaticCall => check!(interpreter, SPEC::enabled(BYZANTIUM)), // EIP-214: New opcode STATICCALL + _ => (), + } + interpreter.return_data_buffer = Bytes::new(); + + let mut out_offset: usize = 0; + let mut out_len: usize = 0; + let mut call_input: Option> = None; + prepare_call_inputs::(interpreter, scheme, host, &mut out_len, &mut out_offset, &mut call_input); + + if call_input.is_none() { + return; + } + + // The Option is not needed form this point + let mut call_input = call_input.unwrap(); + + // Call host to interact with target contract + let (reason, gas, return_data) = host.call(&mut call_input); + + handle_call_result(interpreter, out_offset, out_len, &reason, &gas, &return_data); +} diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 6e9d30e1f7..334f986ca3 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -11,6 +11,7 @@ use crate::primitives::{ SpecId::{self, *}, TransactTo, B160, B256, U256, }; +use crate::journaled_state::JournalCheckpoint; use crate::{db::Database, journaled_state::JournaledState, precompile, Inspector}; use alloc::vec::Vec; use core::{cmp::min, marker::PhantomData}; @@ -407,13 +408,13 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data.journaled_state.checkpoint_commit(); // Do analysis of bytecode straight away. let bytecode = match self.data.env.cfg.perf_analyse_created_bytecodes { - AnalysisKind::Raw => Bytecode::new_raw(bytes.clone()), - AnalysisKind::Check => Bytecode::new_raw(bytes.clone()).to_checked(), - AnalysisKind::Analyse => to_analysed(Bytecode::new_raw(bytes.clone())), + AnalysisKind::Raw => Box::new(Bytecode::new_raw(bytes.clone())), + AnalysisKind::Check => Box::new(Bytecode::new_raw(bytes.clone()).to_checked()), + AnalysisKind::Analyse => Box::new(to_analysed(Bytecode::new_raw(bytes.clone()))), }; self.data .journaled_state - .set_code(created_address, bytecode); + .set_code(created_address, *bytecode); (InstructionResult::Return, ret, interpreter.gas, bytes) } _ => { From 8836a476f37c505257693cf9e71e93d931ed5966 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Wed, 14 Jun 2023 17:46:19 +0300 Subject: [PATCH 04/24] Remove debug logging --- crates/interpreter/src/instructions/host.rs | 2 -- 1 file changed, 2 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index cfbcc8e49e..da4aa0c599 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -322,7 +322,6 @@ pub fn create( } pub fn call(interpreter: &mut Interpreter, host: &mut dyn Host) { - println!("Stack in host::call: {}", stacker::remaining_stack().unwrap()); call_inner::(interpreter, CallScheme::Call, host); } @@ -523,7 +522,6 @@ pub fn call_inner( scheme: CallScheme, host: &mut dyn Host, ) { - println!("Stack in host::call_inner: {}", stacker::remaining_stack().unwrap()); match scheme { CallScheme::DelegateCall => check!(interpreter, SPEC::enabled(HOMESTEAD)), // EIP-7: DELEGATECALL CallScheme::StaticCall => check!(interpreter, SPEC::enabled(BYZANTIUM)), // EIP-214: New opcode STATICCALL From b51827de3f852fe0b85096a3a31cb6d9c7f6bada Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Sat, 17 Jun 2023 18:15:44 +0300 Subject: [PATCH 05/24] Removed an unused import --- crates/revm/src/evm_impl.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 334f986ca3..69d20b6b39 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -11,7 +11,6 @@ use crate::primitives::{ SpecId::{self, *}, TransactTo, B160, B256, U256, }; -use crate::journaled_state::JournalCheckpoint; use crate::{db::Database, journaled_state::JournaledState, precompile, Inspector}; use alloc::vec::Vec; use core::{cmp::min, marker::PhantomData}; From a6611804151c44d4f9a3e142a7bc62cecff95d26 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Mon, 19 Jun 2023 12:02:26 +0300 Subject: [PATCH 06/24] Optimized the stack allocations of create and call opcodes --- bins/revme/src/statetest/runner.rs | 11 +- crates/interpreter/src/instructions/host.rs | 31 +++- crates/interpreter/src/interpreter.rs | 4 +- .../interpreter/src/interpreter/contract.rs | 8 +- crates/revm/src/evm_impl.rs | 135 ++++++++++++------ 5 files changed, 132 insertions(+), 57 deletions(-) diff --git a/bins/revme/src/statetest/runner.rs b/bins/revme/src/statetest/runner.rs index f8eb4596ae..aed90e4c52 100644 --- a/bins/revme/src/statetest/runner.rs +++ b/bins/revme/src/statetest/runner.rs @@ -355,9 +355,14 @@ pub fn run( let console_bar = console_bar.clone(); let elapsed = elapsed.clone(); - joins.push( - std::thread::Builder::new() - .stack_size(50 * 1024 * 1024) + let mut thread = std::thread::Builder::new(); + + // Allow bigger stack in debug mode to prevent stack overflow errors + if cfg!(debug_assertions) { + thread = thread.stack_size(3 * 1024 * 1024); + } + + joins.push(thread .spawn(move || loop { let (index, test_path) = { let mut queue = queue.lock().unwrap(); diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index da4aa0c599..0386529aa2 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -229,9 +229,9 @@ pub fn selfdestruct(interpreter: &mut Interpreter, host: &mut dyn Ho interpreter.instruction_result = InstructionResult::SelfDestruct; } -pub fn create( +pub fn prepare_create_inputs( interpreter: &mut Interpreter, - host: &mut dyn Host, + create_inputs: &mut Option> ) { check_staticcall!(interpreter); if IS_CREATE2 { @@ -282,15 +282,18 @@ pub fn create( } gas!(interpreter, gas_limit); - let mut create_input = CreateInputs { + *create_inputs = Some(Box::new(CreateInputs { caller: interpreter.contract.address, scheme, value, init_code: code, gas_limit, - }; + })); +} + +pub fn handle_create_result(interpreter: &mut Interpreter, result: (InstructionResult, Option, Gas, Bytes)) { + let (return_reason, address, gas, return_data) = result; - let (return_reason, address, gas, return_data) = host.create(&mut create_input); interpreter.return_data_buffer = match return_reason { // Save data to return data buffer if the create reverted return_revert!() => return_data, @@ -321,6 +324,24 @@ pub fn create( } } +pub fn create( + interpreter: &mut Interpreter, + host: &mut dyn Host, +) { + let mut create_input: Option> = None; + prepare_create_inputs::(interpreter, &mut create_input); + + if create_input.is_none() { + return; + } + + let mut create_input = create_input.unwrap(); + + let ret = host.create(&mut create_input); + + handle_create_result(interpreter, ret); +} + pub fn call(interpreter: &mut Interpreter, host: &mut dyn Host) { call_inner::(interpreter, CallScheme::Call, host); } diff --git a/crates/interpreter/src/interpreter.rs b/crates/interpreter/src/interpreter.rs index f5425e911b..04db7cf0da 100644 --- a/crates/interpreter/src/interpreter.rs +++ b/crates/interpreter/src/interpreter.rs @@ -42,7 +42,7 @@ pub struct Interpreter { /// Is interpreter call static. pub is_static: bool, /// Contract information and invoking data - pub contract: Contract, + pub contract: Box, /// Memory limit. See [`crate::CfgEnv`]. #[cfg(feature = "memory_limit")] pub memory_limit: u64, @@ -55,7 +55,7 @@ impl Interpreter { } /// Create new interpreter - pub fn new(contract: Contract, gas_limit: u64, is_static: bool) -> Self { + pub fn new(contract: Box, gas_limit: u64, is_static: bool) -> Self { #[cfg(not(feature = "memory_limit"))] { Self { diff --git a/crates/interpreter/src/interpreter/contract.rs b/crates/interpreter/src/interpreter/contract.rs index 434c1c7156..98cdc35da0 100644 --- a/crates/interpreter/src/interpreter/contract.rs +++ b/crates/interpreter/src/interpreter/contract.rs @@ -19,8 +19,8 @@ pub struct Contract { } impl Contract { - pub fn new(input: Bytes, bytecode: Bytecode, address: B160, caller: B160, value: U256) -> Self { - let bytecode = to_analysed(bytecode).try_into().expect("it is analyzed"); + pub fn new(input: Bytes, bytecode: &Bytecode, address: B160, caller: B160, value: U256) -> Self { + let bytecode = to_analysed(bytecode.clone()).try_into().expect("it is analyzed"); Self { input, @@ -39,7 +39,7 @@ impl Contract { }; Self::new( env.tx.data.clone(), - bytecode, + &bytecode, contract_address, env.tx.caller, env.tx.value, @@ -50,7 +50,7 @@ impl Contract { self.bytecode.jump_map().is_valid(possition) } - pub fn new_with_context(input: Bytes, bytecode: Bytecode, call_context: &CallContext) -> Self { + pub fn new_with_context(input: Bytes, bytecode: &Bytecode, call_context: &CallContext) -> Self { Self::new( input, bytecode, diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 69d20b6b39..dc9d94a808 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -3,7 +3,7 @@ use crate::interpreter::{ CallContext, CallInputs, CallScheme, Contract, CreateInputs, CreateScheme, Gas, Host, InstructionResult, Interpreter, SelfDestructResult, Transfer, CALL_STACK_LIMIT, }; -use crate::journaled_state::is_precompile; +use crate::journaled_state::{is_precompile, JournalCheckpoint}; use crate::primitives::{ create2_address, create_address, keccak256, Account, AnalysisKind, Bytecode, Bytes, EVMError, EVMResult, Env, ExecutionResult, HashMap, InvalidTransaction, Log, Output, ResultAndState, @@ -275,26 +275,25 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, (new_state, logs, gas_used, gas_refunded) } - /// EVM create opcode for both initial crate and CREATE and CREATE2 opcodes. - fn create_inner( + fn prepare_create( &mut self, - inputs: &CreateInputs, - ) -> (InstructionResult, Option, Gas, Bytes) { + inputs: &CreateInputs + ) -> Result<(Gas, B160, JournalCheckpoint, Box), (InstructionResult, Option, Gas, Bytes)> { let gas = Gas::new(inputs.gas_limit); // Check depth of calls if self.data.journaled_state.depth() > CALL_STACK_LIMIT { - return (InstructionResult::CallTooDeep, None, gas, Bytes::new()); + return Err((InstructionResult::CallTooDeep, None, gas, Bytes::new())); } // Fetch balance of caller. let Some((caller_balance,_)) = self.balance(inputs.caller) else { - return (InstructionResult::FatalExternalError, None, gas, Bytes::new()) + return Err((InstructionResult::FatalExternalError, None, gas, Bytes::new())); }; // Check if caller has enough balance to send to the crated contract. if caller_balance < inputs.value { - return (InstructionResult::OutOfFund, None, gas, Bytes::new()); + return Err((InstructionResult::OutOfFund, None, gas, Bytes::new())); } // Increase nonce of caller and check if it overflows @@ -302,7 +301,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, if let Some(nonce) = self.data.journaled_state.inc_nonce(inputs.caller) { old_nonce = nonce - 1; } else { - return (InstructionResult::Return, None, gas, Bytes::new()); + return Err((InstructionResult::Return, None, gas, Bytes::new())); } // Create address @@ -311,7 +310,6 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, CreateScheme::Create => create_address(inputs.caller, old_nonce), CreateScheme::Create2 { salt } => create2_address(inputs.caller, code_hash, salt), }; - let ret = Some(created_address); // Load account so it needs to be marked as hot for access list. if self @@ -321,12 +319,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, .map_err(|e| self.data.error = Some(e)) .is_err() { - return ( + return Err(( InstructionResult::FatalExternalError, None, gas, Bytes::new(), - ); + )); } // create account, transfer funds and make the journal checkpoint. @@ -336,22 +334,27 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, .create_account_checkpoint::(inputs.caller, created_address, inputs.value) { Ok(checkpoint) => checkpoint, - Err(e) => return (e, None, gas, Bytes::new()), + Err(e) => return Err((e, None, gas, Bytes::new())), }; - // Create new interpreter and execute initcode - let (exit_reason, mut interpreter) = self.run_interpreter( - Contract::new( - Bytes::new(), - Bytecode::new_raw(inputs.init_code.clone()), - created_address, - inputs.caller, - inputs.value, - ), - gas.limit(), - false, - ); + let contract = Box::new(Contract::new( + Bytes::new(), + &Bytecode::new_raw(inputs.init_code.clone()), + created_address, + inputs.caller, + inputs.value, + )); + Ok((gas, created_address, checkpoint, contract)) + } + + fn handle_create_result( + &mut self, + created_address: B160, + checkpoint: JournalCheckpoint, + interpreter: &mut Box, + exit_reason: InstructionResult + ) -> (InstructionResult, Option, Gas, Bytes) { // Host error if present on execution match exit_reason { return_ok!() => { @@ -363,7 +366,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data.journaled_state.checkpoint_revert(checkpoint); return ( InstructionResult::CreateContractStartingWithEF, - ret, + Some(created_address), interpreter.gas, bytes, ); @@ -383,7 +386,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data.journaled_state.checkpoint_revert(checkpoint); return ( InstructionResult::CreateContractSizeLimit, - ret, + Some(created_address), interpreter.gas, bytes, ); @@ -397,7 +400,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, // creation fails (i.e. goes out-of-gas) rather than leaving an empty contract. if GSPEC::enabled(HOMESTEAD) { self.data.journaled_state.checkpoint_revert(checkpoint); - return (InstructionResult::OutOfGas, ret, interpreter.gas, bytes); + return (InstructionResult::OutOfGas, Some(created_address), interpreter.gas, bytes); } else { bytes = Bytes::new(); } @@ -414,13 +417,13 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data .journaled_state .set_code(created_address, *bytecode); - (InstructionResult::Return, ret, interpreter.gas, bytes) + (InstructionResult::Return, Some(created_address), interpreter.gas, bytes) } _ => { self.data.journaled_state.checkpoint_revert(checkpoint); ( exit_reason, - ret, + Some(created_address), interpreter.gas, interpreter.return_value(), ) @@ -428,14 +431,37 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } } + /// EVM create opcode for both initial crate and CREATE and CREATE2 opcodes. + fn create_inner( + &mut self, + inputs: &CreateInputs, + ) -> (InstructionResult, Option, Gas, Bytes) { + let res = self.prepare_create(inputs); + + if let Err(ret) = res { + return ret; + } + + let (gas, created_address, checkpoint, contract) = res.unwrap(); + + // Create new interpreter and execute initcode + let (exit_reason, mut interpreter) = self.run_interpreter( + contract, + gas.limit(), + false, + ); + + self.handle_create_result(created_address, checkpoint, &mut interpreter, exit_reason) + } + /// Create a Interpreter and run it. /// Returns the exit reason and created interpreter as it contains return values and gas spend. pub fn run_interpreter( &mut self, - contract: Contract, + contract: Box, gas_limit: u64, is_static: bool, - ) -> (InstructionResult, Interpreter) { + ) -> (InstructionResult, Box) { // Create inspector #[cfg(feature = "memory_limit")] let mut interpreter = Interpreter::new_with_memory_limit( @@ -446,7 +472,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, ); #[cfg(not(feature = "memory_limit"))] - let mut interpreter = Interpreter::new(contract, gas_limit, is_static); + let mut interpreter = Box::new(Interpreter::new(contract, gas_limit, is_static)); if INSPECT { self.inspector @@ -464,10 +490,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, /// Call precompile contract fn call_precompile( &mut self, - mut gas: Gas, - contract: B160, - input_data: Bytes, + inputs: &CallInputs, + mut gas: Gas ) -> (InstructionResult, Gas, Bytes) { + let input_data = inputs.input.clone(); + let contract = inputs.contract; + let precompile = self .precompiles .get(&contract) @@ -495,17 +523,20 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } } - /// Main contract call of the EVM. - fn call_inner(&mut self, inputs: &mut CallInputs) -> (InstructionResult, Gas, Bytes) { + fn prepare_call( + &mut self, + inputs: &mut CallInputs + ) -> Result<(Gas, Box, JournalCheckpoint, Box), (InstructionResult, Gas, Bytes)> { let gas = Gas::new(inputs.gas_limit); // Load account and get code. Account is now hot. let Some((bytecode,_)) = self.code(inputs.contract) else { - return (InstructionResult::FatalExternalError, gas, Bytes::new()); + return Err((InstructionResult::FatalExternalError, gas, Bytes::new())); }; // Check depth + // println!("Current call depth: {}", self.data.journaled_state.depth()); if self.data.journaled_state.depth() > CALL_STACK_LIMIT { - return (InstructionResult::CallTooDeep, gas, Bytes::new()); + return Err((InstructionResult::CallTooDeep, gas, Bytes::new())); } // Create subroutine checkpoint @@ -525,15 +556,33 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data.db, ) { self.data.journaled_state.checkpoint_revert(checkpoint); - return (e, gas, Bytes::new()); + return Err((e, gas, Bytes::new())); } + let contract = Box::new( + Contract::new_with_context( + inputs.input.clone(), &bytecode, &inputs.context + ) + ); + + Ok((gas, Box::new(bytecode), checkpoint, contract)) + } + + /// Main contract call of the EVM. + fn call_inner(&mut self, inputs: &mut CallInputs) -> (InstructionResult, Gas, Bytes) { + let res = self.prepare_call(inputs); + if let Err(ret) = res { + return ret; + } + + let (gas, bytecode, checkpoint, contract) = res.unwrap(); + let ret = if is_precompile(inputs.contract, self.precompiles.len()) { - self.call_precompile(gas, inputs.contract, inputs.input.clone()) + self.call_precompile(inputs, gas) } else if !bytecode.is_empty() { // Create interpreter and execute subcall let (exit_reason, interpreter) = self.run_interpreter( - Contract::new_with_context(inputs.input.clone(), bytecode, &inputs.context), + contract, gas.limit(), inputs.is_static, ); From 5e41ba3e99590d804f0ac18a886d386dd789b832 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Mon, 19 Jun 2023 12:11:09 +0300 Subject: [PATCH 07/24] Remove the stacker crate --- Cargo.lock | 24 ------------------------ Cargo.toml | 2 +- crates/interpreter/Cargo.toml | 2 -- crates/revm/Cargo.toml | 1 - 4 files changed, 1 insertion(+), 28 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 4b483343ec..417733ae61 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -1517,15 +1517,6 @@ dependencies = [ "syn 0.15.44", ] -[[package]] -name = "psm" -version = "0.1.21" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5787f7cda34e3033a72192c018bc5883100330f362ef279a8cbccfce8bb4e874" -dependencies = [ - "cc", -] - [[package]] name = "quick-error" version = "1.2.3" @@ -1683,7 +1674,6 @@ dependencies = [ "revm-precompile", "serde", "serde_json", - "stacker", "tokio", ] @@ -1699,7 +1689,6 @@ dependencies = [ "revm-primitives", "serde", "sha3", - "stacker", ] [[package]] @@ -2143,19 +2132,6 @@ dependencies = [ "der", ] -[[package]] -name = "stacker" -version = "0.1.15" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c886bd4480155fd3ef527d45e9ac8dd7118a898a46530b7b94c3e21866259fce" -dependencies = [ - "cc", - "cfg-if", - "libc", - "psm", - "winapi", -] - [[package]] name = "static_assertions" version = "1.1.0" diff --git a/Cargo.toml b/Cargo.toml index 49aafc6d2d..f1a0440fc0 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,4 +13,4 @@ codegen-units = 1 [profile.ethtests] inherits = "test" -opt-level = 3 \ No newline at end of file +opt-level = 3 diff --git a/crates/interpreter/Cargo.toml b/crates/interpreter/Cargo.toml index 740b64d7f7..a5c4fec52f 100644 --- a/crates/interpreter/Cargo.toml +++ b/crates/interpreter/Cargo.toml @@ -16,8 +16,6 @@ revm-primitives = { path = "../primitives", version="1.1.2", default-features = derive_more = "0.99" enumn = "0.1" -stacker = "0.1.15" - # sha3 keccak hasher sha3 = { version = "0.10", default-features = false, features = [] } diff --git a/crates/revm/Cargo.toml b/crates/revm/Cargo.toml index 0b20042a4b..fcca760ab6 100644 --- a/crates/revm/Cargo.toml +++ b/crates/revm/Cargo.toml @@ -14,7 +14,6 @@ revm-precompile = { path = "../precompile", version = "2.0.2", default-features revm-interpreter = { path = "../interpreter", version = "1.1.2", default-features = false } auto_impl = { version = "1.0", default-features = false } -stacker = { version = "0.1.15" } # Optional serde = { version = "1.0", features = ["derive", "rc"], optional = true } From d9775e856470a72329e013ef443e263c06d5d5dd Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Mon, 19 Jun 2023 12:15:19 +0300 Subject: [PATCH 08/24] Remove temp debug tracing --- crates/revm/src/inspector/customprinter.rs | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/crates/revm/src/inspector/customprinter.rs b/crates/revm/src/inspector/customprinter.rs index 17510feeeb..510d1f5a95 100644 --- a/crates/revm/src/inspector/customprinter.rs +++ b/crates/revm/src/inspector/customprinter.rs @@ -26,11 +26,9 @@ impl Inspector for CustomPrintTracer { let opcode_str = opcode::OPCODE_JUMPMAP[opcode as usize]; let gas_remaining = self.gas_inspector.gas_remaining(); - let depth = data.journaled_state.depth(); println!( - "depth:{}, PC:{}, gas:{:#x}({}), OPCODE: {:?}({:?}) refund:{:#x}({}) Stack:{:?}, Data size:{} Free stack:{}", - depth, + "PC:{}, gas:{:#x}({}), OPCODE: {:?}({:?}) refund:{:#x}({}) Stack:{:?}, Data size:{}", interp.program_counter(), gas_remaining, gas_remaining, @@ -40,7 +38,6 @@ impl Inspector for CustomPrintTracer { interp.gas.refunded(), interp.stack.data(), interp.memory.data().len(), - stacker::remaining_stack().unwrap() ); self.gas_inspector.step(interp, data); From a8bbdb1556ab5870ca36c55e78f9b9bafc182d40 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Mon, 19 Jun 2023 12:17:25 +0300 Subject: [PATCH 09/24] Trace the EVM stack depth --- crates/revm/src/inspector/customprinter.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/crates/revm/src/inspector/customprinter.rs b/crates/revm/src/inspector/customprinter.rs index 510d1f5a95..0d028fecf7 100644 --- a/crates/revm/src/inspector/customprinter.rs +++ b/crates/revm/src/inspector/customprinter.rs @@ -28,7 +28,8 @@ impl Inspector for CustomPrintTracer { let gas_remaining = self.gas_inspector.gas_remaining(); println!( - "PC:{}, gas:{:#x}({}), OPCODE: {:?}({:?}) refund:{:#x}({}) Stack:{:?}, Data size:{}", + "depth:{}, PC:{}, gas:{:#x}({}), OPCODE: {:?}({:?}) refund:{:#x}({}) Stack:{:?}, Data size:{}", + data.journaled_state.depth(), interp.program_counter(), gas_remaining, gas_remaining, From 0092c37579e6313ad50a3891a4e4beafef3ac8b9 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Mon, 19 Jun 2023 23:20:29 +0300 Subject: [PATCH 10/24] Fix the memory limit feature and the snailtracer bin --- bins/revm-test/src/bin/snailtracer.rs | 2 +- crates/interpreter/src/interpreter.rs | 2 +- crates/revm/src/evm_impl.rs | 4 ++-- 3 files changed, 4 insertions(+), 4 deletions(-) diff --git a/bins/revm-test/src/bin/snailtracer.rs b/bins/revm-test/src/bin/snailtracer.rs index fc80a152e4..53ae3fdac8 100644 --- a/bins/revm-test/src/bin/snailtracer.rs +++ b/bins/revm-test/src/bin/snailtracer.rs @@ -48,7 +48,7 @@ pub fn simple_example() { let mut host = DummyHost::new(env); microbench::bench(&bench_options, "Snailtracer Interpreter benchmark", || { - let mut interpreter = Interpreter::new(contract.clone(), u64::MAX, false); + let mut interpreter = Interpreter::new(Box::new(contract.clone()), u64::MAX, false); interpreter.run::<_, BerlinSpec>(&mut host); host.clear() }); diff --git a/crates/interpreter/src/interpreter.rs b/crates/interpreter/src/interpreter.rs index 04db7cf0da..d3144ee6d0 100644 --- a/crates/interpreter/src/interpreter.rs +++ b/crates/interpreter/src/interpreter.rs @@ -79,7 +79,7 @@ impl Interpreter { #[cfg(feature = "memory_limit")] pub fn new_with_memory_limit( - contract: Contract, + contract: Box, gas_limit: u64, is_static: bool, memory_limit: u64, diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index dc9d94a808..29c35de25d 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -464,12 +464,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, ) -> (InstructionResult, Box) { // Create inspector #[cfg(feature = "memory_limit")] - let mut interpreter = Interpreter::new_with_memory_limit( + let mut interpreter = Box::new(Interpreter::new_with_memory_limit( contract, gas_limit, is_static, self.data.env.cfg.memory_limit, - ); + )); #[cfg(not(feature = "memory_limit"))] let mut interpreter = Box::new(Interpreter::new(contract, gas_limit, is_static)); From 3c77dfec43288c3e004ba40f1cd7f9999f3b60c9 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 20 Jun 2023 20:25:31 +0300 Subject: [PATCH 11/24] Fix the formatting --- bins/revme/src/statetest/runner.rs | 3 +- crates/interpreter/src/instructions/host.rs | 42 ++++++++++--- .../interpreter/src/interpreter/contract.rs | 12 +++- crates/revm/src/evm_impl.rs | 59 +++++++++++-------- 4 files changed, 80 insertions(+), 36 deletions(-) diff --git a/bins/revme/src/statetest/runner.rs b/bins/revme/src/statetest/runner.rs index aed90e4c52..ac178c077d 100644 --- a/bins/revme/src/statetest/runner.rs +++ b/bins/revme/src/statetest/runner.rs @@ -362,7 +362,8 @@ pub fn run( thread = thread.stack_size(3 * 1024 * 1024); } - joins.push(thread + joins.push( + thread .spawn(move || loop { let (index, test_path) = { let mut queue = queue.lock().unwrap(); diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index 0386529aa2..a530116276 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -1,5 +1,4 @@ use crate::primitives::{Bytes, Spec, SpecId::*, B160, B256, U256}; -use crate::{MAX_INITCODE_SIZE, Gas}; use crate::{ alloc::vec::Vec, gas::{self, COLD_ACCOUNT_ACCESS_COST, WARM_STORAGE_READ_COST}, @@ -7,6 +6,7 @@ use crate::{ return_ok, return_revert, CallContext, CallInputs, CallScheme, CreateInputs, CreateScheme, Host, InstructionResult, Transfer, }; +use crate::{Gas, MAX_INITCODE_SIZE}; use core::cmp::min; pub fn balance(interpreter: &mut Interpreter, host: &mut dyn Host) { @@ -231,7 +231,7 @@ pub fn selfdestruct(interpreter: &mut Interpreter, host: &mut dyn Ho pub fn prepare_create_inputs( interpreter: &mut Interpreter, - create_inputs: &mut Option> + create_inputs: &mut Option>, ) { check_staticcall!(interpreter); if IS_CREATE2 { @@ -291,7 +291,10 @@ pub fn prepare_create_inputs( })); } -pub fn handle_create_result(interpreter: &mut Interpreter, result: (InstructionResult, Option, Gas, Bytes)) { +pub fn handle_create_result( + interpreter: &mut Interpreter, + result: (InstructionResult, Option, Gas, Bytes), +) { let (return_reason, address, gas, return_data) = result; interpreter.return_data_buffer = match return_reason { @@ -334,7 +337,7 @@ pub fn create( if create_input.is_none() { return; } - + let mut create_input = create_input.unwrap(); let ret = host.create(&mut create_input); @@ -364,7 +367,7 @@ fn prepare_call_inputs( host: &mut dyn Host, result_len: &mut usize, result_offset: &mut usize, - result_call_inputs: &mut Option> + result_call_inputs: &mut Option>, ) { pop!(interpreter, local_gas_limit); pop_address!(interpreter, to); @@ -499,11 +502,18 @@ fn prepare_call_inputs( input, gas_limit, context, - is_static + is_static, })); } -fn handle_call_result(interpreter: &mut Interpreter, out_offset: usize, out_len: usize, reason: &InstructionResult, gas: &Gas, return_data: &Bytes) { +fn handle_call_result( + interpreter: &mut Interpreter, + out_offset: usize, + out_len: usize, + reason: &InstructionResult, + gas: &Gas, + return_data: &Bytes, +) { interpreter.return_data_buffer = return_data.clone(); let target_len = min(out_len, interpreter.return_data_buffer.len()); @@ -553,7 +563,14 @@ pub fn call_inner( let mut out_offset: usize = 0; let mut out_len: usize = 0; let mut call_input: Option> = None; - prepare_call_inputs::(interpreter, scheme, host, &mut out_len, &mut out_offset, &mut call_input); + prepare_call_inputs::( + interpreter, + scheme, + host, + &mut out_len, + &mut out_offset, + &mut call_input, + ); if call_input.is_none() { return; @@ -565,5 +582,12 @@ pub fn call_inner( // Call host to interact with target contract let (reason, gas, return_data) = host.call(&mut call_input); - handle_call_result(interpreter, out_offset, out_len, &reason, &gas, &return_data); + handle_call_result( + interpreter, + out_offset, + out_len, + &reason, + &gas, + &return_data, + ); } diff --git a/crates/interpreter/src/interpreter/contract.rs b/crates/interpreter/src/interpreter/contract.rs index 98cdc35da0..2822776d30 100644 --- a/crates/interpreter/src/interpreter/contract.rs +++ b/crates/interpreter/src/interpreter/contract.rs @@ -19,8 +19,16 @@ pub struct Contract { } impl Contract { - pub fn new(input: Bytes, bytecode: &Bytecode, address: B160, caller: B160, value: U256) -> Self { - let bytecode = to_analysed(bytecode.clone()).try_into().expect("it is analyzed"); + pub fn new( + input: Bytes, + bytecode: &Bytecode, + address: B160, + caller: B160, + value: U256, + ) -> Self { + let bytecode = to_analysed(bytecode.clone()) + .try_into() + .expect("it is analyzed"); Self { input, diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 29c35de25d..9363b098ab 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -277,8 +277,11 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, fn prepare_create( &mut self, - inputs: &CreateInputs - ) -> Result<(Gas, B160, JournalCheckpoint, Box), (InstructionResult, Option, Gas, Bytes)> { + inputs: &CreateInputs, + ) -> Result< + (Gas, B160, JournalCheckpoint, Box), + (InstructionResult, Option, Gas, Bytes), + > { let gas = Gas::new(inputs.gas_limit); // Check depth of calls @@ -353,7 +356,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, created_address: B160, checkpoint: JournalCheckpoint, interpreter: &mut Box, - exit_reason: InstructionResult + exit_reason: InstructionResult, ) -> (InstructionResult, Option, Gas, Bytes) { // Host error if present on execution match exit_reason { @@ -400,7 +403,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, // creation fails (i.e. goes out-of-gas) rather than leaving an empty contract. if GSPEC::enabled(HOMESTEAD) { self.data.journaled_state.checkpoint_revert(checkpoint); - return (InstructionResult::OutOfGas, Some(created_address), interpreter.gas, bytes); + return ( + InstructionResult::OutOfGas, + Some(created_address), + interpreter.gas, + bytes, + ); } else { bytes = Bytes::new(); } @@ -412,12 +420,19 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, let bytecode = match self.data.env.cfg.perf_analyse_created_bytecodes { AnalysisKind::Raw => Box::new(Bytecode::new_raw(bytes.clone())), AnalysisKind::Check => Box::new(Bytecode::new_raw(bytes.clone()).to_checked()), - AnalysisKind::Analyse => Box::new(to_analysed(Bytecode::new_raw(bytes.clone()))), + AnalysisKind::Analyse => { + Box::new(to_analysed(Bytecode::new_raw(bytes.clone()))) + } }; self.data .journaled_state .set_code(created_address, *bytecode); - (InstructionResult::Return, Some(created_address), interpreter.gas, bytes) + ( + InstructionResult::Return, + Some(created_address), + interpreter.gas, + bytes, + ) } _ => { self.data.journaled_state.checkpoint_revert(checkpoint); @@ -445,11 +460,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, let (gas, created_address, checkpoint, contract) = res.unwrap(); // Create new interpreter and execute initcode - let (exit_reason, mut interpreter) = self.run_interpreter( - contract, - gas.limit(), - false, - ); + let (exit_reason, mut interpreter) = self.run_interpreter(contract, gas.limit(), false); self.handle_create_result(created_address, checkpoint, &mut interpreter, exit_reason) } @@ -491,7 +502,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, fn call_precompile( &mut self, inputs: &CallInputs, - mut gas: Gas + mut gas: Gas, ) -> (InstructionResult, Gas, Bytes) { let input_data = inputs.input.clone(); let contract = inputs.contract; @@ -525,8 +536,11 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, fn prepare_call( &mut self, - inputs: &mut CallInputs - ) -> Result<(Gas, Box, JournalCheckpoint, Box), (InstructionResult, Gas, Bytes)> { + inputs: &mut CallInputs, + ) -> Result< + (Gas, Box, JournalCheckpoint, Box), + (InstructionResult, Gas, Bytes), + > { let gas = Gas::new(inputs.gas_limit); // Load account and get code. Account is now hot. let Some((bytecode,_)) = self.code(inputs.contract) else { @@ -559,11 +573,11 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, return Err((e, gas, Bytes::new())); } - let contract = Box::new( - Contract::new_with_context( - inputs.input.clone(), &bytecode, &inputs.context - ) - ); + let contract = Box::new(Contract::new_with_context( + inputs.input.clone(), + &bytecode, + &inputs.context, + )); Ok((gas, Box::new(bytecode), checkpoint, contract)) } @@ -581,11 +595,8 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.call_precompile(inputs, gas) } else if !bytecode.is_empty() { // Create interpreter and execute subcall - let (exit_reason, interpreter) = self.run_interpreter( - contract, - gas.limit(), - inputs.is_static, - ); + let (exit_reason, interpreter) = + self.run_interpreter(contract, gas.limit(), inputs.is_static); (exit_reason, interpreter.gas, interpreter.return_value()) } else { (InstructionResult::Stop, gas, Bytes::new()) From d2e5c17c94fa3f6ecfa9b080e2dc345a8bbf41f9 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Fri, 23 Jun 2023 17:36:45 +0300 Subject: [PATCH 12/24] Remove the handle_ functions These functions does not impact the stack memory footprint --- crates/interpreter/src/instructions/host.rs | 117 ++++++++------------ crates/revm/src/evm_impl.rs | 38 +++---- 2 files changed, 59 insertions(+), 96 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index a530116276..ada427db92 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -1,4 +1,5 @@ use crate::primitives::{Bytes, Spec, SpecId::*, B160, B256, U256}; +use crate::MAX_INITCODE_SIZE; use crate::{ alloc::vec::Vec, gas::{self, COLD_ACCOUNT_ACCESS_COST, WARM_STORAGE_READ_COST}, @@ -6,7 +7,6 @@ use crate::{ return_ok, return_revert, CallContext, CallInputs, CallScheme, CreateInputs, CreateScheme, Host, InstructionResult, Transfer, }; -use crate::{Gas, MAX_INITCODE_SIZE}; use core::cmp::min; pub fn balance(interpreter: &mut Interpreter, host: &mut dyn Host) { @@ -291,11 +291,20 @@ pub fn prepare_create_inputs( })); } -pub fn handle_create_result( +pub fn create( interpreter: &mut Interpreter, - result: (InstructionResult, Option, Gas, Bytes), + host: &mut dyn Host, ) { - let (return_reason, address, gas, return_data) = result; + let mut create_input: Option> = None; + prepare_create_inputs::(interpreter, &mut create_input); + + if create_input.is_none() { + return; + } + + let mut create_input = create_input.unwrap(); + + let (return_reason, address, gas, return_data) = host.create(&mut create_input); interpreter.return_data_buffer = match return_reason { // Save data to return data buffer if the create reverted @@ -327,24 +336,6 @@ pub fn handle_create_result( } } -pub fn create( - interpreter: &mut Interpreter, - host: &mut dyn Host, -) { - let mut create_input: Option> = None; - prepare_create_inputs::(interpreter, &mut create_input); - - if create_input.is_none() { - return; - } - - let mut create_input = create_input.unwrap(); - - let ret = host.create(&mut create_input); - - handle_create_result(interpreter, ret); -} - pub fn call(interpreter: &mut Interpreter, host: &mut dyn Host) { call_inner::(interpreter, CallScheme::Call, host); } @@ -506,48 +497,6 @@ fn prepare_call_inputs( })); } -fn handle_call_result( - interpreter: &mut Interpreter, - out_offset: usize, - out_len: usize, - reason: &InstructionResult, - gas: &Gas, - return_data: &Bytes, -) { - interpreter.return_data_buffer = return_data.clone(); - - let target_len = min(out_len, interpreter.return_data_buffer.len()); - - match reason { - return_ok!() => { - // return unspend gas. - if crate::USE_GAS { - interpreter.gas.erase_cost(gas.remaining()); - interpreter.gas.record_refund(gas.refunded()); - } - interpreter - .memory - .set(out_offset, &interpreter.return_data_buffer[..target_len]); - push!(interpreter, U256::from(1)); - } - return_revert!() => { - if crate::USE_GAS { - interpreter.gas.erase_cost(gas.remaining()); - } - interpreter - .memory - .set(out_offset, &interpreter.return_data_buffer[..target_len]); - push!(interpreter, U256::ZERO); - } - InstructionResult::FatalExternalError => { - interpreter.instruction_result = InstructionResult::FatalExternalError; - } - _ => { - push!(interpreter, U256::ZERO); - } - } -} - pub fn call_inner( interpreter: &mut Interpreter, scheme: CallScheme, @@ -582,12 +531,36 @@ pub fn call_inner( // Call host to interact with target contract let (reason, gas, return_data) = host.call(&mut call_input); - handle_call_result( - interpreter, - out_offset, - out_len, - &reason, - &gas, - &return_data, - ); + interpreter.return_data_buffer = return_data.clone(); + + let target_len = min(out_len, interpreter.return_data_buffer.len()); + + match reason { + return_ok!() => { + // return unspend gas. + if crate::USE_GAS { + interpreter.gas.erase_cost(gas.remaining()); + interpreter.gas.record_refund(gas.refunded()); + } + interpreter + .memory + .set(out_offset, &interpreter.return_data_buffer[..target_len]); + push!(interpreter, U256::from(1)); + } + return_revert!() => { + if crate::USE_GAS { + interpreter.gas.erase_cost(gas.remaining()); + } + interpreter + .memory + .set(out_offset, &interpreter.return_data_buffer[..target_len]); + push!(interpreter, U256::ZERO); + } + InstructionResult::FatalExternalError => { + interpreter.instruction_result = InstructionResult::FatalExternalError; + } + _ => { + push!(interpreter, U256::ZERO); + } + } } diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 9363b098ab..b4bfd986c4 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -351,13 +351,22 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, Ok((gas, created_address, checkpoint, contract)) } - fn handle_create_result( + /// EVM create opcode for both initial crate and CREATE and CREATE2 opcodes. + fn create_inner( &mut self, - created_address: B160, - checkpoint: JournalCheckpoint, - interpreter: &mut Box, - exit_reason: InstructionResult, + inputs: &CreateInputs, ) -> (InstructionResult, Option, Gas, Bytes) { + let res = self.prepare_create(inputs); + + if let Err(ret) = res { + return ret; + } + + let (gas, created_address, checkpoint, contract) = res.unwrap(); + + // Create new interpreter and execute initcode + let (exit_reason, mut interpreter) = self.run_interpreter(contract, gas.limit(), false); + // Host error if present on execution match exit_reason { return_ok!() => { @@ -446,25 +455,6 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } } - /// EVM create opcode for both initial crate and CREATE and CREATE2 opcodes. - fn create_inner( - &mut self, - inputs: &CreateInputs, - ) -> (InstructionResult, Option, Gas, Bytes) { - let res = self.prepare_create(inputs); - - if let Err(ret) = res { - return ret; - } - - let (gas, created_address, checkpoint, contract) = res.unwrap(); - - // Create new interpreter and execute initcode - let (exit_reason, mut interpreter) = self.run_interpreter(contract, gas.limit(), false); - - self.handle_create_result(created_address, checkpoint, &mut interpreter, exit_reason) - } - /// Create a Interpreter and run it. /// Returns the exit reason and created interpreter as it contains return values and gas spend. pub fn run_interpreter( From a63b42ddb91c089df22eaaa59a6bf3f25df93e01 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Fri, 23 Jun 2023 17:41:52 +0300 Subject: [PATCH 13/24] Remove the bytecode from the CALL preparation The bytecode is included in the returned contract, so there is no need to return it. --- crates/revm/src/evm_impl.rs | 11 ++++------- 1 file changed, 4 insertions(+), 7 deletions(-) diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index b4bfd986c4..3fd80ac81b 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -527,10 +527,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, fn prepare_call( &mut self, inputs: &mut CallInputs, - ) -> Result< - (Gas, Box, JournalCheckpoint, Box), - (InstructionResult, Gas, Bytes), - > { + ) -> Result<(Gas, JournalCheckpoint, Box), (InstructionResult, Gas, Bytes)> { let gas = Gas::new(inputs.gas_limit); // Load account and get code. Account is now hot. let Some((bytecode,_)) = self.code(inputs.contract) else { @@ -569,7 +566,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, &inputs.context, )); - Ok((gas, Box::new(bytecode), checkpoint, contract)) + Ok((gas, checkpoint, contract)) } /// Main contract call of the EVM. @@ -579,11 +576,11 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, return ret; } - let (gas, bytecode, checkpoint, contract) = res.unwrap(); + let (gas, checkpoint, contract) = res.unwrap(); let ret = if is_precompile(inputs.contract, self.precompiles.len()) { self.call_precompile(inputs, gas) - } else if !bytecode.is_empty() { + } else if !contract.bytecode.is_empty() { // Create interpreter and execute subcall let (exit_reason, interpreter) = self.run_interpreter(contract, gas.limit(), inputs.is_static); From e9665d4f722085fa144253d025aa4fb7c4e9aaaa Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 27 Jun 2023 18:56:04 +0300 Subject: [PATCH 14/24] Use let-else and match to handle error cases --- crates/interpreter/src/instructions/host.rs | 13 ++----------- crates/revm/src/evm_impl.rs | 17 ++++++++--------- 2 files changed, 10 insertions(+), 20 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index ada427db92..1c9f729ad9 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -298,11 +298,7 @@ pub fn create( let mut create_input: Option> = None; prepare_create_inputs::(interpreter, &mut create_input); - if create_input.is_none() { - return; - } - - let mut create_input = create_input.unwrap(); + let Some(mut create_input) = create_input else { return }; let (return_reason, address, gas, return_data) = host.create(&mut create_input); @@ -521,12 +517,7 @@ pub fn call_inner( &mut call_input, ); - if call_input.is_none() { - return; - } - - // The Option is not needed form this point - let mut call_input = call_input.unwrap(); + let Some(mut call_input) = call_input else { return }; // Call host to interact with target contract let (reason, gas, return_data) = host.call(&mut call_input); diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 3fd80ac81b..9ed2fd812a 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -358,11 +358,10 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, ) -> (InstructionResult, Option, Gas, Bytes) { let res = self.prepare_create(inputs); - if let Err(ret) = res { - return ret; - } - - let (gas, created_address, checkpoint, contract) = res.unwrap(); + let (gas, created_address, checkpoint, contract) = match res { + Ok(o) => o, + Err(e) => return e, + }; // Create new interpreter and execute initcode let (exit_reason, mut interpreter) = self.run_interpreter(contract, gas.limit(), false); @@ -572,11 +571,11 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, /// Main contract call of the EVM. fn call_inner(&mut self, inputs: &mut CallInputs) -> (InstructionResult, Gas, Bytes) { let res = self.prepare_call(inputs); - if let Err(ret) = res { - return ret; - } - let (gas, checkpoint, contract) = res.unwrap(); + let (gas, checkpoint, contract) = match res { + Ok(o) => o, + Err(e) => return e, + }; let ret = if is_precompile(inputs.contract, self.precompiles.len()) { self.call_precompile(inputs, gas) From 1ed97ca0c859560077107451439c3e60439184f3 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 27 Jun 2023 19:05:41 +0300 Subject: [PATCH 15/24] Cloning the bytecode structs across fn calls is ok --- crates/interpreter/src/interpreter/contract.rs | 16 ++++------------ crates/revm/src/evm_impl.rs | 4 ++-- 2 files changed, 6 insertions(+), 14 deletions(-) diff --git a/crates/interpreter/src/interpreter/contract.rs b/crates/interpreter/src/interpreter/contract.rs index 2822776d30..434c1c7156 100644 --- a/crates/interpreter/src/interpreter/contract.rs +++ b/crates/interpreter/src/interpreter/contract.rs @@ -19,16 +19,8 @@ pub struct Contract { } impl Contract { - pub fn new( - input: Bytes, - bytecode: &Bytecode, - address: B160, - caller: B160, - value: U256, - ) -> Self { - let bytecode = to_analysed(bytecode.clone()) - .try_into() - .expect("it is analyzed"); + pub fn new(input: Bytes, bytecode: Bytecode, address: B160, caller: B160, value: U256) -> Self { + let bytecode = to_analysed(bytecode).try_into().expect("it is analyzed"); Self { input, @@ -47,7 +39,7 @@ impl Contract { }; Self::new( env.tx.data.clone(), - &bytecode, + bytecode, contract_address, env.tx.caller, env.tx.value, @@ -58,7 +50,7 @@ impl Contract { self.bytecode.jump_map().is_valid(possition) } - pub fn new_with_context(input: Bytes, bytecode: &Bytecode, call_context: &CallContext) -> Self { + pub fn new_with_context(input: Bytes, bytecode: Bytecode, call_context: &CallContext) -> Self { Self::new( input, bytecode, diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 9ed2fd812a..eaee8cba4a 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -342,7 +342,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, let contract = Box::new(Contract::new( Bytes::new(), - &Bytecode::new_raw(inputs.init_code.clone()), + Bytecode::new_raw(inputs.init_code.clone()), created_address, inputs.caller, inputs.value, @@ -561,7 +561,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, let contract = Box::new(Contract::new_with_context( inputs.input.clone(), - &bytecode, + bytecode, &inputs.context, )); From f73f23dcd85df977d7e66b2e5bbe4fc4f6f04cd4 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 27 Jun 2023 19:34:31 +0300 Subject: [PATCH 16/24] Refactor the inner create return types --- crates/revm/src/evm_impl.rs | 176 +++++++++++++++++++++++------------- 1 file changed, 112 insertions(+), 64 deletions(-) diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index eaee8cba4a..0db149dbf3 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -32,6 +32,20 @@ pub struct EVMImpl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> { _phantomdata: PhantomData, } +pub struct PreparedCreateResult { + gas: Gas, + created_address: B160, + checkpoint: JournalCheckpoint, + contract: Box, +} + +pub struct CreateResult { + result: InstructionResult, + created_address: Option, + gas: Gas, + return_value: Bytes, +} + pub trait Transact { /// Do transaction. /// InstructionResult InstructionResult, Output for call or Address if we are creating @@ -278,25 +292,32 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, fn prepare_create( &mut self, inputs: &CreateInputs, - ) -> Result< - (Gas, B160, JournalCheckpoint, Box), - (InstructionResult, Option, Gas, Bytes), - > { + ) -> Result { let gas = Gas::new(inputs.gas_limit); // Check depth of calls if self.data.journaled_state.depth() > CALL_STACK_LIMIT { - return Err((InstructionResult::CallTooDeep, None, gas, Bytes::new())); + return Err(CreateResult { + result: InstructionResult::CallTooDeep, + created_address: None, + gas: gas, + return_value: Bytes::new(), + }); } // Fetch balance of caller. let Some((caller_balance,_)) = self.balance(inputs.caller) else { - return Err((InstructionResult::FatalExternalError, None, gas, Bytes::new())); + return Err(CreateResult{result: InstructionResult::FatalExternalError, created_address: None, gas, return_value: Bytes::new()}); }; // Check if caller has enough balance to send to the crated contract. if caller_balance < inputs.value { - return Err((InstructionResult::OutOfFund, None, gas, Bytes::new())); + return Err(CreateResult { + result: InstructionResult::OutOfFund, + created_address: None, + gas, + return_value: Bytes::new(), + }); } // Increase nonce of caller and check if it overflows @@ -304,7 +325,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, if let Some(nonce) = self.data.journaled_state.inc_nonce(inputs.caller) { old_nonce = nonce - 1; } else { - return Err((InstructionResult::Return, None, gas, Bytes::new())); + return Err(CreateResult { + result: InstructionResult::Return, + created_address: None, + gas, + return_value: Bytes::new(), + }); } // Create address @@ -322,12 +348,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, .map_err(|e| self.data.error = Some(e)) .is_err() { - return Err(( - InstructionResult::FatalExternalError, - None, + return Err(CreateResult { + result: InstructionResult::FatalExternalError, + created_address: None, gas, - Bytes::new(), - )); + return_value: Bytes::new(), + }); } // create account, transfer funds and make the journal checkpoint. @@ -337,7 +363,14 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, .create_account_checkpoint::(inputs.caller, created_address, inputs.value) { Ok(checkpoint) => checkpoint, - Err(e) => return Err((e, None, gas, Bytes::new())), + Err(e) => { + return Err(CreateResult { + result: e, + created_address: None, + gas, + return_value: Bytes::new(), + }) + } }; let contract = Box::new(Contract::new( @@ -348,23 +381,26 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, inputs.value, )); - Ok((gas, created_address, checkpoint, contract)) + Ok(PreparedCreateResult { + gas, + created_address, + checkpoint, + contract, + }) } /// EVM create opcode for both initial crate and CREATE and CREATE2 opcodes. - fn create_inner( - &mut self, - inputs: &CreateInputs, - ) -> (InstructionResult, Option, Gas, Bytes) { + fn create_inner(&mut self, inputs: &CreateInputs) -> CreateResult { let res = self.prepare_create(inputs); - let (gas, created_address, checkpoint, contract) = match res { + let prepared_create = match res { Ok(o) => o, Err(e) => return e, }; // Create new interpreter and execute initcode - let (exit_reason, mut interpreter) = self.run_interpreter(contract, gas.limit(), false); + let (exit_reason, mut interpreter) = + self.run_interpreter(prepared_create.contract, prepared_create.gas.limit(), false); // Host error if present on execution match exit_reason { @@ -374,13 +410,15 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, // EIP-3541: Reject new contract code starting with the 0xEF byte if GSPEC::enabled(LONDON) && !bytes.is_empty() && bytes.first() == Some(&0xEF) { - self.data.journaled_state.checkpoint_revert(checkpoint); - return ( - InstructionResult::CreateContractStartingWithEF, - Some(created_address), - interpreter.gas, - bytes, - ); + self.data + .journaled_state + .checkpoint_revert(prepared_create.checkpoint); + return CreateResult { + result: InstructionResult::CreateContractStartingWithEF, + created_address: Some(prepared_create.created_address), + gas: interpreter.gas, + return_value: bytes, + }; } // EIP-170: Contract code size limit @@ -394,13 +432,15 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, .limit_contract_code_size .unwrap_or(MAX_CODE_SIZE) { - self.data.journaled_state.checkpoint_revert(checkpoint); - return ( - InstructionResult::CreateContractSizeLimit, - Some(created_address), - interpreter.gas, - bytes, - ); + self.data + .journaled_state + .checkpoint_revert(prepared_create.checkpoint); + return CreateResult { + result: InstructionResult::CreateContractSizeLimit, + created_address: Some(prepared_create.created_address), + gas: interpreter.gas, + return_value: bytes, + }; } if crate::USE_GAS { let gas_for_code = bytes.len() as u64 * gas::CODEDEPOSIT; @@ -410,13 +450,15 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, // final gas fee for adding the contract code to the state, the contract // creation fails (i.e. goes out-of-gas) rather than leaving an empty contract. if GSPEC::enabled(HOMESTEAD) { - self.data.journaled_state.checkpoint_revert(checkpoint); - return ( - InstructionResult::OutOfGas, - Some(created_address), - interpreter.gas, - bytes, - ); + self.data + .journaled_state + .checkpoint_revert(prepared_create.checkpoint); + return CreateResult { + result: InstructionResult::OutOfGas, + created_address: Some(prepared_create.created_address), + gas: interpreter.gas, + return_value: bytes, + }; } else { bytes = Bytes::new(); } @@ -426,30 +468,30 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data.journaled_state.checkpoint_commit(); // Do analysis of bytecode straight away. let bytecode = match self.data.env.cfg.perf_analyse_created_bytecodes { - AnalysisKind::Raw => Box::new(Bytecode::new_raw(bytes.clone())), - AnalysisKind::Check => Box::new(Bytecode::new_raw(bytes.clone()).to_checked()), - AnalysisKind::Analyse => { - Box::new(to_analysed(Bytecode::new_raw(bytes.clone()))) - } + AnalysisKind::Raw => Bytecode::new_raw(bytes.clone()), + AnalysisKind::Check => Bytecode::new_raw(bytes.clone()).to_checked(), + AnalysisKind::Analyse => to_analysed(Bytecode::new_raw(bytes.clone())), }; self.data .journaled_state - .set_code(created_address, *bytecode); - ( - InstructionResult::Return, - Some(created_address), - interpreter.gas, - bytes, - ) + .set_code(prepared_create.created_address, bytecode); + CreateResult { + result: InstructionResult::Return, + created_address: Some(prepared_create.created_address), + gas: interpreter.gas, + return_value: bytes, + } } _ => { - self.data.journaled_state.checkpoint_revert(checkpoint); - ( - exit_reason, - Some(created_address), - interpreter.gas, - interpreter.return_value(), - ) + self.data + .journaled_state + .checkpoint_revert(prepared_create.checkpoint); + CreateResult { + result: exit_reason, + created_address: Some(prepared_create.created_address), + gas: interpreter.gas, + return_value: interpreter.return_value(), + } } } } @@ -729,10 +771,16 @@ impl<'a, GSPEC: Spec, DB: Database + 'a, const INSPECT: bool> Host } let ret = self.create_inner(inputs); if INSPECT { - self.inspector - .create_end(&mut self.data, inputs, ret.0, ret.1, ret.2, ret.3) + self.inspector.create_end( + &mut self.data, + inputs, + ret.result, + ret.created_address, + ret.gas, + ret.return_value, + ) } else { - ret + (ret.result, ret.created_address, ret.gas, ret.return_value) } } From 6189cba01a45e2e40f1de9e512b9fd7f932017f9 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 27 Jun 2023 19:44:01 +0300 Subject: [PATCH 17/24] Refactor the prepare call data into a struct --- crates/revm/src/evm_impl.rs | 114 +++++++++++++++++++++++++----------- 1 file changed, 79 insertions(+), 35 deletions(-) diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 0db149dbf3..8cd390b40e 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -32,7 +32,7 @@ pub struct EVMImpl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> { _phantomdata: PhantomData, } -pub struct PreparedCreateResult { +pub struct PreparedCreate { gas: Gas, created_address: B160, checkpoint: JournalCheckpoint, @@ -46,6 +46,18 @@ pub struct CreateResult { return_value: Bytes, } +pub struct PreparedCall { + gas: Gas, + checkpoint: JournalCheckpoint, + contract: Box, +} + +pub struct CallResult { + result: InstructionResult, + gas: Gas, + return_value: Bytes, +} + pub trait Transact { /// Do transaction. /// InstructionResult InstructionResult, Output for call or Address if we are creating @@ -289,10 +301,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, (new_state, logs, gas_used, gas_refunded) } - fn prepare_create( - &mut self, - inputs: &CreateInputs, - ) -> Result { + fn prepare_create(&mut self, inputs: &CreateInputs) -> Result { let gas = Gas::new(inputs.gas_limit); // Check depth of calls @@ -381,7 +390,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, inputs.value, )); - Ok(PreparedCreateResult { + Ok(PreparedCreate { gas, created_address, checkpoint, @@ -530,11 +539,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } /// Call precompile contract - fn call_precompile( - &mut self, - inputs: &CallInputs, - mut gas: Gas, - ) -> (InstructionResult, Gas, Bytes) { + fn call_precompile(&mut self, inputs: &CallInputs, mut gas: Gas) -> CallResult { let input_data = inputs.input.clone(); let contract = inputs.contract; @@ -549,9 +554,17 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, match out { Ok((gas_used, data)) => { if !crate::USE_GAS || gas.record_cost(gas_used) { - (InstructionResult::Return, gas, Bytes::from(data)) + CallResult { + result: InstructionResult::Return, + gas, + return_value: Bytes::from(data), + } } else { - (InstructionResult::PrecompileOOG, gas, Bytes::new()) + CallResult { + result: InstructionResult::PrecompileOOG, + gas, + return_value: Bytes::new(), + } } } Err(e) => { @@ -560,25 +573,30 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } else { InstructionResult::PrecompileError }; - (ret, gas, Bytes::new()) + CallResult { + result: ret, + gas, + return_value: Bytes::new(), + } } } } - fn prepare_call( - &mut self, - inputs: &mut CallInputs, - ) -> Result<(Gas, JournalCheckpoint, Box), (InstructionResult, Gas, Bytes)> { + fn prepare_call(&mut self, inputs: &mut CallInputs) -> Result { let gas = Gas::new(inputs.gas_limit); // Load account and get code. Account is now hot. let Some((bytecode,_)) = self.code(inputs.contract) else { - return Err((InstructionResult::FatalExternalError, gas, Bytes::new())); + return Err(CallResult{result: InstructionResult::FatalExternalError, gas, return_value: Bytes::new()}); }; // Check depth // println!("Current call depth: {}", self.data.journaled_state.depth()); if self.data.journaled_state.depth() > CALL_STACK_LIMIT { - return Err((InstructionResult::CallTooDeep, gas, Bytes::new())); + return Err(CallResult { + result: InstructionResult::CallTooDeep, + gas, + return_value: Bytes::new(), + }); } // Create subroutine checkpoint @@ -598,7 +616,11 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, self.data.db, ) { self.data.journaled_state.checkpoint_revert(checkpoint); - return Err((e, gas, Bytes::new())); + return Err(CallResult { + result: e, + gas, + return_value: Bytes::new(), + }); } let contract = Box::new(Contract::new_with_context( @@ -607,34 +629,51 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, &inputs.context, )); - Ok((gas, checkpoint, contract)) + Ok(PreparedCall { + gas, + checkpoint, + contract, + }) } /// Main contract call of the EVM. - fn call_inner(&mut self, inputs: &mut CallInputs) -> (InstructionResult, Gas, Bytes) { + fn call_inner(&mut self, inputs: &mut CallInputs) -> CallResult { let res = self.prepare_call(inputs); - let (gas, checkpoint, contract) = match res { + let prepared_call = match res { Ok(o) => o, Err(e) => return e, }; let ret = if is_precompile(inputs.contract, self.precompiles.len()) { - self.call_precompile(inputs, gas) - } else if !contract.bytecode.is_empty() { + self.call_precompile(inputs, prepared_call.gas) + } else if !prepared_call.contract.bytecode.is_empty() { // Create interpreter and execute subcall - let (exit_reason, interpreter) = - self.run_interpreter(contract, gas.limit(), inputs.is_static); - (exit_reason, interpreter.gas, interpreter.return_value()) + let (exit_reason, interpreter) = self.run_interpreter( + prepared_call.contract, + prepared_call.gas.limit(), + inputs.is_static, + ); + CallResult { + result: exit_reason, + gas: interpreter.gas, + return_value: interpreter.return_value(), + } } else { - (InstructionResult::Stop, gas, Bytes::new()) + CallResult { + result: InstructionResult::Stop, + gas: prepared_call.gas, + return_value: Bytes::new(), + } }; // revert changes or not. - if matches!(ret.0, return_ok!()) { + if matches!(ret.result, return_ok!()) { self.data.journaled_state.checkpoint_commit(); } else { - self.data.journaled_state.checkpoint_revert(checkpoint); + self.data + .journaled_state + .checkpoint_revert(prepared_call.checkpoint); } ret @@ -793,10 +832,15 @@ impl<'a, GSPEC: Spec, DB: Database + 'a, const INSPECT: bool> Host } let ret = self.call_inner(inputs); if INSPECT { - self.inspector - .call_end(&mut self.data, inputs, ret.1, ret.0, ret.2) + self.inspector.call_end( + &mut self.data, + inputs, + ret.gas, + ret.result, + ret.return_value, + ) } else { - ret + (ret.result, ret.gas, ret.return_value) } } } From 57a6a8da74132c0758bf18fd6f1b2dff9cf6bc61 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 27 Jun 2023 19:54:45 +0300 Subject: [PATCH 18/24] In debug mode the revm needs 4MB of stack After the latest simplifications of the stack optimizations, the stack memory footprint increased. --- bins/revme/src/statetest/runner.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/bins/revme/src/statetest/runner.rs b/bins/revme/src/statetest/runner.rs index ac178c077d..c7506f5fc6 100644 --- a/bins/revme/src/statetest/runner.rs +++ b/bins/revme/src/statetest/runner.rs @@ -359,7 +359,7 @@ pub fn run( // Allow bigger stack in debug mode to prevent stack overflow errors if cfg!(debug_assertions) { - thread = thread.stack_size(3 * 1024 * 1024); + thread = thread.stack_size(4 * 1024 * 1024); } joins.push( From faf778e3b5ea02a936becced403d5530a8b4d29c Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Tue, 27 Jun 2023 21:33:20 +0300 Subject: [PATCH 19/24] Fix clippy warnings --- crates/interpreter/src/instructions/host.rs | 2 +- crates/revm/src/evm_impl.rs | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index 1c9f729ad9..b8a8806f5b 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -522,7 +522,7 @@ pub fn call_inner( // Call host to interact with target contract let (reason, gas, return_data) = host.call(&mut call_input); - interpreter.return_data_buffer = return_data.clone(); + interpreter.return_data_buffer = return_data; let target_len = min(out_len, interpreter.return_data_buffer.len()); diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 8cd390b40e..30ecf69328 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -309,7 +309,7 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, return Err(CreateResult { result: InstructionResult::CallTooDeep, created_address: None, - gas: gas, + gas, return_value: Bytes::new(), }); } From 9ac3d71226d337f3cb23382e7388a537ba6057dc Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Wed, 28 Jun 2023 19:10:46 +0300 Subject: [PATCH 20/24] Fix `cargo check` warnings --- crates/interpreter/src/instructions/host.rs | 1 + crates/interpreter/src/interpreter.rs | 1 + crates/revm/src/evm_impl.rs | 1 + 3 files changed, 3 insertions(+) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index b8a8806f5b..365306c935 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -1,6 +1,7 @@ use crate::primitives::{Bytes, Spec, SpecId::*, B160, B256, U256}; use crate::MAX_INITCODE_SIZE; use crate::{ + alloc::boxed::Box, alloc::vec::Vec, gas::{self, COLD_ACCOUNT_ACCESS_COST, WARM_STORAGE_READ_COST}, interpreter::Interpreter, diff --git a/crates/interpreter/src/interpreter.rs b/crates/interpreter/src/interpreter.rs index d3144ee6d0..f99effe93d 100644 --- a/crates/interpreter/src/interpreter.rs +++ b/crates/interpreter/src/interpreter.rs @@ -10,6 +10,7 @@ pub use stack::Stack; use crate::primitives::{Bytes, Spec}; use crate::{ + alloc::boxed::Box, instructions::{eval, InstructionResult}, Gas, Host, }; diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 30ecf69328..77d7d24028 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -12,6 +12,7 @@ use crate::primitives::{ TransactTo, B160, B256, U256, }; use crate::{db::Database, journaled_state::JournaledState, precompile, Inspector}; +use alloc::boxed::Box; use alloc::vec::Vec; use core::{cmp::min, marker::PhantomData}; use revm_interpreter::gas::initial_tx_gas; From d7d535dbdb148f4591a840a58cd86dfca7e4a014 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Thu, 29 Jun 2023 16:46:26 +0300 Subject: [PATCH 21/24] Remove debug logging --- crates/revm/src/evm_impl.rs | 1 - 1 file changed, 1 deletion(-) diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 77d7d24028..b24c220cd0 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -591,7 +591,6 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, }; // Check depth - // println!("Current call depth: {}", self.data.journaled_state.depth()); if self.data.journaled_state.depth() > CALL_STACK_LIMIT { return Err(CallResult { result: InstructionResult::CallTooDeep, From ff8ac1a4f78908c0a23d4bdbaff2613a6d1dee94 Mon Sep 17 00:00:00 2001 From: Valentin Mihov Date: Thu, 29 Jun 2023 17:07:47 +0300 Subject: [PATCH 22/24] Make the internal structs private --- crates/revm/src/evm_impl.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index b24c220cd0..43337401f8 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -33,27 +33,27 @@ pub struct EVMImpl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> { _phantomdata: PhantomData, } -pub struct PreparedCreate { +struct PreparedCreate { gas: Gas, created_address: B160, checkpoint: JournalCheckpoint, contract: Box, } -pub struct CreateResult { +struct CreateResult { result: InstructionResult, created_address: Option, gas: Gas, return_value: Bytes, } -pub struct PreparedCall { +struct PreparedCall { gas: Gas, checkpoint: JournalCheckpoint, contract: Box, } -pub struct CallResult { +struct CallResult { result: InstructionResult, gas: Gas, return_value: Bytes, From d61bf3005640cc5a2734d2f8a7c511b4a20599cb Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 3 Jul 2023 00:11:59 +0200 Subject: [PATCH 23/24] add newer cargo.lock --- Cargo.lock | 701 ++++++++++++++++++++++++++++++----------------------- 1 file changed, 392 insertions(+), 309 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 417733ae61..fdcc9b03a2 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2,6 +2,21 @@ # It is not intended for manual editing. version = 3 +[[package]] +name = "addr2line" +version = "0.20.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f4fa78e18c64fce05e902adecd7a5eed15a5e0a3439f7b0e169f0252214865e3" +dependencies = [ + "gimli", +] + +[[package]] +name = "adler" +version = "1.0.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "f26201604c87b1e01bd3d98f8d5d9a8fcbb815e8cedb41ffccbeb4bf593a35fe" + [[package]] name = "ahash" version = "0.8.3" @@ -15,13 +30,19 @@ dependencies = [ [[package]] name = "aho-corasick" -version = "0.7.20" +version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc936419f96fa211c1b9166887b38e5e40b19958e5b895be7c1f93adec7071ac" +checksum = "43f6cb1bf222025340178f382c426f13757b2960e89779dfcb319c32542a5a41" dependencies = [ "memchr", ] +[[package]] +name = "android-tzdata" +version = "0.1.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e999941b234f3131b00bc13c22d06e8c5ff726d1b6318ac7eb276997bbb4fef0" + [[package]] name = "ansi_term" version = "0.12.1" @@ -48,9 +69,9 @@ dependencies = [ [[package]] name = "arrayvec" -version = "0.7.2" +version = "0.7.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8da52d66c7071e2e3fa2a1e5c6d088fec47b593032b254f5e980de8ea54454d6" +checksum = "96d30a06541fbafbc7f82ed10c06164cfbd2c401138f6addd8404629c4b16711" [[package]] name = "async-trait" @@ -58,9 +79,9 @@ version = "0.1.68" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b9ccdd8f2a161be9bd5c023df56f1b2a0bd1d83872ae53b71a84a12c9bf6e842" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -87,13 +108,13 @@ dependencies = [ [[package]] name = "auto_impl" -version = "1.0.1" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8a8c1df849285fbacd587de7818cc7d13be6cd2cbcd47a04fb1801b0e2706e33" +checksum = "fee3da8ef1276b0bee5dd1c7258010d8fffd31801447323115a25560e1327b89" dependencies = [ "proc-macro-error", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] @@ -103,6 +124,21 @@ version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "d468802bab17cbc0cc575e9b053f41e72aa36bfa6b7f55e3529ffa43161b97fa" +[[package]] +name = "backtrace" +version = "0.3.68" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4319208da049c43661739c5fade2ba182f09d1dc2299b32298d3a31692b17e12" +dependencies = [ + "addr2line", + "cc", + "cfg-if", + "libc", + "miniz_oxide", + "object", + "rustc-demangle", +] + [[package]] name = "base16ct" version = "0.2.0" @@ -117,9 +153,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.0" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a4a4ddaa51a5bc52a6948f74c06d20aaaddb71924eab79b8c97a8c556e942d6a" +checksum = "604178f6c5c21f02dc555784810edfb88d34ac2c73b2eae109655649ee73ce3d" [[package]] name = "base64ct" @@ -150,9 +186,9 @@ checksum = "bef38d45163c2f1dde094a7dfd33ccf595c92905c8f8f4fdc18d06fb1037718a" [[package]] name = "bitflags" -version = "2.2.1" +version = "2.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24a6904aef64d73cf10ab17ebace7befb918b82164785cb89907993be7f83813" +checksum = "630be753d4e58660abd17930c71b647fe46c27ea6b63cc59e1e3851406972e42" dependencies = [ "arbitrary", "serde", @@ -182,9 +218,9 @@ dependencies = [ [[package]] name = "bumpalo" -version = "3.12.0" +version = "3.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d261e256854913907f67ed06efbc3338dfe6179796deefc1ff763fc1aee5535" +checksum = "a3e2c3daef883ecc1b5d58c15adae93470a91d425f3532ba1695849656af3fc1" [[package]] name = "byte-slice-cast" @@ -221,11 +257,11 @@ checksum = "baf1de4339761588bc0619e3cbc0120ee582ebb74b53b4efbf79117bd2da40fd" [[package]] name = "chrono" -version = "0.4.24" +version = "0.4.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4e3c5919066adf22df73762e50cffcde3a758f2a848b113b586d1f86728b673b" +checksum = "ec837a71355b28f6556dbd569b37b3f363091c0bd4b2e735674521b4c5fd9bc5" dependencies = [ - "num-integer", + "android-tzdata", "num-traits", ] @@ -246,22 +282,22 @@ dependencies = [ [[package]] name = "console" -version = "0.15.5" +version = "0.15.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3d79fbe8970a77e3e34151cc13d3b3e248aa0faaecb9f6091fa07ebefe5ad60" +checksum = "c926e00cc70edefdc64d3a5ff31cc65bb97a3460097762bd23afb4d8145fccf8" dependencies = [ "encode_unicode", "lazy_static", "libc", "unicode-width", - "windows-sys 0.42.0", + "windows-sys 0.45.0", ] [[package]] name = "const-oid" -version = "0.9.2" +version = "0.9.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "520fbf3c07483f94e3e3ca9d0cfd913d7718ef2483d2cfd91c0d9e91474ab913" +checksum = "6340df57935414636969091153f35f68d9f00bbc8fb4a9c6054706c213e6c6bc" [[package]] name = "convert_case" @@ -271,9 +307,9 @@ checksum = "6245d59a3e82a7fc217c5828a6692dbc6dfb63a0c8c90495621f7b9d79704a0e" [[package]] name = "cpufeatures" -version = "0.2.6" +version = "0.2.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "280a9f2d8b3a38871a3c8a46fb80db65e5e5ed97da80c4d08bf27fb63e35e181" +checksum = "03e69e28e9f7f77debdedbaafa2866e1de9ba56df55a8bd7cfc724c25a09987c" dependencies = [ "libc", ] @@ -286,9 +322,9 @@ checksum = "7a81dae078cea95a014a339291cec439d2f232ebe854a9d672b796c6afafa9b7" [[package]] name = "crypto-bigint" -version = "0.5.1" +version = "0.5.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c2538c4e68e52548bacb3e83ac549f903d44f011ac9d5abb5e132e67d0808f7" +checksum = "cf4c2f4e1afd912bc40bfd6fed5d9dc1f288e0ba01bfcc835cc5bc3eb13efe15" dependencies = [ "generic-array", "rand_core", @@ -306,11 +342,17 @@ dependencies = [ "typenum", ] +[[package]] +name = "data-encoding" +version = "2.4.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "c2e66c9d817f1720209181c316d28635c050fa304f9c79e47a520882661b7308" + [[package]] name = "der" -version = "0.7.3" +version = "0.7.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82b10af9f9f9f2134a42d3f8aa74658660f2e0234b0eb81bd171df8aa32779ed" +checksum = "0c7ed52955ce76b1554f509074bb357d3fb8ac9b51288a65a3fd480d1dfba946" dependencies = [ "const-oid", "zeroize", @@ -318,13 +360,13 @@ dependencies = [ [[package]] name = "derive_arbitrary" -version = "1.3.0" +version = "1.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f3cdeb9ec472d588e539a818b2dee436825730da08ad0017c4b1a17676bdc8b7" +checksum = "53e0efad4403bfc52dc201159c4b842a246a14b98c64b55dfd0f2d89729dfeb8" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -334,40 +376,43 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "4fb810d30a7c1953f91334de7244731fc3f3c10d7fe163338a35b9f640960321" dependencies = [ "convert_case", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "rustc_version", "syn 1.0.109", ] [[package]] name = "digest" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8168378f4e5023e7218c89c891c0fd8ecdb5e5e4f18cb78f38cf245dd021e76f" +checksum = "9ed9a281f7bc9b7576e61468ba615a66a5c8cfdff42420a70aa82701a3b1e292" dependencies = [ "block-buffer", + "const-oid", "crypto-common", "subtle", ] [[package]] name = "ecdsa" -version = "0.16.2" +version = "0.16.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "644d3b8674a5fc5b929ae435bca85c2323d85ccb013a5509c2ac9ee11a6284ba" +checksum = "0997c976637b606099b9985693efa3581e84e41f5c11ba5255f88711058ad428" dependencies = [ "der", + "digest", "elliptic-curve", "rfc6979", "signature", + "spki", ] [[package]] name = "elliptic-curve" -version = "0.13.4" +version = "0.13.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75c71eaa367f2e5d556414a8eea812bc62985c879748d6403edabd9cb03f16e7" +checksum = "968405c8fdc9b3bf4df0a6638858cc0b52462836ab6b1c87377785dd09cf1c0b" dependencies = [ "base16ct", "crypto-bigint", @@ -399,9 +444,9 @@ dependencies = [ [[package]] name = "enr" -version = "0.8.0" +version = "0.8.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb4d5fbf6f56acecd38f5988eb2e4ae412008a2a30268c748c701ec6322f39d4" +checksum = "cf56acd72bb22d2824e66ae8e9e5ada4d0de17a69c7fd35569dde2ada8ec9116" dependencies = [ "base64 0.13.1", "bytes", @@ -421,20 +466,26 @@ version = "0.1.8" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "48016319042fb7c87b78d2993084a831793a897a5cd1a2a67cab9d1eeb4b7d76" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] +[[package]] +name = "equivalent" +version = "1.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "88bffebc5d80432c9b140ee17875ff173a8ab62faad5b257da912bd2f6c1c0a1" + [[package]] name = "errno" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "50d6a0976c999d473fe89ad888d5a284e55366d9dc9038b1ba2aa15128c4afa0" +checksum = "4bcfec3a70f97c962c307b2d2c56e358cf1d00b558d74262b5f929ee8cc7e73a" dependencies = [ "errno-dragonfly", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -497,9 +548,9 @@ dependencies = [ [[package]] name = "ethers-contract" -version = "2.0.3" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2a328cb42014ac0ac577a8dac32eb658ee0f32b5a9a5317a0329ac1d4201f1c6" +checksum = "e066a0d9cfc70c454672bf16bb433b0243427420076dc5b2f49c448fb5a10628" dependencies = [ "ethers-core", "ethers-providers", @@ -514,9 +565,9 @@ dependencies = [ [[package]] name = "ethers-core" -version = "2.0.3" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3a5f8f85ba96698eab9a4782ed2215d0979b1981b99f1be0726c200ffdac22f5" +checksum = "6da5fa198af0d3be20c19192df2bd9590b92ce09a8421e793bec8851270f1b05" dependencies = [ "arrayvec", "bytes", @@ -524,7 +575,6 @@ dependencies = [ "elliptic-curve", "ethabi", "generic-array", - "getrandom", "hex", "k256", "num_enum", @@ -542,13 +592,13 @@ dependencies = [ [[package]] name = "ethers-providers" -version = "2.0.3" +version = "2.0.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7c9d2cbed43cf618004dbe339e389e10dae46ea8e55872ab63a25fad25a6082a" +checksum = "56b498fd2a6c019d023e43e83488cd1fb0721f299055975aa6bac8dbf1e95f2c" dependencies = [ "async-trait", "auto_impl", - "base64 0.21.0", + "base64 0.21.2", "bytes", "enr", "ethers-core", @@ -556,7 +606,6 @@ dependencies = [ "futures-core", "futures-timer", "futures-util", - "getrandom", "hashers", "hex", "http", @@ -617,9 +666,9 @@ checksum = "3f9eec918d3f24069decb9af1554cad7c880e2da24a9afd88aca000531ab82c1" [[package]] name = "form_urlencoded" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a9c384f161156f5260c24a097c56119f9be8c798586aecc13afbcbe7b7e26bf8" +checksum = "a62bc1cf6f830c2ec14a513a9fb124d0a213a629668a4186f329db21fe045652" dependencies = [ "percent-encoding", ] @@ -684,9 +733,9 @@ version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -751,17 +800,21 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.8" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c05aeb6a22b8f62540c194aac980f2115af067bfe15a0734d7277a768d396b31" +checksum = "be4136b2a15dd319360be1c07d9933517ccf0be8f16bf62a3bee4f0d618df427" dependencies = [ "cfg-if", - "js-sys", "libc", "wasi", - "wasm-bindgen", ] +[[package]] +name = "gimli" +version = "0.27.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b6c80984affa11d98d1b88b66ac8853f143217b399d3c74116778ff8fdb4ed2e" + [[package]] name = "gloo-timers" version = "0.2.6" @@ -787,9 +840,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.16" +version = "0.3.20" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5be7b54589b581f624f566bf5d8eb2bab1db736c51528720b6bd36b96b55924d" +checksum = "97ec8491ebaf99c8eaa73058b045fe58073cd6be7f596ac993ced0b0a0c01049" dependencies = [ "bytes", "fnv", @@ -797,7 +850,7 @@ dependencies = [ "futures-sink", "futures-util", "http", - "indexmap", + "indexmap 1.9.3", "slab", "tokio", "tokio-util", @@ -826,6 +879,12 @@ dependencies = [ "serde", ] +[[package]] +name = "hashbrown" +version = "0.14.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2c6201b9ff9fd90a5a3bac2e56a830d0caa509576f0e503818ee82c181b3437a" + [[package]] name = "hashers" version = "1.0.1" @@ -859,15 +918,6 @@ dependencies = [ "libc", ] -[[package]] -name = "hermit-abi" -version = "0.2.6" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee512640fe35acbfb4bb779db6f0d80704c2cacfa2e39b601ef3e3f47d1ae4c7" -dependencies = [ - "libc", -] - [[package]] name = "hermit-abi" version = "0.3.1" @@ -934,9 +984,9 @@ checksum = "c4a1e36c821dbe04574f602848a19f742f4fb3c98d40449f11bcad18d6b17421" [[package]] name = "hyper" -version = "0.14.25" +version = "0.14.27" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cc5e554ff619822309ffd57d8734d77cd5ce6238bc956f037ea06c58238c9899" +checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" dependencies = [ "bytes", "futures-channel", @@ -958,9 +1008,9 @@ dependencies = [ [[package]] name = "hyper-rustls" -version = "0.23.2" +version = "0.24.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1788965e61b367cd03a62950836d5cd41560c3577d90e40e0819373194d1661c" +checksum = "0646026eb1b3eea4cd9ba47912ea5ce9cc07713d105b1a14698f4e6433d348b7" dependencies = [ "http", "hyper", @@ -971,9 +1021,9 @@ dependencies = [ [[package]] name = "idna" -version = "0.3.0" +version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e14ddfc70884202db2244c223200c204c2bda1bc6e0998d11b5e024d657209e6" +checksum = "7d20d6b07bfbc108882d88ed8e37d39636dcc260e15e30c45e6ba089610b917c" dependencies = [ "unicode-bidi", "unicode-normalization", @@ -1012,8 +1062,8 @@ version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "11d7a9f6330b71fea57921c9b61c47ee6e84f72d394754eff6163ae67e7395eb" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] @@ -1027,13 +1077,24 @@ dependencies = [ "hashbrown 0.12.3", ] +[[package]] +name = "indexmap" +version = "2.0.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d5477fe2230a79769d8dc68e0eabf5437907c0457a5614a9e8dddb67f65eb65d" +dependencies = [ + "equivalent", + "hashbrown 0.14.0", +] + [[package]] name = "indicatif" -version = "0.17.3" +version = "0.17.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cef509aa9bc73864d6756f0d34d35504af3cf0844373afe9b8669a5b8005a729" +checksum = "8ff8cc23a7393a397ed1d7f56e6365cba772aba9f9912ab968b03043c395d057" dependencies = [ "console", + "instant", "number_prefix", "portable-atomic", "unicode-width", @@ -1050,20 +1111,20 @@ dependencies = [ [[package]] name = "io-lifetimes" -version = "1.0.9" +version = "1.0.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "09270fd4fa1111bc614ed2246c7ef56239a3063d5be0d1ec3b589c505d400aeb" +checksum = "eae7b9aee968036d54dce06cebaefd919e4472e753296daccd6d344e3e2df0c2" dependencies = [ "hermit-abi 0.3.1", "libc", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "ipnet" -version = "2.7.2" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12b6ee2129af8d4fb011108c73d99a1b83a85977f23b82460c0ae2e25bb4b57f" +checksum = "28b29a3cd74f0f4598934efe3aeba42bae0eb4680554128851ebbecb02af14e6" [[package]] name = "itoa" @@ -1073,9 +1134,9 @@ checksum = "453ad9f582a441959e5f0d088b02ce04cfe8d51a8eaf077f12ac6d3e94164ca6" [[package]] name = "js-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "445dde2150c55e483f3d8416706b97ec8e8237c307e5b7b4b8dd15e6af2a0730" +checksum = "c5f195fe497f702db0f318b07fdd68edb16955aed830df8363d837542f8f935a" dependencies = [ "wasm-bindgen", ] @@ -1096,9 +1157,9 @@ dependencies = [ [[package]] name = "keccak" -version = "0.1.3" +version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3afef3b6eff9ce9d8ff9b3601125eec7f0c8cbac7abd14f355d053fa56c98768" +checksum = "8f6d5ed8676d904364de097082f4e7d240b571b67989ced0240f08b7f966f940" dependencies = [ "cpufeatures", ] @@ -1114,30 +1175,27 @@ dependencies = [ [[package]] name = "libc" -version = "0.2.141" +version = "0.2.147" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3304a64d199bb964be99741b7a14d26972741915b3649639149b2479bb46f4b5" +checksum = "b4668fb0ea861c1df094127ac5f1da3409a82116a4ba74fca2e58ef927159bb3" [[package]] name = "libm" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "348108ab3fba42ec82ff6e9564fc4ca0247bdccdc68dd8af9764bbc79c3c8ffb" +checksum = "f7012b1bbb0719e1097c47611d3898568c546d597c2e74d66f6087edd5233ff4" [[package]] name = "linux-raw-sys" -version = "0.3.1" +version = "0.3.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d59d8c75012853d2e872fb56bc8a2e53718e2cafe1a4c823143141c6d90c322f" +checksum = "ef53942eb7bf7ff43a617b3e2c1c4a5ecf5944a7c1bc12d7ee39bbb15e5c1519" [[package]] name = "log" -version = "0.4.17" +version = "0.4.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "abb12e687cfb44aa40f41fc3978ef76448f9b6038cad6aef4259d3c095a2382e" -dependencies = [ - "cfg-if", -] +checksum = "b06a4cde4c0f271a446782e3eff8de789548ce57dbc8eca9292c27f4a42004b4" [[package]] name = "memchr" @@ -1157,16 +1215,24 @@ version = "0.3.17" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6877bb514081ee2a7ff5ef9de3281f14a4dd4bceac4c09388074a6b5df8a139a" +[[package]] +name = "miniz_oxide" +version = "0.7.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e7810e0be55b428ada41041c41f32c9f1a42817901b4ccf45fa3d4b6561e74c7" +dependencies = [ + "adler", +] + [[package]] name = "mio" -version = "0.8.6" +version = "0.8.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b9d9a46eff5b4ff64b45a9e316a6d1e0bc719ef429cbec4dc630684212bfdf9" +checksum = "927a765cd3fc26206e66b296465fa9d3e5ab003e651c1b3c060e7956d96b19d2" dependencies = [ "libc", - "log", "wasi", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -1248,33 +1314,33 @@ dependencies = [ [[package]] name = "num_cpus" -version = "1.15.0" +version = "1.16.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0fac9e2da13b5eb447a6ce3d392f23a29d8694bff781bf03a16cd9ac8697593b" +checksum = "4161fcb6d602d4d2081af7c3a45852d875a03dd337a6bfdd6e06407b61342a43" dependencies = [ - "hermit-abi 0.2.6", + "hermit-abi 0.3.1", "libc", ] [[package]] name = "num_enum" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a0fa9d8a04aa0af7b5845b514a828f829ae3f0ec3f60d9842e1dfaeb49a0e68b" +checksum = "7a015b430d3c108a207fd776d2e2196aaf8b1cf8cf93253e3a097ff3085076a1" dependencies = [ "num_enum_derive", ] [[package]] name = "num_enum_derive" -version = "0.6.0" +version = "0.6.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e51dcc6bafb7f3ac88b65d2ad21f4b53d878e496712060e23011862ebd2d2d1" +checksum = "96667db765a921f7b295ffee8b60472b686a51d4f21c2ee4ffdb94c7013b65a6" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -1283,11 +1349,20 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "830b246a0e5f20af87141b25c173cd1b609bd7779a4617d6ec582abaf90870f3" +[[package]] +name = "object" +version = "0.31.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8bda667d9f2b5051b8833f59f3bf748b28ef54f850f4fcb389a252aa383866d1" +dependencies = [ + "memchr", +] + [[package]] name = "once_cell" -version = "1.17.1" +version = "1.18.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b7e5500299e16ebb147ae15a00a942af264cf3688f47923b8fc2cd5858f23ad3" +checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "open-fastrlp" @@ -1309,16 +1384,16 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "003b2be5c6c53c1cfeb0a238b8a1c3915cd410feb684457a36c10038f764bb1c" dependencies = [ "bytes", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] [[package]] name = "parity-scale-codec" -version = "3.4.0" +version = "3.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "637935964ff85a605d114591d4d2c13c5d1ba2806dae97cea6bf180238a749ac" +checksum = "d7467bc45fea3d77e829a4df331b9e969e2ec6a4dcd4e126e660f8509b40a475" dependencies = [ "arrayvec", "bitvec", @@ -1330,21 +1405,21 @@ dependencies = [ [[package]] name = "parity-scale-codec-derive" -version = "3.1.4" +version = "3.6.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "86b26a931f824dd4eca30b3e43bb4f31cd5f0d3a403c5f5ff27106b805bfde7b" +checksum = "2c9de611934c78014c455793552d0bf7d65a58211179c49996fde925aa667c38" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] [[package]] name = "percent-encoding" -version = "2.2.0" +version = "2.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "478c572c3d73181ff3c2539045f6eb99e5491218eae919370993b890cdbdd98e" +checksum = "9b2a4787296e9989611394c33f193f676704af1686e70b8f8033ab5ba9a35a94" [[package]] name = "pharos" @@ -1358,29 +1433,29 @@ dependencies = [ [[package]] name = "pin-project" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ad29a609b6bcd67fee905812e544992d216af9d755757c05ed2d0e15a74c6ecc" +checksum = "030ad2bc4db10a8944cb0d837f158bdfec4d4a4873ab701a95046770d11f8842" dependencies = [ "pin-project-internal", ] [[package]] name = "pin-project-internal" -version = "1.0.12" +version = "1.1.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "069bdb1e05adc7a8990dce9cc75370895fbe4e3d58b9b73bf1aee56359344a55" +checksum = "ec2e072ecce94ec471b13398d5402c188e76ac03cf74dd1a975161b23a3f6d9c" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] name = "pin-project-lite" -version = "0.2.9" +version = "0.2.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e0a7ae3ac2f1173085d398531c705756c94a4c56843785df85a60c1a0afac116" +checksum = "4c40d25201921e5ff0c862a505c6557ea88568a4e3ace775ab55e93f2f4f9d57" [[package]] name = "pin-utils" @@ -1409,9 +1484,9 @@ dependencies = [ [[package]] name = "portable-atomic" -version = "0.3.19" +version = "1.3.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26f6a7b87c2e435a3241addceeeff740ff8b7e76b74c13bf9acb17fa454ea00b" +checksum = "767eb9f07d4a5ebcb39bbf2d452058a93c011373abf6832e24194a1c3f004794" [[package]] name = "ppv-lite86" @@ -1450,8 +1525,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "da25490ff9892aab3fcf7c36f08cfb902dd3e71ca0f9f9517bea02a73a5ce38c" dependencies = [ "proc-macro-error-attr", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", "version_check", ] @@ -1462,8 +1537,8 @@ version = "1.0.4" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1be40180e52ecc98ad80b184934baf3d0d29f979574e439af5a55274b35f869" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "version_check", ] @@ -1478,29 +1553,28 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.56" +version = "1.0.63" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2b63bdb0cd06f1f4dedf69b254734f9b45af66e4a031e42a7480257d9898b435" +checksum = "7b368fba921b0dce7e60f5e04ec15e565b3303972b42bcfde1d0713b881959eb" dependencies = [ "unicode-ident", ] [[package]] name = "proptest" -version = "1.1.0" +version = "1.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "29f1b898011ce9595050a68e60f90bad083ff2987a695a42357134c8381fba70" +checksum = "4e35c06b98bf36aba164cc17cb25f7e232f5c4aeea73baa14b8a9f0d92dbfa65" dependencies = [ "bit-set", "bitflags 1.3.2", "byteorder", "lazy_static", "num-traits", - "quick-error 2.0.1", "rand", "rand_chacha", "rand_xorshift", - "regex-syntax", + "regex-syntax 0.6.29", "rusty-fork", "tempfile", "unarray", @@ -1523,12 +1597,6 @@ version = "1.2.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1d01941d82fa2ab50be1e79e6714289dd7cde78eba4c074bc5a4374f650dfe0" -[[package]] -name = "quick-error" -version = "2.0.1" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a993555f31e5a609f617c12db6250dedcac1b0a85076912c436e6fc9b2c8e6a3" - [[package]] name = "quote" version = "0.6.13" @@ -1540,11 +1608,11 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.26" +version = "1.0.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4424af4bf778aae2051a77b60283332f386554255d722233d09fbfc7e30da2fc" +checksum = "573015e8ab27661678357f27dc26460738fd2b6c86e46f386fde94cb5d913105" dependencies = [ - "proc-macro2 1.0.56", + "proc-macro2 1.0.63", ] [[package]] @@ -1603,13 +1671,13 @@ dependencies = [ [[package]] name = "regex" -version = "1.7.3" +version = "1.8.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8b1f693b24f6ac912f4893ef08244d70b6067480d2f1a46e950c9691e6749d1d" +checksum = "d0ab3ca65655bb1e41f2a8c8cd662eb4fb035e67c3f78da1d61dffe89d07300f" dependencies = [ "aho-corasick", "memchr", - "regex-syntax", + "regex-syntax 0.7.2", ] [[package]] @@ -1618,13 +1686,19 @@ version = "0.6.29" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f162c6dd7b008981e4d40210aca20b4bd0f9b60ca9271061b07f78537722f2e1" +[[package]] +name = "regex-syntax" +version = "0.7.2" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "436b050e76ed2903236f032a59761c1eb99e1b0aead2c257922771dab1fc8c78" + [[package]] name = "reqwest" -version = "0.11.16" +version = "0.11.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "27b71749df584b7f4cac2c426c127a7c785a5106cc98f7a8feb044115f0fa254" +checksum = "cde824a14b7c14f85caff81225f411faacc04a2013f41670f41443742b1c1c55" dependencies = [ - "base64 0.21.0", + "base64 0.21.2", "bytes", "encoding_rs", "futures-core", @@ -1653,7 +1727,7 @@ dependencies = [ "wasm-bindgen", "wasm-bindgen-futures", "web-sys", - "webpki-roots", + "webpki-roots 0.22.6", "winreg", ] @@ -1713,7 +1787,7 @@ version = "1.1.2" dependencies = [ "arbitrary", "auto_impl", - "bitflags 2.2.1", + "bitflags 2.3.3", "bitvec", "bytes", "derive_more", @@ -1816,8 +1890,8 @@ version = "0.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "e33d7b2abe0c340d8797fe2907d3f20d3b5ea5908683618bfe80df7f621f672a" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] @@ -1844,6 +1918,12 @@ version = "1.0.2" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "62cc5760263ea229d367e7dff3c0cbf09e4797a125bd87059a6c095804f3b2d1" +[[package]] +name = "rustc-demangle" +version = "0.1.23" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "d626bb9dae77e28219937af045c257c28bfd3f69333c512553507f5f9798cb76" + [[package]] name = "rustc-hex" version = "2.1.0" @@ -1861,37 +1941,47 @@ dependencies = [ [[package]] name = "rustix" -version = "0.37.7" +version = "0.37.22" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aae838e49b3d63e9274e1c01833cc8139d3fec468c3b84688c628f44b1ae11d" +checksum = "8818fa822adcc98b18fedbb3632a6a33213c070556b5aa7c4c8cc21cff565c4c" dependencies = [ "bitflags 1.3.2", "errno", "io-lifetimes", "libc", "linux-raw-sys", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] name = "rustls" -version = "0.20.8" +version = "0.21.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fff78fc74d175294f4e83b28343315ffcfb114b156f0185e9741cb5570f50e2f" +checksum = "e32ca28af694bc1bbf399c33a516dbdf1c90090b8ab23c2bc24f834aa2247f5f" dependencies = [ "log", "ring", + "rustls-webpki", "sct", - "webpki", ] [[package]] name = "rustls-pemfile" -version = "1.0.2" +version = "1.0.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "2d3987094b1d07b653b7dfdc3f70ce9a1da9c51ac18c1b06b662e4f9a0e9f4b2" +dependencies = [ + "base64 0.21.2", +] + +[[package]] +name = "rustls-webpki" +version = "0.100.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d194b56d58803a43635bdc398cd17e383d6f71f9182b9a192c127ca42494a59b" +checksum = "d6207cd5ed3d8dca7816f8f3725513a34609c0c765bf652b8c3cb4cfd87db46b" dependencies = [ - "base64 0.21.0", + "ring", + "untrusted", ] [[package]] @@ -1907,7 +1997,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "cb3dcc6e454c328bb824492db107ab7c0ae8fcffe4ad210136ef014458c1bc4f" dependencies = [ "fnv", - "quick-error 1.2.3", + "quick-error", "tempfile", "wait-timeout", ] @@ -1929,9 +2019,9 @@ dependencies = [ [[package]] name = "scale-info" -version = "2.5.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0cfdffd972d76b22f3d7f81c8be34b2296afd3a25e0a547bd9abe340a4dbbe97" +checksum = "ad560913365790f17cbf12479491169f01b9d46d29cfc7422bf8c64bdc61b731" dependencies = [ "cfg-if", "derive_more", @@ -1941,13 +2031,13 @@ dependencies = [ [[package]] name = "scale-info-derive" -version = "2.5.0" +version = "2.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "61fa974aea2d63dd18a4ec3a49d59af9f34178c73a4f56d2f18205628d00681e" +checksum = "19df9bd9ace6cc2fe19387c96ce677e823e07d017ceed253e7bb3d1d1bd9c73b" dependencies = [ "proc-macro-crate", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] @@ -1963,9 +2053,9 @@ dependencies = [ [[package]] name = "sec1" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "48518a2b5775ba8ca5b46596aae011caa431e6ce7e4a67ead66d92f08884220e" +checksum = "f0aec48e813d6b90b15f0b8948af3c63483992dee44c03e9930b3eebdabe046e" dependencies = [ "base16ct", "der", @@ -2013,31 +2103,31 @@ checksum = "cd0b0ec5f1c1ca621c432a25813d8d60c88abe6d3e08a3eb9cf37d97a0fe3d73" [[package]] name = "serde" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bb2f3770c8bce3bcda7e149193a069a0f4365bda1fa5cd88e03bca26afc1216c" +checksum = "9e8c8cf938e98f769bc164923b06dce91cea1751522f46f8466461af04c9027d" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.160" +version = "1.0.164" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "291a097c63d8497e00160b166a967a4a79c64f3facdd01cbd7502231688d77df" +checksum = "d9735b638ccc51c28bf6914d90a2e9725b377144fc612c49a611fddd1b631d68" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] name = "serde_json" -version = "1.0.96" +version = "1.0.99" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "057d394a50403bcac12672b2b18fb387ab6d289d957dab67dd201875391e52f1" +checksum = "46266871c240a00b8f503b877622fe33430b3c7d963bdc0f2adc511e54a1eae3" dependencies = [ - "indexmap", + "indexmap 2.0.0", "itoa", "ryu", "serde", @@ -2068,9 +2158,9 @@ dependencies = [ [[package]] name = "sha2" -version = "0.10.6" +version = "0.10.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "82e6b795fe2e3b1e845bafcb27aa35405c4d47cdfc92af5fc8d3002f76cebdc0" +checksum = "479fb9d862239e610720565ca91403019f2f00410f1864c5aa7479b950a76ed8" dependencies = [ "cfg-if", "cpufeatures", @@ -2079,9 +2169,9 @@ dependencies = [ [[package]] name = "sha3" -version = "0.10.7" +version = "0.10.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c2bb1a323307527314a36bfb73f24febb08ce2b8a554bf4ffd6f51ad15198c" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" dependencies = [ "digest", "keccak", @@ -2089,9 +2179,9 @@ dependencies = [ [[package]] name = "signature" -version = "2.0.0" +version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8fe458c98333f9c8152221191a77e2a44e8325d0193484af2e9421a53019e57d" +checksum = "5e1788eed21689f9cf370582dfc467ef36ed9c707f073528ddafa8d83e3b8500" dependencies = [ "digest", "rand_core", @@ -2124,9 +2214,9 @@ checksum = "6e63cff320ae2c57904679ba7cb63280a3dc4613885beafb148ee7bf9aa9042d" [[package]] name = "spki" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "37a5be806ab6f127c3da44b7378837ebf01dadca8510a0e572460216b228bd0e" +checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" dependencies = [ "base64ct", "der", @@ -2163,8 +2253,8 @@ checksum = "dcb5ae327f9cc13b68763b5749770cb9e048a99bd9dfdfa58d0cf05d5f64afe0" dependencies = [ "heck 0.3.3", "proc-macro-error", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "syn 1.0.109", ] @@ -2184,8 +2274,8 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1e385be0d24f186b4ce2f9982191e7101bb737312ad61c1f2f984f34bcf85d59" dependencies = [ "heck 0.4.1", - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "rustversion", "syn 1.0.109", ] @@ -2205,9 +2295,9 @@ dependencies = [ [[package]] name = "subtle" -version = "2.4.1" +version = "2.5.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6bdef32e8150c2a081110b42772ffe7d7c9032b606bc226c8260fd97e0976601" +checksum = "81cdd64d312baedb58e21336b31bc043b77e01cc99033ce76ef539f78e965ebc" [[package]] name = "syn" @@ -2226,19 +2316,19 @@ version = "1.0.109" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "72b64191b275b66ffe2469e8af2c1cfe3bafa67b529ead792a6d0160888b4237" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "unicode-ident", ] [[package]] name = "syn" -version = "2.0.13" +version = "2.0.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c9da457c5285ac1f936ebd076af6dac17a61cfe7826f2076b4d015cf47bc8ec" +checksum = "59fb7d6d8281a51045d62b8eb3a7d1ce347b76f312af50cd3dc0af39c87c1737" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", + "proc-macro2 1.0.63", + "quote 1.0.29", "unicode-ident", ] @@ -2250,15 +2340,16 @@ checksum = "55937e1799185b12863d447f42597ed69d9928686b8d88a1df17376a097d8369" [[package]] name = "tempfile" -version = "3.5.0" +version = "3.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b9fbec84f381d5795b08656e4912bec604d162bff9291d6189a78f4c8ab87998" +checksum = "31c0432476357e58790aaa47a8efb0c5138f137343f3b5f23bd36a27e3b0a6d6" dependencies = [ + "autocfg", "cfg-if", "fastrand", "redox_syscall", "rustix", - "windows-sys 0.45.0", + "windows-sys 0.48.0", ] [[package]] @@ -2285,9 +2376,9 @@ version = "1.0.40" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "f9456a42c5b0d803c8cd86e73dd7cc9edd429499f37a3550d286d5e86720569f" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] @@ -2316,11 +2407,12 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.28.0" +version = "1.29.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c3c786bf8134e5a3a166db9b29ab8f48134739014a3eca7bc6bfa95d673b136f" +checksum = "532826ff75199d5833b9d2c5fe410f29235e25704ee5f0ef599fb51c21f4a4da" dependencies = [ "autocfg", + "backtrace", "bytes", "libc", "mio", @@ -2337,27 +2429,26 @@ version = "2.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 2.0.13", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] name = "tokio-rustls" -version = "0.23.4" +version = "0.24.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c43ee83903113e03984cb9e5cebe6c04a5116269e900e3ddba8f068a62adda59" +checksum = "c28327cf380ac148141087fbfb9de9d7bd4e84ab5d2c28fbc911d753de8a7081" dependencies = [ "rustls", "tokio", - "webpki", ] [[package]] name = "tokio-tungstenite" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54319c93411147bced34cb5609a80e0a8e44c5999c93903a81cd866630ec0bfd" +checksum = "ec509ac96e9a0c43427c74f003127d953a265737636129424288d27cb5c4b12c" dependencies = [ "futures-util", "log", @@ -2365,15 +2456,14 @@ dependencies = [ "tokio", "tokio-rustls", "tungstenite", - "webpki", - "webpki-roots", + "webpki-roots 0.23.1", ] [[package]] name = "tokio-util" -version = "0.7.7" +version = "0.7.8" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5427d89453009325de0d8f342c9490009f76e999cb7672d77e46267448f7e6b2" +checksum = "806fe8c2c87eccc8b3267cbae29ed3ab2d0bd37fca70ab622e46aaa9375ddb7d" dependencies = [ "bytes", "futures-core", @@ -2385,17 +2475,17 @@ dependencies = [ [[package]] name = "toml_datetime" -version = "0.6.1" +version = "0.6.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3ab8ed2edee10b50132aed5f331333428b011c99402b5a534154ed15746f9622" +checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" [[package]] name = "toml_edit" -version = "0.19.8" +version = "0.19.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "239410c8609e8125456927e6707163a3b1fdb40561e4b803bc041f466ccfdc13" +checksum = "266f016b7f039eec8a1a80dfe6156b633d208b9fccca5e4db1d6775b0c4e34a7" dependencies = [ - "indexmap", + "indexmap 2.0.0", "toml_datetime", "winnow", ] @@ -2420,20 +2510,20 @@ dependencies = [ [[package]] name = "tracing-attributes" -version = "0.1.23" +version = "0.1.26" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4017f8f45139870ca7e672686113917c71c7a6e02d4924eda67186083c03081a" +checksum = "5f4f31f56159e98206da9efd823404b79b6ef3143b4a7ab76e67b1751b25a4ab" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", ] [[package]] name = "tracing-core" -version = "0.1.30" +version = "0.1.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "24eb03ba0eab1fd845050058ce5e616558e8f8d8fca633e6b163fe25c797213a" +checksum = "0955b8137a1df6f1a2e9a37d8a6656291ff0297c1a97c24e0d8425fe2312f79a" dependencies = [ "once_cell", ] @@ -2466,13 +2556,13 @@ checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" [[package]] name = "tungstenite" -version = "0.18.0" +version = "0.19.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "30ee6ab729cd4cf0fd55218530c4522ed30b7b6081752839b68fcec8d0960788" +checksum = "15fba1a6d6bb030745759a9a2a588bfe8490fc8b4751a277db3a0be1c9ebbf67" dependencies = [ - "base64 0.13.1", "byteorder", "bytes", + "data-encoding", "http", "httparse", "log", @@ -2517,9 +2607,9 @@ checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" [[package]] name = "unicode-ident" -version = "1.0.8" +version = "1.0.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e5464a87b239f13a63a501f2701565754bae92d243d4bb7eb12f6d57d2269bf4" +checksum = "b15811caf2415fb889178633e7724bad2509101cde276048e013b9def5e51fa0" [[package]] name = "unicode-normalization" @@ -2562,9 +2652,9 @@ checksum = "a156c684c91ea7d62626509bce3cb4e1d9ed5c4d978f7b4352658f96a4c26b4a" [[package]] name = "url" -version = "2.3.1" +version = "2.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d68c799ae75762b8c3fe375feb6600ef5602c883c5d21eb51c09f22b83c4643" +checksum = "50bff7831e19200a85b17131d085c25d7811bc4e186efdaf54bbd132994a88cb" dependencies = [ "form_urlencoded", "idna", @@ -2610,11 +2700,10 @@ dependencies = [ [[package]] name = "want" -version = "0.3.0" +version = "0.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1ce8a968cb1cd110d136ff8b819a556d6fb6d919363c61534f6860c7eb172ba0" +checksum = "bfa7760aed19e106de2c7c0b581b509f2f25d3dacaf737cb82ac61bc6d760b0e" dependencies = [ - "log", "try-lock", ] @@ -2626,9 +2715,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "31f8dcbc21f30d9b8f2ea926ecb58f6b91192c17e9d33594b3df58b2007ca53b" +checksum = "7706a72ab36d8cb1f80ffbf0e071533974a60d0a308d01a5d0375bf60499a342" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -2636,24 +2725,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95ce90fd5bcc06af55a641a86428ee4229e44e07033963a2290a8e241607ccb9" +checksum = "5ef2b6d3c510e9625e5fe6f509ab07d66a760f0885d858736483c32ed7809abd" dependencies = [ "bumpalo", "log", "once_cell", - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.34" +version = "0.4.37" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f219e0d211ba40266969f6dbdd90636da12f75bee4fc9d6c23d1260dadb51454" +checksum = "c02dbc21516f9f1f04f187958890d7e6026df8d16540b7ad9492bc34a67cea03" dependencies = [ "cfg-if", "js-sys", @@ -2663,38 +2752,38 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4c21f77c0bedc37fd5dc21f897894a5ca01e7bb159884559461862ae90c0b4c5" +checksum = "dee495e55982a3bd48105a7b947fd2a9b4a8ae3010041b9e0faab3f9cd028f1d" dependencies = [ - "quote 1.0.26", + "quote 1.0.29", "wasm-bindgen-macro-support", ] [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2aff81306fcac3c7515ad4e177f521b5c9a15f2b08f4e32d823066102f35a5f6" +checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ - "proc-macro2 1.0.56", - "quote 1.0.26", - "syn 1.0.109", + "proc-macro2 1.0.63", + "quote 1.0.29", + "syn 2.0.23", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.84" +version = "0.2.87" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0046fef7e28c3804e5e38bfa31ea2a0f73905319b677e57ebe37e49358989b5d" +checksum = "ca6ad05a4870b2bf5fe995117d3728437bd27d7cd5f06f13c17443ef369775a1" [[package]] name = "web-sys" -version = "0.3.61" +version = "0.3.64" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e33b99f4b23ba3eec1a53ac264e35a755f00e966e0065077d6027c0f575b0b97" +checksum = "9b85cbef8c220a6abc02aefd892dfc0fc23afb1c6a426316ec33253a3877249b" dependencies = [ "js-sys", "wasm-bindgen", @@ -2719,6 +2808,15 @@ dependencies = [ "webpki", ] +[[package]] +name = "webpki-roots" +version = "0.23.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b03058f88386e5ff5310d9111d53f48b17d732b401aeb83a8d5190f2ac459338" +dependencies = [ + "rustls-webpki", +] + [[package]] name = "winapi" version = "0.3.9" @@ -2750,21 +2848,6 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" -[[package]] -name = "windows-sys" -version = "0.42.0" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5a3e1820f08b8513f676f7ab6c1f99ff312fb97b553d30ff4dd86f9f15728aa7" -dependencies = [ - "windows_aarch64_gnullvm 0.42.2", - "windows_aarch64_msvc 0.42.2", - "windows_i686_gnu 0.42.2", - "windows_i686_msvc 0.42.2", - "windows_x86_64_gnu 0.42.2", - "windows_x86_64_gnullvm 0.42.2", - "windows_x86_64_msvc 0.42.2", -] - [[package]] name = "windows-sys" version = "0.45.0" @@ -2780,7 +2863,7 @@ version = "0.48.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "677d2418bec65e3338edb076e806bc1ec15693c5d0104683f2efe857f61056a9" dependencies = [ - "windows-targets 0.48.0", + "windows-targets 0.48.1", ] [[package]] @@ -2800,9 +2883,9 @@ dependencies = [ [[package]] name = "windows-targets" -version = "0.48.0" +version = "0.48.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b1eb6f0cd7c80c79759c929114ef071b87354ce476d9d94271031c0497adfd5" +checksum = "05d4b17490f70499f20b9e791dcf6a299785ce8af4d709018206dc5b4953e95f" dependencies = [ "windows_aarch64_gnullvm 0.48.0", "windows_aarch64_msvc 0.48.0", @@ -2899,9 +2982,9 @@ checksum = "1a515f5799fe4961cb532f983ce2b23082366b898e52ffbce459c86f67c8378a" [[package]] name = "winnow" -version = "0.4.1" +version = "0.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ae8970b36c66498d8ff1d66685dc86b91b29db0c7739899012f63a63814b4b28" +checksum = "ca0ace3845f0d96209f0375e6d367e3eb87eb65d27d445bdc9f1843a26f39448" dependencies = [ "memchr", ] From f630ec894995b6cf6e67e20458adde6a1b8c1bf9 Mon Sep 17 00:00:00 2001 From: rakita Date: Mon, 3 Jul 2023 00:19:45 +0200 Subject: [PATCH 24/24] cargo fmt with updated cargo --- crates/interpreter/src/instructions/host.rs | 8 +++++-- crates/revm/src/evm_impl.rs | 24 +++++++++++++++------ 2 files changed, 24 insertions(+), 8 deletions(-) diff --git a/crates/interpreter/src/instructions/host.rs b/crates/interpreter/src/instructions/host.rs index 365306c935..6ec62ae26d 100644 --- a/crates/interpreter/src/instructions/host.rs +++ b/crates/interpreter/src/instructions/host.rs @@ -299,7 +299,9 @@ pub fn create( let mut create_input: Option> = None; prepare_create_inputs::(interpreter, &mut create_input); - let Some(mut create_input) = create_input else { return }; + let Some(mut create_input) = create_input else { + return; + }; let (return_reason, address, gas, return_data) = host.create(&mut create_input); @@ -518,7 +520,9 @@ pub fn call_inner( &mut call_input, ); - let Some(mut call_input) = call_input else { return }; + let Some(mut call_input) = call_input else { + return; + }; // Call host to interact with target contract let (reason, gas, return_data) = host.call(&mut call_input); diff --git a/crates/revm/src/evm_impl.rs b/crates/revm/src/evm_impl.rs index 43337401f8..b76baac58c 100644 --- a/crates/revm/src/evm_impl.rs +++ b/crates/revm/src/evm_impl.rs @@ -278,10 +278,13 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, }; // transfer fee to coinbase/beneficiary. - let Ok((coinbase_account,_)) = self + let Ok((coinbase_account, _)) = self .data .journaled_state - .load_account(coinbase, self.data.db) else { panic!("coinbase account not found");}; + .load_account(coinbase, self.data.db) + else { + panic!("coinbase account not found"); + }; coinbase_account.mark_touch(); coinbase_account.info.balance = coinbase_account .info @@ -316,8 +319,13 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, } // Fetch balance of caller. - let Some((caller_balance,_)) = self.balance(inputs.caller) else { - return Err(CreateResult{result: InstructionResult::FatalExternalError, created_address: None, gas, return_value: Bytes::new()}); + let Some((caller_balance, _)) = self.balance(inputs.caller) else { + return Err(CreateResult { + result: InstructionResult::FatalExternalError, + created_address: None, + gas, + return_value: Bytes::new(), + }); }; // Check if caller has enough balance to send to the crated contract. @@ -586,8 +594,12 @@ impl<'a, GSPEC: Spec, DB: Database, const INSPECT: bool> EVMImpl<'a, GSPEC, DB, fn prepare_call(&mut self, inputs: &mut CallInputs) -> Result { let gas = Gas::new(inputs.gas_limit); // Load account and get code. Account is now hot. - let Some((bytecode,_)) = self.code(inputs.contract) else { - return Err(CallResult{result: InstructionResult::FatalExternalError, gas, return_value: Bytes::new()}); + let Some((bytecode, _)) = self.code(inputs.contract) else { + return Err(CallResult { + result: InstructionResult::FatalExternalError, + gas, + return_value: Bytes::new(), + }); }; // Check depth