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: correct epoch counting #5749
base: feature-dan2
Are you sure you want to change the base?
Conversation
Test Results (CI) 3 files 120 suites 43m 50s ⏱️ Results for commit 7b41d15. ♻️ This comment has been updated with latest results. |
Test Results (Integration tests) 2 files 11 suites 12m 3s ⏱️ For more details on these failures, see this check. Results for commit 7b41d15. ♻️ This comment has been updated with latest results. |
9a7cceb
to
e5af697
Compare
e5af697
to
8eb6296
Compare
8eb6296
to
d2a0c8c
Compare
b3c9407
to
25959c5
Compare
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.
A few small nits
38e0c6f
to
545dd8c
Compare
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.
Looks good (tested). Just some defence-in-depth comments.
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.
utACK
Description
Fix the epoch counting.
Motivation and Context
When the epoch length changed it affected the history as well. E.g. when you have epoch length set to 10 and it's height 1000. then the epoch # is 100. But when there is new consensus constant from 1001 with epoch length 20. Suddenly the epoch is 50.
Now it computes it like this:
When there is an constant change then it's effect is immediate but the epoch skip is prevented.
e.g.
How Has This Been Tested?
There is a new test
test_epoch_to_height_and_back
What process can a PR reviewer use to test or verify this change?
cargo.exe +stable test --package tari_core --lib -- consensus::consensus_manager::tests::test_epoch_to_height_and_back --exact --nocapture
Breaking Changes
This will break 2nd layer ONLY on chains that have new consensus constants.