Skip to content

Commit

Permalink
Optimization/pre warm intra block cache fix nonce collisions (#7089)
Browse files Browse the repository at this point in the history
Co-authored-by: Ben Adams <[email protected]>
  • Loading branch information
LukaszRozmej and benaadams authored Oct 24, 2024
1 parent 85294fe commit ebc0def
Showing 1 changed file with 16 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
using Nethermind.Evm;
using Nethermind.Evm.Tracing;
using Nethermind.Evm.TransactionProcessing;
using Nethermind.Int256;
using Nethermind.Logging;
using Nethermind.State;
using Nethermind.Core.Eip2930;
Expand Down Expand Up @@ -143,6 +144,21 @@ private void WarmupTransactions(ParallelOptions parallelOptions, IReleaseSpec sp
tx = block.Transactions[i];
tx.CopyTo(systemTransaction);
using IReadOnlyTxProcessingScope scope = env.Build(stateRoot);
Address senderAddress = tx.SenderAddress!;
if (!scope.WorldState.AccountExists(senderAddress))
{
scope.WorldState.CreateAccountIfNotExists(senderAddress, UInt256.Zero);
}
for (int prev = 0; prev < i; prev++)
{
if (senderAddress == block.Transactions[prev].SenderAddress)
{
scope.WorldState.IncrementNonce(senderAddress);
}
}
if (spec.UseTxAccessLists)
{
scope.WorldState.WarmUp(tx.AccessList); // eip-2930
Expand Down

0 comments on commit ebc0def

Please sign in to comment.