Skip to content

Commit

Permalink
Add native call tracer (#6945)
Browse files Browse the repository at this point in the history
Co-authored-by: lukasz.rozmej <lukasz.rozmej@gmail.com>
  • Loading branch information
natebeauregard and LukaszRozmej authored May 2, 2024
1 parent abe8f8f commit 7733036
Show file tree
Hide file tree
Showing 29 changed files with 1,276 additions and 73 deletions.
2 changes: 2 additions & 0 deletions src/Nethermind/Nethermind.Core/Collections/ArrayPoolList.cs
Original file line number Diff line number Diff line change
Expand Up @@ -362,4 +362,6 @@ public void Dispose()
#endif

public Span<T> AsSpan() => _array.AsSpan(0, Count);

public ReadOnlyMemory<T> AsMemory() => new(_array, 0, Count);
}
18 changes: 18 additions & 0 deletions src/Nethermind/Nethermind.Core/CompositeDisposable.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
// SPDX-FileCopyrightText: 2024 Demerzel Solutions Limited
// SPDX-License-Identifier: LGPL-3.0-only

using System;
using System.Collections.Generic;

namespace Nethermind.Core;

public class CompositeDisposable : List<IDisposable>, IDisposable
{
public void Dispose()
{
foreach (IDisposable disposable in this)
{
disposable.Dispose();
}
}
}
23 changes: 22 additions & 1 deletion src/Nethermind/Nethermind.Evm.Test/EvmPooledMemoryTests.cs
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,19 @@ public class MyTracer : ITxTracer, IDisposable
public bool IsTracingBlockHash { get; } = false;
public bool IsTracingAccess { get; } = false;
public bool IsTracingFees => false;
public bool IsTracing => IsTracingReceipt || IsTracingActions || IsTracingOpLevelStorage || IsTracingMemory || IsTracingInstructions || IsTracingRefunds || IsTracingCode || IsTracingStack || IsTracingBlockHash || IsTracingAccess || IsTracingFees;
public bool IsTracingLogs => false;
public bool IsTracing => IsTracingReceipt
|| IsTracingActions
|| IsTracingOpLevelStorage
|| IsTracingMemory
|| IsTracingInstructions
|| IsTracingRefunds
|| IsTracingCode
|| IsTracingStack
|| IsTracingBlockHash
|| IsTracingAccess
|| IsTracingFees
|| IsTracingLogs;

public string lastmemline;

Expand All @@ -241,6 +253,10 @@ public void ReportOperationRemainingGas(long gas)
{
}

public void ReportLog(LogEntry log)
{
}

public void SetOperationStack(TraceStack stack)
{
}
Expand Down Expand Up @@ -320,6 +336,11 @@ public void ReportActionError(EvmExceptionType exceptionType)
throw new NotSupportedException();
}

public void ReportActionRevert(long gas, ReadOnlyMemory<byte> output)
{
throw new NotSupportedException();
}

public void ReportActionEnd(long gas, Address deploymentAddress, ReadOnlyMemory<byte> deployedCode)
{
throw new NotSupportedException();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.Specs;
using Nethermind.Specs.Forks;
using Nethermind.State;
using Nethermind.Trie.Pruning;
using NSubstitute;
Expand Down
Loading

0 comments on commit 7733036

Please sign in to comment.