-
Notifications
You must be signed in to change notification settings - Fork 430
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
Support for state override parameter in some RPC methods #7362
base: master
Are you sure you want to change the base?
Conversation
…verride # Conflicts: # src/Nethermind/Nethermind.Consensus/Processing/BlockProcessor.cs
6cb949c
to
00aae73
Compare
00aae73
to
363fdc9
Compare
@@ -24,4 +23,7 @@ public override TrieNode FindCachedOrUnknown(Hash256? address, in TreePath path, | |||
|
|||
public override byte[]? TryLoadRlp(Hash256? address, in TreePath path, Hash256 hash, ReadFlags flags = ReadFlags.None) => | |||
base.TryLoadRlp(address, in path, hash, flags) ?? store.TryLoadRlp(address, in path, hash, flags); | |||
|
|||
// TODO clarify is ClearCache is reliable enough to use | |||
public void ResetOverrides() => ClearCache(); |
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.
Comment on top of ClearCache
says that it's added "to support testing", but it seems like a good way to reset state-override changes applied on top of OverlayTrieStore
.
bfa7dc9
to
bd28e70
Compare
This reverts commit 15f0e39.
IReleaseSpec currentSpec, | ||
AccountOverride accountOverride, | ||
Address address) | ||
{ | ||
if (accountOverride.Code is not null) | ||
{ | ||
stateProvider.InsertCode(address, accountOverride.Code, currentSpec); |
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 needed to prevent an "Account {address} is null when updating storage hash"
error in StateProvider
when overridden code writes to address storage.
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.
@OlegJakushkin maybe this solves some issues on StateRoot in eth_simulate?
…verride # Conflicts: # src/Nethermind/Nethermind.Evm/OverridableCodeInfoRepository.cs
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.
-
I think it would be good to separate ReadOnlyTxProcessingEnv with OverridableTxProcessingEnv instead of changing the first.
-
That double test serialization was also changed in different PR Avoid double serialization in RPC tests #7547
@@ -76,10 +76,11 @@ public NethermindApi(IConfigProvider configProvider, IJsonSerializer jsonSeriali | |||
public IBlockchainBridge CreateBlockchainBridge() | |||
{ | |||
ReadOnlyBlockTree readOnlyTree = BlockTree!.AsReadOnly(); | |||
OverridableWorldStateManager overridableWorldStateManager = new(DbProvider!, WorldStateManager!.TrieStore, LogManager); | |||
|
|||
// TODO: reuse the same trie cache here | |||
ReadOnlyTxProcessingEnv readOnlyTxProcessingEnv = new( |
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.
Maybe let's create OverridableTxProcessingEnv
?
@@ -2,12 +2,14 @@ | |||
// SPDX-License-Identifier: LGPL-3.0-only | |||
|
|||
using Nethermind.Core.Crypto; | |||
using Nethermind.Evm; | |||
using Nethermind.Evm.TransactionProcessing; | |||
using Nethermind.State; | |||
|
|||
namespace Nethermind.Consensus.Processing; | |||
|
|||
public class ReadOnlyTxProcessingScope( |
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.
maybe move to OverridableTxProcessingScope
?
IReleaseSpec currentSpec, | ||
AccountOverride accountOverride, | ||
Address address) | ||
{ | ||
if (accountOverride.Code is not null) | ||
{ | ||
stateProvider.InsertCode(address, accountOverride.Code, currentSpec); |
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.
@OlegJakushkin maybe this solves some issues on StateRoot in eth_simulate?
ITrieStore trieStore = overlayTrieStore; | ||
if ((forWarmup as IPreBlockCaches)?.Caches is { } preBlockCaches) | ||
trieStore = new PreCachedTrieStore(trieStore, preBlockCaches.RlpCache); |
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.
ITrieStore trieStore = overlayTrieStore; | |
if ((forWarmup as IPreBlockCaches)?.Caches is { } preBlockCaches) | |
trieStore = new PreCachedTrieStore(trieStore, preBlockCaches.RlpCache); | |
ITrieStore trieStore = (forWarmup as IPreBlockCaches)?.Caches is { } preBlockCaches ? new PreCachedTrieStore(trieStore, preBlockCaches.RlpCache) : overlayTrieStore; |
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.
trieStore
will be undefined in new PreCachedTrieStore(trieStore, preBlockCaches.RlpCache)
79f571c
to
4cca8a2
Compare
4cca8a2
to
eba8bf0
Compare
src/Nethermind/Nethermind.JsonRpc/Modules/Trace/TraceRpcModule.cs
Outdated
Show resolved
Hide resolved
…eader & fix starting block for `trace_callMany`
Resolves #4021, resolves #6120, resolves #7306.
Changes
eth_call
,eth_estimategas
trace_call
debug_traceCall
trace_call
,trace_callMany
, andtrace_rawTransaction
to run on top of the specified block, instead of the previous one, similar to other clients.What types of changes does your code introduce?
Testing
Requires testing
If yes, did you write tests?
Documentation
Requires documentation update
Requires explanation in Release Notes