Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor for verkle transition #7373

Draft
wants to merge 48 commits into
base: master
Choose a base branch
from
Draft

refactor for verkle transition #7373

wants to merge 48 commits into from

Conversation

tanishqjasoria
Copy link
Contributor

Fixes Closes Resolves #

Please choose one of the keywords above to refer to the issue this PR solves followed by the issue number (e.g. Fixes #000). If no issue number, remove the line. Also, remove everything marked optional that is not applicable. Remove this note after reading.

Changes

  • List the changes

Types of changes

What types of changes does your code introduce?

  • Bugfix (a non-breaking change that fixes an issue)
  • New feature (a non-breaking change that adds functionality)
  • Breaking change (a change that causes existing functionality not to work as expected)
  • Optimization
  • Refactoring
  • Documentation update
  • Build-related changes
  • Other: Description

Testing

Requires testing

  • Yes
  • No

If yes, did you write tests?

  • Yes
  • No

Notes on testing

Optional. Remove if not applicable.

Documentation

Requires documentation update

  • Yes
  • No

If yes, link the PR to the docs update or the issue with the details labeled docs. Remove if not applicable.

Requires explanation in Release Notes

  • Yes
  • No

If yes, fill in the details here. Remove if not applicable.

Remarks

Optional. Remove if not applicable.

yerke26 and others added 12 commits September 12, 2024 14:19
# Conflicts:
#	src/Nethermind/Ethereum.Test.Base/BlockchainTestBase.cs
#	src/Nethermind/Nethermind.AuRa.Test/AuraBlockProcessorTests.cs
#	src/Nethermind/Nethermind.Blockchain.Test/Producers/DevBlockproducerTests.cs
#	src/Nethermind/Nethermind.Blockchain.Test/ReorgTests.cs
#	src/Nethermind/Nethermind.Blockchain/GenesisLoader.cs
#	src/Nethermind/Nethermind.Clique.Test/CliqueBlockProducerTests.cs
#	src/Nethermind/Nethermind.Consensus.AuRa/AuRaBlockProcessor.cs
#	src/Nethermind/Nethermind.Consensus.Clique/CliquePlugin.cs
#	src/Nethermind/Nethermind.Consensus.Ethash/NethDevPlugin.cs
#	src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.BlockProductionTransactionsExecutor.cs
#	src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs
#	src/Nethermind/Nethermind.Consensus/Processing/IBlockProcessor.cs
#	src/Nethermind/Nethermind.Consensus/Processing/ReadOnlyChainProcessingEnv.cs
#	src/Nethermind/Nethermind.Consensus/Processing/ReadOnlyTxProcessingEnv.cs
#	src/Nethermind/Nethermind.Consensus/Producers/BlockProducerEnvFactory.cs
#	src/Nethermind/Nethermind.Core.Test/Blockchain/TestBlockchain.cs
#	src/Nethermind/Nethermind.Evm/TransactionProcessing/CallAndRestoreTransactionProcessorAdapter.cs
#	src/Nethermind/Nethermind.Evm/TransactionProcessing/ExecuteTransactionProcessorAdapter.cs
#	src/Nethermind/Nethermind.Evm/TransactionProcessing/TraceTransactionProcessorAdapter.cs
#	src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
#	src/Nethermind/Nethermind.Facade/Simulate/SimulateReadOnlyBlocksProcessingEnv.cs
#	src/Nethermind/Nethermind.Facade/Simulate/SimulateTransactionProcessor.cs
#	src/Nethermind/Nethermind.Init/InitializeStateDb.cs
#	src/Nethermind/Nethermind.Init/Steps/InitializeBlockchain.cs
#	src/Nethermind/Nethermind.JsonRpc.Benchmark/EthModuleBenchmarks.cs
#	src/Nethermind/Nethermind.JsonRpc.Test/Modules/Trace/ParityStyleTracerTests.cs
#	src/Nethermind/Nethermind.JsonRpc/Modules/RpcBlockTransactionsExecutor.cs
#	src/Nethermind/Nethermind.Merge.AuRa.Test/AuRaMergeEngineModuleTests.cs
#	src/Nethermind/Nethermind.Merge.AuRa/AuRaMergeBlockProcessor.cs
#	src/Nethermind/Nethermind.Merge.AuRa/InitializationSteps/InitializeBlockchainAuRaMerge.cs
#	src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.HelperFunctions.cs
#	src/Nethermind/Nethermind.Merge.Plugin.Test/EngineModuleTests.Setup.cs
#	src/Nethermind/Nethermind.Optimism/InitializeBlockchainOptimism.cs
#	src/Nethermind/Nethermind.Optimism/OptimismBlockProcessor.cs
#	src/Nethermind/Nethermind.Optimism/OptimismBlockProducerEnvFactory.cs
#	src/Nethermind/Nethermind.Optimism/OptimismTransactionProcessor.cs
#	src/Nethermind/Nethermind.Optimism/ReadOnlyChainProcessingEnv.cs
#	src/Nethermind/Nethermind.Synchronization.Test/SyncThreadTests.cs
# Conflicts:
#	src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/BeaconBlockRootHandler.cs
#	src/Nethermind/Nethermind.Blockchain/BeaconBlockRoot/IBeaconBlockRootHandler.cs
#	src/Nethermind/Nethermind.Consensus/Processing/BlockCachePreWarmer.cs
#	src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs
#	src/Nethermind/Nethermind.Consensus/Processing/IBlockCachePreWarmer.cs
# Conflicts:
#	src/Nethermind/Nethermind.Evm/TransactionProcessing/TransactionProcessor.cs
@@ -28,10 +28,10 @@ public partial class ReportingContractBasedValidator : IAuRaValidator, IReportin
private readonly ContractBasedValidator _contractValidator;
private readonly long _posdaoTransition;
private readonly ITxSender _posdaoTxSender;
private readonly IReadOnlyStateProvider _stateProvider;
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should we introduce a IReadOnlyWorldStateProvider interface, it will be the same as the old one, just act as a place holder?

@@ -72,8 +72,7 @@ protected override ITxSource CreateTxSourceForProducer(ITxSource? additionalTxSo
return new OptimismTxPoolTxSource(baseTxSource);
}

protected override BlockProcessor CreateBlockProcessor(
IReadOnlyTxProcessingScope readOnlyTxProcessingEnv,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope?

{
return new OptimismBlockProcessor(
specProvider,
blockValidator,
rewardCalculator,
transactionsExecutor,
scope.WorldState,
worldStateProvider,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

scope?

{
tx.Nonce = _accountStateProvider.GetNonce(tx.SenderAddress);
tx.Nonce = _worldStateManager.GlobalWorldStateProvider
.GetGlobalStateReader().GetNonce(_blockFinder.Head.StateRoot, tx.SenderAddress);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

manager.StateReader?

@@ -52,7 +52,7 @@ protected override ReadOnlyTxProcessingEnv CreateTxProcessingEnv() =>
_receiptStorage,
_specProvider,
_blockTree,
_worldStateManager.GlobalStateReader,
_worldStateManager.GlobalWorldStateProvider,
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

we can keep the stateReader here

/// <returns></returns>
IWorldState CreateResettableWorldState(IWorldState? forWarmup = null);
IWorldStateProvider CreateResettableWorldStateProvider();
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

IWorldStateProvider to warmup?

Blockchain.LogManager,
transactionsExecutor);

ReadOnlyChainProcessingEnv traceProcessingEnv = CreateChainProcessingEnv(rpcBlockTransactionsExecutor);
ReadOnlyChainProcessingEnv executeProcessingEnv = CreateChainProcessingEnv(executeBlockTransactionsExecutor);

Tracer tracer = new(scope.WorldState, traceProcessingEnv.ChainProcessor, executeProcessingEnv.ChainProcessor);
TraceRpcModule = new TraceRpcModule(receiptFinder, tracer, Blockchain.BlockFinder, JsonRpcConfig, txProcessingEnv.StateReader);
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

bring back state reader

@@ -9,5 +9,5 @@ namespace Nethermind.Evm.TransactionProcessing;
public interface IReadOnlyTxProcessingScope : IDisposable
{
ITransactionProcessor TransactionProcessor { get; }
IWorldState WorldState { get; }
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hmm... yea. This is a problem as the whole point of the scope is to represent a single IWorldState. So making it a WorldStateProvider changes that. So it probably should be called IReadOnlyTxProcessingEnv now.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants