Remove height from match result key#387
Merged
philipsu522 merged 10 commits intomasterfrom Nov 14, 2022
Merged
Conversation
codchen
approved these changes
Nov 14, 2022
philipsu522
added a commit
that referenced
this pull request
Nov 14, 2022
* Remove height from match result key * Rm comments * Add check * Use iterator * rev * gofump * Fix tests * revert migration * revert migration * gofmt
masih
pushed a commit
that referenced
this pull request
Sep 29, 2025
masih
pushed a commit
that referenced
this pull request
Sep 30, 2025
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Describe your changes and provide context
~/.sei/data/application.dbis currently huge, even after regenesis (113GB). This is due to every height keeping a record of every match result up to that height. I.e.:block height 2 -> match-result-0, match-result-1, match-result-2
block height 3 -> match-result-0, match-result-1, match-result-2, match-result-3
Currently, the key is indexed by the height: https://github.com/sei-protocol/sei-chain/blob/master/x/dex/keeper/match_result.go#L33
However, each height maintains a copy of the store, meaning the height in the query https://github.com/sei-protocol/sei-chain/blob/master/x/dex/client/cli/query/query_match_result.go#L19 is used only to fetch the version of the store containing match results.
As a result, match-result-[0..2] are never used in block height 3.
This PR compresses the key to migrate from matchResultsPrefix- to matchResultsPrefix-matchResultsKe
Testing performed to validate your change
Add unit test, will test on internal testnet as well