diff --git a/src/Nethermind/Nethermind.AccountAbstraction/Executor/AABlockProducerTransactionsExecutor.cs b/src/Nethermind/Nethermind.AccountAbstraction/Executor/AABlockProducerTransactionsExecutor.cs index e3791db4b03..2066e0b9ac3 100644 --- a/src/Nethermind/Nethermind.AccountAbstraction/Executor/AABlockProducerTransactionsExecutor.cs +++ b/src/Nethermind/Nethermind.AccountAbstraction/Executor/AABlockProducerTransactionsExecutor.cs @@ -56,12 +56,12 @@ public override TxReceipt[] ProcessTransactions( { if (IsAccountAbstractionTransaction(transaction)) { - BlockProcessor.TxAction action = ProcessAccountAbstractionTransaction(block, blkCtx, transaction, i++, receiptsTracer, processingOptions, transactionsInBlock); + BlockProcessor.TxAction action = ProcessAccountAbstractionTransaction(block, in blkCtx, transaction, i++, receiptsTracer, processingOptions, transactionsInBlock); if (action == BlockProcessor.TxAction.Stop) break; } else { - BlockProcessor.TxAction action = ProcessTransaction(block, blkCtx, transaction, i++, receiptsTracer, processingOptions, transactionsInBlock); + BlockProcessor.TxAction action = ProcessTransaction(block, in blkCtx, transaction, i++, receiptsTracer, processingOptions, transactionsInBlock); if (action == BlockProcessor.TxAction.Stop) break; } } @@ -81,7 +81,7 @@ private bool IsAccountAbstractionTransaction(Transaction transaction) private BlockProcessor.TxAction ProcessAccountAbstractionTransaction( Block block, - BlockExecutionContext blkCtx, + in BlockExecutionContext blkCtx, Transaction currentTx, int index, BlockReceiptsTracer receiptsTracer, @@ -90,7 +90,7 @@ private BlockProcessor.TxAction ProcessAccountAbstractionTransaction( { int snapshot = receiptsTracer.TakeSnapshot(); - BlockProcessor.TxAction action = ProcessTransaction(block, blkCtx, currentTx, index, receiptsTracer, processingOptions, transactionsInBlock, false); + BlockProcessor.TxAction action = ProcessTransaction(block, in blkCtx, currentTx, index, receiptsTracer, processingOptions, transactionsInBlock, false); if (action != BlockProcessor.TxAction.Add) { return action; diff --git a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockProductionTransactionsExecutor.cs b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockProductionTransactionsExecutor.cs index f794d3b64b6..fdaab77ccdb 100644 --- a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockProductionTransactionsExecutor.cs +++ b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockProductionTransactionsExecutor.cs @@ -79,7 +79,7 @@ public virtual TxReceipt[] ProcessTransactions(Block block, ProcessingOptions pr BlockExecutionContext blkCtx = new(block.Header); foreach (Transaction currentTx in transactions) { - TxAction action = ProcessTransaction(block, blkCtx, currentTx, i++, receiptsTracer, processingOptions, transactionsInBlock); + TxAction action = ProcessTransaction(block, in blkCtx, currentTx, i++, receiptsTracer, processingOptions, transactionsInBlock); if (action == TxAction.Stop) break; } @@ -91,7 +91,7 @@ public virtual TxReceipt[] ProcessTransactions(Block block, ProcessingOptions pr protected TxAction ProcessTransaction( Block block, - BlockExecutionContext blkCtx, + in BlockExecutionContext blkCtx, Transaction currentTx, int index, BlockReceiptsTracer receiptsTracer, @@ -109,7 +109,7 @@ protected TxAction ProcessTransaction( } else { - _transactionProcessor.ProcessTransaction(blkCtx, currentTx, receiptsTracer, processingOptions, _stateProvider); + _transactionProcessor.ProcessTransaction(in blkCtx, currentTx, receiptsTracer, processingOptions, _stateProvider); if (addToBlock) { diff --git a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockValidationTransactionsExecutor.cs b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockValidationTransactionsExecutor.cs index 116ba87a90c..e520562d4e2 100644 --- a/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockValidationTransactionsExecutor.cs +++ b/src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockValidationTransactionsExecutor.cs @@ -39,14 +39,14 @@ public TxReceipt[] ProcessTransactions(Block block, ProcessingOptions processing for (int i = 0; i < block.Transactions.Length; i++) { Transaction currentTx = block.Transactions[i]; - ProcessTransaction(blkCtx, currentTx, i, receiptsTracer, processingOptions); + ProcessTransaction(in blkCtx, currentTx, i, receiptsTracer, processingOptions); } return receiptsTracer.TxReceipts.ToArray(); } - private void ProcessTransaction(BlockExecutionContext blkCtx, Transaction currentTx, int index, BlockReceiptsTracer receiptsTracer, ProcessingOptions processingOptions) + private void ProcessTransaction(in BlockExecutionContext blkCtx, Transaction currentTx, int index, BlockReceiptsTracer receiptsTracer, ProcessingOptions processingOptions) { - _transactionProcessor.ProcessTransaction(blkCtx, currentTx, receiptsTracer, processingOptions, _stateProvider); + _transactionProcessor.ProcessTransaction(in blkCtx, currentTx, receiptsTracer, processingOptions, _stateProvider); TransactionProcessed?.Invoke(this, new TxProcessedEventArgs(index, currentTx, receiptsTracer.TxReceipts[index])); } } diff --git a/src/Nethermind/Nethermind.Consensus/Processing/TransactionProcessorAdapterExtensions.cs b/src/Nethermind/Nethermind.Consensus/Processing/TransactionProcessorAdapterExtensions.cs index 7e92e41dd13..9b57646922a 100644 --- a/src/Nethermind/Nethermind.Consensus/Processing/TransactionProcessorAdapterExtensions.cs +++ b/src/Nethermind/Nethermind.Consensus/Processing/TransactionProcessorAdapterExtensions.cs @@ -12,7 +12,7 @@ namespace Nethermind.Consensus.Processing; internal static class TransactionProcessorAdapterExtensions { public static void ProcessTransaction(this ITransactionProcessorAdapter transactionProcessor, - BlockExecutionContext blkCtx, + in BlockExecutionContext blkCtx, Transaction currentTx, BlockReceiptsTracer receiptsTracer, ProcessingOptions processingOptions, @@ -24,7 +24,7 @@ public static void ProcessTransaction(this ITransactionProcessorAdapter transact } using ITxTracer tracer = receiptsTracer.StartNewTxTrace(currentTx); - transactionProcessor.Execute(currentTx, blkCtx, receiptsTracer); + transactionProcessor.Execute(currentTx, in blkCtx, receiptsTracer); receiptsTracer.EndTxTrace(); } } diff --git a/src/Nethermind/Nethermind.Evm/ExecutionEnvironment.cs b/src/Nethermind/Nethermind.Evm/ExecutionEnvironment.cs index afd332d5a39..ec6600fef8e 100644 --- a/src/Nethermind/Nethermind.Evm/ExecutionEnvironment.cs +++ b/src/Nethermind/Nethermind.Evm/ExecutionEnvironment.cs @@ -17,7 +17,7 @@ public ExecutionEnvironment Address caller, Address? codeSource, ReadOnlyMemory inputData, - TxExecutionContext txExecutionContext, + in TxExecutionContext txExecutionContext, UInt256 transferValue, UInt256 value, int callDepth = 0) diff --git a/src/Nethermind/Nethermind.Evm/Tracing/GasEstimator.cs b/src/Nethermind/Nethermind.Evm/Tracing/GasEstimator.cs index 7ae1c6c64a3..a2ddc2c0397 100644 --- a/src/Nethermind/Nethermind.Evm/Tracing/GasEstimator.cs +++ b/src/Nethermind/Nethermind.Evm/Tracing/GasEstimator.cs @@ -89,7 +89,7 @@ private bool TryExecutableTransaction(Transaction transaction, BlockHeader block transaction.GasLimit = gasLimit; BlockExecutionContext blCtx = new(block); - _transactionProcessor.CallAndRestore(transaction, blCtx, tracer.WithCancellation(token)); + _transactionProcessor.CallAndRestore(transaction, in blCtx, tracer.WithCancellation(token)); transaction.GasLimit = originalGasLimit; diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/BuildUpTransactionProcessorAdapter.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/BuildUpTransactionProcessorAdapter.cs index 3583b6480b9..acfb1c7d295 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/BuildUpTransactionProcessorAdapter.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/BuildUpTransactionProcessorAdapter.cs @@ -15,7 +15,7 @@ public BuildUpTransactionProcessorAdapter(ITransactionProcessor transactionProce _transactionProcessor = transactionProcessor; } - public void Execute(Transaction transaction, BlockExecutionContext blkCtx, ITxTracer txTracer) => - _transactionProcessor.BuildUp(transaction, blkCtx, txTracer); + public void Execute(Transaction transaction, in BlockExecutionContext blkCtx, ITxTracer txTracer) => + _transactionProcessor.BuildUp(transaction, in blkCtx, txTracer); } } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/CallAndRestoreTransactionProcessorAdapter.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/CallAndRestoreTransactionProcessorAdapter.cs index 7042c9337a1..d518b5ee279 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/CallAndRestoreTransactionProcessorAdapter.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/CallAndRestoreTransactionProcessorAdapter.cs @@ -15,7 +15,7 @@ public CallAndRestoreTransactionProcessorAdapter(ITransactionProcessor transacti _transactionProcessor = transactionProcessor; } - public void Execute(Transaction transaction, BlockExecutionContext blkCtx, ITxTracer txTracer) => - _transactionProcessor.CallAndRestore(transaction, blkCtx, txTracer); + public void Execute(Transaction transaction, in BlockExecutionContext blkCtx, ITxTracer txTracer) => + _transactionProcessor.CallAndRestore(transaction, in blkCtx, txTracer); } } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ChangeableTransactionProcessorAdapter.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ChangeableTransactionProcessorAdapter.cs index 231950c656c..661a6698820 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ChangeableTransactionProcessorAdapter.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ChangeableTransactionProcessorAdapter.cs @@ -22,9 +22,9 @@ public ChangeableTransactionProcessorAdapter(ITransactionProcessor transactionPr TransactionProcessor = transactionProcessor; } - public void Execute(Transaction transaction, BlockExecutionContext blkCtx, ITxTracer txTracer) + public void Execute(Transaction transaction, in BlockExecutionContext blkCtx, ITxTracer txTracer) { - CurrentAdapter.Execute(transaction, blkCtx, txTracer); + CurrentAdapter.Execute(transaction, in blkCtx, txTracer); } } } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ExecuteTransactionProcessorAdapter.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ExecuteTransactionProcessorAdapter.cs index 2b4967dd3cd..b0f51de953e 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ExecuteTransactionProcessorAdapter.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ExecuteTransactionProcessorAdapter.cs @@ -15,7 +15,7 @@ public ExecuteTransactionProcessorAdapter(ITransactionProcessor transactionProce _transactionProcessor = transactionProcessor; } - public void Execute(Transaction transaction, BlockExecutionContext blkCtx, ITxTracer txTracer) => - _transactionProcessor.Execute(transaction, blkCtx, txTracer); + public void Execute(Transaction transaction, in BlockExecutionContext blkCtx, ITxTracer txTracer) => + _transactionProcessor.Execute(transaction, in blkCtx, txTracer); } } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessor.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessor.cs index 972ac5be1d8..21973ee817a 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessor.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessor.cs @@ -11,21 +11,21 @@ public interface ITransactionProcessor /// /// Execute transaction, commit state /// - void Execute(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer); + void Execute(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer); /// /// Call transaction, rollback state /// - void CallAndRestore(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer); + void CallAndRestore(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer); /// /// Execute transaction, keep the state uncommitted /// - void BuildUp(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer); + void BuildUp(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer); /// /// Call transaction, no validations, commit state /// Will NOT charge gas from sender account, so stateDiff will miss gas fee /// - void Trace(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer); + void Trace(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer); } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessorAdapter.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessorAdapter.cs index 06ab48f127e..4f09f301792 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessorAdapter.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ITransactionProcessorAdapter.cs @@ -8,6 +8,6 @@ namespace Nethermind.Evm.TransactionProcessing { public interface ITransactionProcessorAdapter { - void Execute(Transaction transaction, BlockExecutionContext blkCtx, ITxTracer txTracer); + void Execute(Transaction transaction, in BlockExecutionContext blkCtx, ITxTracer txTracer); } } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ReadOnlyTransactionProcessor.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ReadOnlyTransactionProcessor.cs index 97c68f0aec2..f6999143fd9 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/ReadOnlyTransactionProcessor.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/ReadOnlyTransactionProcessor.cs @@ -23,17 +23,17 @@ public ReadOnlyTransactionProcessor(ITransactionProcessor transactionProcessor, _stateProvider.StateRoot = startState ?? throw new ArgumentNullException(nameof(startState)); } - public void Execute(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) => - _transactionProcessor.Execute(transaction, blCtx, txTracer); + public void Execute(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) => + _transactionProcessor.Execute(transaction, in blCtx, txTracer); - public void CallAndRestore(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) => - _transactionProcessor.CallAndRestore(transaction, blCtx, txTracer); + public void CallAndRestore(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) => + _transactionProcessor.CallAndRestore(transaction, in blCtx, txTracer); - public void BuildUp(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) => - _transactionProcessor.BuildUp(transaction, blCtx, txTracer); + public void BuildUp(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) => + _transactionProcessor.BuildUp(transaction, in blCtx, txTracer); - public void Trace(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) => - _transactionProcessor.Trace(transaction, blCtx, txTracer); + public void Trace(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) => + _transactionProcessor.Trace(transaction, in blCtx, txTracer); public bool IsContractDeployed(Address address) => _stateProvider.IsContract(address); diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TraceTransactionProcessorAdapter.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TraceTransactionProcessorAdapter.cs index 3b51b89ccee..6c75c5b5e19 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TraceTransactionProcessorAdapter.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TraceTransactionProcessorAdapter.cs @@ -15,7 +15,7 @@ public TraceTransactionProcessorAdapter(ITransactionProcessor transactionProcess _transactionProcessor = transactionProcessor; } - public void Execute(Transaction transaction, BlockExecutionContext blkCtx, ITxTracer txTracer) => - _transactionProcessor.Trace(transaction, blkCtx, txTracer); + public void Execute(Transaction transaction, in BlockExecutionContext blkCtx, ITxTracer txTracer) => + _transactionProcessor.Trace(transaction, in blkCtx, txTracer); } } diff --git a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs index 73fcfc54c25..e5f954c2aab 100644 --- a/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs +++ b/src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs @@ -72,30 +72,30 @@ public TransactionProcessor( Ecdsa = new EthereumEcdsa(specProvider.ChainId, logManager); } - public void CallAndRestore(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) + public void CallAndRestore(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) { - Execute(transaction, blCtx, txTracer, ExecutionOptions.CommitAndRestore); + Execute(transaction, in blCtx, txTracer, ExecutionOptions.CommitAndRestore); } - public void BuildUp(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) + public void BuildUp(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) { // we need to treat the result of previous transaction as the original value of next transaction // when we do not commit WorldState.TakeSnapshot(true); - Execute(transaction, blCtx, txTracer, ExecutionOptions.None); + Execute(transaction, in blCtx, txTracer, ExecutionOptions.None); } - public void Execute(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) + public void Execute(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) { - Execute(transaction, blCtx, txTracer, ExecutionOptions.Commit); + Execute(transaction, in blCtx, txTracer, ExecutionOptions.Commit); } - public void Trace(Transaction transaction, BlockExecutionContext blCtx, ITxTracer txTracer) + public void Trace(Transaction transaction, in BlockExecutionContext blCtx, ITxTracer txTracer) { - Execute(transaction, blCtx, txTracer, ExecutionOptions.NoValidation); + Execute(transaction, in blCtx, txTracer, ExecutionOptions.NoValidation); } - protected virtual void Execute(Transaction tx, BlockExecutionContext blCtx, ITxTracer tracer, ExecutionOptions opts) + protected virtual void Execute(Transaction tx, in BlockExecutionContext blCtx, ITxTracer tracer, ExecutionOptions opts) { BlockHeader header = blCtx.Header; IReleaseSpec spec = SpecProvider.GetSpec(header); @@ -147,7 +147,7 @@ protected virtual void Execute(Transaction tx, BlockExecutionContext blCtx, ITxT if (commit) WorldState.Commit(spec, tracer.IsTracingState ? tracer : NullTxTracer.Instance); - ExecutionEnvironment env = BuildExecutionEnvironmnet(tx, blCtx, spec, tracer, opts, effectiveGasPrice); + ExecutionEnvironment env = BuildExecutionEnvironmnet(tx, in blCtx, spec, tracer, opts, effectiveGasPrice); long gasAvailable = tx.GasLimit - intrinsicGas; if (!ExecuteEVMCall(tx, header, spec, tracer, opts, gasAvailable, env, out TransactionSubstate? substate, out long spentGas, out byte statusCode)) @@ -433,7 +433,7 @@ protected virtual bool IncrementNonce(Transaction tx, BlockHeader header, IRelea } protected virtual ExecutionEnvironment BuildExecutionEnvironmnet( - Transaction tx, BlockExecutionContext blCtx, IReleaseSpec spec, ITxTracer tracer, ExecutionOptions opts, + Transaction tx, in BlockExecutionContext blCtx, IReleaseSpec spec, ITxTracer tracer, ExecutionOptions opts, in UInt256 effectiveGasPrice) { Address recipient = tx.GetRecipient(tx.IsContractCreation ? WorldState.GetNonce(tx.SenderAddress) : 0) ?? @@ -441,7 +441,7 @@ protected virtual ExecutionEnvironment BuildExecutionEnvironmnet( throw new InvalidDataException("Recipient has not been resolved properly before tx execution"); TxExecutionContext executionContext = - new(blCtx, tx.SenderAddress, effectiveGasPrice, tx.BlobVersionedHashes); + new(in blCtx, tx.SenderAddress, effectiveGasPrice, tx.BlobVersionedHashes); CodeInfo codeInfo = tx.IsContractCreation ? new(tx.Data.AsArray()) : VirtualMachine.GetCachedCodeInfo(WorldState, recipient, spec); @@ -450,7 +450,7 @@ protected virtual ExecutionEnvironment BuildExecutionEnvironmnet( return new ExecutionEnvironment ( - txExecutionContext: executionContext, + txExecutionContext: in executionContext, value: tx.Value, transferValue: tx.Value, caller: tx.SenderAddress, diff --git a/src/Nethermind/Nethermind.Evm/TxExecutionContext.cs b/src/Nethermind/Nethermind.Evm/TxExecutionContext.cs index 2e00bddb906..637c6fc0258 100644 --- a/src/Nethermind/Nethermind.Evm/TxExecutionContext.cs +++ b/src/Nethermind/Nethermind.Evm/TxExecutionContext.cs @@ -13,7 +13,7 @@ public readonly struct TxExecutionContext public UInt256 GasPrice { get; } public byte[][]? BlobVersionedHashes { get; } - public TxExecutionContext(BlockExecutionContext blockExecutionContext, Address origin, in UInt256 gasPrice, byte[][] blobVersionedHashes) + public TxExecutionContext(in BlockExecutionContext blockExecutionContext, Address origin, in UInt256 gasPrice, byte[][] blobVersionedHashes) { BlockExecutionContext = blockExecutionContext; Origin = origin; diff --git a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs index 3ddd12fbc2d..d388f58a775 100644 --- a/src/Nethermind/Nethermind.Evm/VirtualMachine.cs +++ b/src/Nethermind/Nethermind.Evm/VirtualMachine.cs @@ -2297,7 +2297,7 @@ private EvmExceptionType InstructionCall( ExecutionEnvironment callEnv = new ( - txExecutionContext: env.TxExecutionContext, + txExecutionContext: in env.TxExecutionContext, callDepth: env.CallDepth + 1, caller: caller, codeSource: codeSource, @@ -2535,7 +2535,7 @@ private EvmExceptionType InstructionSelfDestruct(EvmState vmState, ref ExecutionEnvironment callEnv = new ( - txExecutionContext: env.TxExecutionContext, + txExecutionContext: in env.TxExecutionContext, callDepth: env.CallDepth + 1, caller: env.ExecutingAccount, executingAccount: contractAddress, diff --git a/src/Nethermind/Nethermind.Mev/MevBlockProductionTransactionsExecutor.cs b/src/Nethermind/Nethermind.Mev/MevBlockProductionTransactionsExecutor.cs index add5367424e..a12e997e876 100644 --- a/src/Nethermind/Nethermind.Mev/MevBlockProductionTransactionsExecutor.cs +++ b/src/Nethermind/Nethermind.Mev/MevBlockProductionTransactionsExecutor.cs @@ -70,7 +70,7 @@ public override TxReceipt[] ProcessTransactions(Block block, ProcessingOptions p else { // otherwise process transaction as usual - TxAction action = ProcessTransaction(block, blkCtx, currentTx, transactionsInBlock.Count, receiptsTracer, processingOptions, transactionsInBlock); + TxAction action = ProcessTransaction(block, in blkCtx, currentTx, transactionsInBlock.Count, receiptsTracer, processingOptions, transactionsInBlock); if (action == TxAction.Stop) break; } } @@ -90,7 +90,7 @@ public override TxReceipt[] ProcessTransactions(Block block, ProcessingOptions p else { // process accumulated bundle - TxAction action = ProcessBundle(block, blkCtx, bundleTransactions, transactionsInBlock, receiptsTracer, processingOptions); + TxAction action = ProcessBundle(block, in blkCtx, bundleTransactions, transactionsInBlock, receiptsTracer, processingOptions); if (action == TxAction.Stop) break; // start accumulating new bundle @@ -103,11 +103,11 @@ public override TxReceipt[] ProcessTransactions(Block block, ProcessingOptions p { // process the bundle and stop accumulating it bundleHash = null; - TxAction action = ProcessBundle(block, blkCtx, bundleTransactions, transactionsInBlock, receiptsTracer, processingOptions); + TxAction action = ProcessBundle(block, in blkCtx, bundleTransactions, transactionsInBlock, receiptsTracer, processingOptions); if (action == TxAction.Stop) break; // process normal transaction - action = ProcessTransaction(block, blkCtx, currentTx, transactionsInBlock.Count, receiptsTracer, processingOptions, transactionsInBlock); + action = ProcessTransaction(block, in blkCtx, currentTx, transactionsInBlock.Count, receiptsTracer, processingOptions, transactionsInBlock); if (action == TxAction.Stop) break; } } @@ -115,7 +115,7 @@ public override TxReceipt[] ProcessTransactions(Block block, ProcessingOptions p // if we ended with accumulated bundle, lets process it if (bundleTransactions.Count > 0) { - ProcessBundle(block, blkCtx, bundleTransactions, transactionsInBlock, receiptsTracer, processingOptions); + ProcessBundle(block, in blkCtx, bundleTransactions, transactionsInBlock, receiptsTracer, processingOptions); } _stateProvider.Commit(spec, receiptsTracer); @@ -125,7 +125,7 @@ public override TxReceipt[] ProcessTransactions(Block block, ProcessingOptions p } private TxAction ProcessBundle(Block block, - BlockExecutionContext blkCtx, + in BlockExecutionContext blkCtx, List bundleTransactions, LinkedHashSet transactionsInBlock, BlockReceiptsTracer receiptsTracer, @@ -149,7 +149,7 @@ bool CheckFeeNotManipulated() TxAction txAction = TxAction.Skip; for (int index = 0; index < bundleTransactions.Count && bundleSucceeded; index++) { - txAction = ProcessBundleTransaction(block, blkCtx, bundleTransactions[index], index, receiptsTracer, processingOptions, transactionsInBlock); + txAction = ProcessBundleTransaction(block, in blkCtx, bundleTransactions[index], index, receiptsTracer, processingOptions, transactionsInBlock); bundleSucceeded &= txAction == TxAction.Add; // if we need to stop on not first tx in the bundle, we actually want to skip the bundle @@ -188,14 +188,14 @@ bool CheckFeeNotManipulated() private TxAction ProcessBundleTransaction( Block block, - BlockExecutionContext blkCtx, + in BlockExecutionContext blkCtx, BundleTransaction currentTx, int index, BlockReceiptsTracer receiptsTracer, ProcessingOptions processingOptions, LinkedHashSet transactionsInBlock) { - TxAction action = ProcessTransaction(block, blkCtx, currentTx, index, receiptsTracer, processingOptions, transactionsInBlock, false); + TxAction action = ProcessTransaction(block, in blkCtx, currentTx, index, receiptsTracer, processingOptions, transactionsInBlock, false); if (action == TxAction.Add) { string? error = receiptsTracer.LastReceipt.Error; diff --git a/src/Nethermind/Nethermind.Optimism/OptimismTransactionProcessor.cs b/src/Nethermind/Nethermind.Optimism/OptimismTransactionProcessor.cs index ac0f4c4f2e4..1af53687a9e 100644 --- a/src/Nethermind/Nethermind.Optimism/OptimismTransactionProcessor.cs +++ b/src/Nethermind/Nethermind.Optimism/OptimismTransactionProcessor.cs @@ -31,7 +31,7 @@ public OptimismTransactionProcessor( private UInt256? _currentTxL1Cost; - protected override void Execute(Transaction tx, BlockExecutionContext blCtx, ITxTracer tracer, ExecutionOptions opts) + protected override void Execute(Transaction tx, in BlockExecutionContext blCtx, ITxTracer tracer, ExecutionOptions opts) { IReleaseSpec spec = SpecProvider.GetSpec(blCtx.Header); _currentTxL1Cost = null; @@ -43,7 +43,7 @@ protected override void Execute(Transaction tx, BlockExecutionContext blCtx, ITx WorldState.Commit(spec); } - base.Execute(tx, blCtx, tracer, opts); + base.Execute(tx, in blCtx, tracer, opts); } protected override bool ValidateStatic(Transaction tx, BlockHeader header, IReleaseSpec spec, ITxTracer tracer, ExecutionOptions opts,