Context (“snap-sync for domains” algorithm)
Prerequisites:
- MMR sync (new protocol) to support XDM and fraud proofs - from aux storage of the consensus chain client.
- snap-sync changes: “snap-sync from a custom block”
- Domains change:
- enable block and state request protocols for domains and disable block sync for domains (pause_sync)
- toggle consensus blocks notifications to pause/resume domain block derivation
- add execution receipt of the last confirmed domain block and associated consensus block fields to LatestConfirmedDomainBlock
Algorithm:
- Get last_confirmed_domains_block from the consensus chain runtime state and retrieve execution receipt of the last confirmed domain block and associated consensus block fields of the LatestConfirmedDomainBlock from consensus chain runtime state.
- MMR-sync (must be done before the final domain blocks sync/derivation).
- Snap-sync consensus chain from the associated consensus block:
a) After getting the state and before syncing/derivation domain chain blocks - download state and last_confirmed_domains_block from the domain network.
b) Sync blocks for consensus chain (from DSN - because we can’t guarantee other peers don’t prune their local blocks at the arbitrary height) with reenabling domain chain notification. (edited)
How to get LatestConfirmedDomainBlock and execution receipt?
- Initially, we planned to obtain this information using snap-sync for consensus chain (from the local runtime state) but modifying polkadot-sdk to support multiple sync with gaps seems problematic.
- Alternatively, we can get this information from the consensus of connected peers - similar to the current segment headers obtained for DSN-sync.
Comment: we can also try to snap-sync to the local temporary chain and grab information from here (additional R&D required).
Can we trust the last confirmed block information when we get it from a consensus of peers (majority)?