Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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
Snowbridge free consensus updates #5201
Snowbridge free consensus updates #5201
Changes from 15 commits
5dde91c
e8e0616
8aa9d7e
ea85bf5
3c55dd8
a74bcc2
e07082e
622d9e2
4994b52
9391a36
f768444
6417823
3321bc0
6ad199b
c0077e1
ab8739c
88d944d
34dda83
ba9560a
8521c51
67a120b
82f05de
dbea452
File filter
Filter by extension
Conversations
Jump to
There are no files selected for viewing
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.
Can you double-check and confirm that this doesn't allow free spamming for this call with using the same "valid" update (with
update.next_sync_committee_update.is_some() == true
) over and over for free, potentially DoS-ing BH blocks?It looks like there is a
compute_period
verification for updating sync committee, that would not allow the DoS I described above, but I got a bit lost in the details and would like you to confirm.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.
@acatangiu that's a valid point, thanks! There is a specific test for that (
duplicate_sync_committee_updates_are_not_free
): https://github.com/paritytech/polkadot-sdk/pull/5201/files#diff-ea6025b3cac6719f750d1f0065ba30d70a16d386a5ce374e4a6b79299f48a3eeR684There 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.
Thanks, didn't yet look at tests 🙈
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.
The test tries to submit the exact same proof twice, which will fail the second time because the attested header in the proof is no longer newer than the stored one on-chain.
But what about the following scenario:
N
in periodP
with sync committeeS
provided inSome(next_sync_committee_update)
N+1
in periodP
with sync committeeS
provided inSome(next_sync_committee_update)
?Basically try to "farm" the
Some(next_sync_committee_update)
tx fee freebie, to spam update one slot at a time.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.
The above is a valid issue, and is being fixed in Snowfork#172
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.
This part of the comment, "If free headers are allowed". I don't see it reflected in the code. Should it be another condition apart from the inequality?
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.
Good catch, in an older implementation it was optional. Comment updated here: ab8739c#diff-adbbba03e39a047dd71745d3ed0eaf33b4e982ac58d64f273f1574816ff44940R664