Skip to content

Commit

Permalink
Build fix
Browse files Browse the repository at this point in the history
  • Loading branch information
ak88 committed Aug 22, 2024
1 parent c7e9f61 commit f65e216
Show file tree
Hide file tree
Showing 14 changed files with 28 additions and 28 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@

namespace Nethermind.Benchmarks.Core;
[MemoryDiagnoser]
public class AuthorizedCodeInfoRepositoryBenchmark
public class CodeInfoRepositoryBenchmark
{

private IReleaseSpec _spec = MainnetSpecProvider.Instance.GetSpec(MainnetSpecProvider.PragueActivation);

private AuthorizationTuple[] Tuples100;
private AuthorizationTuple[] Tuples1k;

private AuthorizedCodeInfoRepository sut;
private CodeInfoRepository sut;
private static EthereumEcdsa _ethereumEcdsa;
private WorldState _stateProvider;

Expand All @@ -45,8 +45,8 @@ public void GlobalSetup()
_stateProvider.CreateAccount(Address.Zero, 100000000000000);
_stateProvider.Commit(_spec);

_ethereumEcdsa = new(1, new OneLoggerLogManager(NullLogger.Instance));
sut = new AuthorizedCodeInfoRepository(new CodeInfoRepository(), 1, NullLogger.Instance);
_ethereumEcdsa = new(1);
sut = new(1);
var list = new List<AuthorizationTuple>();
var rnd = new Random();
var addressBuffer = new byte[20];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ public RlpDecodeBlockBenchmark()
var transactions = new Transaction[100];
for (int i = 0; i < 100; i++)
{
transactions[i] = Build.A.Transaction.WithData(new byte[] { (byte)i }).WithNonce((UInt256)i).WithValue((UInt256)i).Signed(new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance), TestItem.PrivateKeyA).TestObject;
transactions[i] = Build.A.Transaction.WithData(new byte[] { (byte)i }).WithNonce((UInt256)i).WithValue((UInt256)i).Signed(new EthereumEcdsa(TestBlockchainIds.ChainId), TestItem.PrivateKeyA).TestObject;
}

_scenarios = new[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ public RlpEncodeBlockBenchmark()
var transactions = new Transaction[100];
for (int i = 0; i < 100; i++)
{
transactions[i] = Build.A.Transaction.WithData(new byte[] { (byte)i }).WithNonce((UInt256)i).WithValue((UInt256)i).Signed(new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance), TestItem.PrivateKeyA).TestObject;
transactions[i] = Build.A.Transaction.WithData(new byte[] { (byte)i }).WithNonce((UInt256)i).WithValue((UInt256)i).Signed(new EthereumEcdsa(TestBlockchainIds.ChainId), TestItem.PrivateKeyA).TestObject;
}

_scenarios = new[]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public RlpEncodeHeaderBenchmark()
var transactions = new Transaction[100];
for (int i = 0; i < 100; i++)
{
transactions[i] = Build.A.Transaction.WithData(new byte[] { (byte)i }).WithNonce((UInt256)i).WithValue((UInt256)i).Signed(new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance), TestItem.PrivateKeyA).TestObject;
transactions[i] = Build.A.Transaction.WithData(new byte[] { (byte)i }).WithNonce((UInt256)i).WithValue((UInt256)i).Signed(new EthereumEcdsa(TestBlockchainIds.ChainId), TestItem.PrivateKeyA).TestObject;
}

_scenarios = new[]
Expand Down
4 changes: 2 additions & 2 deletions src/Nethermind/Nethermind.Evm.Benchmark/EvmBenchmarks.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public void GlobalSetup()
_stateProvider = new WorldState(trieStore, codeDb, new OneLoggerLogManager(NullLogger.Instance));
_stateProvider.CreateAccount(Address.Zero, 1000.Ether());
_stateProvider.Commit(_spec);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(0);
_virtualMachine = new VirtualMachine(_blockhashProvider, MainnetSpecProvider.Instance, codeInfoRepository, LimboLogs.Instance);

