Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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(store/v2)!: simplify storage #22683
refactor(store/v2)!: simplify storage #22683
Changes from 24 commits
9b3fb0c
3647b6b
1e73de6
bbc9fcd
77b4963
553c84f
f3bb075
19c7c76
ec1bc29
ca33ca4
6d4bf77
4b55afd
3ae3676
f799ddb
f5fbb8b
12b7152
6ea2f12
26d0709
fd70846
7207c81
10192af
c3359be
88c74c1
5d6c5f0
e2a8fd5
c027f0b
f543c52
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
couldn't genesis be done at a height other than 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.
when starting a node the version of the tree will always be 0, since its empty and if the root is nil the version is assumed to be 0, but when you write (apply change sets) it would be on the height/version you specify.
If you remove a store key the values are still there, unless pruned. In that case the mutable tree will nil because the version of the tree could be 30 but the key was removed at 20. Clients may still want to query version(s) <20. In this case the latest version of the tree will be 20 not 30.
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.
do you mean to say that
t.tree.Get(key
will return nil whenkey
is absent? what's special about genesis?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.
sorry meant storekey, the above comment explains the flow
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.
why does version 0 need special casing?
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.
its meant to treat the flow as if there is no key set then its not found but we would still want to return true 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.
Potential Logic Error in
VersionExists
MethodIn the
VersionExists
method, whenlatestVersion == 0
, the method returnstrue
regardless of the inputversion
. This could incorrectly indicate that any version exists when, in fact, no versions may have been committed yet.Consider adjusting the logic to accurately reflect the existence of the specified version:
This change ensures that the method only returns
true
when checking for version0
when no versions have been committed, aligning with expected behavior.📝 Committable suggestion
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.
Potential incorrect behavior when
latestVersion
is zero inVersionExists
methodWhen
latestVersion
is zero, theVersionExists
method returnstrue
for any version. This may not be accurate, as no versions exist yet.Consider modifying the logic to return
true
only whenversion == 0
:📝 Committable suggestion