Skip to content

Reconcile trie spec (§4.2) with the reference implementation's sharded trie #274

@topocount

Description

@topocount

Context

The L0 conformance vectors (added under /vectors, FIP validator-onboarding gate L0 — snapchain#917) currently cover Layer 1 only: encoding, BLAKE3-160 hash, Ed25519 signature, and signer. These rest on protobuf + BLAKE3 + Ed25519 and are reproducible in any language.

They intentionally omit the post-state merkle root (Layer 2) because docs/SPECIFICATION.md §4.2 is stale relative to the reference implementation (farcasterxyz/snapchain):

  • §4.2.1 describes a timestamp-prefixed 36-byte Sync ID (10b timestamp + 1b type + 4b fid + 1b crdt + 20b hash) in a chronologically-ordered Merkle Patricia Trie with exclusion-set sync — the legacy hubs design.
  • snapchain's actual trie key is [virtual_shard(1)][fid(BE)][msg_type<<3 (1)][hash(20)]fid-sharded, fid-prefixed, no timestamp (256 virtual shards). On-chain events are keyed by transaction_hash + log_index; fnames by a padded name. A trie leaf's hash is blake3_20(key); internal nodes hash the concatenation of child hashes sorted by child byte.

Scope

  1. Update §4.2 (and §4.2.1/§4.2.2) to describe the sharded trie key layout, node hashing, and the per-entity key encodings actually used by the reference implementation.
  2. Audit/extend §3.1 CRDTs for the off-chain-signer message types (KEY_ADD / KEY_REMOVE).
  3. Once the trie spec is reconciled, promote the post-state merkle root vectors into /vectors so an alternative client can reproduce state roots, not just the cryptographic layer.

Mirror of Linear NEYN-12044 follow-up (epic NEYN-12026). Tracks the Layer-2 portion of the conformance corpus.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions