-
Notifications
You must be signed in to change notification settings - Fork 632
CBR-525: Fix failure to sync issue when switching to OBFT #4153
Conversation
464bbdf
to
ff01d02
Compare
ff01d02
to
9a5a3db
Compare
It seems that Hydra ran out of disk space when running over Erik's last push (source):
Since it ran a gc I thought it may work if I just retrigger CI, so I ran There are also errors with AppVeyor (1 & 2), but they are not required so at present I plan to ignore them. |
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.
Just some comments about typos (no big deal). Going to run this on OBFT testnet and make sure it all goes well before approving on my end.
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.
Nice job. I left some comments. Approving because I do not believe any of the few issues I raised to be dealbreakers. The most important, I think, is this one but I expect that in practice the two values are always equal.
obftLeaderCanMint :: AddressHash PublicKey -> BlockCount -> OldestFirst [] LastSlotInfo -> Bool | ||
obftLeaderCanMint leaderAddrHash blkSecurityParam (OldestFirst lastBlkSlots) = | ||
obftLeaderCanMint :: AddressHash PublicKey -> BlockCount -> LastBlkSlots -> Bool | ||
obftLeaderCanMint leaderAddrHash blkSecurityParam lastBlkSlots = | ||
blocksMintedByLeaderInLastKSlots leaderAddrHash lastBlkSlots | ||
<= leaderMintThreshold blkSecurityParam |
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.
Isn't there risk of a mismatch between blkSecurityParam
and the lbsCount
inside of lastBlkSlots
? I think, but am not sure, that if those get out of sync we get an invalid comparison.
The LastBlkSlots is binning based on one k
value, and the threshold demanded is based on another k
value.
Perhaps we can just check that the values are equal at some point. They should always be equal, right?
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.
if those get out of sync we get an invalid comparison.
The only way they could get out of sync was there was a successful update proposal to change it and I really don't think there will be such a thing.
There is however another related issue. For OBFT we are checking that the block we are validating has not been signed too often in the last k
blocks when I think it should actually be last k
slots. This is only the same thing if there are no slots with missing blocks.
Confirmed with @dcoutts that blocks is indeed correct.
I documented the delegator/delegatee story in this commit (also my auto-formatter apparently moved imports). I believe we are doing the right thing. Would appreciate a double-check from @intricate and @erikd. |
With property tests.
Co-authored-by: Luke Nadur <luke.nadur@iohk.io>
The old version of the struct was a list which made calculating the OBFT parameters highly inefficient. New version is much more efficient and has tests.
0488fd9
to
50e0eb5
Compare
I also take the liberty of fixing a typo.
50e0eb5
to
5abdfa0
Compare
bors r+ |
4153: CBR-525: Fix failure to sync issue when switching to OBFT r=disassembler a=erikd ## Description Fix issue that caused the node to loose sync with the chain in OBFT era and then fail to re-sync once out of sync. ## Linked issue https://iohk.myjetbrains.com/youtrack/issue/CBR-525 - [x] CHANGELOG entry has been added and is linked to the correct PR on GitHub. ## Testing checklist <!-- If you aren't providing any tests as part of this PR, use this section to state clearly why. It needs to be a strong motivation and definitely the exception, not the rule. --> - [x] I have added tests to cover my changes. - [x] All new and existing tests passed. ## QA Steps Synced the OBFT testnet numerous times. Co-authored-by: Erik de Castro Lopo <erikd@mega-nerd.com> Co-authored-by: Michael Hueschen <michaelhueschen@gmail.com> Co-authored-by: Samuel Leathers <samuel.leathers@iohk.io>
bors r+ |
4153: CBR-525: Fix failure to sync issue when switching to OBFT r=disassembler a=erikd ## Description Fix issue that caused the node to loose sync with the chain in OBFT era and then fail to re-sync once out of sync. ## Linked issue https://iohk.myjetbrains.com/youtrack/issue/CBR-525 - [x] CHANGELOG entry has been added and is linked to the correct PR on GitHub. ## Testing checklist <!-- If you aren't providing any tests as part of this PR, use this section to state clearly why. It needs to be a strong motivation and definitely the exception, not the rule. --> - [x] I have added tests to cover my changes. - [x] All new and existing tests passed. ## QA Steps Synced the OBFT testnet numerous times. Co-authored-by: Erik de Castro Lopo <erikd@mega-nerd.com> Co-authored-by: Michael Hueschen <michaelhueschen@gmail.com> Co-authored-by: Samuel Leathers <samuel.leathers@iohk.io>
Build succeeded |
Description
Fix issue that caused the node to loose sync with the chain in OBFT era and then fail to re-sync once out of sync.
Linked issue
https://iohk.myjetbrains.com/youtrack/issue/CBR-525
Testing checklist
QA Steps
Synced the OBFT testnet numerous times.