_environment = new ExecutionEnvironment
Expand All @@ -55,7 +55,7 @@ public void GlobalSetup()
codeInfo: new CodeInfo(ByteCode),
value: 0,
transferValue: 0,
txExecutionContext: new TxExecutionContext(_header, Address.Zero, 0, null),
txExecutionContext: new TxExecutionContext(_header, Address.Zero, 0, null, codeInfoRepository),
inputData: default,
isSystemExecutionEnv: false
);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void GlobalSetup()
_stateProvider.Commit(_spec);

Console.WriteLine(MuirGlacier.Instance);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(0);
_virtualMachine = new VirtualMachine(_blockhashProvider, MainnetSpecProvider.Instance, codeInfoRepository, new OneLoggerLogManager(NullLogger.Instance));

_environment = new ExecutionEnvironment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ public void GlobalSetup()
_stateProvider.Commit(_spec);

Console.WriteLine(MuirGlacier.Instance);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(0);
_virtualMachine = new VirtualMachine(_blockhashProvider, MainnetSpecProvider.Instance, codeInfoRepository, new OneLoggerLogManager(NullLogger.Instance));

_environment = new ExecutionEnvironment
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Setup()
_stateProvider.Commit(_specProvider.GenesisSpec);
_stateProvider.CommitTree(0);

_codeInfoRepository = new CodeInfoRepository();
_codeInfoRepository = new CodeInfoRepository(0);

VirtualMachine virtualMachine = new(new TestBlockhashProvider(_specProvider), _specProvider, _codeInfoRepository, LimboLogs.Instance);

Expand All @@ -63,7 +63,7 @@ public void Setup()
return new TransactionResult();
});

_ethereumEcdsa = new EthereumEcdsa(_specProvider.ChainId, LimboLogs.Instance);
_ethereumEcdsa = new EthereumEcdsa(_specProvider.ChainId);
}


Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@ public void Setup()
_stateProvider.Commit(_specProvider.GenesisSpec);
_stateProvider.CommitTree(0);

_codeInfoRepository = new CodeInfoRepository();
_codeInfoRepository = new CodeInfoRepository(1);

VirtualMachine virtualMachine = new(new TestBlockhashProvider(_specProvider), _specProvider, _codeInfoRepository, LimboLogs.Instance);

Expand All @@ -63,7 +63,7 @@ public void Setup()
return new TransactionResult();
});

_ethereumEcdsa = new EthereumEcdsa(_specProvider.ChainId, LimboLogs.Instance);
_ethereumEcdsa = new EthereumEcdsa(_specProvider.ChainId);
}


Expand Down
16 changes: 8 additions & 8 deletions src/Nethermind/Nethermind.Evm/ExecutionEnvironment.cs
Original file line number Diff line number Diff line change
Expand Up @@ -38,44 +38,44 @@ public ExecutionEnvironment
/// <summary>
/// Parsed bytecode for the current call.
/// </summary>
public readonly CodeInfo CodeInfo = codeInfo;
public readonly CodeInfo CodeInfo;

/// <summary>
/// Currently executing account (in DELEGATECALL this will be equal to caller).
/// </summary>
public readonly Address ExecutingAccount = executingAccount;
public readonly Address ExecutingAccount;

/// <summary>
/// Caller
/// </summary>
public readonly Address Caller = caller;
public readonly Address Caller;

/// <summary>
/// Bytecode source (account address).
/// </summary>
public readonly Address? CodeSource = codeSource;
public readonly Address? CodeSource;

/// <summary>
/// Parameters / arguments of the current call.
/// </summary>
public readonly ReadOnlyMemory<byte> InputData = inputData;
public readonly ReadOnlyMemory<byte> InputData;

/// <summary>
/// Transaction originator
/// </summary>
public readonly TxExecutionContext TxExecutionContext = txExecutionContext;
public readonly TxExecutionContext TxExecutionContext;

/// <summary>
/// ETH value transferred in this call.
/// </summary>
public readonly UInt256 TransferValue = transferValue;
public readonly UInt256 TransferValue;

/// <summary>
/// Value information passed (it is different from transfer value in DELEGATECALL.
/// DELEGATECALL behaves like a library call and it uses the value information from the caller even
/// as no transfer happens.
/// </summary>
public readonly UInt256 Value = value;
public readonly UInt256 Value;

/// <example>If we call TX -> DELEGATECALL -> CALL -> STATICCALL then the call depth would be 3.</example>
public readonly int CallDepth;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -304,7 +304,7 @@ protected virtual ExecutionEnvironment BuildExecutionEnvironment(
Address recipient = tx.GetRecipient(tx.IsContractCreation ? WorldState.GetNonce(tx.SenderAddress) : 0);
if (recipient is null) ThrowInvalidDataException("Recipient has not been resolved properly before tx execution");

TxExecutionContext executionContext = new(in blCtx, tx.SenderAddress, effectiveGasPrice, tx.BlobVersionedHashes);
TxExecutionContext executionContext = new(in blCtx, tx.SenderAddress, effectiveGasPrice, tx.BlobVersionedHashes, _codeInfoRepository);

CodeInfo codeInfo = tx.IsContractCreation ? new(tx.Data?.AsArray() ?? Array.Empty<byte>())
: _codeInfoRepository.GetCachedCodeInfo(WorldState, recipient, spec);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public void GlobalSetup()
new SyncConfig(),
LimboLogs.Instance);
_blockhashProvider = new BlockhashProvider(blockTree, specProvider, stateProvider, LimboLogs.Instance);
CodeInfoRepository codeInfoRepository = new();
CodeInfoRepository codeInfoRepository = new(1);
_virtualMachine = new VirtualMachine(_blockhashProvider, specProvider, codeInfoRepository, LimboLogs.Instance);

Block genesisBlock = Build.A.Block.Genesis.TestObject;
Expand All @@ -97,7 +97,7 @@ TransactionProcessor transactionProcessor
BlockProcessor blockProcessor = new(specProvider, Always.Valid, new RewardCalculator(specProvider), transactionsExecutor,
stateProvider, NullReceiptStorage.Instance, new BlockhashStore(specProvider, stateProvider), transactionProcessor, LimboLogs.Instance);

EthereumEcdsa ecdsa = new(specProvider.ChainId, LimboLogs.Instance);
EthereumEcdsa ecdsa = new(specProvider.ChainId);
BlockchainProcessor blockchainProcessor = new(
blockTree,
blockProcessor,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ public void SetUp()
_ser.Register(new TransactionsMessageSerializer());
_ser.Register(new StatusMessageSerializer());
NodeStatsManager stats = new NodeStatsManager(TimerFactory.Default, LimboLogs.Instance);
var ecdsa = new EthereumEcdsa(TestBlockchainIds.ChainId, LimboLogs.Instance);
var ecdsa = new EthereumEcdsa(TestBlockchainIds.ChainId);
var tree = Build.A.BlockTree().TestObject;
var stateProvider = new WorldState(new TrieStore(new MemDb(), LimboLogs.Instance), new MemDb(), LimboLogs.Instance);
var specProvider = MainnetSpecProvider.Instance;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ public void Dispose()
}
}

private readonly IEthereumEcdsa _ecdsa = new EthereumEcdsa(BlockchainIds.Sepolia, LimboLogs.Instance); // TODO: separate general crypto signer from Ethereum transaction signing
private readonly IEthereumEcdsa _ecdsa = new EthereumEcdsa(BlockchainIds.Sepolia); // TODO: separate general crypto signer from Ethereum transaction signing

private IMessageSerializationService _messageSerializationService;

Expand Down

0 comments on commit f65e216

Please sign in to comment.