-
Notifications
You must be signed in to change notification settings - Fork 15
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
fix: expire all previous epochs #5279
base: main
Are you sure you want to change the base?
Conversation
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #5279 +/- ##
======================================
- Coverage 70% 70% -0%
======================================
Files 486 487 +1
Lines 87138 87051 -87
Branches 87138 87051 -87
======================================
- Hits 61169 61030 -139
- Misses 22687 22740 +53
+ Partials 3282 3281 -1 ☔ View full report in Codecov by Sentry. |
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.
@j4m1ef0rd I'll make the below changes.
Will wait for @acdibble and @marcellorigotti 's inputs re. api breakage before merging.
@@ -350,7 +350,7 @@ type RpcSuspensions = Vec<(Offence, Vec<(u32, state_chain_runtime::AccountId)>)> | |||
|
|||
#[derive(Serialize, Deserialize)] | |||
pub struct RpcAuctionState { | |||
blocks_per_epoch: u32, | |||
epoch_duration: u32, |
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.
Unfortunately this is a breaking change 🙈
We could keep the old name around and flag it as deprecated... or maybe just keep the old name with a comment explaining that the name is for historical reasons...
@acdibble how much of a pain is it for you to change this?
state-chain/pallets/cf-validator/src/migrations/rename_blocks_per_epoch.rs
Outdated
Show resolved
Hide resolved
state-chain/pallets/cf-validator/src/migrations/rename_blocks_per_epoch.rs
Outdated
Show resolved
Hide resolved
@@ -27,7 +27,7 @@ pub struct BtcUtxos { | |||
|
|||
#[derive(Serialize, Deserialize, Encode, Decode, Eq, PartialEq, TypeInfo, Debug)] | |||
pub struct EpochState { | |||
pub blocks_per_epoch: u32, | |||
pub epoch_duration: u32, |
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.
Also a breaking change here, fyi @marcellorigotti
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.
Does this mean that after the next binary release until we run the runtime-upgrade this rpc won't be available?
Or will it still work right away but with the new field name (blocks_per_epoch -> epoch_duration)?
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.
Yeah it would mean that the binary release needs to be coordinated with the runtime upgrade. I think a better option would be to add a new field with the new name, and remove it in the following release (1.7 or 1.8).
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.
I agree with the other option. If this RPC doesn't work then monitoring doesn't work as well (the majority of it at least)
Pull Request
Closes: PRO-1613
Checklist
Please conduct a thorough self-review before opening the PR.
Summary
expire_epoch
function to recursively expire all previous epochs that had not expired yet in chronological order. This should avoid the bug stated in the issue.BlocksPerEpoch
->EpochDuration
Non-Breaking changes
I think this is non breaking, i'll let you tag it @dandanlen