Skip to content

Remove height from match result key#387

Merged
philipsu522 merged 10 commits intomasterfrom
match-result-rm-height
Nov 14, 2022
Merged

Remove height from match result key#387
philipsu522 merged 10 commits intomasterfrom
match-result-rm-height

Conversation

@philipsu522
Copy link
Contributor

Describe your changes and provide context

~/.sei/data/application.db is 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

@philipsu522 philipsu522 merged commit f00f9b0 into master 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
@masih masih deleted the match-result-rm-height branch October 31, 2025 15:50
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants