Skip to content

Commit

Permalink
add precondition that ref epoch in the past
Browse files Browse the repository at this point in the history
guarantees time computation doesn't underflow
  • Loading branch information
jordanschalm committed Nov 11, 2023
1 parent 2b2b8a1 commit 224eca7
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions contracts/epochs/FlowEpoch.cdc
Original file line number Diff line number Diff line change
Expand Up @@ -375,6 +375,9 @@ pub contract FlowEpoch {
}

pub fun updateEpochTimingConfig(_ newConfig: EpochTimingConfig) {
pre {
FlowEpoch.currentEpochCounter >= newConfig.refCounter: "Reference epoch must be before next epoch"
}
FlowEpoch.account.load<EpochTimingConfig>(from: /storage/flowEpochTimingConfig)
FlowEpoch.account.save(newConfig, to: /storage/flowEpochTimingConfig)
}
Expand Down

0 comments on commit 224eca7

Please sign in to comment.