paritytech / paritytech/web3-storage

Replace the raw [Option<H256>; 7] sync-roots parameter with a semantic type

Open
#340 1 comment 1 reaction 1 assignee View on GitHub

@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_sync parameter, find_matching_root, tests/benchmarks
  • provider-node: ReplicaSyncChainClient::submit_sync_confirmation, sync_confirmation_roots, the dynamic-value construction in subxt_client.rs
  • crates/storage-subxt regen (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 ReplicaSyncRecord bookkeeping; coordinate merge order

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.