diff --git a/.changeset/fifty-eggs-jam.md b/.changeset/fifty-eggs-jam.md new file mode 100644 index 0000000000..f5f40264d6 --- /dev/null +++ b/.changeset/fifty-eggs-jam.md @@ -0,0 +1,5 @@ +--- +"@nomicfoundation/edr": minor +--- + +Added `Response::traces` method with a raw trace format compatible with EthereumJS' VM. A failed create reports no `contractAddress`, unlike EthereumJS. diff --git a/Cargo.lock b/Cargo.lock index b839d65e93..9d7bd34695 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -3310,7 +3310,6 @@ dependencies = [ "edr_solidity", "edr_solidity_tests", "edr_state_api", - "edr_tracing", "edr_utils_sync", "foundry-cheatcodes", "foundry-compilers", @@ -3502,7 +3501,6 @@ dependencies = [ "edr_state_api", "edr_test_block_replay", "edr_test_utils", - "edr_tracing", "edr_transaction", "edr_utils", "edr_utils_sync", @@ -3720,7 +3718,6 @@ dependencies = [ "edr_decoder_revert", "edr_defaults", "edr_primitives", - "edr_tracing", "foundry-compilers", "foundry-evm-core", "foundry-evm-traces", @@ -7541,8 +7538,7 @@ dependencies = [ [[package]] name = "revm-inspectors" version = "0.42.2" -source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "90c136a072540987ee442e9824631835520b13e5756f20780a637ba2e11f9c28" +source = "git+https://github.com/Wodann/revm-inspectors?branch=feat%2Ftop-of-stack-snapshot-0.42#10fb30837d5d4c9151d47790e98b4a2bb1471640" dependencies = [ "alloy-primitives", "alloy-rpc-types-eth", diff --git a/Cargo.toml b/Cargo.toml index 0dd6dc7e1b..53ba4d8f73 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -274,7 +274,11 @@ c-kzg = { version = "2.1.8", default-features = false, features = [ "ethereum_kzg_settings", ] } -revm-inspectors = { version = "0.42.2", features = ["serde"] } +# Temporary fork: revm-inspectors 0.42.2 with paradigmxyz/revm-inspectors#468 +# applied, which adds `StackSnapshotType::Top`. That change ships in +# revm-inspectors 0.44, which needs revm 43. Drop the fork once EDR is on +# revm >= 43. +revm-inspectors = { git = "https://github.com/Wodann/revm-inspectors", branch = "feat/top-of-stack-snapshot-0.42", features = ["serde"] } # No foundry-fork-db release supports revm 42 (0.27.0 on crates.io pins revm # ^41; the next fork-db bump goes straight to revm 43), so a foundry-core git # revision is used: the one Foundry v1.8.0 and v1.8.1 (the stable releases on diff --git a/crates/edr_napi/Cargo.toml b/crates/edr_napi/Cargo.toml index ca79afcb77..be23f36f51 100644 --- a/crates/edr_napi/Cargo.toml +++ b/crates/edr_napi/Cargo.toml @@ -40,7 +40,6 @@ edr_solidity_tests.workspace = true edr_state_api.workspace = true edr_signer.workspace = true edr_solidity.workspace = true -edr_tracing.workspace = true edr_utils_sync.workspace = true k256.workspace = true mimalloc-safe = { workspace = true, features = ["local_dynamic_tls"] } diff --git a/crates/edr_napi/index.d.ts b/crates/edr_napi/index.d.ts index be5dce3066..a4768612d4 100644 --- a/crates/edr_napi/index.d.ts +++ b/crates/edr_napi/index.d.ts @@ -91,10 +91,6 @@ export declare class Provider { export declare class ProviderFactory {} -export declare class RawTrace { - get trace(): Array -} - export declare class Response { /** Returns the response data as a JSON string or a JSON object. */ get data(): string | any @@ -108,6 +104,12 @@ export declare class Response { * request's call itself. */ callTraces(): Array + /** + * Returns the raw traces of executed contracts. This may contain zero or + * more traces. Uses a function instead of a getter to avoid repeated + * expensive conversions. + */ + traces(): Array> } export declare class ReturnData { @@ -314,11 +316,6 @@ export declare enum CallKind { Create = 4, } -export interface CallOutput { - /** Return value */ - returnValue: Uint8Array -} - /** The result of executing a call override. */ export interface CallOverrideResult { result: Uint8Array @@ -493,13 +490,6 @@ export interface CounterExampleSequence { /** The instrumentation coverage library file name. */ export declare const COVERAGE_LIBRARY_FILE_NAME: string -export interface CreateOutput { - /** Return value */ - returnValue: Uint8Array - /** Optionally, a 160-bit address */ - address?: Uint8Array -} - export interface CustomErrorStackTraceEntry { type: StackTraceEntryType.CUSTOM_ERROR message: string @@ -591,14 +581,6 @@ export interface ExecutionLog { data: Uint8Array } -/** The result of executing a transaction. */ -export interface ExecutionResult { - /** The transaction result */ - result: SuccessResult | RevertResult | HaltResult - /** Optional contract address if the transaction created a new contract. */ - contractAddress?: Uint8Array -} - /** Represents the exit code of the EVM. */ export declare enum ExitCode { /** Execution was successful. */ @@ -814,19 +796,6 @@ export declare const GENERIC_CHAIN_TYPE: string export declare function genericChainProviderFactory(): ProviderFactory -/** The result when the EVM terminates due to an exceptional halt. */ -export interface HaltResult { - /** The exceptional halt that occurred */ - reason: ExceptionalHalt - /** - * Halting will spend all the gas and will thus be equal to the specified - * gas limit - */ - gasUsed: bigint - /** The logs */ - logs: Array -} - /** Configuration for a hardfork activation */ export interface HardforkActivation { /** The condition for the hardfork activation */ @@ -1341,6 +1310,15 @@ export interface ObservabilityConfig { * Defaults to `IncludeTraces.None`. */ includeCallTraces?: IncludeTraces + /** + * How much of the stack each step of `Response.traces()` records. + * + * This will be overridden if `Provider.setVerboseTracing(true)` is called, + * which records the full stack until it is disabled again. + * + * Defaults to `StackSnapshotType.None`. + */ + recordStack?: StackSnapshotType } export declare const OP_CHAIN_TYPE: string @@ -1527,16 +1505,6 @@ export interface RevertErrorStackTraceEntry { isInvalidOpcodeError: boolean } -/** The result when the EVM terminates due to a revert. */ -export interface RevertResult { - /** The amount of gas used */ - gasUsed: bigint - /** The logs */ - logs: Array - /** The transaction output */ - output: Uint8Array -} - /** * Derives the secp256k1 public key of the provided secret key, returning it * in uncompressed SEC1 form: 65 bytes, `0x04 || X || Y`. @@ -1832,6 +1800,16 @@ export interface SourceReference { range: Array } +/** How much of the stack each step of a raw trace records. */ +export declare enum StackSnapshotType { + /** No stack entries. */ + None = 0, + /** The full stack. */ + Full = 1, + /** Only the top entry of the stack. */ + Top = 2, +} + /** The stack trace result */ export interface StackTrace { /** Enum tag for JS. */ @@ -1916,20 +1894,6 @@ export declare enum SuccessReason { SelfDestruct = 2, } -/** The result when the EVM terminates successfully. */ -export interface SuccessResult { - /** The reason for termination */ - reason: SuccessReason - /** The amount of gas used */ - gasUsed: bigint - /** The amount of gas refunded */ - gasRefunded: bigint - /** The logs */ - logs: Array - /** The transaction output */ - output: CallOutput | CreateOutput -} - /** * See [`edr_solidity_tests::result::SuiteResult`] * @@ -1982,49 +1946,64 @@ export interface TracingConfigWithBuffers { ignoreContracts?: boolean } +/** Matches Hardhat's `MinimalExecResult` interface. */ +export interface TracingExecResult { + /** Whether execution succeeded */ + readonly success: boolean + /** Gas used during execution */ + readonly executionGasUsed: bigint + /** Address of the created contract. None if the create failed. */ + readonly contractAddress?: Uint8Array + /** The reason for the exit (success or halt) */ + readonly reason?: SuccessReason | ExceptionalHalt + /** The output data */ + readonly output?: Uint8Array +} + +/** Matches Hardhat's `MinimalMessage` interface. */ export interface TracingMessage { /** Sender address */ readonly caller: Uint8Array /** Recipient address. None if it is a Create message. */ readonly to?: Uint8Array - /** Whether it's a static call */ - readonly isStaticCall: boolean - /** Transaction gas limit */ - readonly gasLimit: bigint - /** Depth of the message */ - readonly depth: number - /** Input data of the message */ - readonly data: Uint8Array - /** Value sent in the message */ - readonly value: bigint /** * Address of the code that is being executed. Can be different from `to` * if a delegate call is being done. */ readonly codeAddress?: Uint8Array - /** Code of the contract that is being executed. */ - readonly code?: Uint8Array + /** Value sent in the message */ + readonly value: bigint + /** Input data of the message */ + readonly data: Uint8Array + /** Transaction gas limit */ + readonly gasLimit: bigint + /** Whether it's a static call */ + readonly isStaticCall: boolean } +/** Matches Hardhat's `MinimalEVMResult` interface. */ export interface TracingMessageResult { - /** Execution result */ - readonly executionResult: ExecutionResult + /** The execution result */ + readonly execResult: TracingExecResult } +/** Opcode information for a tracing step. */ +export interface TracingOpcode { + /** The name of the opcode */ + readonly name: string +} + +/** Matches Hardhat's `MinimalInterpreterStep` interface. */ export interface TracingStep { + /** The program counter */ + readonly pc: number /** Call depth */ readonly depth: number - /** The program counter */ - readonly pc: bigint - /** The executed op code */ - readonly opcode: string - /** - * The entries on the stack. It only contains the top element unless - * verbose tracing is enabled. The vector is empty if there are no elements - * on the stack. - */ + /** The executed opcode */ + readonly opcode: TracingOpcode + /** The stack entries, as many as `ObservabilityConfig.recordStack` records. */ readonly stack: Array - /** The memory at the step. None if verbose tracing is disabled. */ + /** The memory at the step. None unless verbose tracing is enabled. */ readonly memory?: Uint8Array } diff --git a/crates/edr_napi/index.js b/crates/edr_napi/index.js index 6a264c8226..5bf2277419 100644 --- a/crates/edr_napi/index.js +++ b/crates/edr_napi/index.js @@ -785,7 +785,6 @@ module.exports.Exit = nativeBinding.Exit module.exports.Precompile = nativeBinding.Precompile module.exports.Provider = nativeBinding.Provider module.exports.ProviderFactory = nativeBinding.ProviderFactory -module.exports.RawTrace = nativeBinding.RawTrace module.exports.Response = nativeBinding.Response module.exports.ReturnData = nativeBinding.ReturnData module.exports.SolidityTestRunnerFactory = nativeBinding.SolidityTestRunnerFactory @@ -834,6 +833,7 @@ module.exports.precompileP256Verify = nativeBinding.precompileP256Verify module.exports.printStackTrace = nativeBinding.printStackTrace module.exports.RECEIVE_FUNCTION_NAME = nativeBinding.RECEIVE_FUNCTION_NAME module.exports.secp256k1PublicKeyFromSecretKey = nativeBinding.secp256k1PublicKeyFromSecretKey +module.exports.StackSnapshotType = nativeBinding.StackSnapshotType module.exports.StackTraceEntryType = nativeBinding.StackTraceEntryType module.exports.stackTraceEntryTypeToString = nativeBinding.stackTraceEntryTypeToString module.exports.SuccessReason = nativeBinding.SuccessReason diff --git a/crates/edr_napi/src/config.rs b/crates/edr_napi/src/config.rs index 2b9d049e7f..8c17985702 100644 --- a/crates/edr_napi/src/config.rs +++ b/crates/edr_napi/src/config.rs @@ -254,6 +254,27 @@ impl TryFrom for edr_provider::config::Local { } } +/// How much of the stack each step of a raw trace records. +#[napi] +pub enum StackSnapshotType { + /// No stack entries. + None, + /// The full stack. + Full, + /// Only the top entry of the stack. + Top, +} + +impl From for edr_provider::observability::StackSnapshotType { + fn from(value: StackSnapshotType) -> Self { + match value { + StackSnapshotType::None => Self::None, + StackSnapshotType::Full => Self::Full, + StackSnapshotType::Top => Self::Top, + } + } +} + /// Configuration for runtime observability. #[napi(object)] pub struct ObservabilityConfig<'env> { @@ -266,6 +287,13 @@ pub struct ObservabilityConfig<'env> { /// /// Defaults to `IncludeTraces.None`. pub include_call_traces: Option, + /// How much of the stack each step of `Response.traces()` records. + /// + /// This will be overridden if `Provider.setVerboseTracing(true)` is called, + /// which records the full stack until it is disabled again. + /// + /// Defaults to `StackSnapshotType.None`. + pub record_stack: Option, } /// Configuration for a provider. @@ -670,6 +698,9 @@ impl ObservabilityConfig<'_> { ), on_collected_coverage_fn, on_collected_gas_report_fn, + record_stack: self + .record_stack + .map_or(default_config.record_stack, Into::into), verbose_raw_tracing: default_config.verbose_raw_tracing, }) } diff --git a/crates/edr_napi/src/context.rs b/crates/edr_napi/src/context.rs index 9022c6f5bc..99c6328404 100644 --- a/crates/edr_napi/src/context.rs +++ b/crates/edr_napi/src/context.rs @@ -128,6 +128,7 @@ impl EdrContext { (factory, dropped_provider_sender) }; + let record_stack = provider_config.observability.record_stack; let contract_decoder = Arc::clone(contract_decoder.as_inner()); runtime.clone().spawn_blocking(move || { let result = factory @@ -144,6 +145,7 @@ impl EdrContext { runtime, contract_decoder, dropped_provider_sender, + record_stack, #[cfg(feature = "scenarios")] scenario_file, )) @@ -411,6 +413,7 @@ impl EdrContext { runtime, Arc::default(), dropped_provider_sender, + edr_provider::observability::StackSnapshotType::None, #[cfg(feature = "scenarios")] None, ))) @@ -450,6 +453,7 @@ impl EdrContext { ) ); + let record_stack = provider_config.observability.record_stack; let contract_decoder = Arc::clone(contract_decoder.as_inner()); let timer = Arc::clone(time.as_inner()); @@ -496,6 +500,7 @@ impl EdrContext { runtime, contract_decoder, dropped_provider_sender, + record_stack, #[cfg(feature = "scenarios")] None, ))) diff --git a/crates/edr_napi/src/provider.rs b/crates/edr_napi/src/provider.rs index 968915b65f..25e53e26a3 100644 --- a/crates/edr_napi/src/provider.rs +++ b/crates/edr_napi/src/provider.rs @@ -8,6 +8,7 @@ use std::sync::{ }; use edr_napi_core::provider::SyncProvider; +use edr_provider::observability::{recorded_stack, StackSnapshotType}; use edr_solidity::artifacts::{ slang::extract_slang_contract_metadata, solc::extract_solc_contract_metadata, solx::extract_solx_contract_metadata, to_compiler_type, @@ -34,9 +35,12 @@ pub struct Provider { provider: Arc, runtime: runtime::Handle, dropped_provider_sender: AsyncDeallocatorSender>, + /// The configured stack snapshots, which verbose tracing overrides while + /// enabled. + record_stack: StackSnapshotType, /// What a response reports to V8 for each call trace arena it carries. - /// Follows `verbose_raw_tracing`, which [`Self::set_verbose_tracing`] - /// toggles. + /// Follows the recorded stack snapshots, which + /// [`Self::set_verbose_tracing`] changes. call_trace_external_mem_size: AtomicI64, #[cfg(feature = "scenarios")] scenario_file: Option>>, @@ -47,11 +51,15 @@ impl Provider { /// /// Hand the result to JavaScript as a [`GcProvider`], so V8 learns of the /// OS thread it now owns. + /// + /// `record_stack` must match the provider's configuration, which starts + /// with verbose tracing disabled. pub(crate) fn new( provider: Arc, runtime: runtime::Handle, contract_decoder: Arc>, dropped_provider_sender: AsyncDeallocatorSender>, + record_stack: StackSnapshotType, #[cfg(feature = "scenarios")] scenario_file: Option< napi::tokio::sync::Mutex, >, @@ -61,9 +69,10 @@ impl Provider { provider, runtime, dropped_provider_sender, - // `verbose_raw_tracing` is not exposed in the provider config, so - // it starts disabled. - call_trace_external_mem_size: AtomicI64::new(call_trace_external_mem_size(false)), + record_stack, + call_trace_external_mem_size: AtomicI64::new(call_trace_external_mem_size( + record_stack, + )), #[cfg(feature = "scenarios")] scenario_file: scenario_file.map(Arc::new), } @@ -298,7 +307,7 @@ impl Provider { pub async fn set_verbose_tracing(&self, verbose_tracing: bool) -> napi::Result<()> { // Responses made from here on report the figure for this setting. self.call_trace_external_mem_size.store( - call_trace_external_mem_size(verbose_tracing), + call_trace_external_mem_size(recorded_stack(self.record_stack, verbose_tracing)), atomic::Ordering::Relaxed, ); diff --git a/crates/edr_napi/src/provider/response.rs b/crates/edr_napi/src/provider/response.rs index b0f744b11b..c00c4863e3 100644 --- a/crates/edr_napi/src/provider/response.rs +++ b/crates/edr_napi/src/provider/response.rs @@ -1,3 +1,4 @@ +use edr_provider::observability::StackSnapshotType; use edr_solidity::solidity_stack_trace::StackTraceCreationResult; use napi::{bindgen_prelude::Either3, Either}; use napi_derive::napi; @@ -5,13 +6,18 @@ use napi_derive::napi; use crate::{ gc::gc_tracked, solidity_tests::test_results::{CallTrace, HeuristicFailed, StackTrace, UnexpectedError}, - trace::solidity_stack_trace::{ - solidity_stack_trace_error_to_napi, solidity_stack_trace_heuristic_failed_to_napi, - solidity_stack_trace_success_to_napi, + trace::{ + raw_trace_from_call_trace_arena, + solidity_stack_trace::{ + solidity_stack_trace_error_to_napi, solidity_stack_trace_heuristic_failed_to_napi, + solidity_stack_trace_success_to_napi, + }, + TracingMessage, TracingMessageResult, TracingStep, }, }; -/// Bytes reported for one recorded call trace arena, without stack snapshots. +/// Bytes reported for one recorded call trace arena, without full stack +/// snapshots. /// /// A `CallTraceNode` is 384 bytes, so this stands for roughly 85 calls. The /// EVM steps that an arena also records are deliberately not counted. @@ -22,7 +28,7 @@ use crate::{ const CALL_TRACE_EXTERNAL_MEM_SIZE: i64 = 32 * 1024; /// Bytes reported for one recorded call trace arena whose steps also carry -/// stack snapshots, as `verbose_raw_tracing` records them. +/// full stack snapshots, as verbose tracing records them. /// /// PR #1301 measured 4.9x more retained memory in this configuration, so 4x /// stays on the low side of the only figures available. @@ -40,10 +46,10 @@ const VALUE_DATA_EXTERNAL_MEM_SIZE: i64 = 256 * 1024 * 1024; /// Bytes a response reports for each call trace arena it carries. /// -/// Recording stack snapshots retains several times as much, so a verbosely -/// recorded arena stands for more. -pub(crate) const fn call_trace_external_mem_size(verbose_tracing: bool) -> i64 { - if verbose_tracing { +/// Recording full stack snapshots retains several times as much, so such an +/// arena stands for more. +pub(crate) const fn call_trace_external_mem_size(recorded_stack: StackSnapshotType) -> i64 { + if recorded_stack.is_full() || recorded_stack.is_all() { VERBOSE_CALL_TRACE_EXTERNAL_MEM_SIZE } else { CALL_TRACE_EXTERNAL_MEM_SIZE @@ -142,16 +148,17 @@ impl Response { .collect() } - // TODO(#1288): Add backwards compatibility layer for Hardhat 2 - // #[doc = "Returns the raw traces of executed contracts. This maybe contain - // zero or more traces."] #[napi(catch_unwind, getter)] - // pub fn traces(&self) -> Vec { - // self.inner - // .call_trace_arenas - // .iter() - // .map(|trace| RawTrace::from(trace.clone())) - // .collect() - // } + /// Returns the raw traces of executed contracts. This may contain zero or + /// more traces. Uses a function instead of a getter to avoid repeated + /// expensive conversions. + #[napi(catch_unwind)] + pub fn traces(&self) -> Vec>> { + self.inner + .call_trace_arenas + .iter() + .map(raw_trace_from_call_trace_arena) + .collect() + } } #[cfg(test)] @@ -173,7 +180,7 @@ mod tests { let envelope = "a".repeat(2_048); let response = Response::new( response(Either::A(envelope.clone())), - call_trace_external_mem_size(false), + call_trace_external_mem_size(StackSnapshotType::None), ); assert_eq!(response.external_memory, envelope.len() as i64); @@ -184,7 +191,7 @@ mod tests { let mut inner = response(Either::A("a".repeat(2_048))); inner.stack_trace_result = Some(StackTraceCreationResult::HeuristicFailed); - let response = Response::new(inner, call_trace_external_mem_size(false)); + let response = Response::new(inner, call_trace_external_mem_size(StackSnapshotType::None)); assert_eq!( response.external_memory, @@ -199,11 +206,11 @@ mod tests { let mut inner = response(Either::A("a".repeat(2_048))); inner.call_trace_arenas = vec![CallTraceArena::default()]; - let response = Response::new(inner, call_trace_external_mem_size(false)); + let response = Response::new(inner, call_trace_external_mem_size(StackSnapshotType::None)); assert_eq!( response.external_memory, - 2_048 + call_trace_external_mem_size(false) + 2_048 + call_trace_external_mem_size(StackSnapshotType::None) ); } @@ -212,9 +219,12 @@ mod tests { let mut inner = response(Either::A(String::new())); inner.call_trace_arenas = vec![CallTraceArena::default()]; - let response = Response::new(inner, call_trace_external_mem_size(true)); + let response = Response::new(inner, call_trace_external_mem_size(StackSnapshotType::Full)); - assert_eq!(response.external_memory, call_trace_external_mem_size(true)); + assert_eq!( + response.external_memory, + call_trace_external_mem_size(StackSnapshotType::Full) + ); } #[test] @@ -222,11 +232,19 @@ mod tests { let mut inner = response(Either::A(String::new())); inner.call_trace_arenas = vec![CallTraceArena::default(); 3]; - let response = Response::new(inner, call_trace_external_mem_size(false)); + let response = Response::new(inner, call_trace_external_mem_size(StackSnapshotType::None)); assert_eq!( response.external_memory, - 3 * call_trace_external_mem_size(false) + 3 * call_trace_external_mem_size(StackSnapshotType::None) + ); + } + + #[test] + fn recording_the_top_of_the_stack_reports_the_base_figure() { + assert_eq!( + call_trace_external_mem_size(StackSnapshotType::Top), + call_trace_external_mem_size(StackSnapshotType::None) ); } @@ -235,8 +253,8 @@ mod tests { #[test] fn recording_stack_snapshots_reports_four_times_as_much() { assert_eq!( - call_trace_external_mem_size(true), - 4 * call_trace_external_mem_size(false) + call_trace_external_mem_size(StackSnapshotType::Full), + 4 * call_trace_external_mem_size(StackSnapshotType::None) ); } @@ -246,7 +264,7 @@ mod tests { fn external_memory_of_an_oversized_response_is_the_value_floor() { let response = Response::new( response(Either::B(serde_json::Value::Null)), - call_trace_external_mem_size(false), + call_trace_external_mem_size(StackSnapshotType::None), ); assert_eq!(response.external_memory, VALUE_DATA_EXTERNAL_MEM_SIZE); diff --git a/crates/edr_napi/src/result.rs b/crates/edr_napi/src/result.rs index 47cca6cecb..a95db87836 100644 --- a/crates/edr_napi/src/result.rs +++ b/crates/edr_napi/src/result.rs @@ -1,13 +1,6 @@ use edr_chain_spec::EvmHaltReason; -use edr_tracing::AfterMessage; -use napi::{ - bindgen_prelude::{BigInt, Either3, Uint8Array}, - Either, -}; use napi_derive::napi; -use crate::log::ExecutionLog; - /// The possible reasons for successful termination of the EVM. #[napi] pub enum SuccessReason { @@ -39,46 +32,6 @@ impl From for edr_chain_spec_evm::result::SuccessReason { } } -#[napi(object)] -pub struct CallOutput { - /// Return value - pub return_value: Uint8Array, -} - -#[napi(object)] -pub struct CreateOutput { - /// Return value - pub return_value: Uint8Array, - /// Optionally, a 160-bit address - pub address: Option, -} - -/// The result when the EVM terminates successfully. -#[napi(object)] -pub struct SuccessResult { - /// The reason for termination - pub reason: SuccessReason, - /// The amount of gas used - pub gas_used: BigInt, - /// The amount of gas refunded - pub gas_refunded: BigInt, - /// The logs - pub logs: Vec, - /// The transaction output - pub output: Either, -} - -/// The result when the EVM terminates due to a revert. -#[napi(object)] -pub struct RevertResult { - /// The amount of gas used - pub gas_used: BigInt, - /// The logs - pub logs: Vec, - /// The transaction output - pub output: Uint8Array, -} - /// Indicates that the EVM has experienced an exceptional halt. This causes /// execution to immediately end with all gas being consumed. #[napi] @@ -102,9 +55,14 @@ pub enum ExceptionalHalt { CreateInitCodeSizeLimit, } -impl From for ExceptionalHalt { - fn from(halt: EvmHaltReason) -> Self { - match halt { +impl ExceptionalHalt { + /// Converts a halt that the EVM can report for a transaction. + /// + /// Returns `None` for the halts that only an inspector observes in nested + /// calls. Hardhat 2's previous collector in `edr_tracing` reported those as + /// reverts, and its consumers expect that. + pub fn from_halt(halt: EvmHaltReason) -> Option { + let halt = match halt { EvmHaltReason::OutOfGas(..) => ExceptionalHalt::OutOfGas, EvmHaltReason::OpcodeNotFound => ExceptionalHalt::OpcodeNotFound, EvmHaltReason::InvalidFEOpcode => ExceptionalHalt::InvalidFEOpcode, @@ -127,98 +85,9 @@ impl From for ExceptionalHalt { | EvmHaltReason::StateChangeDuringStaticCall | EvmHaltReason::CallNotAllowedInsideStatic | EvmHaltReason::OutOfFunds - | EvmHaltReason::CallTooDeep => { - unreachable!("Internal halts that can be only found inside Inspector: {halt:?}") - } - } - } -} - -/// The result when the EVM terminates due to an exceptional halt. -#[napi(object)] -pub struct HaltResult { - /// The exceptional halt that occurred - pub reason: ExceptionalHalt, - /// Halting will spend all the gas and will thus be equal to the specified - /// gas limit - pub gas_used: BigInt, - /// The logs - pub logs: Vec, -} - -/// The result of executing a transaction. -#[napi(object)] -pub struct ExecutionResult { - /// The transaction result - pub result: Either3, - /// Optional contract address if the transaction created a new contract. - pub contract_address: Option, -} - -impl From<&AfterMessage> for ExecutionResult { - fn from(value: &AfterMessage) -> Self { - let AfterMessage { - execution_result, - contract_address, - } = value; - - let result = match execution_result { - edr_chain_spec_evm::result::ExecutionResult::Success { - reason, - gas, - logs, - output, - } => { - let logs = logs.iter().map(ExecutionLog::from).collect(); - - Either3::A(SuccessResult { - reason: SuccessReason::from(*reason), - gas_used: BigInt::from(gas.tx_gas_used()), - gas_refunded: BigInt::from(gas.final_refunded()), - logs, - output: match output { - edr_chain_spec_evm::result::Output::Call(return_value) => { - let return_value = Uint8Array::with_data_copied(return_value); - - Either::A(CallOutput { return_value }) - } - edr_chain_spec_evm::result::Output::Create(return_value, address) => { - let return_value = Uint8Array::with_data_copied(return_value); - - Either::B(CreateOutput { - return_value, - address: address.as_ref().map(Uint8Array::with_data_copied), - }) - } - }, - }) - } - edr_chain_spec_evm::result::ExecutionResult::Revert { gas, logs, output } => { - let logs = logs.iter().map(ExecutionLog::from).collect(); - let output = Uint8Array::with_data_copied(output); - - Either3::B(RevertResult { - gas_used: BigInt::from(gas.tx_gas_used()), - logs, - output, - }) - } - edr_chain_spec_evm::result::ExecutionResult::Halt { reason, gas, logs } => { - let logs = logs.iter().map(ExecutionLog::from).collect(); - - Either3::C(HaltResult { - reason: ExceptionalHalt::from(reason.clone()), - gas_used: BigInt::from(gas.tx_gas_used()), - logs, - }) - } + | EvmHaltReason::CallTooDeep => return None, }; - let contract_address = contract_address.as_ref().map(Uint8Array::with_data_copied); - - Self { - result, - contract_address, - } + Some(halt) } } diff --git a/crates/edr_napi/src/trace.rs b/crates/edr_napi/src/trace.rs index 03057a2427..5926a4419c 100644 --- a/crates/edr_napi/src/trace.rs +++ b/crates/edr_napi/src/trace.rs @@ -5,15 +5,15 @@ // the original API while we rewrite the stack trace refinement to Rust. #![cfg_attr(test, allow(dead_code))] -use std::sync::Arc; - use edr_chain_spec::EvmHaltReason; -use edr_primitives::bytecode::opcode::OpCode; -use edr_tracing::BeforeMessage; -use napi::bindgen_prelude::{BigInt, Either3, Uint8Array}; +use edr_chain_spec_evm::interpreter::{return_revert, InstructionResult, SuccessOrHalt}; +use edr_primitives::{bytecode::opcode::OpCode, Address}; +use edr_solidity::nested_trace::is_calllike_op; +use edr_solidity_tests::traces::{CallKind, CallTrace, CallTraceArena, CallTraceNode}; +use napi::bindgen_prelude::{BigInt, Either, Either3, Uint8Array}; use napi_derive::napi; -use crate::result::ExecutionResult; +use crate::result::{ExceptionalHalt, SuccessReason}; mod library_utils; @@ -23,6 +23,7 @@ mod model; mod return_data; pub mod solidity_stack_trace; +/// Matches Hardhat's `MinimalMessage` interface. #[napi(object)] pub struct TracingMessage { /// Sender address @@ -33,116 +34,82 @@ pub struct TracingMessage { #[napi(readonly)] pub to: Option, - /// Whether it's a static call - #[napi(readonly)] - pub is_static_call: bool, - - /// Transaction gas limit + /// Address of the code that is being executed. Can be different from `to` + /// if a delegate call is being done. #[napi(readonly)] - pub gas_limit: BigInt, + pub code_address: Option, - /// Depth of the message + /// Value sent in the message #[napi(readonly)] - pub depth: u8, + pub value: BigInt, /// Input data of the message #[napi(readonly)] pub data: Uint8Array, - /// Value sent in the message - #[napi(readonly)] - pub value: BigInt, - - /// Address of the code that is being executed. Can be different from `to` - /// if a delegate call is being done. + /// Transaction gas limit #[napi(readonly)] - pub code_address: Option, + pub gas_limit: BigInt, - /// Code of the contract that is being executed. + /// Whether it's a static call #[napi(readonly)] - pub code: Option, -} - -impl From<&BeforeMessage> for TracingMessage { - fn from(value: &BeforeMessage) -> Self { - // Deconstruct to make sure all fields are handled - let BeforeMessage { - depth, - caller, - to, - is_static_call, - gas_limit, - data, - value, - code_address, - code, - } = value; - - let data = Uint8Array::with_data_copied(data); - - let code = code - .as_ref() - .map(|code| Uint8Array::with_data_copied(code.original_bytes())); - - TracingMessage { - caller: Uint8Array::with_data_copied(caller), - to: to.as_ref().map(Uint8Array::with_data_copied), - gas_limit: BigInt::from(*gas_limit), - is_static_call: *is_static_call, - depth: *depth as u8, - data, - value: BigInt { - sign_bit: false, - words: value.into_limbs().to_vec(), - }, - code_address: code_address.as_ref().map(Uint8Array::with_data_copied), - code, - } - } + pub is_static_call: bool, } +/// Matches Hardhat's `MinimalInterpreterStep` interface. #[napi(object)] pub struct TracingStep { - /// Call depth - #[napi(readonly)] - pub depth: u8, /// The program counter #[napi(readonly)] - pub pc: BigInt, - /// The executed op code + pub pc: u32, + /// Call depth #[napi(readonly)] - pub opcode: String, - /// The entries on the stack. It only contains the top element unless - /// verbose tracing is enabled. The vector is empty if there are no elements - /// on the stack. + pub depth: u32, + /// The executed opcode + #[napi(readonly)] + pub opcode: TracingOpcode, + /// The stack entries, as many as `ObservabilityConfig.recordStack` records. #[napi(readonly)] pub stack: Vec, - /// The memory at the step. None if verbose tracing is disabled. + /// The memory at the step. None unless verbose tracing is enabled. #[napi(readonly)] pub memory: Option, } -impl TracingStep { - pub fn new(step: &edr_tracing::Step) -> Self { - let stack = step.stack.full().map_or_else( - || { - step.stack - .top() - .map(u256_to_bigint) - .map_or_else(Vec::default, |top| vec![top]) - }, - |stack| stack.iter().map(u256_to_bigint).collect(), - ); - let memory = step.memory.as_ref().map(Uint8Array::with_data_copied); - - Self { - depth: step.depth as u8, - pc: BigInt::from(u64::from(step.pc)), - opcode: OpCode::name_by_op(step.opcode).to_string(), - stack, - memory, - } - } +/// Opcode information for a tracing step. +#[napi(object)] +pub struct TracingOpcode { + /// The name of the opcode + #[napi(readonly)] + pub name: String, +} + +/// Matches Hardhat's `MinimalEVMResult` interface. +#[napi(object)] +pub struct TracingMessageResult { + /// The execution result + #[napi(readonly)] + pub exec_result: TracingExecResult, +} + +/// Matches Hardhat's `MinimalExecResult` interface. +#[napi(object)] +pub struct TracingExecResult { + /// Whether execution succeeded + #[napi(readonly)] + pub success: bool, + /// Gas used during execution + #[napi(readonly)] + pub execution_gas_used: BigInt, + /// Address of the created contract. None if the create failed. + #[napi(readonly)] + pub contract_address: Option, + /// The reason for the exit (success or halt) + #[napi(readonly)] + pub reason: Option>, + /// The output data + #[napi(readonly)] + pub output: Option, } pub(crate) fn u256_to_bigint(v: &edr_primitives::U256) -> BigInt { @@ -152,41 +119,164 @@ pub(crate) fn u256_to_bigint(v: &edr_primitives::U256) -> BigInt { } } -#[napi(object)] -pub struct TracingMessageResult { - /// Execution result - #[napi(readonly)] - pub execution_result: ExecutionResult, -} +type RawTrace = Either3; -#[napi] -#[derive(Clone)] -pub struct RawTrace { - inner: Arc>, +/// Converts a `CallTraceArena` into a flat vector of `RawTrace` messages, +/// following the order that `EthereumJS` would have produced. +pub(crate) fn raw_trace_from_call_trace_arena(arena: &CallTraceArena) -> Vec { + let mut result = Vec::new(); + if let Some(node) = arena.nodes().first() + && (node.trace.kind.is_any_create() || !should_skip_call(&node.trace)) + { + convert_node(arena, node, false, node.trace.caller, &mut result); + } + result } -impl From>> for RawTrace { - fn from(value: Arc>) -> Self { - Self { inner: value } +/// DFS traversal of the arena, emitting Before/Step/After messages in the flat +/// order that the old `TraceCollector` used to produce. +fn convert_node( + arena: &CallTraceArena, + node: &CallTraceNode, + mut is_static_call: bool, + original_caller: Address, + output: &mut Vec>, +) { + let trace = &node.trace; + + // 1. Emit BeforeMessage (TracingMessage) + let is_create = trace.kind.is_any_create(); + is_static_call |= trace.kind == CallKind::StaticCall; + + output.push(Either3::A(TracingMessage { + caller: match trace.kind { + CallKind::DelegateCall => Uint8Array::with_data_copied(original_caller.as_slice()), + _ => Uint8Array::with_data_copied(trace.caller.as_slice()), + }, + to: match trace.kind { + CallKind::Create | CallKind::Create2 => None, + CallKind::DelegateCall | CallKind::CallCode => { + Some(Uint8Array::with_data_copied(trace.caller.as_slice())) + } + _ => Some(Uint8Array::with_data_copied(trace.address.as_slice())), + }, + code_address: if is_create { + None + } else { + Some(Uint8Array::with_data_copied(trace.address.as_slice())) + }, + value: u256_to_bigint(&trace.value), + data: Uint8Array::with_data_copied(&trace.data), + gas_limit: BigInt::from(trace.gas_limit), + is_static_call, + })); + + // 2. Emit Step messages (TracingStep) and recursively convert child calls + let mut steps = trace.steps.iter().peekable(); + if !is_create + && let Some(first_step) = steps.peek() + && first_step.op == OpCode::STOP + { + // Calls skip a leading STOP step. Creates keep it. + steps.next(); } -} -#[napi] -impl RawTrace { - #[napi(getter)] - pub fn trace(&self) -> Vec> { - self.inner - .messages - .iter() - .map(|message| match message { - edr_tracing::TraceMessage::Before(message) => { - Either3::A(TracingMessage::from(message)) + let mut child_index = 0; + for step in steps { + output.push(Either3::B(TracingStep { + pc: step.pc.try_into().expect("PC larger than u32::MAX"), + depth: trace + .depth + .try_into() + .expect("Call depth larger than u32::MAX"), + opcode: TracingOpcode { + name: OpCode::name_by_op(step.op.get()).to_string(), + }, + stack: step + .stack + .as_ref() + .map(|s| s.iter().map(u256_to_bigint).collect()) + .unwrap_or_default(), + memory: step + .memory + .as_ref() + .map(|m| Uint8Array::with_data_copied(m.as_bytes())), + })); + + if is_calllike_op(step) { + // The opcode of this step is a call, but it's possible that this step resulted + // in a revert or out of gas error in which case there's no actual child call executed and recorded: + if let Some(call_id) = node.children.get(child_index).copied() { + child_index += 1; + + let child_node = arena + .nodes() + .get(call_id) + .expect("child index should be valid"); + + if matches!(step.op, OpCode::CREATE | OpCode::CREATE2) + || !should_skip_call(&child_node.trace) + { + convert_node( + arena, + child_node, + is_static_call, + match child_node.trace.kind { + CallKind::DelegateCall => original_caller, + _ => child_node.trace.caller, + }, + output, + ); } - edr_tracing::TraceMessage::Step(step) => Either3::B(TracingStep::new(step)), - edr_tracing::TraceMessage::After(message) => Either3::C(TracingMessageResult { - execution_result: ExecutionResult::from(message), - }), - }) - .collect() + } + } + } + + // 3. Emit AfterMessage (TracingMessageResult) + let reason = convert_status(trace.status); + + let contract_address = if is_create && trace.success { + Some(Uint8Array::with_data_copied(trace.address.as_slice())) + } else { + None + }; + + output.push(Either3::C(TracingMessageResult { + exec_result: TracingExecResult { + success: trace.success, + execution_gas_used: BigInt::from(trace.gas_used), + contract_address, + reason, + output: Some(Uint8Array::with_data_copied(&trace.output)), + }, + })); +} + +/// Converts an `InstructionResult` status into an optional reason. +/// +/// Returns `None` for a missing status, a revert, a fatal or internal error, +/// and a halt without an `ExceptionalHalt` counterpart. +fn convert_status( + status: Option, +) -> Option> { + let status = status?; + + let success_or_halt: SuccessOrHalt = status.into(); + match success_or_halt { + SuccessOrHalt::Success(reason) => Some(Either::A(SuccessReason::from(reason))), + SuccessOrHalt::Halt(reason) => ExceptionalHalt::from_halt(reason).map(Either::B), + SuccessOrHalt::Revert | SuccessOrHalt::FatalExternalError | SuccessOrHalt::Internal(_) => { + None + } } } + +// Historically, Hardhat 2 didn't emit a before message for calls that failed +// immediately with a revert or out of gas error, so we skip them to maintain +// compatibility with existing traces. +fn should_skip_call(trace: &CallTrace) -> bool { + trace.steps.is_empty() + && trace + .status + .is_some_and(|status| matches!(status, return_revert!())) +} diff --git a/crates/edr_napi/test/provider.ts b/crates/edr_napi/test/provider.ts index 415d03e05a..cc74f9ffd8 100644 --- a/crates/edr_napi/test/provider.ts +++ b/crates/edr_napi/test/provider.ts @@ -5,20 +5,27 @@ import { Interface } from "ethers"; import { AccountOverride, + CallTrace, CallOverrideResult, ContractDecoder, + IncludeTraces, L1Hardfork, l1HardforkToString, Provider, + Response, SubscriptionEvent, + TracingMessageResult, precompileP256Verify, OP_CHAIN_TYPE, opProviderFactory, opHardforkToString, OpHardfork, + StackSnapshotType, } from ".."; import { ALCHEMY_URL, + collectMessages, + collectSteps, createGenericProvider, DEFAULT_GENESIS_ADDRESS, fundedGenesisState, @@ -102,358 +109,742 @@ describe("Provider", () => { await assert.isFulfilled(provider); }); - // TODO(#1288): Add backwards compatibility for Hardhat 2 - // describe("verbose mode", function () { - // it("should only include the top of the stack by default", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // const responseObject = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "eth_sendTransaction", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // PUSH1 1 - // // PUSH1 2 - // // PUSH1 3 - // // STOP - // data: "0x60016002600300", - // }, - // ], - // }) - // ); - - // const rawTraces = responseObject.traces; - // assert.lengthOf(rawTraces, 1); - - // const trace = rawTraces[0].trace; - // const steps = collectSteps(trace); - - // assert.lengthOf(steps, 4); - - // assert.deepEqual(steps[0].stack, []); - // assert.deepEqual(steps[1].stack, [1n]); - // assert.deepEqual(steps[2].stack, [2n]); - // assert.deepEqual(steps[3].stack, [3n]); - // }); - - // it("should only include the whole stack if verbose mode is enabled", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // await provider.setVerboseTracing(true); - - // const responseObject = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "eth_sendTransaction", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // PUSH1 1 - // // PUSH1 2 - // // PUSH1 3 - // // STOP - // data: "0x60016002600300", - // }, - // ], - // }) - // ); - - // const rawTraces = responseObject.traces; - // assert.lengthOf(rawTraces, 1); - - // const trace = rawTraces[0].trace; - // const steps = collectSteps(trace); - - // assert.lengthOf(steps, 4); - - // // verbose tracing is enabled, so all steps should have a stack - // assert.isTrue(steps.every((step) => step.stack !== undefined)); - - // assert.deepEqual(steps[0].stack, []); - // assert.deepEqual(steps[1].stack, [1n]); - // assert.deepEqual(steps[2].stack, [1n, 2n]); - // assert.deepEqual(steps[3].stack, [1n, 2n, 3n]); - // }); - - // it("should not include memory by default", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // const responseObject = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "eth_sendTransaction", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // store 0x000...001 as the first memory word - // // PUSH1 1 - // // PUSH0 - // // MSTORE - // // STOP - // data: "0x60015f5200", - // }, - // ], - // }) - // ); - - // const rawTraces = responseObject.traces; - // assert.lengthOf(rawTraces, 1); - - // const trace = rawTraces[0].trace; - // const steps = collectSteps(trace); - - // assert.lengthOf(steps, 4); - - // // verbose tracing is disabled, so none of the steps should have a stack - // assert.isTrue(steps.every((step) => step.memory === undefined)); - // }); - - // it("should include memory if verbose mode is enabled", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // await provider.setVerboseTracing(true); - - // const responseObject = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "eth_sendTransaction", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // store 0x000...001 as the first memory word - // // PUSH1 1 - // // PUSH0 - // // MSTORE - // // STOP - // data: "0x60015f5200", - // }, - // ], - // }) - // ); - - // const rawTraces = responseObject.traces; - // assert.lengthOf(rawTraces, 1); - - // const trace = rawTraces[0].trace; - // const steps = collectSteps(trace); - - // assert.lengthOf(steps, 4); - - // assertEqualMemory(steps[0].memory, Uint8Array.from([])); - // assertEqualMemory(steps[1].memory, Uint8Array.from([])); - // assertEqualMemory(steps[2].memory, Uint8Array.from([])); - // assertEqualMemory( - // steps[3].memory, - // Uint8Array.from([...Array(31).fill(0), 1]) - // ); - // }); - - // it("should include isStaticCall flag in tracing messages", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // const responseObject = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "eth_sendTransaction", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // make a static call to the zero address - // // yul: staticcall(gas(), 0, 0, 0, 0, 0) - // data: "0x6000808080805afa00", - // gas: "0x" + 1_000_000n.toString(16), - // }, - // ], - // }) - // ); - - // const rawTraces = responseObject.traces; - // assert.lengthOf(rawTraces, 1); - - // const trace = rawTraces[0].trace; - // const messageResults = collectMessages(trace); - // assert.lengthOf(messageResults, 2); - - // // outer message - // assert.isFalse(messageResults[0].isStaticCall); - - // // inner message triggered by STATICCALL - // assert.isTrue(messageResults[1].isStaticCall); - // }); - - // it("should have tracing information when debug_traceTransaction is used", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // const sendTxResponse = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "eth_sendTransaction", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // PUSH1 0x42 - // // PUSH0 - // // MSTORE - // // PUSH1 0x20 - // // PUSH0 - // // RETURN - // data: "0x60425f5260205ff3", - // gas: "0x" + 1_000_000n.toString(16), - // }, - // ], - // }) - // ); - - // let responseData; - - // if (typeof sendTxResponse.data === "string") { - // responseData = JSON.parse(sendTxResponse.data); - // } else { - // responseData = sendTxResponse.data; - // } - - // const txHash = responseData.result; - - // const traceTransactionResponse = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "debug_traceTransaction", - // params: [txHash], - // }) - // ); - - // const rawTraces = traceTransactionResponse.traces; - // assert.lengthOf(rawTraces, 1); - // }); - - // it("should have tracing information when debug_traceCall is used", async function () { - // const provider = await context.createProvider( - // GENERIC_CHAIN_TYPE, - // { - // ...providerConfig, - // genesisState: providerConfig.genesisState.concat( - // l1GenesisState(l1HardforkFromString(providerConfig.hardfork)) - // ), - // }, - // loggerConfig, - // { - // subscriptionCallback: (_event: SubscriptionEvent) => {}, - // }, - // new ContractDecoder() - // ); - - // const traceCallResponse = await provider.handleRequest( - // JSON.stringify({ - // id: 1, - // jsonrpc: "2.0", - // method: "debug_traceCall", - // params: [ - // { - // from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", - // // PUSH1 0x42 - // // PUSH0 - // // MSTORE - // // PUSH1 0x20 - // // PUSH0 - // // RETURN - // data: "0x60425f5260205ff3", - // gas: "0x" + 1_000_000n.toString(16), - // }, - // ], - // }) - // ); - - // const rawTraces = traceCallResponse.traces; - // assert.lengthOf(rawTraces, 1); - // }); - // }); + describe("verbose mode", function () { + const tracingProviderOverrides = { + genesisState: fundedGenesisState(), + observability: { + includeCallTraces: IncludeTraces.All, + }, + }; + + it("should not include the stack by default", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 1 + // PUSH1 2 + // PUSH1 3 + // STOP + data: "0x60016002600300", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const steps = collectSteps(trace); + + assert.lengthOf(steps, 4); + + assert.deepEqual(steps[0].stack, []); + assert.deepEqual(steps[1].stack, []); + assert.deepEqual(steps[2].stack, []); + assert.deepEqual(steps[3].stack, []); + }); + + it("should only include the top of the stack if configured", async function () { + const provider = await createGenericProvider(context, { + ...tracingProviderOverrides, + observability: { + recordStack: StackSnapshotType.Top, + ...tracingProviderOverrides.observability, + }, + }); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 1 + // PUSH1 2 + // PUSH1 3 + // STOP + data: "0x60016002600300", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const steps = collectSteps(trace); + + assert.lengthOf(steps, 4); + + assert.deepEqual(steps[0].stack, []); + assert.deepEqual(steps[1].stack, [1n]); + assert.deepEqual(steps[2].stack, [2n]); + assert.deepEqual(steps[3].stack, [3n]); + }); + + it("should only include the whole stack if verbose mode is enabled", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + await provider.setVerboseTracing(true); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 1 + // PUSH1 2 + // PUSH1 3 + // STOP + data: "0x60016002600300", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const steps = collectSteps(trace); + + assert.lengthOf(steps, 4); + + // verbose tracing is enabled, so all steps should have a stack + assert.isTrue(steps.every((step) => step.stack !== undefined)); + + assert.deepEqual(steps[0].stack, []); + assert.deepEqual(steps[1].stack, [1n]); + assert.deepEqual(steps[2].stack, [1n, 2n]); + assert.deepEqual(steps[3].stack, [1n, 2n, 3n]); + }); + + async function pushThreeAndStopStacks( + provider: Provider + ): Promise { + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 1 + // PUSH1 2 + // PUSH1 3 + // STOP + data: "0x60016002600300", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + return collectSteps(rawTraces[0]).map((step) => step.stack); + } + + const TOP_OF_STACK = [[], [1n], [2n], [3n]]; + const FULL_STACK = [[], [1n], [1n, 2n], [1n, 2n, 3n]]; + const NO_STACK = [[], [], [], []]; + + for (const [name, recordStack, expectedStacks] of [ + ["None", StackSnapshotType.None, NO_STACK], + ["Top", StackSnapshotType.Top, TOP_OF_STACK], + ["Full", StackSnapshotType.Full, FULL_STACK], + ] as const) { + it(`should record the configured stack for StackSnapshotType.${name}`, async function () { + const provider = await createGenericProvider(context, { + ...tracingProviderOverrides, + observability: { + ...tracingProviderOverrides.observability, + recordStack, + }, + }); + + assert.deepEqual( + await pushThreeAndStopStacks(provider), + expectedStacks + ); + }); + } + + it("should restore the configured stack after disabling verbose mode", async function () { + const provider = await createGenericProvider(context, { + ...tracingProviderOverrides, + observability: { + ...tracingProviderOverrides.observability, + recordStack: StackSnapshotType.Top, + }, + }); + + await provider.setVerboseTracing(true); + assert.deepEqual(await pushThreeAndStopStacks(provider), FULL_STACK); + + await provider.setVerboseTracing(false); + assert.deepEqual(await pushThreeAndStopStacks(provider), TOP_OF_STACK); + }); + + it("should include the top of the stack across nested call frames", async function () { + const provider = await createGenericProvider(context, { + ...tracingProviderOverrides, + observability: { + recordStack: StackSnapshotType.Top, + ...tracingProviderOverrides.observability, + }, + }); + + // Deploy a contract with runtime code: + // PUSH1 0x0a + // PUSH1 0x0b + // STOP + await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH5 0x600a600b00 + // PUSH0 + // MSTORE + // PUSH1 5 (length) + // PUSH1 27 (offset) + // RETURN + data: "0x64600a600b005f526005601bf3", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const calleeAddress = 0x5fbdb2315678afecb367f032d93f642f64180aa3n; + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 2, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 0 (x5: return length & offset, args length & offset, value) + // PUSH20 + // PUSH2 0xffff (gas) + // CALL + // PUSH1 0x2a + // STOP + data: "0x60006000600060006000735fbdb2315678afecb367f032d93f642f64180aa361fffff1602a00", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const steps = collectSteps(trace); + + assert.lengthOf(steps, 13); + assert.deepEqual( + steps.map((step) => step.depth), + [0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 0, 0] + ); + + assert.deepEqual( + steps.map((step) => step.stack), + [ + // Caller frame: PUSH1 0 (x5), PUSH20, PUSH2, CALL + [], + [0n], + [0n], + [0n], + [0n], + [0n], + [calleeAddress], + [0xffffn], + // Callee frame: PUSH1 0x0a, PUSH1 0x0b, STOP + [], + [0x0an], + [0x0bn], + // Caller frame: PUSH1 0x2a sees the CALL success flag, then STOP + [1n], + [0x2an], + ] + ); + }); + + it("should not include memory by default", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // store 0x000...001 as the first memory word + // PUSH1 1 + // PUSH0 + // MSTORE + // STOP + data: "0x60015f5200", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const steps = collectSteps(trace); + + assert.lengthOf(steps, 4); + + // verbose tracing is disabled, so none of the steps should have memory + assert.isTrue(steps.every((step) => step.memory === undefined)); + }); + + it("should include memory if verbose mode is enabled", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + await provider.setVerboseTracing(true); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // store 0x000...001 as the first memory word + // PUSH1 1 + // PUSH0 + // MSTORE + // STOP + data: "0x60015f5200", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const steps = collectSteps(trace); + + assert.lengthOf(steps, 4); + + assertEqualMemory(steps[0].memory, Uint8Array.from([])); + assertEqualMemory(steps[1].memory, Uint8Array.from([])); + assertEqualMemory(steps[2].memory, Uint8Array.from([])); + assertEqualMemory( + steps[3].memory, + Uint8Array.from([...Array(31).fill(0), 1]) + ); + }); + + it("should report a state change during a static call as a revert", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + // Deploy a contract with runtime code: + // PUSH1 1 + // PUSH1 0 + // SSTORE + // STOP + await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH6 0x600160005500 + // PUSH0 + // MSTORE + // PUSH1 6 (length) + // PUSH1 26 (offset) + // RETURN + data: "0x656001600055005f526006601af3", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 2, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 0 (x4: return length & offset, args length & offset) + // PUSH20 + // PUSH2 0xffff (gas) + // STATICCALL + // STOP + data: "0x6000600060006000735fbdb2315678afecb367f032d93f642f64180aa361fffffa00", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const results = rawTraces[0].filter( + (traceItem): traceItem is TracingMessageResult => + "execResult" in traceItem + ); + assert.lengthOf(results, 2); + + // The callee's result precedes the caller's. + const calleeResult = results[0].execResult; + assert.isFalse(calleeResult.success); + assert.isUndefined(calleeResult.reason); + }); + + it("should include isStaticCall flag in tracing messages", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // make a static call to the zero address + // yul: staticcall(gas(), 0, 0, 0, 0, 0) + data: "0x6000808080805afa00", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const messageResults = collectMessages(trace); + assert.lengthOf(messageResults, 2); + + // outer message + assert.isFalse(messageResults[0].isStaticCall); + + // inner message triggered by STATICCALL + assert.isTrue(messageResults[1].isStaticCall); + }); + + it("should have tracing information when debug_traceTransaction is used", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const sendTxResponse = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 0x42 + // PUSH0 + // MSTORE + // PUSH1 0x20 + // PUSH0 + // RETURN + data: "0x60425f5260205ff3", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + let responseData; + + if (typeof sendTxResponse.data === "string") { + responseData = JSON.parse(sendTxResponse.data); + } else { + responseData = sendTxResponse.data; + } + + const txHash = responseData.result; + + const traceTransactionResponse = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "debug_traceTransaction", + params: [txHash], + }) + ); + + const rawTraces = traceTransactionResponse.traces(); + assert.lengthOf(rawTraces, 1); + }); + + it("should have tracing information when debug_traceCall is used", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const traceCallResponse = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "debug_traceCall", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 0x42 + // PUSH0 + // MSTORE + // PUSH1 0x20 + // PUSH0 + // RETURN + data: "0x60425f5260205ff3", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = traceCallResponse.traces(); + assert.lengthOf(rawTraces, 1); + }); + + it("should record a leading STOP step in a creation frame", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // STOP + data: "0x00", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const messages = collectMessages(trace); + assert.lengthOf(messages, 1); + assert.isNotOk(messages[0].to); + + const steps = collectSteps(trace); + assert.lengthOf(steps, 1); + assert.strictEqual(steps[0].opcode.name, "STOP"); + }); + + describe("contract address of a create", function () { + // Init code that reverts with empty output. + // PUSH1 0 (size) + // PUSH1 0 (offset) + // REVERT + const REVERTING_INIT_CODE = "0x60006000fd"; + + // Init code that halts on the designated invalid opcode. + // INVALID + const HALTING_INIT_CODE = "0xfe"; + + async function deployAndCollectResults( + initCode: string + ): Promise { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const responseObject = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + data: initCode, + gas: GAS_BELOW_OSAKA_CAP, + }, + ], + }) + ); + + const rawTraces = responseObject.traces(); + assert.lengthOf(rawTraces, 1); + + return rawTraces[0].filter( + (traceItem): traceItem is TracingMessageResult => + "execResult" in traceItem + ); + } + + it("should omit the contract address of a reverted deployment", async function () { + const results = await deployAndCollectResults(REVERTING_INIT_CODE); + assert.lengthOf(results, 1); + + const { execResult } = results[0]; + assert.isFalse(execResult.success); + assert.isUndefined(execResult.contractAddress); + }); + + it("should omit the contract address of a halted deployment", async function () { + const results = await deployAndCollectResults(HALTING_INIT_CODE); + assert.lengthOf(results, 1); + + const { execResult } = results[0]; + assert.isFalse(execResult.success); + assert.isUndefined(execResult.contractAddress); + }); + }); + + describe("precompile calls", function () { + const IDENTITY_PRECOMPILE_ADDRESS = + "0x0000000000000000000000000000000000000004"; + + async function callIdentityPrecompile( + provider: Provider + ): Promise { + return provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_sendTransaction", + params: [ + { + from: "0xf39fd6e51aad88f6f4ce6ab8827279cfffb92266", + // PUSH1 0 (x5: return length & offset, args length & offset, value) + // PUSH1 4 (identity precompile) + // PUSH2 0xffff (gas) + // CALL + // STOP + data: "0x60006000600060006000600461fffff100", + gas: "0x" + 1_000_000n.toString(16), + }, + ], + }) + ); + } + + it("should include precompile calls in call traces", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const callTraces = ( + await callIdentityPrecompile(provider) + ).callTraces(); + assert.lengthOf(callTraces, 1); + + const childCalls = callTraces[0].children.filter( + (child): child is CallTrace => "kind" in child + ); + assert.lengthOf(childCalls, 1); + assert.strictEqual(childCalls[0].address, IDENTITY_PRECOMPILE_ADDRESS); + }); + + it("should emit before and after messages for precompile calls in raw traces", async function () { + const provider = await createGenericProvider( + context, + tracingProviderOverrides + ); + + const rawTraces = (await callIdentityPrecompile(provider)).traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + const messages = collectMessages(trace); + assert.lengthOf(messages, 2); + + const precompileMessage = messages[1]; + assert.isDefined(precompileMessage.to); + assert.deepEqual( + Buffer.from(precompileMessage.to), + Buffer.from(toBytes(IDENTITY_PRECOMPILE_ADDRESS)) + ); + + // The precompile's after message directly follows its before message, + // as a precompile executes no steps. + const precompileMessageIndex = trace.indexOf(precompileMessage); + const precompileResult = trace[precompileMessageIndex + 1]; + assert.isTrue( + "execResult" in precompileResult && + precompileResult.execResult.success + ); + }); + }); + }); async function deployAndTestCustomPrecompile(enabled: boolean) { // Contract code in edr/data/contracts/CustomPrecompile.sol @@ -663,6 +1054,45 @@ describe("Provider", () => { "0x" + RESULT.map((byte) => byte.toString(16).padStart(2, "0")).join("") ); }); + + it("omits a top-level call that the callback reverts from the raw trace", async function () { + const provider = await createGenericProvider(context, { + observability: { + includeCallTraces: IncludeTraces.All, + }, + }); + + await provider.setCallOverrideCallback( + (): Promise => + Promise.resolve({ + result: new Uint8Array(), + shouldRevert: true, + }) + ); + + const response = await provider.handleRequest( + JSON.stringify({ + id: 1, + jsonrpc: "2.0", + method: "eth_call", + params: [ + { + to: "0xabababababababababababababababababababab", + data: "0xdeadbeef", + gas: GAS_BELOW_OSAKA_CAP, + }, + "latest", + ], + }) + ); + + const rawTraces = response.traces(); + assert.lengthOf(rawTraces, 1); + + const trace = rawTraces[0]; + assert.lengthOf(collectMessages(trace), 0); + assert.lengthOf(collectSteps(trace), 0); + }); }); describe("decodeConsoleLogInputsCallback", () => { @@ -972,14 +1402,13 @@ describe("Provider", () => { }); }); -// TODO(#1288): Add backwards compatibility for Hardhat 2 -// function assertEqualMemory( -// stepMemory: Uint8Array | undefined, -// expected: Uint8Array -// ) { -// if (stepMemory === undefined) { -// assert.fail("step memory is undefined"); -// } - -// assert.deepEqual(stepMemory, expected); -// } +function assertEqualMemory( + stepMemory: Uint8Array | undefined, + expected: Uint8Array +) { + if (stepMemory === undefined) { + assert.fail("step memory is undefined"); + } + + assert.deepEqual(stepMemory, expected); +} diff --git a/crates/edr_provider/Cargo.toml b/crates/edr_provider/Cargo.toml index 226f14f665..eb2300c482 100644 --- a/crates/edr_provider/Cargo.toml +++ b/crates/edr_provider/Cargo.toml @@ -54,7 +54,6 @@ edr_signer.workspace = true edr_solidity.workspace = true edr_state_api.workspace = true edr_test_utils = { workspace = true, optional = true } -edr_tracing.workspace = true edr_transaction.workspace = true edr_utils.workspace = true edr_utils_sync.workspace = true diff --git a/crates/edr_provider/src/data.rs b/crates/edr_provider/src/data.rs index 771a9c48e9..8787a82a47 100644 --- a/crates/edr_provider/src/data.rs +++ b/crates/edr_provider/src/data.rs @@ -3654,6 +3654,192 @@ mod tests { Ok(()) } + mod nested_storage_read { + use edr_chain_l1::rpc::call::L1CallRequest; + use edr_chain_spec_evm::TransactionError; + use edr_database_components::DatabaseComponentError; + use edr_primitives::{address, bytecode::opcode}; + use edr_runtime::overrides::AccountOverride; + use edr_state_api::{account::AccountInfo, State, StateError}; + + use super::*; + use crate::{ + observability::{observe_execution, ObservedExecution}, + requests::eth::resolve_call_request, + }; + + /// The action named by the injected storage error. + const FAILING_READ_ACTION: &str = "read the failing storage slot"; + const INNER_CONTRACT: Address = address!("0x1111111111111111111111111111111111111111"); + const OUTER_CONTRACT: Address = address!("0x2222222222222222222222222222222222222222"); + const FAILING_SLOT_INDEX: u8 = 0; + /// Reads the failing slot. + const INNER_CODE: [u8; 4] = [ + opcode::PUSH1, + FAILING_SLOT_INDEX, + opcode::SLOAD, + opcode::STOP, + ]; + /// The return range, argument range and value of the nested call. + const ZERO_CALL_ARGUMENT_COUNT: usize = 5; + /// The depth of the frame that the outer contract's call enters. + const NESTED_CALL_DEPTH: usize = 1; + + /// Calls `INNER_CONTRACT` with all remaining gas, no value and empty + /// ranges. + fn outer_code() -> Vec { + let mut code = [opcode::PUSH1, 0].repeat(ZERO_CALL_ARGUMENT_COUNT); + code.push(opcode::PUSH20); + code.extend_from_slice(INNER_CONTRACT.as_slice()); + code.extend_from_slice(&[opcode::GAS, opcode::CALL, opcode::STOP]); + code + } + + /// A state whose read of the failing slot at `INNER_CONTRACT` fails + /// while `fail_read` is set. + struct FailingStorageState { + inner: StateT, + fail_read: bool, + } + + impl> State for FailingStorageState { + type Error = StateError; + + fn basic(&self, address: Address) -> Result, StateError> { + self.inner.basic(address) + } + + fn code_by_hash(&self, code_hash: B256) -> Result { + self.inner.code_by_hash(code_hash) + } + + fn storage(&self, address: Address, index: U256) -> Result { + if self.fail_read + && address == INNER_CONTRACT + && index == U256::from(FAILING_SLOT_INDEX) + { + Err(StateError::Unsupported { + action: FAILING_READ_ACTION.to_owned(), + details: None, + }) + } else { + self.inner.storage(address, index) + } + } + } + + type ObservedCall = + ObservedExecution>; + + /// Returns the observed `eth_call` of `OUTER_CONTRACT`, or the error + /// that failed it. Replays the path of `run_call_impl` with a state + /// whose read of the failing slot fails if `fail_read` is set. + fn call_outer_contract( + fail_read: bool, + ) -> anyhow::Result>> { + let code_override = |code: Vec| AccountOverride { + balance: None, + nonce: None, + code: Some(Bytecode::new_raw(code.into())), + storage: None, + }; + let state_overrides = StateOverrides::new(HashMap::from_iter([ + (INNER_CONTRACT, code_override(INNER_CODE.to_vec())), + (OUTER_CONTRACT, code_override(outer_code())), + ])); + + let mut fixture = ProviderTestFixture::::new_local()?; + let data = &mut fixture.provider_data; + let block_spec = BlockSpec::latest(); + let request = L1CallRequest { + to: Some(OUTER_CONTRACT), + ..L1CallRequest::default() + }; + let transaction = resolve_call_request(data, request, &block_spec, &state_overrides)?; + let cfg_env = data.create_evm_config_at_block_spec(&block_spec)?; + let observer_config = + EvmObserverConfig::new(&data.observability, data.contract_decoder.clone()); + let custom_precompiles = data.precompile_overrides.clone(); + let scheduled_blob_params = data.scheduled_blob_params().cloned(); + + let result = + data.execute_in_block_context(Some(&block_spec), |blockchain, block, state| { + let state = FailingStorageState { + inner: StateRefOverrider::new(&state_overrides, state.as_ref()), + fail_read, + }; + observe_execution(&observer_config, |observer| { + let block_env = + ::BlockEnv::new_block_env( + block.block_header(), + cfg_env.spec, + scheduled_blob_params.as_ref(), + ); + call::run_call::( + blockchain, + block_env, + state, + cfg_env, + transaction, + &custom_precompiles, + observer, + ) + }) + })?; + + Ok(result) + } + + /// A failed storage read in a nested call makes revm return an error, + /// so `eth_call` fails before a call trace is collected. + #[test] + fn failed_storage_read_in_nested_call_fails_without_call_traces() -> anyhow::Result<()> { + let error = match call_outer_contract(true)? { + Ok(observed) => panic!( + "the failed storage read should fail the request, got: {:?}", + observed.result() + ), + Err(error) => error, + }; + + assert!( + matches!( + &error, + ProviderError::RunTransaction(TransactionError::Database( + DatabaseComponentError::State(StateError::Unsupported { action, .. }) + )) if action == FAILING_READ_ACTION + ), + "expected the injected storage error without call traces, got: {error:?}" + ); + + Ok(()) + } + + /// Without the failure, the same call succeeds and traces the storage + /// read in a nested frame. + #[test] + fn storage_read_in_nested_call_is_traced_at_depth_one() -> anyhow::Result<()> { + let observed = call_outer_contract(false)??; + assert!( + observed.result().is_success(), + "the call should succeed, got: {:?}", + observed.result() + ); + + let has_nested_inner_frame = observed + .evm_observed_data + .call_trace_arena + .nodes() + .iter() + .any(|node| { + node.trace.address == INNER_CONTRACT && node.trace.depth == NESTED_CALL_DEPTH + }); + assert!(has_nested_inner_frame); + + Ok(()) + } + } + #[test] fn console_log_run_call() -> anyhow::Result<()> { let mut fixture = ProviderTestFixture::::new_local()?; diff --git a/crates/edr_provider/src/debugger.rs b/crates/edr_provider/src/debugger.rs deleted file mode 100644 index 13a9f583a9..0000000000 --- a/crates/edr_provider/src/debugger.rs +++ /dev/null @@ -1,23 +0,0 @@ -use edr_eth::spec::HaltReasonTrait; -use edr_tracing::TraceCollector; - -use crate::{console_log::ConsoleLogCollector, mock::Mocker}; - -pub struct Debugger { - pub console_logger: ConsoleLogCollector, - pub mocker: Mocker, - pub trace_collector: TraceCollector, -} - -impl Debugger { - /// Creates a new instance with the provided mocker. - /// If verbose is true, full stack and memory will be recorded for each - /// step. - pub fn with_mocker(mocker: Mocker, verbose: bool) -> Self { - Self { - console_logger: ConsoleLogCollector::default(), - mocker, - trace_collector: TraceCollector::new(verbose), - } - } -} diff --git a/crates/edr_provider/src/observability.rs b/crates/edr_provider/src/observability.rs index dff28577a4..a836ef73b7 100644 --- a/crates/edr_provider/src/observability.rs +++ b/crates/edr_provider/src/observability.rs @@ -24,6 +24,7 @@ use edr_state_api::State; use foundry_evm_traces::CallTraceArena; use parking_lot::RwLock; use revm_inspector::JournalExt; +pub use revm_inspectors::tracing::StackSnapshotType; use revm_inspectors::tracing::{TracingInspector, TracingInspectorConfig}; use crate::{ @@ -49,9 +50,38 @@ pub struct ObservabilityConfig { pub include_call_traces: IncludeTraces, pub on_collected_coverage_fn: Option>, pub on_collected_gas_report_fn: Option>, + /// How much of the stack each recorded step carries. + pub record_stack: StackSnapshotType, + /// Records the full stack and memory while enabled. `record_stack` keeps + /// its configured value meanwhile. pub verbose_raw_tracing: bool, } +impl ObservabilityConfig { + /// Whether recorded steps carry a memory snapshot. + pub fn records_memory(&self) -> bool { + self.verbose_raw_tracing + } + + /// How much of the stack recorded steps carry. + pub fn recorded_stack(&self) -> StackSnapshotType { + recorded_stack(self.record_stack, self.verbose_raw_tracing) + } +} + +/// How much of the stack recorded steps carry, given the configured amount and +/// whether verbose raw tracing is enabled. +pub const fn recorded_stack( + record_stack: StackSnapshotType, + verbose_raw_tracing: bool, +) -> StackSnapshotType { + if verbose_raw_tracing { + StackSnapshotType::Full + } else { + record_stack + } +} + impl Debug for ObservabilityConfig { fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { f.debug_struct("Config") @@ -65,7 +95,8 @@ impl Debug for ObservabilityConfig { "on_collected_gas_report_fn", &self.on_collected_gas_report_fn.is_some(), ) - .field("verbose_raw_traces", &self.verbose_raw_tracing) + .field("record_stack", &self.record_stack) + .field("verbose_raw_tracing", &self.verbose_raw_tracing) .finish() } } @@ -77,7 +108,8 @@ pub struct EvmObserverConfig { pub include_call_traces: IncludeTraces, pub contract_decoder: Arc>, pub on_collected_coverage_fn: Option>, - pub verbose_raw_tracing: bool, + pub record_memory: bool, + pub record_stack: StackSnapshotType, } impl EvmObserverConfig { @@ -91,7 +123,8 @@ impl EvmObserverConfig { contract_decoder, include_call_traces: config.include_call_traces, on_collected_coverage_fn: config.on_collected_coverage_fn.clone(), - verbose_raw_tracing: config.verbose_raw_tracing, + record_memory: config.records_memory(), + record_stack: config.recorded_stack(), } } } @@ -160,15 +193,13 @@ impl EvmObserver { .on_collected_coverage_fn .map(CodeCoverageReporter::new); - let tracing_config = if config.verbose_raw_tracing { - TracingInspectorConfig::all() - } else { - TracingInspectorConfig::default_parity() - .set_steps(true) - // Call traces include precompile calls, like Solidity test call traces. - .set_exclude_precompile_calls(false) - .set_record_logs(true) - }; + let tracing_config = TracingInspectorConfig::none() + .set_steps(true) + .set_memory_snapshots(config.record_memory) + .set_stack_snapshots(config.record_stack) + // Call traces include precompile calls, like Solidity test call traces. + .set_exclude_precompile_calls(false) + .set_record_logs(true); Self { bytecode_collector: ExecutedBytecodeCollector::default(), diff --git a/crates/edr_provider/tests/integration/call_traces.rs b/crates/edr_provider/tests/integration/call_traces.rs index 803461dc3f..b20d34b61d 100644 --- a/crates/edr_provider/tests/integration/call_traces.rs +++ b/crates/edr_provider/tests/integration/call_traces.rs @@ -34,10 +34,10 @@ const LOG_TOPIC: B256 = B256::new({ }); // https://github.com/NomicFoundation/edr/issues/1542 -async fn transaction_call_trace_includes_logs(verbose_raw_tracing: bool) -> anyhow::Result<()> { +#[tokio::test(flavor = "multi_thread")] +async fn transaction_call_trace_includes_logs() -> anyhow::Result<()> { let mut config = create_test_config(); config.observability.include_call_traces = IncludeTraces::All; - config.observability.verbose_raw_tracing = verbose_raw_tracing; let from = public_key_to_address( config @@ -92,13 +92,3 @@ async fn transaction_call_trace_includes_logs(verbose_raw_tracing: bool) -> anyh Ok(()) } - -#[tokio::test(flavor = "multi_thread")] -async fn transaction_call_trace_includes_logs_default_tracing() -> anyhow::Result<()> { - transaction_call_trace_includes_logs(false).await -} - -#[tokio::test(flavor = "multi_thread")] -async fn transaction_call_trace_includes_logs_verbose_raw_tracing() -> anyhow::Result<()> { - transaction_call_trace_includes_logs(true).await -} diff --git a/crates/edr_solidity/Cargo.toml b/crates/edr_solidity/Cargo.toml index a3d96a7884..0cd4a1c11f 100644 --- a/crates/edr_solidity/Cargo.toml +++ b/crates/edr_solidity/Cargo.toml @@ -18,7 +18,6 @@ edr_common.workspace = true edr_decoder_revert.workspace = true edr_defaults.workspace = true edr_primitives.workspace = true -edr_tracing.workspace = true foundry-compilers.workspace = true foundry-evm-core.workspace = true foundry-evm-traces.workspace = true diff --git a/crates/edr_solidity/src/lib.rs b/crates/edr_solidity/src/lib.rs index c6ba26b3d5..11a7bc80cb 100644 --- a/crates/edr_solidity/src/lib.rs +++ b/crates/edr_solidity/src/lib.rs @@ -13,7 +13,6 @@ pub mod exit_code; pub mod library_utils; pub mod linker; pub mod nested_trace; -pub mod nested_tracer; pub mod proxy_detection; pub mod solidity_stack_trace; pub mod solidity_tracer; diff --git a/crates/edr_solidity/src/nested_trace.rs b/crates/edr_solidity/src/nested_trace.rs index 62a2ac09ee..2f556ab2ef 100644 --- a/crates/edr_solidity/src/nested_trace.rs +++ b/crates/edr_solidity/src/nested_trace.rs @@ -8,7 +8,7 @@ use derive_where::derive_where; use edr_chain_spec::HaltReasonTrait; use edr_primitives::{Address, Bytes, HashMap, U256}; -pub use self::conversion::CallTraceArenaConversionError; +pub use self::conversion::{is_calllike_op, CallTraceArenaConversionError}; use crate::{ build_model::ContractMetadata, contracts_identifier::IdentifiedContract, exit_code::ExitCode, }; diff --git a/crates/edr_solidity/src/nested_trace/conversion.rs b/crates/edr_solidity/src/nested_trace/conversion.rs index 160480d30f..a222d20fdd 100644 --- a/crates/edr_solidity/src/nested_trace/conversion.rs +++ b/crates/edr_solidity/src/nested_trace/conversion.rs @@ -191,7 +191,8 @@ fn convert_instruction_result_to_exit_code( } } -fn is_calllike_op(step: &CallTraceStep) -> bool { +/// Checks whether the given step corresponds to a call-like opcode. +pub fn is_calllike_op(step: &CallTraceStep) -> bool { use revm_bytecode::opcode; matches!( diff --git a/crates/edr_solidity/src/nested_tracer.rs b/crates/edr_solidity/src/nested_tracer.rs deleted file mode 100644 index 34702f8266..0000000000 --- a/crates/edr_solidity/src/nested_tracer.rs +++ /dev/null @@ -1,476 +0,0 @@ -//! Naive Rust port of the `VmTracer` from Hardhat. - -use std::{cell::RefCell, rc::Rc}; - -use edr_chain_spec::HaltReasonTrait; -use edr_chain_spec_evm::result::ExecutionResult; -use edr_primitives::{Address, Bytes, U160, U256}; -use edr_tracing::{BeforeMessage, Step}; - -use crate::{ - exit_code::ExitCode, - nested_trace::{ - CallMessage, CreateMessage, EvmStep, NestedTrace, NestedTraceStep, PrecompileMessage, - }, -}; - -/// Errors that can occur during the generation of the nested trace. -#[derive(Debug, thiserror::Error)] -pub enum NestedTracerError { - /// Invalid precompile address - #[error("Invalid precompile address: {0}")] - InvalidPrecompileAddress(U160), - /// Invalid input: The created address should be defined in the successful - #[error("Created address should be defined in successful create trace")] - MissingAddressInExecutionResult, - /// Invalid input: Missing code address. - #[error("Missing code address")] - MissingCodeAddress, - /// Invalid input: Missing code. - #[error("Missing code")] - MissingCode, - /// Invalid input: Message execution started while a precompile was - /// executing. - #[error("Message execution started while a precompile was executing")] - MessageDuringPreCompile, - /// Invalid input: Step event fired while a precompile was executing. - #[error("Step event fired while a precompile was executing")] - StepDuringPreCompile, -} - -/// Observes a trace, collecting information about the execution of the EVM. -pub fn convert_trace_messages_to_nested_trace( - trace: edr_tracing::Trace, -) -> Result>, NestedTracerError> { - let mut tracer = NestedTracer::new(); - - tracer.add_messages(trace.messages)?; - - Ok(tracer.get_last_top_level_message_trace()) -} - -/// Naive Rust port of the `VmTracer` from Hardhat. -struct NestedTracer { - tracing_steps: Vec, - message_traces: Vec>>>, -} - -impl Default for NestedTracer { - fn default() -> Self { - Self::new() - } -} - -// Temporarily hardcoded to remove the need of using ethereumjs' common and evm -// TODO(#565): We should be using a more robust check by checking the hardfork -// config (and potentially other config like optional support for RIP -// precompiles, which start at 0x100). -const MAX_PRECOMPILE_NUMBER: u16 = 10; - -impl NestedTracer { - /// Creates a new [`NestedTracer`]. - const fn new() -> Self { - NestedTracer { - tracing_steps: Vec::new(), - message_traces: Vec::new(), - } - } - - /// Returns a reference to the last top-level message trace. - fn get_last_top_level_message_trace(mut self) -> Option> { - self.message_traces.pop().map(convert_to_external_trace) - } - - fn add_messages( - &mut self, - messages: Vec>, - ) -> Result<(), NestedTracerError> { - for msg in messages { - match msg { - edr_tracing::TraceMessage::Before(before) => { - self.add_before_message(before)?; - } - edr_tracing::TraceMessage::Step(step) => { - self.add_step(step)?; - } - edr_tracing::TraceMessage::After(after) => { - self.add_after_message(after.execution_result)?; - } - } - } - Ok(()) - } - - fn add_before_message(&mut self, message: BeforeMessage) -> Result<(), NestedTracerError> { - let trace: InternalNestedTrace; - - if message.depth == 0 { - self.message_traces.clear(); - self.tracing_steps.clear(); - } - - if let Some(to) = message.to { - let to_as_u160 = U160::from_be_bytes(**to); - - if to_as_u160 <= U160::from(MAX_PRECOMPILE_NUMBER) { - let precompile: u32 = to_as_u160 - .try_into() - .map_err(|_err| NestedTracerError::InvalidPrecompileAddress(to_as_u160))?; - - let precompile_trace = PrecompileMessage { - value: message.value, - exit: ExitCode::Success, - return_data: Bytes::new(), - depth: message.depth, - gas_used: 0, - precompile, - calldata: message.data, - }; - - trace = InternalNestedTrace::Precompile(precompile_trace); - } else { - // if we enter here, then `to` is not None, therefore - // `code_address` and `code` should be Some - let code_address = message - .code_address - .ok_or(NestedTracerError::MissingCodeAddress)?; - let code = message.code.ok_or(NestedTracerError::MissingCode)?; - - let call_trace = InternalCallMessage { - steps: Vec::new(), - calldata: message.data, - address: to, - code_address, - depth: message.depth, - value: message.value, - exit: ExitCode::Success, - return_data: Bytes::new(), - gas_used: 0, - code: code.original_bytes(), - number_of_subtraces: 0, - }; - - trace = InternalNestedTrace::Call(call_trace); - } - } else { - let create_trace = InternalCreateMessage { - number_of_subtraces: 0, - steps: Vec::new(), - depth: message.depth, - value: message.value, - exit: ExitCode::Success, - return_data: Bytes::new(), - gas_used: 0, - code: message.data, - deployed_contract: None, - }; - - trace = InternalNestedTrace::Create(create_trace); - } - - // We need to share it so that adding steps when processing via stack - // also updates the inner elements - let trace = Rc::new(RefCell::new(trace)); - - if let Some(parent_ref) = self.message_traces.last_mut() { - let mut parent_trace = parent_ref.borrow_mut(); - match &mut *parent_trace { - InternalNestedTrace::Precompile(_) => { - return Err(NestedTracerError::MessageDuringPreCompile); - } - InternalNestedTrace::Create(create) => { - create - .steps - .push(InternalNestedTraceStep::Message(Rc::clone(&trace))); - create.number_of_subtraces += 1; - } - InternalNestedTrace::Call(call) => { - call.steps - .push(InternalNestedTraceStep::Message(Rc::clone(&trace))); - call.number_of_subtraces += 1; - } - }; - } - - self.message_traces.push(trace); - - Ok(()) - } - - fn add_step(&mut self, step: Step) -> Result<(), NestedTracerError> { - if let Some(parent_ref) = self.message_traces.last_mut() { - let mut parent_trace = parent_ref.borrow_mut(); - let steps = match &mut *parent_trace { - InternalNestedTrace::Precompile(_) => { - return Err(NestedTracerError::StepDuringPreCompile); - } - InternalNestedTrace::Create(create) => &mut create.steps, - InternalNestedTrace::Call(call) => &mut call.steps, - }; - - steps.push(InternalNestedTraceStep::Evm(EvmStep { pc: step.pc })); - } - - self.tracing_steps.push(step); - - Ok(()) - } - - fn add_after_message( - &mut self, - result: ExecutionResult, - ) -> Result<(), NestedTracerError> { - if let Some(trace) = self.message_traces.last_mut() { - let mut trace = trace.borrow_mut(); - - trace.set_gas_used(result.tx_gas_used()); - - match result { - ExecutionResult::Success { output, .. } => { - trace.set_exit_code(ExitCode::Success); - trace.set_return_data(output.data().clone()); - - if let InternalNestedTrace::Create(trace) = &mut *trace { - let address = output - .address() - .ok_or(NestedTracerError::MissingAddressInExecutionResult)?; - - trace.deployed_contract = Some(address.as_slice().to_vec().into()); - } - } - ExecutionResult::Halt { reason, .. } => { - trace.set_exit_code(ExitCode::Halt(reason)); - trace.set_return_data(Bytes::new()); - } - ExecutionResult::Revert { output, .. } => { - trace.set_exit_code(ExitCode::Revert); - trace.set_return_data(output); - } - } - } - - if self.message_traces.len() > 1 { - self.message_traces.pop(); - } - - Ok(()) - } -} - -/// A nested trace where the message steps are shared and mutable via a -/// refcell. -#[derive(Clone, Debug)] -enum InternalNestedTrace { - Create(InternalCreateMessage), - Call(InternalCallMessage), - Precompile(PrecompileMessage), -} - -impl InternalNestedTrace { - fn set_gas_used(&mut self, gas_used: u64) { - match self { - InternalNestedTrace::Create(create) => create.gas_used = gas_used, - InternalNestedTrace::Call(call) => call.gas_used = gas_used, - - InternalNestedTrace::Precompile(precompile) => precompile.gas_used = gas_used, - } - } - - fn set_exit_code(&mut self, exit_code: ExitCode) { - match self { - InternalNestedTrace::Create(create) => create.exit = exit_code, - InternalNestedTrace::Call(call) => call.exit = exit_code, - - InternalNestedTrace::Precompile(precompile) => precompile.exit = exit_code, - } - } - - fn set_return_data(&mut self, return_data: Bytes) { - match self { - InternalNestedTrace::Create(create) => create.return_data = return_data, - InternalNestedTrace::Call(call) => call.return_data = return_data, - - InternalNestedTrace::Precompile(precompile) => precompile.return_data = return_data, - } - } -} - -/// Represents a call message. -#[derive(Clone, Debug)] -struct InternalCallMessage { - // The following is just an optimization: When processing this traces it's useful to know ahead - // of time how many subtraces there are. - /// Number of subtraces. Used to speed up the processing of the traces in - /// JS. - pub number_of_subtraces: u32, - /// Children messages. - pub steps: Vec>, - /// Calldata buffer - pub calldata: Bytes, - /// Address of the contract that is being executed. - pub address: Address, - /// Address of the code that is being executed. - pub code_address: Address, - /// Code of the contract that is being executed. - pub code: Bytes, - /// Value of the message. - pub value: U256, - /// Return data buffer. - pub return_data: Bytes, - /// EVM exit code. - pub exit: ExitCode, - /// How much gas was used. - pub gas_used: u64, - /// Depth of the message. - pub depth: usize, -} - -/// Represents a create message. -#[derive(Clone, Debug)] -struct InternalCreateMessage { - // The following is just an optimization: When processing this traces it's useful to know ahead - // of time how many subtraces there are. - /// Number of subtraces. Used to speed up the processing of the traces in - /// JS. - pub number_of_subtraces: u32, - /// Children messages. - pub steps: Vec>, - /// Address of the deployed contract. - pub deployed_contract: Option, - /// Code of the contract that is being executed. - pub code: Bytes, - /// Value of the message. - pub value: U256, - /// Return data buffer. - pub return_data: Bytes, - /// EVM exit code. - pub exit: ExitCode, - /// How much gas was used. - pub gas_used: u64, - /// Depth of the message. - pub depth: usize, -} - -/// Represents a message step. Naive Rust port of the `MessageTraceStep` -/// from Hardhat. -#[derive(Clone, Debug)] -enum InternalNestedTraceStep { - /// [`NestedTrace`] variant. - // It's both read and written to (updated) by the `[NestedTracer]`. - Message(Rc>>), - /// [`EvmStep`] variant. - Evm(EvmStep), -} - -enum InternalNestedTraceStepWithoutRefCell { - Message(Box>), - Evm(EvmStep), -} - -/// Converts the [`InternalNestedTrace`] into a [`NestedTrace`] by -/// cloning it. -/// -/// # Panics -/// -/// Panics if the value is mutably borrowed. -fn convert_to_external_trace( - value: Rc>>, -) -> NestedTrace { - // We can't use `Rc::try_unwrap` because it requires that the `Rc` is unique. - let trace = value.borrow().clone(); - - match trace { - InternalNestedTrace::Create(create) => { - let InternalCreateMessage { - number_of_subtraces, - steps, - deployed_contract, - code, - value, - return_data, - exit, - gas_used, - depth, - } = create; - - NestedTrace::Create(CreateMessage { - number_of_subtraces, - steps: steps.into_iter().map(convert_to_external_step).collect(), - identified_contract: None, - deployed_contract, - code, - value, - return_data, - exit, - gas_used, - depth, - }) - } - InternalNestedTrace::Call(call) => { - let InternalCallMessage { - number_of_subtraces, - steps, - calldata, - address, - code_address, - code, - value, - return_data, - exit, - gas_used, - depth, - } = call; - NestedTrace::Call(CallMessage { - number_of_subtraces, - steps: steps.into_iter().map(convert_to_external_step).collect(), - identified_contract: None, - calldata, - address, - code_address, - code, - value, - return_data, - exit, - gas_used, - depth, - }) - } - InternalNestedTrace::Precompile(precompile) => NestedTrace::Precompile(precompile), - } -} - -/// # Panics -// Panics if a nested value is mutably borrowed. -fn convert_to_external_step( - value: InternalNestedTraceStep, -) -> NestedTraceStep { - match value { - InternalNestedTraceStep::Message(message) => { - InternalNestedTraceStepWithoutRefCell::Message(Box::new(convert_to_external_trace( - message, - ))) - } - InternalNestedTraceStep::Evm(evm_step) => { - InternalNestedTraceStepWithoutRefCell::Evm(evm_step) - } - } - .into() -} - -// This can be a `From` conversion, because it can't panic. -impl From> - for NestedTraceStep -{ - fn from(step: InternalNestedTraceStepWithoutRefCell) -> Self { - match step { - InternalNestedTraceStepWithoutRefCell::Message(trace) => match *trace { - NestedTrace::Create(create_trace) => NestedTraceStep::Create(create_trace), - NestedTrace::Call(call_trace) => NestedTraceStep::Call(call_trace), - NestedTrace::Precompile(precompile_trace) => { - NestedTraceStep::Precompile(precompile_trace) - } - }, - InternalNestedTraceStepWithoutRefCell::Evm(evm_step) => NestedTraceStep::Evm(evm_step), - } - } -} diff --git a/hardhat-tests/package.json b/hardhat-tests/package.json index a463ba86fa..a08a5e9b84 100644 --- a/hardhat-tests/package.json +++ b/hardhat-tests/package.json @@ -38,7 +38,7 @@ "ethereumjs-abi": "^0.6.8", "ethers": "^6.1.0", "fs-extra": "^7.0.1", - "hardhat": "2.28.4", + "hardhat": "2.28.6", "mocha": "^11.1.0", "prettier": "^3.2.5", "rimraf": "^3.0.2", diff --git a/hardhat-tests/test/internal/hardhat-network/provider/trace-event-bridge.ts b/hardhat-tests/test/internal/hardhat-network/provider/trace-event-bridge.ts new file mode 100644 index 0000000000..e28314ebd6 --- /dev/null +++ b/hardhat-tests/test/internal/hardhat-network/provider/trace-event-bridge.ts @@ -0,0 +1,89 @@ +import { assert } from "chai"; +import { createHardhatNetworkProvider } from "hardhat/internal/hardhat-network/provider/provider"; + +import { DEFAULT_ACCOUNTS } from "../helpers/providers"; + +interface VmEventCounts { + steps: number; + beforeMessages: number; + afterMessages: number; +} + +async function sendTransactionCountingVmEvents( + data: string +): Promise { + const provider: any = await createHardhatNetworkProvider( + { + hardfork: "cancun", + chainId: 123, + networkId: 123, + blockGasLimit: 6000000, + minGasPrice: 0n, + throwOnTransactionFailures: true, + throwOnCallFailures: true, + automine: true, + intervalMining: 0, + mempoolOrder: "priority", + chains: new Map(), + genesisAccounts: DEFAULT_ACCOUNTS, + allowUnlimitedContractSize: false, + allowBlocksWithSameTimestamp: false, + enableTransientStorage: false, + enableRip7212: false, + }, + { enabled: false } + ); + + const counts: VmEventCounts = { + steps: 0, + beforeMessages: 0, + afterMessages: 0, + }; + provider._node._vm.evm.events.on("step", () => { + counts.steps += 1; + }); + provider._node._vm.evm.events.on("beforeMessage", () => { + counts.beforeMessages += 1; + }); + provider._node._vm.evm.events.on("afterMessage", () => { + counts.afterMessages += 1; + }); + + const [sender] = (await provider.request({ + method: "eth_accounts", + })) as string[]; + + await provider.request({ + method: "eth_sendTransaction", + params: [{ from: sender, data, gas: "0x100000" }], + }); + + // The minimal vm uses AsyncEventEmitter: listeners run on a later tick + await new Promise((resolve) => setImmediate(resolve)); + + return counts; +} + +describe("Trace-event bridge", function () { + it("emits step/beforeMessage/afterMessage on a transaction", async function () { + // Init code executing exactly 4 steps: PUSH1 1, PUSH1 2, PUSH1 3, STOP + const counts = await sendTransactionCountingVmEvents("0x60016002600300"); + + assert.equal(counts.beforeMessages, 1, "beforeMessage events"); + assert.equal(counts.afterMessages, 1, "afterMessage events"); + assert.equal(counts.steps, 4, "step events"); + }); + + it("emits beforeMessage/afterMessage for a precompile call", async function () { + // Init code calling the identity precompile at 0x04: + // PUSH1 0 (x5: return length & offset, args length & offset, value) + // PUSH1 4, PUSH2 0xffff (gas), CALL, STOP + const counts = await sendTransactionCountingVmEvents( + "0x60006000600060006000600461fffff100" + ); + + assert.equal(counts.beforeMessages, 2, "beforeMessage events"); + assert.equal(counts.afterMessages, 2, "afterMessage events"); + assert.equal(counts.steps, 9, "step events"); + }); +}); diff --git a/js/benchmark/package.json b/js/benchmark/package.json index fb129097e8..ba489d7f93 100644 --- a/js/benchmark/package.json +++ b/js/benchmark/package.json @@ -21,7 +21,7 @@ "eslint-plugin-import": "2.32.0", "eslint-plugin-prettier": "5.5.6", "hardhat": "3.18.0", - "hardhat2": "npm:hardhat@2.28.4", + "hardhat2": "npm:hardhat@2.28.6", "lodash": "^4.17.11", "prettier": "^3.2.5", "simple-git": "^3.25.0", diff --git a/patches/hardhat@2.28.4.patch b/patches/hardhat@2.28.6.patch similarity index 69% rename from patches/hardhat@2.28.4.patch rename to patches/hardhat@2.28.6.patch index 8764549d70..a54ae10791 100644 --- a/patches/hardhat@2.28.4.patch +++ b/patches/hardhat@2.28.6.patch @@ -12,16 +12,16 @@ index abba026d4e3dcbe3658047c20a5cc4fcfd43ffdb..5e3578f963ed2b8e020425be35145665 private _callOverrideCallback?; private constructor(); diff --git a/internal/hardhat-network/provider/provider.d.ts.map b/internal/hardhat-network/provider/provider.d.ts.map -index 9d31ee4326d66725b85b5ce45de79ba29c252deb..ea82219d526e39c64215c5cf2aa4b6fbab3887ba 100644 +index 660aca206496602e24483581278607023d4e52d3..8cea6390b517149bf07f70fb4b57bf16fb70481f 100644 --- a/internal/hardhat-network/provider/provider.d.ts.map +++ b/internal/hardhat-network/provider/provider.d.ts.map @@ -1 +1 @@ --{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/provider.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,SAAS,EAGT,eAAe,EAEf,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,UAAU,EAKV,wBAAwB,EAKzB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAoCtC,OAAO,EACL,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,cAAc,CAAC;AAWtB,OAAO,EAAE,YAAY,EAA8B,MAAM,kBAAkB,CAAC;AAO5E,eAAO,MAAM,gBAAgB,+CAA+C,CAAC;AAI7E,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC,CAgB/D;AAED,UAAU,4BAA4B;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,oBAAoB,CAAC;IACrC,YAAY,EAAE,YAAY,CAAC;IAC3B,MAAM,EAAE,0BAA0B,CAAC;IACnC,eAAe,EAAE,cAAc,EAAE,CAAC;IAClC,0BAA0B,EAAE,OAAO,CAAC;IACpC,0BAA0B,EAAE,OAAO,CAAC;IACpC,mBAAmB,EAAE,OAAO,CAAC;IAC7B,4BAA4B,EAAE,OAAO,CAAC;IAEtC,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,WAAW,CAAC,EAAE,IAAI,CAAC;IACnB,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB,UAAU,CAAC,EAAE,UAAU,CAAC;IACxB,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,sBAAsB,EAAE,OAAO,CAAC;IA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,OAAO,CAAC,QAAQ,CAAC,iBAAiB;IAClC,OAAO,CAAC,QAAQ,CAAC,uBAAuB;IAlB1C,OAAO,CAAC,kBAAkB,CAAK;IAG/B,OAAO,CAAC,qBAAqB,CAAC,CAAuB;IAErD,OAAO;WAkBa,MAAM,CACxB,MAAM,EAAE,4BAA4B,EACpC,YAAY,EAAE,YAAY,EAC1B,aAAa,CAAC,EAAE,wBAAwB,GACvC,OAAO,CAAC,kBAAkB,CAAC;IA8KjB,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;YAiJhD,qBAAqB;YAerB,MAAM;YA0DN,wBAAwB;YAexB,kBAAkB;IAIhC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,4BAA4B;IAOpC,OAAO,CAAC,6BAA6B;CAWtC;AAQD,wBAAsB,4BAA4B,CAChD,4BAA4B,EAAE,4BAA4B,EAC1D,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,eAAe,CAAC,CAY1B"} \ No newline at end of file -+{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/provider.ts"],"names":[],"mappings":";AAAA,OAAO,KAAK,EACV,SAAS,EAGT,eAAe,EAEf,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,UAAU,EAKV,wBAAwB,EAKzB,MAAM,sBAAsB,CAAC;AAK9B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAoCtC,OAAO,EACL,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,YAAY,EAA8B,MAAM,kBAAkB,CAAC;AAO5E,eAAO,MAAM,gBAAgB,+CAA+C,CAAC;AAI7E,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC,CAgB/D;AAED,UAAU,4BAA4B;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A4B,EACpC,YAAY,EAAE,YAAY,EAC1B,aAAa,CAAC,EAAE,wBAAwB,GACvC,OAAO,CAAC,kBAAkB,CAAC;IAsLjB,OAAO,CAAC,IAAI,EAAE,gBAAgB,GAAG,OAAO,CAAC,OAAO,CAAC;YAyJhD,qBAAqB;YAerB,MAAM;YA0EN,wBAAwB;YAexB,kBAAkB;IAIhC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,4BAA4B;IAOpC,OAAO,CAAC,6BAA6B;CAWtC;AAQD,wBAAsB,4BAA4B,CAChD,4BAA4B,EAAE,4BAA4B,EAC1D,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,eAAe,CAAC,CAY1B"} ++{"version":3,"file":"provider.d.ts","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/provider.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,SAAS,EAGT,eAAe,EAEf,0BAA0B,EAC1B,gBAAgB,EACjB,MAAM,gBAAgB,CAAC;AAExB,OAAO,KAAK,EACV,UAAU,EAKV,wBAAwB,EAKzB,MAAM,sBAAsB,CAAC;AAU9B,OAAO,EAAE,YAAY,EAAE,MAAM,QAAQ,CAAC;AAoCtC,OAAO,EACL,UAAU,EACV,cAAc,EACd,oBAAoB,EACpB,YAAY,EACb,MAAM,cAAc,CAAC;AAUtB,OAAO,EAAE,YAAY,EAA8B,MAAM,kBAAkB,CAAC;AAO5E,eAAO,MAAM,gBAAgB,+CAA+C,CAAC;AAI7E,wBAAsB,mBAAmB,IAAI,OAAO,CAAC,UAAU,CAAC,CAgB/D;AAED,UAAU,4BAA4B;IACpC,QAAQ,EAAE,MAAM,CAAC;IACjB,OAAO,EAAE,MAAM,CAAC;IAChB,SAAS,EAAE,MAAM,CAAC;IAClB,aAAa,EAAE,MAAM,CAAC;IACtB,WAAW,EAAE,MAAM,CAAC;IACpB,QAAQ,EAAE,OAAO,CAAC;IAClB,cAAc,EAAE,oBAAoB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B;YAexB,kBAAkB;IAIhC,OAAO,CAAC,iBAAiB;IASzB,OAAO,CAAC,4BAA4B;IAOpC,OAAO,CAAC,6BAA6B;CAWtC;AAQD,wBAAsB,4BAA4B,CAChD,4BAA4B,EAAE,4BAA4B,EAC1D,YAAY,EAAE,YAAY,EAC1B,SAAS,CAAC,EAAE,SAAS,GACpB,OAAO,CAAC,eAAe,CAAC,CAY1B"} \ No newline at end of file diff --git a/internal/hardhat-network/provider/provider.js b/internal/hardhat-network/provider/provider.js -index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d292c0086 100644 +index 10f3b552eff7297ca16ae3acb5c30e5d97c5498e..734cc28a6ba359d235b98573dff2ca0130a5a62d 100644 --- a/internal/hardhat-network/provider/provider.js +++ b/internal/hardhat-network/provider/provider.js @@ -64,15 +64,14 @@ async function getGlobalEdrContext() { @@ -69,7 +69,7 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d blockNumber: config.forkConfig.blockNumber !== undefined ? BigInt(config.forkConfig.blockNumber) : undefined, -@@ -112,59 +117,65 @@ class EdrProviderWrapper extends events_1.EventEmitter { +@@ -112,59 +117,67 @@ class EdrProviderWrapper extends events_1.EventEmitter { url: config.forkConfig.jsonRpcUrl, }; } @@ -119,7 +119,6 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d - blockGasLimit: BigInt(config.blockGasLimit), chainId: BigInt(config.chainId), coinbase: Buffer.from(coinbase.slice(2), "hex"), -+ defaultTransactionGasLimit: _resolveDefaultTransactionGasLimit(hardforkName, config.blockGasLimit, transactionGasCap), precompileOverrides, - fork, genesisState, @@ -139,7 +138,11 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d }, + network, networkId: BigInt(config.networkId), - observability: {}, +- observability: {}, ++ observability: { ++ includeCallTraces: edr_1.IncludeTraces.All, ++ recordStack: edr_1.StackSnapshotType.Top, ++ }, ownedAccounts, - // Turn off the Osaka EIP-7825 per transaction gas limit for HH2 - // when being run from `solidity-coverage`. @@ -155,7 +158,7 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d }; const edrLoggerConfig = { enable: loggerConfig.enabled, -@@ -184,7 +195,7 @@ class EdrProviderWrapper extends events_1.EventEmitter { +@@ -184,7 +197,7 @@ class EdrProviderWrapper extends events_1.EventEmitter { }; const edrSubscriptionConfig = { subscriptionCallback: (event) => { @@ -164,7 +167,7 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d }, }; const edrTracingConfig = tracingConfig ?? {}; -@@ -194,9 +205,10 @@ class EdrProviderWrapper extends events_1.EventEmitter { +@@ -194,9 +207,10 @@ class EdrProviderWrapper extends events_1.EventEmitter { const minimalEthereumJsNode = { _vm: (0, minimal_vm_1.getMinimalEthereumJsVm)(provider), }; @@ -178,95 +181,30 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d return wrapper; } async request(args) { -@@ -231,60 +243,75 @@ class EdrProviderWrapper extends events_1.EventEmitter { - else { - response = responseObject.data; - } -- const needsTraces = this._node._vm.evm.events.eventNames().length > 0 || -- this._node._vm.events.eventNames().length > 0; -- if (needsTraces) { +@@ -234,10 +248,8 @@ class EdrProviderWrapper extends events_1.EventEmitter { + const needsTraces = this._node._vm.evm.events.eventNames().length > 0 || + this._node._vm.events.eventNames().length > 0; + if (needsTraces) { - const rawTraces = responseObject.traces; - for (const rawTrace of rawTraces) { - // For other consumers in JS we need to marshall the entire trace over FFI - const trace = rawTrace.trace; -- // beforeTx event -- if (this._node._vm.events.listenerCount("beforeTx") > 0) { -- this._node._vm.events.emit("beforeTx"); -- } -- for (const traceItem of trace) { -- // step event -- if ("pc" in traceItem) { -- if (this._node._vm.evm.events.listenerCount("step") > 0) { -- this._node._vm.evm.events.emit("step", (0, convertToEdr_1.edrTracingStepToMinimalInterpreterStep)(traceItem)); -- } -- } -- // afterMessage event ++ const rawTraces = responseObject.traces(); ++ for (const trace of rawTraces) { + // beforeTx event + if (this._node._vm.events.listenerCount("beforeTx") > 0) { + this._node._vm.events.emit("beforeTx"); +@@ -250,7 +262,7 @@ class EdrProviderWrapper extends events_1.EventEmitter { + } + } + // afterMessage event - else if ("executionResult" in traceItem) { -- if (this._node._vm.evm.events.listenerCount("afterMessage") > 0) { -- this._node._vm.evm.events.emit("afterMessage", (0, convertToEdr_1.edrTracingMessageResultToMinimalEVMResult)(traceItem)); -- } -- } -- // beforeMessage event -- else { -- if (this._node._vm.evm.events.listenerCount("beforeMessage") > 0) { -- this._node._vm.evm.events.emit("beforeMessage", (0, convertToEdr_1.edrTracingMessageToMinimalMessage)(traceItem)); -- } -- } -- } -- // afterTx event -- if (this._node._vm.events.listenerCount("afterTx") > 0) { -- this._node._vm.events.emit("afterTx"); -- } -- } -- } -+ // TODO: re-enable tracing events once EDR adds backwards compatibility support -+ // const needsTraces = -+ // this._node._vm.evm.events.eventNames().length > 0 || -+ // this._node._vm.events.eventNames().length > 0; -+ // if (needsTraces) { -+ // const rawTraces = responseObject.traces; -+ // for (const rawTrace of rawTraces) { -+ // // For other consumers in JS we need to marshall the entire trace over FFI -+ // const trace = rawTrace.trace; -+ // // beforeTx event -+ // if (this._node._vm.events.listenerCount("beforeTx") > 0) { -+ // this._node._vm.events.emit("beforeTx"); -+ // } -+ // for (const traceItem of trace) { -+ // // step event -+ // if ("pc" in traceItem) { -+ // if (this._node._vm.evm.events.listenerCount("step") > 0) { -+ // this._node._vm.evm.events.emit( -+ // "step", -+ // edrTracingStepToMinimalInterpreterStep(traceItem) -+ // ); -+ // } -+ // } -+ // // afterMessage event -+ // else if ("executionResult" in traceItem) { -+ // if (this._node._vm.evm.events.listenerCount("afterMessage") > 0) { -+ // this._node._vm.evm.events.emit( -+ // "afterMessage", -+ // edrTracingMessageResultToMinimalEVMResult(traceItem) -+ // ); -+ // } -+ // } -+ // // beforeMessage event -+ // else { -+ // if (this._node._vm.evm.events.listenerCount("beforeMessage") > 0) { -+ // this._node._vm.evm.events.emit( -+ // "beforeMessage", -+ // edrTracingMessageToMinimalMessage(traceItem) -+ // ); -+ // } -+ // } -+ // } -+ // // afterTx event -+ // if (this._node._vm.events.listenerCount("afterTx") > 0) { -+ // this._node._vm.events.emit("afterTx"); -+ // } -+ // } -+ // } ++ else if ("execResult" in traceItem) { + if (this._node._vm.evm.events.listenerCount("afterMessage") > 0) { + this._node._vm.evm.events.emit("afterMessage", (0, convertToEdr_1.edrTracingMessageResultToMinimalEVMResult)(traceItem)); + } +@@ -270,21 +282,25 @@ class EdrProviderWrapper extends events_1.EventEmitter { + } if ((0, http_1.isErrorResponse)(response)) { let error; - let stackTrace = null; @@ -300,7 +238,7 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d if (response.error.code === errors_1.InvalidArgumentsError.CODE) { error = new errors_1.InvalidArgumentsError(response.error.message); } -@@ -304,10 +331,6 @@ class EdrProviderWrapper extends events_1.EventEmitter { +@@ -304,10 +320,6 @@ class EdrProviderWrapper extends events_1.EventEmitter { if (args.method === "web3_clientVersion") { return clientVersion(response.result); } @@ -311,7 +249,7 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d else { return response.result; } -@@ -328,14 +351,16 @@ class EdrProviderWrapper extends events_1.EventEmitter { +@@ -328,14 +340,16 @@ class EdrProviderWrapper extends events_1.EventEmitter { const [genesisState, ownedAccounts] = _genesisStateAndOwnedAccounts(forkConfig !== undefined, this._providerConfig.hardfork, this._originalGenesisAccounts); this._providerConfig.genesisState = genesisState; this._providerConfig.ownedAccounts = ownedAccounts; @@ -335,7 +273,7 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d blockNumber: forkConfig.blockNumber !== undefined ? BigInt(forkConfig.blockNumber) : undefined, -@@ -346,7 +371,16 @@ class EdrProviderWrapper extends events_1.EventEmitter { +@@ -346,7 +360,16 @@ class EdrProviderWrapper extends events_1.EventEmitter { }; } else { @@ -353,30 +291,14 @@ index 8f6a795176e0ccb5e78a96143be1dab4b8d78593..233092ac49e242d32f4df8590cacd32d } const context = await getGlobalEdrContext(); const provider = await context.createProvider(GENERIC_CHAIN_TYPE, this._providerConfig, this._loggerConfig, this._subscriptionConfig, this._provider.contractDecoder()); -@@ -429,6 +463,15 @@ function _addCompilationResultParams(params) { - function _resetParams(params) { - return (0, validation_1.validateParams)(params, hardhat_network_1.optionalRpcHardhatNetworkConfig); - } -+function _resolveDefaultTransactionGasLimit(hardfork, blockGasLimit, transactionGasCap) { -+ if (transactionGasCap !== undefined) { -+ return transactionGasCap; -+ } -+ if ((0, hardforks_1.hardforkGte)(hardfork, hardforks_1.HardforkName.OSAKA)) { -+ return BigInt(Math.min(constants_1.FUSAKA_TRANSACTION_GAS_LIMIT, blockGasLimit)); -+ } -+ return BigInt(blockGasLimit); -+} - function _genesisStateAndOwnedAccounts(isForked, hardfork, genesisAccounts) { - const { l1GenesisState, l1HardforkFromString } = (0, napi_rs_1.requireNapiRsModule)("@nomicfoundation/edr"); - const genesisState = isForked diff --git a/internal/hardhat-network/provider/provider.js.map b/internal/hardhat-network/provider/provider.js.map -index c2bd27290c8ceab5d014a86bd50a891aa24ab07c..623ba6268d5cfaad3ebf463b73880be2e11a027b 100644 +index 2bddfb96c5affd4463f5230e45ffe49e28ff0773..43e571e11700516bc748ea7c57bc5f5cc3e32be8 100644 --- a/internal/hardhat-network/provider/provider.js.map +++ b/internal/hardhat-network/provider/provider.js.map @@ -1 +1 @@ --{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,2CAAoD;AACpD,8CAA6E;AAC7E,4DAAoC;AACpC,kDAA0B;AAC1B,mCAAsC;A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UAAU,GAAG,UAAU,CAAC,IAAI;QAChC,wBAAwB;QACxB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAChD,CAAC;QAEF,YAAY,CAAC,IAAI,CAAC;YAChB,OAAO,EAAE,IAAA,uBAAgB,EAAC,UAAU,CAAC;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;YAChC,IAAI,EAAE,IAAI,UAAU,EAAE,EAAE,sEAAsE;SAC/F,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,UAAU,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file -+{"version":3,"file":"provider.js","sourceRoot":"","sources":["../../../src/internal/hardhat-network/provider/provider.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAsBA,2CAAoD;AACpD,8CAA6E;AAC7E,4DAAoC;AACpC,kDAA0B;AAC1B,mCAAsC;AACtC,wDAA+B;AAC/B,yCAA2B;AAE3B,qDAA8D;AAC9D,+CAGyB;AACzB,oEAA0E;AAC1E,oFAGwD;AACxD,8DAG6C;AAC7C,0EAA2E;AAC3E,wDAKqC;AACrC,oDAA4D;AAC5D,oDAI8B;AAC9B,iEAA8D;AAC9D,qEAA2E;AAG3E,wDAAwD;AAOxD,uDAQ8B;AAC9B,6CAA4E;AAC5E,gDAA8E;AAE9E,MAAM,GAAG,GAAG,IAAA,eAAK,EAAC,uCAAuC,CAAC,CAAC;AAE3D,+EAA+E;AAElE,QAAA,gBAAgB,GAAG,4CAA4C,CAAC;AAC7E,IAAI,iBAAyC,CAAC;AAE9C,0CAA0C;AACnC,KAAK,UAAU,mBAAmB;IACvC,MAAM,EAAE,UAAU,EAAE,kBAAkB,EAAE,2BAA2B,EAAE,GACnE,IAAA,6BAAmB,EACjB,sBAAsB,CACkB,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F;QAC3F,CAAC,CAAC,cAAc,CAAC,oBAAoB,CAAC,QAAQ,CAAC,CAAC,CAAC;IAEnD,MAAM,aAAa,GAAG,eAAe,CAAC,GAAG,CAAC,CAAC,OAAO,EAAE,EAAE;QACpD,MAAM,UAAU,GAAG,UAAU,CAAC,IAAI;QAChC,wBAAwB;QACxB,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,UAAU,CAAC,KAAK,CAAC,CAAC,CAAC,EAAE,KAAK,CAAC,CAChD,CAAC;QAEF,YAAY,CAAC,IAAI,CAAC;YAChB,OAAO,EAAE,IAAA,uBAAgB,EAAC,UAAU,CAAC;YACrC,OAAO,EAAE,MAAM,CAAC,OAAO,CAAC,OAAO,CAAC;YAChC,IAAI,EAAE,IAAI,UAAU,EAAE,EAAE,sEAAsE;SAC/F,CAAC,CAAC;QAEH,OAAO,OAAO,CAAC,UAAU,CAAC;IAC5B,CAAC,CAAC,CAAC;IAEH,OAAO,CAAC,YAAY,EAAE,aAAa,CAAC,CAAC;AACvC,CAAC"} \ No newline at end of file diff --git a/internal/hardhat-network/provider/utils/convertToEdr.d.ts b/internal/hardhat-network/provider/utils/convertToEdr.d.ts index 69eebf11f2d8a5847ea74db738007391dde986b7..498b0c31286157833577cff91b07917f0a7a6007 100644 @@ -408,7 +330,7 @@ index 23b0715c04680d560c779a40890217d96f60916f..11771582b3e38226fac624b9e10a7849 +{"version":3,"file":"convertToEdr.d.ts","sourceRoot":"","sources":["../../../../src/internal/hardhat-network/provider/utils/convertToEdr.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EACV,MAAM,EACN,YAAY,EACZ,aAAa,EAEb,cAAc,EACd,oBAAoB,EACpB,WAAW,EACX,UAAU,EACX,MAAM,sBAAsB,CAAC;AAyB9B,OAAO,EAAE,YAAY,EAAE,MAAM,yBAAyB,CAAC;AACvD,OAAO,EAAE,oBAAoB,EAAE,YAAY,EAAE,MAAM,eAAe,CAAC;AAEnE,OAAO,EACL,gBAAgB,EAChB,sBAAsB,EACtB,cAAc,EACf,MAAM,aAAa,CAAC;AAIrB,wBAAgB,8BAA8B,CAAC,QAAQ,EAAE,YAAY,GAAG,MAAM,CA8C7E;AAED,wBAAgB,2BAA2B,CAAC,MAAM,EAAE,MAAM,GAAG,YAAY,CAgDxE;AAED,wBAAgB,mCAAmC,CACjD,MAAM,EAAE,oBAAoB,GAC3B,MAAM,GAAG,aAAa,GAAG,SAAS,CAcpC;AAED,wBAAgB,uCAAuC,CACrD,YAAY,EAAE,YAAY,GACzB,YAAY,CAWd;AAED,wBAAgB,sCAAsC,CACpD,IAAI,EAAE,WAAW,GAChB,sBAAsB,CAexB;AAED,wBAAgB,yCAAyC,CACvD,oBAAoB,EAAE,oBAAoB,GACzC,gBAAgB,CA+BlB;AAED,wBAAgB,iCAAiC,CAC/C,OAAO,EAAE,cAAc,GACtB,cAAc,CAahB;AAED,wBAAgB,gBAAgB,CAAC,KAAK,CAAC,EAAE;IACvC,CAAC,IAAI,EAAE,MAAM,GAAG,MAAM,CAAC;CACxB,GAAG,UAAU,EAAE,GAAG,SAAS,CAc3B"} \ No newline at end of file diff --git a/internal/hardhat-network/provider/utils/convertToEdr.js b/internal/hardhat-network/provider/utils/convertToEdr.js -index 9f306964d32309a3a72626fd5d522d2066758821..53b7bcd1328b2bcf7ca82e2596ef0bc639553010 100644 +index 9f306964d32309a3a72626fd5d522d2066758821..ae7f1a83860d726a5ca877c125d889df290f0667 100644 --- a/internal/hardhat-network/provider/utils/convertToEdr.js +++ b/internal/hardhat-network/provider/utils/convertToEdr.js @@ -1,101 +1,20 @@ @@ -520,7 +442,7 @@ index 9f306964d32309a3a72626fd5d522d2066758821..53b7bcd1328b2bcf7ca82e2596ef0bc6 } exports.edrSpecIdToEthereumHardfork = edrSpecIdToEthereumHardfork; function ethereumjsIntervalMiningConfigToEdr(config) { -@@ -126,50 +45,6 @@ function ethereumjsMempoolOrderToEdrMineOrdering(mempoolOrder) { +@@ -126,91 +45,34 @@ function ethereumjsMempoolOrderToEdrMineOrdering(mempoolOrder) { } } exports.ethereumjsMempoolOrderToEdrMineOrdering = ethereumjsMempoolOrderToEdrMineOrdering; @@ -570,7 +492,61 @@ index 9f306964d32309a3a72626fd5d522d2066758821..53b7bcd1328b2bcf7ca82e2596ef0bc6 -exports.edrRpcDebugTraceToHardhat = edrRpcDebugTraceToHardhat; function edrTracingStepToMinimalInterpreterStep(step) { const minimalInterpreterStep = { - pc: Number(step.pc), +- pc: Number(step.pc), ++ pc: step.pc, + depth: step.depth, + opcode: { +- name: step.opcode, ++ name: step.opcode.name, + }, + stack: step.stack, ++ memory: step.memory, + }; +- if (step.memory !== undefined) { +- minimalInterpreterStep.memory = step.memory; +- } + return minimalInterpreterStep; + } + exports.edrTracingStepToMinimalInterpreterStep = edrTracingStepToMinimalInterpreterStep; + function edrTracingMessageResultToMinimalEVMResult(tracingMessageResult) { +- const { result, contractAddress } = tracingMessageResult.executionResult; +- // only SuccessResult has logs +- const success = "logs" in result; ++ const execResult = tracingMessageResult.execResult; + const minimalEVMResult = { + execResult: { +- executionGasUsed: result.gasUsed, +- success, ++ success: execResult.success, ++ executionGasUsed: execResult.executionGasUsed, ++ contractAddress: execResult.contractAddress !== undefined ++ ? new util_1.Address(execResult.contractAddress) ++ : undefined, ++ reason: execResult.reason, ++ output: execResult.output !== undefined ++ ? Buffer.from(execResult.output) ++ : undefined, + }, + }; +- // only success and exceptional halt have reason +- if ("reason" in result) { +- minimalEVMResult.execResult.reason = result.reason; +- } +- if ("output" in result) { +- const { output } = result; +- if (output instanceof Uint8Array) { +- minimalEVMResult.execResult.output = Buffer.from(output); +- } +- else { +- minimalEVMResult.execResult.output = Buffer.from(output.returnValue); +- } +- } +- if (contractAddress !== undefined) { +- minimalEVMResult.execResult.contractAddress = new util_1.Address(contractAddress); +- } + return minimalEVMResult; + } + exports.edrTracingMessageResultToMinimalEVMResult = edrTracingMessageResultToMinimalEVMResult; diff --git a/internal/hardhat-network/provider/utils/convertToEdr.js.map b/internal/hardhat-network/provider/utils/convertToEdr.js.map index f83df9fdce13dcce820f520b556ec9dce9537ff8..b97968227b38b48845d60e4a93e8dd21f21cc778 100644 --- a/internal/hardhat-network/provider/utils/convertToEdr.js.map @@ -581,18 +557,24 @@ index f83df9fdce13dcce820f520b556ec9dce9537ff8..b97968227b38b48845d60e4a93e8dd21 +{"version":3,"file":"convertToEdr.js","sourceRoot":"","sources":["../../../../src/internal/hardhat-network/provider/utils/convertToEdr.ts"],"names":[],"mappings":";;;AAUA,8CAoB8B;AAC9B,2CAA2C;AAE3C,wDAAiE;AACjE,uDAAuD;AASvD,+EAA+E;AAE/E,SAAgB,8BAA8B,CAAC,QAAsB;IACnE,QAAQ,QAAQ,EAAE;QAChB,KAAK,wBAAY,CAAC,QAAQ;YACxB,OAAO,cAAQ,CAAC;QAClB,KAAK,wBAAY,CAAC,SAAS;YACzB,OAAO,eAAS,CAAC;QACnB,KAAK,wBAAY,CAAC,GAAG;YACnB,OAAO,cAAQ,CAAC;QAClB,KAAK,wBAAY,CAAC,iBAAiB;YACjC,OAAO,eAAS,CAAC;QACnB,KAAK,wBAAY,CAAC,eAAe;YAC/B,OAAO,qBAAe,CAAC;QACzB,KAAK,wBAAY,CAAC,SAAS;YACzB,OAAO,eAAS,CAAC;QACnB,KAAK,wBAAY,CAAC,cAAc;YAC9B,OAAO,oBAAc,CAAC;QACxB,KAAK,wBAAY,CAAC,UAAU;YAC1B,OAAO,gBAAU,CAAC;QACpB,KAAK,wBAAY,CAAC,QAAQ;YACxB,OAAO,cAAQ,CAAC;QAClB,KAAK,wBAAY,CAAC,YAAY;YAC5B,OAAO,kBAAY,CAAC;QACtB,KAAK,wBAAY,CAAC,MAAM;YACtB,OAAO,YAAM,CAAC;QAChB,KAAK,wBAAY,CAAC,MAAM;YACtB,OAAO,YAAM,CAAC;QAChB,KAAK,wBAAY,CAAC,aAAa;YAC7B,OAAO,mBAAa,CAAC;QACvB,KAAK,wBAAY,CAAC,YAAY;YAC5B,OAAO,kBAAY,CAA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ider.ts b/src/internal/hardhat-network/provider/provider.ts -index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700fc7be3db 100644 +index d299f5c6853ab9dc2521234bbeb431c328fb9db8..85fba933c7aae219399657e09e47a6e23b56e26d 100644 --- a/src/internal/hardhat-network/provider/provider.ts +++ b/src/internal/hardhat-network/provider/provider.ts -@@ -30,6 +30,7 @@ import * as t from "io-ts"; - - import { requireNapiRsModule } from "../../../common/napi-rs"; - import { -+ FUSAKA_TRANSACTION_GAS_LIMIT, - HARDHAT_NETWORK_RESET_EVENT, - HARDHAT_NETWORK_REVERT_SNAPSHOT_EVENT, - } from "../../constants"; -@@ -67,7 +68,6 @@ import { +@@ -21,7 +21,12 @@ import type { + AccountOverride, + } from "@nomicfoundation/edr"; + import { privateToAddress } from "@ethereumjs/util"; +-import { ContractDecoder, precompileP256Verify } from "@nomicfoundation/edr"; ++import { ++ ContractDecoder, ++ IncludeTraces, ++ precompileP256Verify, ++ StackSnapshotType, ++} from "@nomicfoundation/edr"; + import picocolors from "picocolors"; + import debug from "debug"; + import { EventEmitter } from "events"; +@@ -67,7 +72,6 @@ import { MempoolOrder, } from "./node-types"; import { @@ -600,7 +582,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 edrTracingMessageResultToMinimalEVMResult, edrTracingMessageToMinimalMessage, edrTracingStepToMinimalInterpreterStep, -@@ -130,8 +130,6 @@ interface HardhatNetworkProviderConfig { +@@ -130,8 +134,6 @@ interface HardhatNetworkProviderConfig { enableRip7212: boolean; } @@ -609,7 +591,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 type CallOverrideCallback = ( address: Buffer, data: Buffer -@@ -157,11 +155,14 @@ export class EdrProviderWrapper +@@ -157,11 +159,14 @@ export class EdrProviderWrapper _vm: MinimalEthereumJsVm; }, private readonly _subscriptionConfig: SubscriptionConfig, @@ -627,7 +609,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 ) { super(); } -@@ -200,9 +201,15 @@ export class EdrProviderWrapper +@@ -200,9 +205,15 @@ export class EdrProviderWrapper const cacheDir = config.forkCachePath; @@ -645,7 +627,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 blockNumber: config.forkConfig.blockNumber !== undefined ? BigInt(config.forkConfig.blockNumber) -@@ -212,16 +219,18 @@ export class EdrProviderWrapper +@@ -212,16 +223,18 @@ export class EdrProviderWrapper httpHeaders: httpHeadersToEdr(config.forkConfig.httpHeaders), url: config.forkConfig.jsonRpcUrl, }; @@ -672,7 +654,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 const printLineFn = loggerConfig.printLineFn ?? printLine; const replaceLastLineFn = loggerConfig.replaceLastLineFn ?? replaceLastLine; -@@ -230,7 +239,7 @@ export class EdrProviderWrapper +@@ -230,7 +243,7 @@ export class EdrProviderWrapper const edrHardfork = ethereumsjsHardforkToEdrSpecId(hardforkName); const [genesisState, ownedAccounts] = _genesisStateAndOwnedAccounts( @@ -681,7 +663,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 edrHardfork, config.genesisAccounts ); -@@ -241,20 +250,34 @@ export class EdrProviderWrapper +@@ -241,20 +254,29 @@ export class EdrProviderWrapper : [precompileP256Verify()] : []; @@ -706,11 +688,6 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 - blockGasLimit: BigInt(config.blockGasLimit), chainId: BigInt(config.chainId), coinbase: Buffer.from(coinbase.slice(2), "hex"), -+ defaultTransactionGasLimit: _resolveDefaultTransactionGasLimit( -+ hardforkName, -+ config.blockGasLimit, -+ transactionGasCap -+ ), precompileOverrides, - fork, genesisState, @@ -719,7 +696,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 initialBaseFeePerGas: config.initialBaseFeePerGas !== undefined ? BigInt(config.initialBaseFeePerGas!) -@@ -262,25 +285,17 @@ export class EdrProviderWrapper +@@ -262,25 +284,20 @@ export class EdrProviderWrapper minGasPrice: config.minGasPrice, mining: { autoMine: config.automine, @@ -731,7 +708,11 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 }, + network, networkId: BigInt(config.networkId), - observability: {}, +- observability: {}, ++ observability: { ++ includeCallTraces: IncludeTraces.All, ++ recordStack: StackSnapshotType.Top, ++ }, ownedAccounts, - // Turn off the Osaka EIP-7825 per transaction gas limit for HH2 - // when being run from `solidity-coverage`. @@ -748,7 +729,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 }; const edrLoggerConfig = { -@@ -303,7 +318,7 @@ export class EdrProviderWrapper +@@ -303,7 +320,7 @@ export class EdrProviderWrapper const edrSubscriptionConfig = { subscriptionCallback: (event: SubscriptionEvent) => { @@ -757,7 +738,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 }, }; -@@ -332,14 +347,14 @@ export class EdrProviderWrapper +@@ -332,14 +349,14 @@ export class EdrProviderWrapper edrSubscriptionConfig, config.genesisAccounts, cacheDir, @@ -778,114 +759,30 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 return wrapper; } -@@ -387,75 +402,88 @@ export class EdrProviderWrapper - response = responseObject.data; - } +@@ -392,11 +409,8 @@ export class EdrProviderWrapper + this._node._vm.events.eventNames().length > 0; -- const needsTraces = -- this._node._vm.evm.events.eventNames().length > 0 || -- this._node._vm.events.eventNames().length > 0; -- -- if (needsTraces) { + if (needsTraces) { - const rawTraces = responseObject.traces; - for (const rawTrace of rawTraces) { - // For other consumers in JS we need to marshall the entire trace over FFI - const trace = rawTrace.trace; - -- // beforeTx event -- if (this._node._vm.events.listenerCount("beforeTx") > 0) { -- this._node._vm.events.emit("beforeTx"); -- } -- -- for (const traceItem of trace) { -- // step event -- if ("pc" in traceItem) { -- if (this._node._vm.evm.events.listenerCount("step") > 0) { -- this._node._vm.evm.events.emit( -- "step", -- edrTracingStepToMinimalInterpreterStep(traceItem) -- ); -- } -- } -- // afterMessage event ++ const rawTraces = responseObject.traces(); ++ for (const trace of rawTraces) { + // beforeTx event + if (this._node._vm.events.listenerCount("beforeTx") > 0) { + this._node._vm.events.emit("beforeTx"); +@@ -413,7 +427,7 @@ export class EdrProviderWrapper + } + } + // afterMessage event - else if ("executionResult" in traceItem) { -- if (this._node._vm.evm.events.listenerCount("afterMessage") > 0) { -- this._node._vm.evm.events.emit( -- "afterMessage", -- edrTracingMessageResultToMinimalEVMResult(traceItem) -- ); -- } -- } -- // beforeMessage event -- else { -- if (this._node._vm.evm.events.listenerCount("beforeMessage") > 0) { -- this._node._vm.evm.events.emit( -- "beforeMessage", -- edrTracingMessageToMinimalMessage(traceItem) -- ); -- } -- } -- } -- -- // afterTx event -- if (this._node._vm.events.listenerCount("afterTx") > 0) { -- this._node._vm.events.emit("afterTx"); -- } -- } -- } -+ // TODO: re-enable tracing events once EDR adds backwards compatibility support -+ // const needsTraces = -+ // this._node._vm.evm.events.eventNames().length > 0 || -+ // this._node._vm.events.eventNames().length > 0; -+ -+ // if (needsTraces) { -+ // const rawTraces = responseObject.traces; -+ // for (const rawTrace of rawTraces) { -+ // // For other consumers in JS we need to marshall the entire trace over FFI -+ // const trace = rawTrace.trace; -+ -+ // // beforeTx event -+ // if (this._node._vm.events.listenerCount("beforeTx") > 0) { -+ // this._node._vm.events.emit("beforeTx"); -+ // } -+ -+ // for (const traceItem of trace) { -+ // // step event -+ // if ("pc" in traceItem) { -+ // if (this._node._vm.evm.events.listenerCount("step") > 0) { -+ // this._node._vm.evm.events.emit( -+ // "step", -+ // edrTracingStepToMinimalInterpreterStep(traceItem) -+ // ); -+ // } -+ // } -+ // // afterMessage event -+ // else if ("executionResult" in traceItem) { -+ // if (this._node._vm.evm.events.listenerCount("afterMessage") > 0) { -+ // this._node._vm.evm.events.emit( -+ // "afterMessage", -+ // edrTracingMessageResultToMinimalEVMResult(traceItem) -+ // ); -+ // } -+ // } -+ // // beforeMessage event -+ // else { -+ // if (this._node._vm.evm.events.listenerCount("beforeMessage") > 0) { -+ // this._node._vm.evm.events.emit( -+ // "beforeMessage", -+ // edrTracingMessageToMinimalMessage(traceItem) -+ // ); -+ // } -+ // } -+ // } -+ -+ // // afterTx event -+ // if (this._node._vm.events.listenerCount("afterTx") > 0) { -+ // this._node._vm.events.emit("afterTx"); -+ // } -+ // } -+ // } - ++ else if ("execResult" in traceItem) { + if (this._node._vm.evm.events.listenerCount("afterMessage") > 0) { + this._node._vm.evm.events.emit( + "afterMessage", +@@ -442,20 +456,32 @@ export class EdrProviderWrapper if (isErrorResponse(response)) { let error; @@ -926,7 +823,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 if (response.error.code === InvalidArgumentsError.CODE) { error = new InvalidArgumentsError(response.error.message); } else { -@@ -479,11 +507,6 @@ export class EdrProviderWrapper +@@ -479,11 +505,6 @@ export class EdrProviderWrapper // e.g. `HardhatNetwork/2.19.0/@nomicfoundation/edr/0.2.0-dev` if (args.method === "web3_clientVersion") { return clientVersion(response.result); @@ -938,7 +835,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 } else { return response.result; } -@@ -519,18 +542,19 @@ export class EdrProviderWrapper +@@ -519,18 +540,19 @@ export class EdrProviderWrapper this._providerConfig.genesisState = genesisState; this._providerConfig.ownedAccounts = ownedAccounts; @@ -967,7 +864,7 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 blockNumber: forkConfig.blockNumber !== undefined ? BigInt(forkConfig.blockNumber) -@@ -541,7 +565,18 @@ export class EdrProviderWrapper +@@ -541,7 +563,18 @@ export class EdrProviderWrapper url: forkConfig.jsonRpcUrl, }; } else { @@ -987,31 +884,8 @@ index 7e4276a589668b96c16243f547c0a2caecdb0d46..2c66beed0ccf52984129eb104cc5d700 } const context = await getGlobalEdrContext(); -@@ -677,6 +712,22 @@ function _resetParams(params: any[]): [RpcHardhatNetworkConfig | undefined] { - return validateParams(params, optionalRpcHardhatNetworkConfig); - } - -+function _resolveDefaultTransactionGasLimit( -+ hardfork: HardforkName, -+ blockGasLimit: number, -+ transactionGasCap: bigint | undefined -+): bigint { -+ if (transactionGasCap !== undefined) { -+ return transactionGasCap; -+ } -+ -+ if (hardforkGte(hardfork, HardforkName.OSAKA)) { -+ return BigInt(Math.min(FUSAKA_TRANSACTION_GAS_LIMIT, blockGasLimit)); -+ } -+ -+ return BigInt(blockGasLimit); -+} -+ - function _genesisStateAndOwnedAccounts( - isForked: boolean, - hardfork: string, diff --git a/src/internal/hardhat-network/provider/utils/convertToEdr.ts b/src/internal/hardhat-network/provider/utils/convertToEdr.ts -index 7fc17b29c0483c4f72ec471f8be60ce7d563add8..6e29625e68e2b6d45f91042bd10fbbabfe70f518 100644 +index 7fc17b29c0483c4f72ec471f8be60ce7d563add8..a77598208744be77e9acc6ffba6ce281fb210360 100644 --- a/src/internal/hardhat-network/provider/utils/convertToEdr.ts +++ b/src/internal/hardhat-network/provider/utils/convertToEdr.ts @@ -1,5 +1,5 @@ @@ -1158,7 +1032,7 @@ index 7fc17b29c0483c4f72ec471f8be60ce7d563add8..6e29625e68e2b6d45f91042bd10fbbab } export function ethereumjsIntervalMiningConfigToEdr( -@@ -174,62 +70,6 @@ export function ethereumjsMempoolOrderToEdrMineOrdering( +@@ -174,113 +70,43 @@ export function ethereumjsMempoolOrderToEdrMineOrdering( } } @@ -1221,3 +1095,69 @@ index 7fc17b29c0483c4f72ec471f8be60ce7d563add8..6e29625e68e2b6d45f91042bd10fbbab export function edrTracingStepToMinimalInterpreterStep( step: TracingStep ): MinimalInterpreterStep { + const minimalInterpreterStep: MinimalInterpreterStep = { +- pc: Number(step.pc), ++ pc: step.pc, + depth: step.depth, + opcode: { +- name: step.opcode, ++ name: step.opcode.name, + }, + stack: step.stack, ++ memory: step.memory, + }; + +- if (step.memory !== undefined) { +- minimalInterpreterStep.memory = step.memory; +- } +- + return minimalInterpreterStep; + } + + export function edrTracingMessageResultToMinimalEVMResult( + tracingMessageResult: TracingMessageResult + ): MinimalEVMResult { +- const { result, contractAddress } = tracingMessageResult.executionResult; +- +- // only SuccessResult has logs +- const success = "logs" in result; ++ const execResult = tracingMessageResult.execResult; + + const minimalEVMResult: MinimalEVMResult = { + execResult: { +- executionGasUsed: result.gasUsed, +- success, ++ success: execResult.success, ++ executionGasUsed: execResult.executionGasUsed, ++ contractAddress: ++ execResult.contractAddress !== undefined ++ ? new Address(execResult.contractAddress) ++ : undefined, ++ reason: execResult.reason, ++ output: ++ execResult.output !== undefined ++ ? Buffer.from(execResult.output) ++ : undefined, + }, + }; + +- // only success and exceptional halt have reason +- if ("reason" in result) { +- minimalEVMResult.execResult.reason = result.reason; +- } +- if ("output" in result) { +- const { output } = result; +- if (output instanceof Uint8Array) { +- minimalEVMResult.execResult.output = Buffer.from(output); +- } else { +- minimalEVMResult.execResult.output = Buffer.from(output.returnValue); +- } +- } +- +- if (contractAddress !== undefined) { +- minimalEVMResult.execResult.contractAddress = new Address(contractAddress); +- } +- + return minimalEVMResult; + } + diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 8d38eb4828..d7d726a218 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -8,7 +8,7 @@ overrides: hardhat>@nomicfoundation/edr: workspace:* patchedDependencies: - hardhat@2.28.4: d8456b4328ad7b07fc176942b27b07c36eb5060ae7ff2dd9312ed4853c823b0d + hardhat@2.28.6: b8790b083be74288377cfb15e513008d2674febe060595223c378dae7a0f2b5f hardhat@3.18.0: a06714727fa15e18d65840ee713f8400cd01daa9e4837354fe7ad532bdda2b68 importers: @@ -214,8 +214,8 @@ importers: specifier: ^7.0.1 version: 7.0.1 hardhat: - specifier: 2.28.4 - version: 2.28.4(patch_hash=d8456b4328ad7b07fc176942b27b07c36eb5060ae7ff2dd9312ed4853c823b0d)(supports-color@8.1.1)(ts-node@10.9.2(@types/node@22.20.5)(typescript@5.8.3))(typescript@5.8.3) + specifier: 2.28.6 + version: 2.28.6(patch_hash=b8790b083be74288377cfb15e513008d2674febe060595223c378dae7a0f2b5f)(supports-color@8.1.1)(ts-node@10.9.2(@types/node@22.20.5)(typescript@5.8.3))(typescript@5.8.3) mocha: specifier: ^11.1.0 version: 11.8.0 @@ -296,8 +296,8 @@ importers: specifier: 3.18.0 version: 3.18.0(patch_hash=a06714727fa15e18d65840ee713f8400cd01daa9e4837354fe7ad532bdda2b68) hardhat2: - specifier: npm:hardhat@2.28.4 - version: hardhat@2.28.4(patch_hash=d8456b4328ad7b07fc176942b27b07c36eb5060ae7ff2dd9312ed4853c823b0d)(supports-color@8.1.1)(ts-node@10.9.2(@types/node@22.20.5)(typescript@5.8.3))(typescript@5.8.3) + specifier: npm:hardhat@2.28.6 + version: hardhat@2.28.6(patch_hash=b8790b083be74288377cfb15e513008d2674febe060595223c378dae7a0f2b5f)(supports-color@8.1.1)(ts-node@10.9.2(@types/node@22.20.5)(typescript@5.8.3))(typescript@5.8.3) lodash: specifier: ^4.17.11 version: 4.18.1 @@ -2591,8 +2591,8 @@ packages: graphemer@1.4.0: resolution: {integrity: sha512-EtKwoO6kxCL9WO5xipiHTZlSzBm7WLT627TqC/uVRd0HKmq8NXyebnNYxDoBi7wt8eTWrUrKXCOVaFq9x1kgag==} - hardhat@2.28.4: - resolution: {integrity: sha512-iQC4WNWjWMz7cVVFqzEBNisUQ/EEEJrWysJ2hRAMTnfXJx6Y11UXdmtz4dHIzvGL0z27XCCaJrcApDPH0KaZEg==} + hardhat@2.28.6: + resolution: {integrity: sha512-zQze7qe+8ltwHvhX5NQ8sN1N37WWZGw8L63y+2XcPxGwAjc/SMF829z3NS6o1krX0sryhAsVBK/xrwUqlsot4Q==} hasBin: true peerDependencies: ts-node: '*' @@ -6200,7 +6200,7 @@ snapshots: graphemer@1.4.0: {} - hardhat@2.28.4(patch_hash=d8456b4328ad7b07fc176942b27b07c36eb5060ae7ff2dd9312ed4853c823b0d)(supports-color@8.1.1)(ts-node@10.9.2(@types/node@22.20.5)(typescript@5.8.3))(typescript@5.8.3): + hardhat@2.28.6(patch_hash=b8790b083be74288377cfb15e513008d2674febe060595223c378dae7a0f2b5f)(supports-color@8.1.1)(ts-node@10.9.2(@types/node@22.20.5)(typescript@5.8.3))(typescript@5.8.3): dependencies: '@ethereumjs/util': 9.1.0 '@ethersproject/abi': 5.8.0 diff --git a/pnpm-workspace.yaml b/pnpm-workspace.yaml index e7b5f3eb03..b47acb8141 100644 --- a/pnpm-workspace.yaml +++ b/pnpm-workspace.yaml @@ -10,7 +10,7 @@ overrides: hardhat>@nomicfoundation/edr: "workspace:*" patchedDependencies: - hardhat@2.28.4: patches/hardhat@2.28.4.patch + hardhat@2.28.6: patches/hardhat@2.28.6.patch hardhat@3.18.0: patches/hardhat@3.18.0.patch # Delay installs until a version is at least 1 week old