-
Notifications
You must be signed in to change notification settings - Fork 4.1k
WIP: expose historical queries #258
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
Conversation
client/query.go
Outdated
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.
🎉
genesis/parse.go
Outdated
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.
If you do make([]Option, 0, cnt) then you can use append and don't need to have an i variable, and it's the same speed.
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.
nice tip
state/merkle.go
Outdated
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 wrote this, but I don't like it that much - it doesn't communicate the intent very well. I wonder if we should have a method inside Tree that is more descriptive, like tree.IsEmpty()
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, please do. So we can quickly check if we can save safely
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.
Added IsEmpty to develop. You should be able to replace that with !s.committed.Tree.IsEmpty()
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 only really need to check the Size actually, since if the latest version is > 0, then there are keys in the tree, but I'd still recommend using the new !IsEmpty.
state/merkle.go
Outdated
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.
Nice poor-man's pruning!
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.
Yup, hardcoded length, enough to get it out. We can work on other techniques later, but refactoring will change a lot, so it can wait.
app/app_test.go
Outdated
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.
require.NoError?
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.
Actually, here I require it is an error
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.
You can do require.Error then :)
genesis/parse.go
Outdated
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 it's worth to make / a const? like KeyDelimiter
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, did that
StoreApp just the queries, BaseApp with handler/ticker Ticker now defined top level, as an interface, with context Name for info taken as parameter, start cmd uses commandline name Cleaner compisition of apps.
6747314 to
7ef20bb
Compare
* Rebuild PDF * Separate commitment path (ref cosmos#258) * Clarify connection versioning (ref cosmos#269) * Note private store key flexibility (ref cosmos#145)
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…osmos#258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
* [cosmos#207](crypto-org-chain#207) Remove api CacheWrapWithTrace. * [cosmos#205](crypto-org-chain#205) Support object store. * [cosmos#240](crypto-org-chain#240) Split methods from `MultiStore` into specialized `RootMultiStore`, keep `MultiStore` generic. * [cosmos#241](crypto-org-chain#241) Refactor the cache store to be btree backed, prepare to support copy-on-write atomic branching. * [cosmos#242](crypto-org-chain#242) Init cache on cache lazily, save memory allocations. * [cosmos#243](crypto-org-chain#243) Support `RunAtomic` API to use new CoW cache store. * [cosmos#244](crypto-org-chain#244) Add `Discard` method to CacheWrap to discard the write buffer. * [cosmos#258](crypto-org-chain#258) Add `NewFromParent` API to cachemulti store to create a new store from block-stm multiversion data structure. * [cosmos#1043](crypto-org-chain#1043) Add back CacheWrapWithTrace api.
…258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
…258) Solution: - add API NewFromParent to cache multistore. Update store/CHANGELOG.md Signed-off-by: yihuang <huang@crypto.com> fix test fix lint
This is based on PR #257 and should not be merged until that PR gets merged to develop, thus the WIP state. Beside the dependency, the code is ready to merge IMO.
We now keep the last 10 blocks available for queries and expose the height as an argument for queries. If H is the last committed block, the default (height=0) is to return H-1, as you can immediately get a proof for this. (Most recent query with proofs). If you just submitted a tx that was included on height H, you should query with
--height=$Hin order to ensure you read the state after the tx was processed.This involved updating all the shell script integration tests, which do just this, send a tx, then immediately query the state.