diff --git a/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/Custom/Native/Call/NativeCallTracer.cs b/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/Custom/Native/Call/NativeCallTracer.cs index 565e15a80a36..4c69cdc72712 100644 --- a/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/Custom/Native/Call/NativeCallTracer.cs +++ b/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/Custom/Native/Call/NativeCallTracer.cs @@ -57,16 +57,20 @@ public NativeCallTracer( public override GethLikeTxTrace BuildResult() { GethLikeTxTrace result = base.BuildResult(); - NativeCallTracerCallFrame firstCallFrame = _callStack[0]; Debug.Assert(_callStack.Count == 1, $"Unexpected frames on call stack, expected only master frame, found {_callStack.Count} frames."); - _callStack.RemoveAt(0); - _disposables.Add(firstCallFrame); + if (_callStack.Count is not 0) + { + NativeCallTracerCallFrame firstCallFrame = _callStack[0]; + _callStack.RemoveAt(0); + _disposables.Add(firstCallFrame); - result.TxHash = _txHash; - result.CustomTracerResult = new GethLikeCustomTrace { Value = firstCallFrame }; + result.TxHash = _txHash; + result.CustomTracerResult = new GethLikeCustomTrace { Value = firstCallFrame }; + } + result.TxHash = _txHash; _resultBuilt = true; return result; diff --git a/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/GethTraceOptions.cs b/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/GethTraceOptions.cs index 6af4bd4fea7e..66605682db0b 100644 --- a/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/GethTraceOptions.cs +++ b/src/Nethermind/Nethermind.Blockchain/Tracing/GethStyle/GethTraceOptions.cs @@ -4,7 +4,6 @@ using System; using System.Collections.Generic; using System.Text.Json; -using System.Text.Json.Serialization; using Nethermind.Core; using Nethermind.Core.Crypto; using Nethermind.Evm; @@ -13,33 +12,26 @@ namespace Nethermind.Blockchain.Tracing.GethStyle; public record GethTraceOptions { - [JsonPropertyName("disableMemory")] [Obsolete("Use EnableMemory instead.")] public bool DisableMemory { get => !EnableMemory; init => EnableMemory = !value; } - [JsonPropertyName("disableStorage")] public bool DisableStorage { get; init; } - [JsonPropertyName("enableMemory")] public bool EnableMemory { get; init; } - [JsonPropertyName("disableStack")] public bool DisableStack { get; init; } - [JsonPropertyName("timeout")] public string Timeout { get; init; } - [JsonPropertyName("tracer")] public string Tracer { get; init; } - [JsonPropertyName("txHash")] public Hash256? TxHash { get; init; } - [JsonPropertyName("tracerConfig")] public JsonElement? TracerConfig { get; init; } - [JsonPropertyName("stateOverrides")] public Dictionary? StateOverrides { get; init; } + public BlockOverride? BlockOverrides { get; set; } + public static GethTraceOptions Default { get; } = new(); } diff --git a/src/Nethermind/Nethermind.Consensus/Tracing/GethStyleTracer.cs b/src/Nethermind/Nethermind.Consensus/Tracing/GethStyleTracer.cs index 83833ef5631e..b2bce702e101 100644 --- a/src/Nethermind/Nethermind.Consensus/Tracing/GethStyleTracer.cs +++ b/src/Nethermind/Nethermind.Consensus/Tracing/GethStyleTracer.cs @@ -179,12 +179,14 @@ public IEnumerable TraceBadBlockToFile(Hash256 blockHash, GethTraceOptio // // Wild stuff! BlockHeader baseBlockHeader = block.Header; + if ((processingOptions & ProcessingOptions.ForceSameBlock) == 0) { baseBlockHeader = FindParent(block); } - using var scope = blockProcessingEnv.BuildAndOverride(baseBlockHeader, options.StateOverrides); + options.BlockOverrides?.ApplyOverrides(block.Header); + using Scope scope = blockProcessingEnv.BuildAndOverride(baseBlockHeader, options.StateOverrides); IBlockTracer tracer = CreateOptionsTracer(block.Header, options with { TxHash = txHash }, scope.Component.WorldState, specProvider); try diff --git a/src/Nethermind/Nethermind.Facade/Proxy/Models/Simulate/BlockOverride.cs b/src/Nethermind/Nethermind.Evm/BlockOverride.cs similarity index 96% rename from src/Nethermind/Nethermind.Facade/Proxy/Models/Simulate/BlockOverride.cs rename to src/Nethermind/Nethermind.Evm/BlockOverride.cs index 4bb929aef316..fb0f7b6e52c2 100644 --- a/src/Nethermind/Nethermind.Facade/Proxy/Models/Simulate/BlockOverride.cs +++ b/src/Nethermind/Nethermind.Evm/BlockOverride.cs @@ -6,7 +6,7 @@ using Nethermind.Core.Crypto; using Nethermind.Int256; -namespace Nethermind.Facade.Proxy.Models.Simulate; +namespace Nethermind.Evm; public class BlockOverride { diff --git a/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/TransactionBundle.cs b/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/TransactionBundle.cs index 3d1119669d45..4e11f17c79cb 100644 --- a/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/TransactionBundle.cs +++ b/src/Nethermind/Nethermind.JsonRpc/Modules/DebugModule/TransactionBundle.cs @@ -5,7 +5,6 @@ using Nethermind.Core; using Nethermind.Evm; using Nethermind.Facade.Eth.RpcTransaction; -using Nethermind.Facade.Proxy.Models.Simulate; namespace Nethermind.JsonRpc.Modules.DebugModule;