paritytech / paritytech/web3-storage
Replace the raw [Option<H256>; 7] sync-roots parameter with a semantic type
@danielbui12 is already working on this.
Since Sep 14, 2026.
- Dominant language
- Rust
- Stars
- 13
- Forks
- 3
- Avg merge
- 2d 2h
- Merged PRs (30d)
- 33
Description
Motivation
confirm_replica_sync (and find_matching_root) take a bare [Option<H256>; 7] whose position semantics — index 0 = current snapshot root, indices 1–6 = the prime-bucketed historical-root slots — live only in doc comments and the design doc. Since #274 the array is also a signed payload (the replica attests SCALE(roots)), so its layout is now part of the attestation format, which makes the opacity worse: nothing in the type says what a position means or which side fills it.
Proposal
A named struct in storage-primitives, e.g.
pub struct SyncRoots {
/// The current snapshot root being attested (position 0 today).
pub current: Option<H256>,
/// The six prime-bucketed historical slots (see Bucket.historical_roots).
pub historical: [Option<H256>; 6],
}
SCALE encodes a struct as the concatenation of its fields, so this is byte-identical to [Option<H256>; 7] — no extrinsic-shape change, no migration, and existing signed attestations stay valid. Constructors like SyncRoots::current(root) replace the node's sync_confirmation_roots helper.
Touch surface
- pallet:
confirm_replica_syncparameter,find_matching_root, tests/benchmarks - provider-node:
ReplicaSyncChainClient::submit_sync_confirmation,sync_confirmation_roots, the dynamic-value construction insubxt_client.rs crates/storage-subxtregen (type name changes in metadata even though bytes don't)- JS: descriptors regen; e2e that constructs the array, if any
Related
- #274 — made the array a signed attestation payload
- #301 — touches the same extrinsic's
ReplicaSyncRecordbookkeeping; coordinate merge order
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Assessment
This issue has not been assessed yet.