polkadot-sdk icon indicating copy to clipboard operation
polkadot-sdk copied to clipboard

Snowbridge - Ethereum Client - Reject finalized updates without a sync committee in next store period

Open claravanstaden opened this issue 9 months ago • 2 comments

While syncing Ethereum consensus updates to the Snowbridge Ethereum light client, the syncing process stalled due to error InvalidSyncCommitteeUpdate when importing the next sync committee for period 1087.

This bug manifested specifically because our light client checkpoint is a few weeks old (submitted to governance weeks ago) and had to catchup until a recent block. Since then, we have done thorough testing of the catchup sync process.

Symptoms

  • Import next sync committee for period 1086 (essentially period 1087). Light client store period = 1086.
  • Import header in period 1087. Light client store period = 1087. The current and next sync committee is not updated, and is now in an outdated state. (current sync committee = 1086 and current sync committee = 1087, where it should be current sync committee = 1087 and current sync committee = None)
  • Import next sync committee for period 1087 (essentially period 1088) fails because the expected next sync committee's roots don't match.

Bug

The bug here is that the current and next sync committee's didn't handover when an update in the next period was received.

Fix

There are two possible fixes here:

  1. Correctly handover sync committees when a header in the next period is received.
  2. Reject updates in the next period until the next sync committee period is known.

We opted for solution 2, which is more conservative and requires less changes.

Polkadot-sdk versions

This fix should be backported in polkadot-sdk versions 1.7 and up.

Snowfork PR: https://github.com/Snowfork/polkadot-sdk/pull/145

claravanstaden avatar May 16 '24 07:05 claravanstaden

@vgeddes @yrong @alistair-singh please review.

claravanstaden avatar May 16 '24 07:05 claravanstaden

when merged, we should backport to the all other release branches:

  • [ ] release-crates-io-v1.7.0 - patch release the fellows BridgeHubs runtimes - @claravanstaden do you want to do it?
  • [ ] release-crates-io-v1.8.0
  • [ ] release-crates-io-v1.9.0
  • [ ] release-crates-io-v1.10.0
  • [ ] release-crates-io-v1.11.0
  • [ ] release-crates-io-v1.12.0 (commit soon)

@bkontur I'll do all of the above, yes. I need to update the Ethereum client storage in the runtimes PR too.

claravanstaden avatar May 16 '24 14:05 claravanstaden

@bkontur rest of the backported fix PRs:

  • 1.8.0 - https://github.com/paritytech/polkadot-sdk/pull/4483
  • 1.9.0 - https://github.com/paritytech/polkadot-sdk/pull/4484
  • 1.10.0 - https://github.com/paritytech/polkadot-sdk/pull/4485
  • 1.11.0 - https://github.com/paritytech/polkadot-sdk/pull/4486

claravanstaden avatar May 17 '24 09:05 claravanstaden