Skip to content
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

chore: Prune historical values in Validator pallet #5292

Merged
merged 2 commits into from
Oct 18, 2024

Conversation

MxmUrw
Copy link
Contributor

@MxmUrw MxmUrw commented Sep 24, 2024

Pull Request

Closes: PRO-1318

Checklist

Please conduct a thorough self-review before opening the PR.

  • I am confident that the code works.
  • I have written sufficient tests.
  • I have written and tested required migrations.
  • I have updated documentation where appropriate.

Summary

Currently some epoch-indexed storage values are not deleted when their epoch is expiring. This PR adds logic to delete these storage values.

This includes:

  • Clean up of AuthorityIndex, HistoricalAuthorities, HistoricalBonds
  • Delete values for every newly expired epoch in expire_epoch
  • Add migration for deleting values for all previously expired epochs
  • Tests for migration and epoch expiry

Non-Breaking changes

If this PR includes non-breaking changes, select the non-breaking label. On merge, CI will automatically cherry-pick the commit to a PR against the release branch.

This includes:
 - Implemented for AuthorityIndex, HistoricalAuthorities, HistoricalBonds
 - Deleting values on epoch expiry
 - Migration for deleting values for *all* previously expired epochs
 - Tests for migration and epoch expiry
Copy link

codecov bot commented Sep 24, 2024

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 70%. Comparing base (6d33725) to head (336fb0e).
Report is 29 commits behind head on main.

Additional details and impacted files
@@          Coverage Diff          @@
##            main   #5292   +/-   ##
=====================================
- Coverage     70%     70%   -0%     
=====================================
  Files        487     488    +1     
  Lines      87426   87442   +16     
  Branches   87426   87442   +16     
=====================================
- Hits       61505   61431   -74     
- Misses     22642   22725   +83     
- Partials    3279    3286    +7     
Flag Coverage Δ
70% <100%> (-<1%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@MxmUrw MxmUrw marked this pull request as ready for review September 24, 2024 14:38
@MxmUrw MxmUrw requested a review from dandanlen as a code owner September 24, 2024 14:38
Copy link
Collaborator

@dandanlen dandanlen left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This looks correct, however may require some re-discussion about whether it's desirable or not...

state-chain/pallets/cf-validator/src/lib.rs Outdated Show resolved Hide resolved
@dandanlen dandanlen enabled auto-merge October 18, 2024 09:55
@dandanlen dandanlen added this pull request to the merge queue Oct 18, 2024
Merged via the queue into main with commit dee3275 Oct 18, 2024
49 checks passed
@dandanlen dandanlen deleted the chore/prune-historical-values-in-validator-pallet branch October 18, 2024 10:53
syan095 added a commit that referenced this pull request Oct 23, 2024
* origin/main:
  feat: broker can encode btc smart contract call (#5329)
  chore: localnet recreate script can use defaults (#5338)
  feat: witnessing btc smart contract swaps (#5331)
  feat: Solana CCM fallback (#5316)
  fix: scale types for pending ceremonies (#5286)
  chore: Prune historical values in Validator pallet (#5292)
  feat: expose deposit transaction hash from ingress-egress-tracker (#5320)

# Conflicts:
#	Cargo.lock
#	engine/src/witness/btc/smart_contract.rs
dandanlen pushed a commit that referenced this pull request Oct 30, 2024
* Add first attempt at pruning.

This includes:
 - Implemented for AuthorityIndex, HistoricalAuthorities, HistoricalBonds
 - Deleting values on epoch expiry
 - Migration for deleting values for *all* previously expired epochs
 - Tests for migration and epoch expiry

* Remove comments (noted in review).
dandanlen pushed a commit that referenced this pull request Oct 31, 2024
* Add first attempt at pruning.

This includes:
 - Implemented for AuthorityIndex, HistoricalAuthorities, HistoricalBonds
 - Deleting values on epoch expiry
 - Migration for deleting values for *all* previously expired epochs
 - Tests for migration and epoch expiry

* Remove comments (noted in review).
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