Fix border condition in Snowbridge free consensus Updates (#5671)
# Description
A fix for a border condition introduced with new feature
https://github.com/paritytech/polkadot-sdk/pull/5201. A malicious
relayer could spam the Ethereum client with sync committee updates that
have already been imported for the period. This PR adds a storage item
to track the last imported sync committee period, so that subsequent
irrelevant updates are not free.
Original PR: https://github.com/Snowfork/polkadot-sdk/pull/172
## Integration
Downstream projects are not affected. Relayers will not be able to spam
the Ethereum client with irrelevant sync committee updates for free.
## Review Notes
Adds a storage item to track the last free sync committee update period,
so that duplicate imports are not free.
---------
Co-authored-by: Adrian Catangiu <adrian@parity.io>
Showing
- bridges/snowbridge/pallets/ethereum-client/src/lib.rs 20 additions, 7 deletionsbridges/snowbridge/pallets/ethereum-client/src/lib.rs
- bridges/snowbridge/pallets/ethereum-client/src/mock.rs 27 additions, 0 deletionsbridges/snowbridge/pallets/ethereum-client/src/mock.rs
- bridges/snowbridge/pallets/ethereum-client/src/tests.rs 55 additions, 8 deletionsbridges/snowbridge/pallets/ethereum-client/src/tests.rs
- bridges/snowbridge/pallets/ethereum-client/tests/fixtures/initial-checkpoint.json 15 additions, 15 deletions...ts/ethereum-client/tests/fixtures/initial-checkpoint.json
- bridges/snowbridge/pallets/ethereum-client/tests/fixtures/sync-committee-update-period-0-newer.json 565 additions, 0 deletions.../tests/fixtures/sync-committee-update-period-0-newer.json
- bridges/snowbridge/pallets/ethereum-client/tests/fixtures/sync-committee-update-period-0-older.json 565 additions, 0 deletions.../tests/fixtures/sync-committee-update-period-0-older.json
- bridges/snowbridge/pallets/ethereum-client/tests/fixtures/sync-committee-update-period-0.json 565 additions, 0 deletions...client/tests/fixtures/sync-committee-update-period-0.json
- prdoc/pr_5671.prdoc 16 additions, 0 deletionsprdoc/pr_5671.prdoc