-
Notifications
You must be signed in to change notification settings - Fork 622
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
[stateless_validation] Broadcast chunk endrosement to next 5 block producers #10449
[stateless_validation] Broadcast chunk endrosement to next 5 block producers #10449
Conversation
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.
LGTM
// h may be skipped and block producer at height h+1 picks up the chunk. We need to ensure | ||
// that these later block producers also receive the chunk endorsement. | ||
// Keeping a threshold of 5 block producers should be sufficient for most scenarios. | ||
const NUM_NEXT_BLOCK_PRODUCERS_TO_SEND_CHUNK_ENDORSEMENT: u64 = 5; |
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.
nit: I would consider making that configurable.
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.
Maybe in a future PR. Do we have a stateless validation related config like we did for resharding?
self.epoch_manager.get_epoch_id_from_prev_block(chunk_header.prev_block_hash())?; | ||
let block_producer = | ||
self.epoch_manager.get_block_producer(&epoch_id, chunk_header.height_created())?; | ||
// Verify that we are the block producer for this height. |
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.
Could a malicious chunk producer try to OOM us by sending chunk endorsements for the next e100 heights?
No need to fix it here but if this is a risk please leave a TODO(stateless-validation)
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.
That's a very valid point! I've added a todo in code. We would definitely need to discuss this to see what are possible mitigations. I've tried listing out a few.
Codecov ReportAttention:
Additional details and impacted files@@ Coverage Diff @@
## master #10449 +/- ##
==========================================
- Coverage 72.01% 71.98% -0.03%
==========================================
Files 718 718
Lines 144922 144919 -3
Branches 144922 144919 -3
==========================================
- Hits 104360 104326 -34
- Misses 35768 35804 +36
+ Partials 4794 4789 -5
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
In the current implementation, we only send the chunk endorsements to the next block producer. As discussed in this Zulip thread, it's possible for a chunk to be included in a block at a height different from that it was created for. This leads to the situation where this new block producer hasn't received the chunk endorsements for this chunk.
The solution here is to broadcast the chunk endorsement message to the next 5 block producers and hope that the chunk would get included in any one of them in cases of skipped blocks.
Note that this also means we are always going to use the chunk_validators as of the
chunk.height_created
and NOTchunk.height_included