Skip to content

Commit

Permalink
Updates references to Nethermind references to 1.20.1.
Browse files Browse the repository at this point in the history
Switched over to using official reference assemblies instead of custom built assemblies copied into repository.
  • Loading branch information
MicahZoltu committed Aug 1, 2023
1 parent 227b064 commit 85a94d6
Show file tree
Hide file tree
Showing 31 changed files with 59 additions and 77 deletions.
27 changes: 27 additions & 0 deletions .devcontainer/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
// For format details, see https://aka.ms/devcontainer.json. For config options, see the
// README at: https://github.com/devcontainers/templates/tree/main/src/dotnet
{
"name": "C# (.NET)",
// Or use a Dockerfile or Docker Compose file. More info: https://containers.dev/guide/dockerfile
"image": "mcr.microsoft.com/devcontainers/dotnet:0-7.0"

// Features to add to the dev container. More info: https://containers.dev/features.
// "features": {},

// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [5000, 5001],
// "portsAttributes": {
// "5001": {
// "protocol": "https"
// }
// }

// Use 'postCreateCommand' to run commands after the container is created.
// "postCreateCommand": "dotnet restore",

// Configure tool-specific properties.
// "customizations": {},

// Uncomment to connect as root instead. More info: https://aka.ms/dev-containers-non-root.
// "remoteUser": "root"
}
6 changes: 2 additions & 4 deletions Zoltu.Nethermind.Plugin.Multicall.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,11 @@
<ProduceReferenceAssembly>false</ProduceReferenceAssembly>
</PropertyGroup>
<ItemGroup>
<SourceRoot Include="$(MSBuildProjectDirectory)\" MappedPath="/_/"/>
<SourceRoot Include="$(MSBuildProjectDirectory)\" MappedPath="/_/" />
<FrameworkReference Include="Microsoft.AspNetCore.App" />
<Reference Include=".\references\*.dll">
<Private>false</Private>
</Reference>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Nethermind.Numerics.Int256" Version="1.1.0" />
<PackageReference Include="Nethermind.ReferenceAssemblies" Version="1.20.1" />
</ItemGroup>
</Project>
Binary file removed references/Nethermind.Abi.dll
Binary file not shown.
Binary file removed references/Nethermind.Api.dll
Binary file not shown.
Binary file removed references/Nethermind.Blockchain.dll
Binary file not shown.
Binary file removed references/Nethermind.Config.dll
Binary file not shown.
Binary file removed references/Nethermind.Consensus.dll
Binary file not shown.
Binary file removed references/Nethermind.Core.dll
Binary file not shown.
Binary file removed references/Nethermind.Crypto.dll
Binary file not shown.
Binary file removed references/Nethermind.Db.dll
Binary file not shown.
Binary file removed references/Nethermind.Evm.dll
Binary file not shown.
Binary file removed references/Nethermind.Facade.dll
Binary file not shown.
Binary file removed references/Nethermind.Grpc.dll
Binary file not shown.
Binary file removed references/Nethermind.JsonRpc.dll
Binary file not shown.
Binary file removed references/Nethermind.KeyStore.dll
Binary file not shown.
Binary file removed references/Nethermind.Logging.dll
Binary file not shown.
Binary file removed references/Nethermind.Monitoring.dll
Binary file not shown.
Binary file removed references/Nethermind.Network.Stats.dll
Binary file not shown.
Binary file removed references/Nethermind.Network.dll
Binary file not shown.
Binary file removed references/Nethermind.Serialization.Json.dll
Binary file not shown.
Binary file removed references/Nethermind.Sockets.dll
Binary file not shown.
Binary file removed references/Nethermind.Specs.dll
Binary file not shown.
Binary file removed references/Nethermind.State.dll
Binary file not shown.
Binary file removed references/Nethermind.Synchronization.dll
Binary file not shown.
Binary file removed references/Nethermind.Trie.dll
Binary file not shown.
Binary file removed references/Nethermind.TxPool.dll
Binary file not shown.
Binary file removed references/Nethermind.Wallet.dll
Binary file not shown.
51 changes: 0 additions & 51 deletions references/copy-references.mjs

This file was deleted.

2 changes: 1 addition & 1 deletion source/MulticallModule.cs
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public ResultWrapper<CallResult[]> eth_multicall(Int64 blockNumber, String block
var block = new Block(blockHeader, transactions.Select(x => x.ToTransaction()), Enumerable.Empty<BlockHeader>());
var cancellationToken = new CancellationTokenSource(jsonRpcConfig.Timeout).Token;
var blockTracer = new MyBlockTracer(cancellationToken);
var postTraceStateRoot = this.tracer.Trace(block, blockTracer);
this.tracer.Trace(block, blockTracer);
return ResultWrapper<CallResult[]>.Success(blockTracer.Results.ToArray());
}

