-
Notifications
You must be signed in to change notification settings - Fork 146
fix(state): Change StorageState methods to always expect a block hash
#4792
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
fix(state): Change StorageState methods to always expect a block hash
#4792
Conversation
StorageState methods to always expect a block hash
f810b70 to
7fdcd0b
Compare
7fdcd0b to
c0524b4
Compare
Before, it expected a state root hash. This also fixes notifications for the state_subscribeStorage RPC call.
c0524b4 to
f412899
Compare
33d59e9 to
1b1c4d6
Compare
3be6ad6 to
f6b3457
Compare
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.
Cleaner now! I like it
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 really think you should merge this to development given the nature of the fixes.
Yeah, I thought about that too. Shouldn't make too much of a difference since I'll probably merge |
Just tried this and actually it does make a difference because I based this branch off Let's just get #4769 done quickly after merging this to get these fixes onto |
3a71c45
into
haiko/read-only-storage-state
After #4792, StorageState methods that expected a state root hash now take a block hash. This updates all affected StorageState methods on ClientAdapter and simplifies their implementation.
Changes
This PR changes the semantics of some methods in the
StorageStateinterface and its implementations byInmemoryStorageStateandClientAdapter.Before this change, those methods expected a state root hash as parameter. This was probably done due to how the internal
Triesdata structure works, maintaining a map from state root hash toTrie. In any case, its inconvenient, unintuitive and in some cases just plain wrong. These methods are also sometimes called incorrectly with a block hash.In order to enable implementing
StorageStateonClientAdapterfor the ongoingdb.Backendrework, without requiring hacky workarounds, I propose to merge this PR into my feature branch for #4467.Tests
go test -tags integration github.com/ChainSafe/gossamerIssues
#4467