-
Notifications
You must be signed in to change notification settings - Fork 3.7k
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
feat: ADR-040: Add RootStore
implementation
#10430
feat: ADR-040: Add RootStore
implementation
#10430
Conversation
91eb724
to
6b983e5
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.
part-1 review
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.
Part 2 review
- let's rename
flat
package toroot
store/v2/flat/root_store.go
Outdated
) | ||
|
||
// RootStoreConfig is used to define a schema and pass options to the RootStore constructor. | ||
type RootStoreConfig struct { |
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 we don't need to store the config at all. The idea of RootStore was to remove the functionality of Multistore (dynamically adding / removing sub stores) and only provide a minimum functionality to keep the compatibility with existing modules (notably IBC).
In other words, RootStore
:
- is configured by app
- doesn't need to load a dynamic configuration from its persistent state.
Let's review this approach.
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.
436fdaa
to
ad9ab87
Compare
This pull request introduces 1 alert when merging ad9ab87 into 8fc9f76 - view on LGTM.com new alerts:
|
ad9ab87
to
b90fadf
Compare
Okay, this is now reworked to store an independent SMT for each store (and combine each tree into a "namespace" Merkle map to produce a root hash, like the Multistore). This will allow us to implement proofs in an IBC-compatible way. The actual proofs are not implemented, but that can be done on top of #10015. Since that PR has yet to be reviewed, I propose we focus on getting this merged and then rebase that branch and add RootStore proofs there. |
RootStore
implementation
Codecov Report
@@ Coverage Diff @@
## master #10430 +/- ##
==========================================
- Coverage 65.42% 64.72% -0.71%
==========================================
Files 634 624 -10
Lines 60702 60354 -348
==========================================
- Hits 39716 39065 -651
- Misses 18686 19056 +370
+ Partials 2300 2233 -67
|
5df15dc
to
325e448
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.
Nothing insightful to add, just a few nitpicks. Didn't find any functional issues.
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.
- Let's update the documentation by explaining when and how the substores are created
- There is lot of code duplication with
v1
. Would it be possible to import it rather than copying? Or maybe moving to it's own package, but it's a breaking change which we would like to avoid...
store/v2/types.go
Outdated
const StoreTypeTransient = v1.StoreTypeTransient | ||
const StoreTypeDB = v1.StoreTypeDB | ||
const StoreTypeSMT = v1.StoreTypeSMT | ||
const StoreTypePersistent = v1.StoreTypePersistent |
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 StoreTypeSMT
is not needed in v1
package and we can move it here.
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.
Unfortunately if we do that we can't include it in the (StoreType) String()
function, because it's in a separate package.
dbb2dfa
to
04b51a5
Compare
GetVersion rename to databucket, indexbucket
- GetVersion - migration (StoreUpgrades) - flat.Store query uses getversion
857d09a
to
eab5875
Compare
eab5875
to
c04cd39
Compare
c04cd39
to
ad227e0
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.
utACK.
Let's clarify https://github.com/cosmos/cosmos-sdk/pull/10430/files#r754657414 before merging.
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.
Excellent work! I left some rather nit-picky comments, I can't find anything substantial left to change.
store/v2/root/store.go
Outdated
if tlm.TracingEnabled() { | ||
store = tracekv.NewStore(store, tlm.TraceWriter, tlm.TraceContext) | ||
} | ||
if wls, has := tlm.listeners[skey.Name()]; has && len(wls) != 0 { |
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.
Use ListeningEnabled
method here?
store/v2/root/store.go
Outdated
if ls, has := tlm.listeners[key]; has { | ||
tlm.listeners[key] = append(ls, listeners...) | ||
} else { | ||
tlm.listeners[key] = listeners |
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.
We can append to tlm.listeners[key]
whether or not that key already exists in the map (as long as the entire map isn't nil, which it isn't)
Tiny things to update:
|
Co-authored-by: Ian Norden <iansnorden@gmail.com>
198c1a5
to
644cef8
Compare
Description
Part of: #10192
Introduces a new
RootStore
type in thestore/v2
package and an implementation, without yet replacing theMultiStore
or refactoring its use within the SDK (which will happen in the follow up: #10174).Specified by ADR-040.
Fixes #10651
Fixes #10263
Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change