osmosis
osmosis copied to clipboard
feat(twap): historic pruning
Closes: #2197
What is the purpose of the change
Adds TWAP historic pruning and tests.
Brief Changelog
- [x] implement pruning in
pruneRecordsBeforeTime
- [x] implement getters for all records and unit test them (
helpers_test.go
) - [x] use getters to test the pruning logic
- [x] reuse denom constants in tests
- [x] Create follow-up issue for
AfterEpochEnd
tests: https://github.com/osmosis-labs/osmosis/issues/2372 - [x] Create follow-up issue for setting pruning-keep period via parameter: https://github.com/osmosis-labs/osmosis/issues/2371
Testing and Verifying
This change added tests and can be verified as follows:
-
TestGetAllHistoricalPoolIndexedTWAPs
-
TestGetAllHistoricalTimeIndexedTWAPs
-
TestPruneRecordsBeforeTime
Documentation and Release Note
- Does this pull request introduce a new feature or user-facing behavior changes? yes
- Is a relevant changelog entry added to the
Unreleased
section inCHANGELOG.md
? no - How is the feature or change documented? not applicable
We should remove
//nolint:unused,deadcode
right above
//nolint:unused,deadcode
func (k Keeper) deleteHistoricalRecord(ctx sdk.Context, twap types.TwapRecord) {
Thanks for the reviews everyone!