Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 4 additions & 1 deletion src/Nethermind.Arbitrum/ArbitrumPlugin.cs
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,13 @@
using Nethermind.Arbitrum.Modules;
using Nethermind.Arbitrum.Precompiles;
using Nethermind.Arbitrum.Stylus;
using Nethermind.Arbitrum.Tracing;
using Nethermind.Blockchain;
using Nethermind.Config;
using Nethermind.Consensus;
using Nethermind.Consensus.Processing;
using Nethermind.Consensus.Producers;
using Nethermind.Consensus.Tracing;
using Nethermind.Consensus.Validators;
using Nethermind.Core;
using Nethermind.Core.Container;
Expand Down Expand Up @@ -229,7 +231,8 @@ protected override void Load(ContainerBuilder builder)

// Rpcs
.AddSingleton<ArbitrumEthModuleFactory>()
.Bind<IRpcModuleFactory<IEthRpcModule>, ArbitrumEthModuleFactory>();
.Bind<IRpcModuleFactory<IEthRpcModule>, ArbitrumEthModuleFactory>()
.AddScoped<IGethStyleTracer, ArbitrumGethStyleTracer>();

if (blocksConfig.BuildBlocksOnMainState)
builder.AddSingleton<IBlockProducerEnvFactory, ArbitrumGlobalWorldStateBlockProducerEnvFactory>();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,18 @@

using Nethermind.Arbitrum.Config;
using Nethermind.Arbitrum.Execution.Transactions;
using Nethermind.Arbitrum.Tracing;
using Nethermind.Blockchain.Tracing;
using Nethermind.Core;
using Nethermind.Core.Crypto;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Evm.Tracing;
using Nethermind.Int256;

namespace Nethermind.Arbitrum.Execution.Receipts;

public class ArbitrumBlockReceiptTracer(
ArbitrumTxExecutionContext txExecContext,
IArbitrumConfig arbitrumConfig) : BlockReceiptsTracer
IArbitrumConfig arbitrumConfig) : BlockReceiptsTracer, IArbitrumTxTracer
{
protected override TxReceipt BuildReceipt(Address recipient, long spentGas, byte statusCode, LogEntry[] logEntries, Hash256? stateRoot)
{
Expand Down Expand Up @@ -40,4 +42,37 @@

return txReceipt;
}

public void CaptureArbitrumTransfer(Address? from, Address? to, UInt256 value, bool before, BalanceChangeReason reason)
{
IArbitrumTxTracer? arbitrumTxTracer = InnerTracer?.GetTracer<IArbitrumTxTracer>();
arbitrumTxTracer?.CaptureArbitrumTransfer(from, to, value, before, reason);
}

public void CaptureArbitrumStorageGet(UInt256 index, int depth, bool before)
{
if (InnerTracer is IArbitrumTxTracer arbitrumTxTracer) arbitrumTxTracer.CaptureArbitrumStorageGet(index, depth, before);

Check failure on line 54 in src/Nethermind.Arbitrum/Execution/Receipts/ArbitrumBlockReceiptTracer.cs

View workflow job for this annotation

GitHub Actions / format-check (src/Nethermind.Arbitrum/Nethermind.Arbitrum.csproj)

Embedded statements must be on their own line
}

public void CaptureArbitrumStorageSet(UInt256 index, ValueHash256 value, int depth, bool before)
{
if (InnerTracer is IArbitrumTxTracer arbitrumTxTracer) arbitrumTxTracer.CaptureArbitrumStorageSet(index, value, depth, before);

Check failure on line 59 in src/Nethermind.Arbitrum/Execution/Receipts/ArbitrumBlockReceiptTracer.cs

View workflow job for this annotation

GitHub Actions / format-check (src/Nethermind.Arbitrum/Nethermind.Arbitrum.csproj)

Embedded statements must be on their own line
}

public void CaptureStylusHostio(string name, ReadOnlySpan<byte> args, ReadOnlySpan<byte> outs, ulong startInk, ulong endInk)
{
if (InnerTracer is IArbitrumTxTracer arbitrumTxTracer) arbitrumTxTracer.CaptureStylusHostio(name, args, outs, startInk, endInk);

Check failure on line 64 in src/Nethermind.Arbitrum/Execution/Receipts/ArbitrumBlockReceiptTracer.cs

View workflow job for this annotation

GitHub Actions / format-check (src/Nethermind.Arbitrum/Nethermind.Arbitrum.csproj)

Embedded statements must be on their own line
}

/// <summary>
/// Reports change of code for address
/// </summary>
/// <param name="address"></param>
/// <param name="before"></param>
/// <param name="after"></param>
/// <remarks>Depends on <see cref="IsTracingState"/></remarks>
public new void ReportCodeChange(Address address, byte[]? before, byte[]? after)
{
base.ReportCodeChange(address, before!, after!);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,3 +14,11 @@ public class ArbitrumGethLikeBlockTracer(GethTraceOptions options)

protected override GethLikeTxTrace OnEnd(ArbitrumGethLikeTxTracer txTracer) => txTracer.BuildResult();
}

public class ArbitrumGethLikeNativeBlockTracer(GethTraceOptions options)
: BlockTracerBase<GethLikeTxTrace, ArbitrumNativeCallTracer>(options.TxHash)
{
protected override ArbitrumNativeCallTracer OnStart(Transaction? tx) => new(tx, options);

protected override GethLikeTxTrace OnEnd(ArbitrumNativeCallTracer txTracer) => txTracer.BuildResult();
}
Loading
Loading