Expand Down
45 changes: 26 additions & 19 deletions source/MulticallModuleFactory.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,47 +48,54 @@ public override IMulticallModule Create()
var txProcessingEnv = new ReadOnlyTxProcessingEnv(dbProvider, trieNodeResolver, blockTree, specProvider, logManager);
var rewardCalculator = rewardCalculatorSource.Get(txProcessingEnv.TransactionProcessor);
var chainProcessingEnv = new ReadOnlyChainProcessingEnv(txProcessingEnv, Always.Valid, recoveryStep, rewardCalculator, receiptFinder, dbProvider, specProvider, logManager);
var tracer = new MyTracer(chainProcessingEnv.StateProvider, chainProcessingEnv.ChainProcessor);
var tracer = new MyTracer(chainProcessingEnv.StateProvider, chainProcessingEnv.ChainProcessor, chainProcessingEnv.ChainProcessor);
return new MulticallModule(tracer, blockTree, jsonRpcConfig);
}
}

// ripped from Nethermind codebase so we can enable nonce checking, since processing options isn't exposed
public class MyTracer : ITracer
{
private readonly IStateProvider _stateProvider;
private readonly IBlockchainProcessor _blockProcessor;
private readonly IWorldState _stateProvider;
private readonly IBlockchainProcessor _traceProcessor;
private readonly IBlockchainProcessor _executeProcessor;

public MyTracer(IStateProvider stateProvider, IBlockchainProcessor blockProcessor)
public MyTracer(IWorldState stateProvider, IBlockchainProcessor traceProcessor, IBlockchainProcessor executeProcessor)
{
_stateProvider = stateProvider ?? throw new ArgumentNullException(nameof(stateProvider));
_blockProcessor = blockProcessor ?? throw new ArgumentNullException(nameof(blockProcessor));
_traceProcessor = traceProcessor ?? throw new ArgumentNullException(nameof(traceProcessor));
_executeProcessor = executeProcessor ?? throw new ArgumentNullException(nameof(executeProcessor));
}

public Block? Trace(Block block, IBlockTracer blockTracer)
public void Trace(Block block, IBlockTracer blockTracer) => Process(block, blockTracer, _traceProcessor);
public void Execute(Block block, IBlockTracer tracer) => Process(block, tracer, _executeProcessor);

public void Accept(ITreeVisitor visitor, Keccak stateRoot)
{
if (visitor == null) throw new ArgumentNullException(nameof(visitor));
if (stateRoot == null) throw new ArgumentNullException(nameof(stateRoot));

_stateProvider.Accept(visitor, stateRoot);
}

private void Process(Block block, IBlockTracer blockTracer, IBlockchainProcessor processor)
{
/* We force process since we want to process a block that has already been processed in the past and normally it would be ignored.
We also want to make it read only so the state is not modified persistently in any way. */

blockTracer.StartNewBlockTrace(block);

try
{
blockTracer.StartNewBlockTrace(block);
/* We force process since we want to process a block that has already been processed in the past and normally it would be ignored.
We also want to make it read only so the state is not modified persistently in any way. */
Block? processedBlock = _blockProcessor.Process(block, ProcessingOptions.ProducingBlock, blockTracer);
blockTracer.EndBlockTrace();
return processedBlock;
processor.Process(block, ProcessingOptions.ProducingBlock, blockTracer);
}
catch (Exception)
{
_stateProvider.Reset();
throw;
}
}

public void Accept(ITreeVisitor visitor, Keccak stateRoot)
{
if (visitor == null) throw new ArgumentNullException(nameof(visitor));
if (stateRoot == null) throw new ArgumentNullException(nameof(stateRoot));

_stateProvider.Accept(visitor, stateRoot);
blockTracer.EndBlockTrace();
}
}
}
5 changes: 3 additions & 2 deletions source/MulticallTransactionTracer.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ namespace Zoltu.Nethermind.Plugin.Multicall
{
public sealed class MulticallTransactionTracer : ITxTracer
{
public Boolean IsTracing => true;
public Boolean IsTracingReceipt => true;
public Boolean IsTracingState => true;
public Boolean IsTracingAccess => false;
Expand Down Expand Up @@ -75,8 +76,8 @@ public void ReportRefund(Int64 refund) { }
public void ReportSelfDestruct(Address address, UInt256 balance, Address refundAddress) { }
public void ReportStackPush(in ReadOnlySpan<Byte> stackItem) { }
public void ReportStorageChange(in ReadOnlySpan<Byte> key, in ReadOnlySpan<Byte> value) { }
public void ReportStorageChange(StorageCell storageCell, Byte[] before, Byte[] after) { }
public void ReportStorageRead(StorageCell storageCell) { }
public void ReportStorageChange(in StorageCell storageCell, Byte[] before, Byte[] after) { }
public void ReportStorageRead(in StorageCell storageCell) { }
public void SetOperationMemory(List<String> memoryTrace) { }
public void SetOperationMemorySize(UInt64 newSize) { }
public void SetOperationStack(List<String> stackTrace) { }
Expand Down

0 comments on commit 85a94d6

Please sign in to comment.