-
Notifications
You must be signed in to change notification settings - Fork 10
FM-259: Sign all incomplete checkpoints #292
Conversation
.find(|v| v.public_key.0 == validator_ctx.public_key) | ||
.cloned() | ||
{ | ||
// TODO: Code generation in the ipc-solidity-actors repo should cater for this. |
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.
@cryptoAtwill, can you double-check that this is the case once you migrate to the ipc-solidity-actors
bindings?
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.
I don't remember seeing that this has been implemented already, we just talked about the fact that the bindings generate as many versions of SubnetID
and whatnot as there are facets. So it's just a note for the future that if this gets out of hand, we should try to solve it there.
let height = checkpoint.block_height; | ||
let validator_ctx = ctx.clone(); | ||
|
||
tokio::spawn(async move { |
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.
Why is it possibel to do the broadcast of incomplete signatures in parallel here without resulting in nonce races? (I also ask because in the comment above you mention that broadcasts can't be done in parallel).
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.
Sorry, it looks like my comment wasn't as clear as it could have been.
What I meant was that we should not try to kick off a separate background task for each pending checkpoint like this:
for cp in pending_checkpoints {
tokio::spawn(async move {
checkpoint::broadcast_signature(broadcaster, cp).await;
});
}
That's because every time the broadcaster
is asked to send a transaction it will query the state for the nonce, and in this case that will surely mean all of the checkpoint submissions will get the same nonce and only one will go through.
Instead, what we have is effectively this:
tokio::spawn(async move {
for cp in pending_checkpoints {
checkpoint::broadcast_signature(broadcaster, cp).await;
}
});
So it's not doing the submissions in parallel, they are done one after the other, but in the background.
ef135e5
to
808e14c
Compare
Closes consensus-shipyard/ipc#298
The PR changes the end-of-period checkpoint signature broadcasting by validators to apply on all incomplete (a.k.a. pending) checkpoints where they were validators.
So, instead of doing this on node start, it's done on each checkpoint period end. This has the following benefits:
main.rs
stays simpler and the checkpointing logic is kept in the interpreter