-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
state/kvindexer: associate event attributes with events #9759
Conversation
To clarify, if On current version (without your changes) this returns two blocks:
While this finds 0 blocks:
cc @romac who brought this up: Is it possible to change the RPC to add an extra argument or option, something like: This currently works on old version and returns the two blocks:
Can we make it work within your PR branch? Or is this something that's already handled here? If it is, can you write one unit test for it? |
You are issuing the
I am currently running local tests using two TM versions to evaluate the behaviour of the indexer when upgrading from an old to a new version. @ancazamfir an additional question, can you tell me whether you expect the same behaviour from the transaction indexer or is the block indexer your main concern? |
there was an extra
this is proposing a new flag, outside the query string. This would be a better solution for hermes as would work in a backwards compatible way.
ah, I thought the problem is not present in the tx_indexer. I need to test this. will get back to you. |
@ancazamfir it is present and this PR has a solution for it too, but making it backwards compatible seems to be a bigger feat then I'd expected. |
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.
Thanks @jmalicevic for this nice work.
Please be sure to address any outstanding comment from other reviewers.
} | ||
|
||
func NewApplication() *Application { | ||
state := loadState(dbm.NewMemDB()) | ||
return &Application{state: state} | ||
} | ||
|
||
func (app *Application) SetGenBlockEvents() { |
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.
Is this method ever used anywhere?
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 not used atm but should be used if we want to turn on the generation of Blockevents.
Co-authored-by: Sergio Mena <sergio@informal.systems>
…rmint into jasmina/block-indexer-q
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, thanks @jmalicevic! Great work! 🎉
And thanks for adding in the extra unit tests 🙂
Co-authored-by: Thane Thomson <connect@thanethomson.com>
* Updated event sequencing and added query keyword * code cosmetics * Documentation update * Added per event indexing and querying to txindexer * rpc test fix * Added support for older versions where event sequencing is not supported * Added support for old versions to tx indexer * Added RPC match flag, fixed bugs in tx indexer, added tests * Removed reference to match.events from the docs * Openapi update * Added height deduplication Co-authored-by: Thane Thomson <connect@thanethomson.com> Co-authored-by: Anca Zamfir <zamfiranca@gmail.com> Co-authored-by: Sergio Mena <sergio@informal.systems> Co-authored-by: Romain Ruetschi <romain.ruetschi@gmail.com> Co-authored-by: Thane Thomson <connect@thanethomson.com>
* Revert "Fixed ordering of match.events in light client RPC (tendermint#9877)" * Revert "state/kvindexer: associate event attributes with events (tendermint#9759)" * Revert "consensus: correctly save reference to previous height precommits (backport tendermint#9760) (tendermint#9776)" * add peer gossip sleep (tendermint#241) (tendermint#245) * add peer gossip sleep * add changelog * Update .changelog/unreleased/bug-fixes/4-busy-loop-send-block-part.md Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com> * Update .changelog/unreleased/bug-fixes/4-busy-loop-send-block-part.md --------- Co-authored-by: jhernandezb <contact@jhernandez.me> Co-authored-by: Jasmina Malicevic <jasmina.dustinac@gmail.com> (cherry picked from commit 5954e75) Co-authored-by: Sergio Mena <sergio@informal.systems> * Build changelog for v0.34.25 release Signed-off-by: Thane Thomson <connect@thanethomson.com> * Bump version --------- Signed-off-by: Thane Thomson <connect@thanethomson.com> Co-authored-by: mergify[bot] <37929162+mergify[bot]@users.noreply.github.com> Co-authored-by: Thane Thomson <connect@thanethomson.com>
* v0.37.x:state/kvindexer: port 0.34 query fix (#77) Backport of #77 from 0.37 and #382 to handle slashes * state/kvindexer: associate event attributes with events (tendermint#9759) * By event search is now default behaviour. Including fixes from PRs added to 0.34 --------- Co-authored-by: Lasaro <lasaro@gmail.com> Co-authored-by: Thane Thomson <connect@thanethomson.com> Co-authored-by: Sergio Mena <sergio@informal.systems>
* state/kvindexer: associate event attributes with events (tendermint#9759) Co-authored-by: Anca Zamfir <zamfiranca@gmail.com> Co-authored-by: Sergio Mena <sergio@informal.systems> Co-authored-by: Romain Ruetschi <romain.ruetschi@gmail.com> Co-authored-by: Thane Thomson <connect@thanethomson.com> * Backport kvindexer fix Signed-off-by: Thane Thomson <connect@thanethomson.com> Co-authored-by: Callum Waters <cmwaters19@gmail.com> Co-authored-by: Thane Thomson <connect@thanethomson.com> * By event search is now default behaviour. Including fixes from PRs added to 0.34 Co-authored-by: Lasaro <lasaro@gmail.com>
Closes #9712
This PR changes the way keys are generated for block events, and how they are stored in the database. Namely,
in previous versions, for each event attribute, there was a different entry in the kvstore. Users can query the events and get the corresponding height where an attribute occurred, but cannot correlate attributes to the actual events which they belong to.
We expand the key with the event information, allowing a user to query for attributes that happened within the same height AND the same event.
To achieve this behaviour, users have to add a
match_event=true
keyword to their RPC query. Otherwise, the index search system falls back to the original behaviour.PR checklist
CHANGELOG_PENDING.md
updated, or no changelog entry neededdocs/
) and code comments, or nodocumentation updates needed