-
Notifications
You must be signed in to change notification settings - Fork 38
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
feat: optimize Godwoken finality mechanism #836
feat: optimize Godwoken finality mechanism #836
Conversation
keroro520
commented
Nov 1, 2022
•
edited by Flouse
Loading
edited by Flouse
- feat: optimize Godwoken finality mechanism godwoken-scripts#132
d0d2336
to
cba5aef
Compare
e7948f8
to
643273b
Compare
643273b
to
4abcbe3
Compare
6d16ca2
to
3e96828
Compare
2034831
to
db0dabe
Compare
1fd5c07
to
52ab220
Compare
Running integration testWorkflow Run Id: 3477986299 Components:
Manually running integration testPost a comment contains
Note:
Run Resultsuccess |
4db4042
to
3ed5cc7
Compare
Running integration testWorkflow Run Id: 3511948660 Components:
Manually running integration testPost a comment contains
Note:
Run Resultsuccess |
fae95b6
to
264fe46
Compare
264fe46
to
9487d16
Compare
9487d16
to
ba19213
Compare
d269603
to
1ffaf94
Compare
// NOTE: To ensure that at least one finalized block is found below, start a binary search at | ||
// `upgrade_global_state_version_to_v2 - 1`. | ||
l = l.saturating_sub(1); | ||
let mut r = block.raw().number().unpack().saturating_sub(1); |
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.
Here's my analysis/proof:
Loop invaraint: l
is finalized. r + 1
is not finalized.
l < mid <= r
.
So l = mid
and r = mid - 1
shrinks the range and maintains the loop invariant.
When the loop ends, l
is the last finalized block.
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.
l = upgrade_global_state_version_to_v2 - 1
conveniently satisfies that “l
is finalized”. If we start with l = upgrade_global_state_version_to_v2
it's not necessarily true.