-
Notifications
You must be signed in to change notification settings - Fork 0
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
pass in world state where there in no context which worldState to use #55
base: master
Are you sure you want to change the base?
Conversation
@@ -71,25 +71,24 @@ protected override ITxSource CreateTxSourceForProducer(ITxSource? additionalTxSo | |||
return new OptimismTxPoolTxSource(baseTxSource); | |||
} | |||
|
|||
protected override BlockProcessor CreateBlockProcessor( | |||
IReadOnlyTxProcessingScope readOnlyTxProcessingEnv, | |||
protected override BlockProcessor CreateBlockProcessor(IReadOnlyTxProcessingScope readOnlyTxProcessingEnv, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
check if we now need readOnlyTransiton processor or not, or we can just replace WorldState inside the readOnlyTxProcessingEnv itself?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
also check on the difference on how produce and processor are intialized to get some more ideas?
@@ -108,7 +91,7 @@ protected virtual Task InitBlockchain() | |||
setApi.TxPoolInfoProvider = new TxPoolInfoProvider(chainHeadInfoProvider.AccountStateProvider, txPool); | |||
setApi.GasPriceOracle = new GasPriceOracle(getApi.BlockTree!, getApi.SpecProvider, _api.LogManager, blocksConfig.MinGasPrice); | |||
BlockCachePreWarmer? preWarmer = blocksConfig.PreWarmStateOnBlockProcessing | |||
? new(new(_api.WorldStateManager!, _api.BlockTree!, _api.SpecProvider, _api.LogManager, _api.WorldState), _api.SpecProvider, _api.LogManager, _api.WorldState) | |||
? new(new(_api.WorldStateManager!, _api.BlockTree!, _api.SpecProvider, _api.LogManager), _api.SpecProvider, _api.WorldStateManager!, _api.LogManager) | |||
: null; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
have a look at this as well again - might be a better way to do this?
@@ -165,14 +165,13 @@ public Task Execute(CancellationToken cancellationToken) | |||
worldState, | |||
trieStore, | |||
getApi.DbProvider, | |||
getApi.LogManager); | |||
getApi.LogManager, preBlockCaches); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this as well?
@@ -37,7 +38,8 @@ public BlockhashProvider(IBlockFinder blockTree, ISpecProvider specProvider, IWo | |||
|
|||
if (spec.IsBlockHashInStateAvailable) | |||
{ | |||
return _blockhashStore.GetBlockHashFromState(currentBlock, number); | |||
IWorldState? worldStateToUse = _worldStateManager.GetGlobalWorldState(currentBlock); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we instead use a function here or a sperate interface that gives us the correct interface when given a header
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
another issues here, this will only work when we have a global worldState instantiation.
@@ -14,12 +14,12 @@ | |||
[assembly: InternalsVisibleTo("Nethermind.Merge.Plugin.Test")] | |||
namespace Nethermind.Blockchain.Blocks; | |||
|
|||
public class BlockhashStore(ISpecProvider specProvider, IWorldState worldState) | |||
public class BlockhashStore(ISpecProvider specProvider) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
can we add worldStateManager for this as well, both the functions have the required information to query the correct worldState
@@ -58,16 +61,17 @@ public bool ValidateParams(BlockHeader parent, BlockHeader header, bool isUncle | |||
{ | |||
long step = header.AuRaStep.Value; | |||
|
|||
IWorldState? worldState = _worldStateManager.GetGlobalWorldState(header); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this is mostly done here to avoid a huge bad refactor to pass with down with every seal validator
@@ -85,17 +82,18 @@ public override object[] Call(CallInfo callInfo) | |||
|
|||
lock (_readOnlyTxProcessorSource) | |||
{ | |||
using var scope = _readOnlyTxProcessorSource.Build(GetState(callInfo.ParentHeader)); | |||
using IReadOnlyTxProcessingScope? scope = | |||
_readOnlyTxProcessorSource.Build(GetState(callInfo.ParentHeader), callInfo.ParentHeader); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
this does not feel like correct, why are we using parent header? does this work for aura? because technically this is a constant contract and we are getting data from the parent block only.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes, we use the parentHeader for the block execution as well, so we can get the state for the parent header as well!
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
Types of changes
What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Notes on testing
Optional. Remove if not applicable.
Documentation
Requires documentation update
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
If yes, fill in the details here. Remove if not applicable.
Remarks
Optional. Remove if not applicable.