Propose every nth block as finality candidate instead of all the blocks#93
Propose every nth block as finality candidate instead of all the blocks#93gaudenzkessler merged 14 commits intodevelopfrom
Conversation
d63802e to
12ec509
Compare
12ec509 to
ecae24a
Compare
ecae24a to
3b40c63
Compare
Propose every nth block as finality candidate instead of all the blocks
3b40c63 to
d862bf5
Compare
haerdib
left a comment
There was a problem hiding this comment.
To how I understood integritee-network/worker#1003 the following should be done in the parentchain:
- store the
next_finalization_candidate_block_numberor whatever you call it, it's au64, so that's fine, somewhere as a state. - Check if the
block_numbersent with this xt, matches the previously storednext_finalization_candidate_block_number. If it does, finalize that block hash.
This PR however adds a diff and checks if that diff plus the last finalized (?) block number match the current block number. If so, the that block is finalized. So the finalization of the block depends on the block_diff sent by the very same xt, not the one sent previously. Or did I misunderstand something?
We can take that offline if you'd like to, I think I finally understood integritee-network/worker#1003
|
ok I can turn it around. |
633c4e1 to
534b97d
Compare
da377ec to
ca3383a
Compare
ca3383a to
a81d41f
Compare
clangenb
left a comment
There was a problem hiding this comment.
Looks good in general. I have some minor remarks though. :)
|
LGTM, thank you, I especially liked that the function |
cf46c96 to
b1765e8
Compare
b1765e8 to
6a9a50b
Compare
clangenb
left a comment
There was a problem hiding this comment.
Nice, thanks for adding the asserts in the tests! Only one thing remains. :)
clangenb
left a comment
There was a problem hiding this comment.
Thanks for incorporating the feedback! I found one last thing. :)
| shard7, | ||
| 1, | ||
| block_number, | ||
| block_number, |
There was a problem hiding this comment.
Can we please call the finalization candidate next_finalization_candidate? :)
| ensure!( | ||
| block_number == finalization_candidate_block_number, | ||
| <Error<T>>::ReceivedUnexpectedSidechainBlock | ||
| ); | ||
|
|
There was a problem hiding this comment.
The naming of your test made me realize one more test that we need to do:
ensure!(
next_finalization_candidate_block_number > finalization_candidate_block_number
<Error<T>>::InvalidNextFinalizationCandidateBlockNumber
);
…ks (#93) Propose every nth block as finality candidate instead of all the blocks Co-authored-by: Gaudenz Kessler <gaudenz.kessler@scs.ch>
* Propose every nth block as finality candidate instead of all the blocks (#93) Propose every nth block as finality candidate instead of all the blocks Co-authored-by: Gaudenz Kessler <gaudenz.kessler@scs.ch> * Add validity check to finalization (#111) * Add validity check to finalization * adjust test * adjust benchmark test Co-authored-by: Gaudenz Kessler <gaudenz.kessler@scs.ch> * fixup! Propose every nth block as finality candidate instead of all the blocks (#93) Co-authored-by: gaudenzkessler <92718752+gaudenzkessler@users.noreply.github.com> Co-authored-by: Gaudenz Kessler <gaudenz.kessler@scs.ch>
belongs to #1003