Skip to content

feat(ledger)!: add chain identifiers and the supported ledger catalog - #62

Draft
Wondertan wants to merge 1 commit into
mainfrom
feat/ledger-catalog
Draft

Wondertan wants to merge 1 commit into
mainfrom
feat/ledger-catalog

Conversation

@Wondertan

@Wondertan Wondertan commented Sep 30, 2026 •

Copy link
Copy Markdown
Member

Summary

Moves the supported-ledger catalog into @libid/ledger, so @libid/identity and other consumers share one definition of each chain and its libID deployments.

  • LedgerId gains chain, a CAIP-2 identifier such as eip155:3735928814. Consumers use it to key wallet sessions and look up networks; ceremony behavior is unchanged.
  • Ledger extends LedgerId with a name, testnet flag, native currency, and addresses: named deployments the package stores uninterpreted. Consumers give each name its meaning and can require the names they need in their own types.
  • defineLedger validates a definition and derives the Chain Profile hash from the chain id. For eip155 that is keccak256(abi.encode(uint256 chainId)), matching CeremonyAuthorization.chainId(). Only eip155 is implemented.
  • ledgers['eden-testnet'] is the first catalog entry. The catalog holds no RPC or indexer endpoints; consumers supply those.
  • Ceremony's testing ledgers get synthetic test: chain ids, and the dev app's synthetic ledger gains chain: 'test:local'. One ceremony test that builds a LedgerId by hand gains chain.

Breaking: @libid/ledger 0.1.0 is published, and LedgerId gains a required chain, so every implementation must add one.

defineLedger does not re-validate the notary origin: the ceremony already checks it when a run snapshots the ledger, and doing it here would pull a DOM or Node lib into this package.

The RPC and wallet access layer (namespace-keyed queries and commands, the eip155 driver) is planned as a separate follow-up.

Verification

  • pnpm --filter @libid/ledger build, typecheck, test: 8 tests pass, including a type-level check that catalog literals are preserved; it was confirmed to fail when the expected type is wrong.
  • The Eden hash matches CeremonyProofVerifier.chainId() read from the deployed verifier (0x76BD…9275, 0x70c2…e41c) on 2026-09-30. eip155:1 and eip155:31337 vectors were computed independently with viem.
  • Workspace-wide pnpm build, typecheck, test (ledger 8, popup 154, ceremony 996), lint, fmt:check and test:packages pass on main at cbe7f35.

Not run: ceremony Playwright e2e suites (no ceremony runtime changes).

@Wondertan
Wondertan added this pull request to stack #68 September 30, 2026 20:04
An error occurred while trying to automatically change base from feat/ceremony-rebuild-plan to main October 1, 2026 10:59
@Wondertan
Wondertan force-pushed the feat/ledger-catalog branch from e2f118c to 93f3dc7 Compare October 2, 2026 20:12
@Wondertan
Wondertan removed this pull request from stack #68 October 2, 2026 20:13
@Wondertan
Wondertan changed the base branch from feat/ceremony-rebuild-plan to main October 2, 2026 20:13
@Wondertan
Wondertan added this pull request to stack #107 October 2, 2026 20:13
@cloudflare-workers-and-pages

cloudflare-workers-and-pages Bot commented Oct 2, 2026 •

Copy link
Copy Markdown

🚀 Deploying Preview to Cloudflare 🚀

Preview URL: https://feat-ledger-catalog.previews.lib.id, https://feat-ledger-catalog-libid.grounded-systems.workers.dev (commit 5c9d301)

This URL reflects your latest Preview deployment

Preview Deployments by commit

Status Deployment URL Commit Updated (UTC) See this deployment's details
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://a3bc9d17.previews.lib.id, https://a3bc9d17-libid.grounded-systems.workers.dev 5c9d301 2026-10-02T20:15:25.546Z Visit the dashboard ↗
  • Build: Success ✅
  • Deployment: Success ✅

View logs ↗
https://78a42e31.previews.lib.id, https://78a42e31-libid.grounded-systems.workers.dev 93f3dc7 2026-10-02T20:13:52.891Z Visit the dashboard ↗

LedgerId gains a CAIP-2 `chain`. `defineLedger` builds a `Ledger` with its
name, testnet flag, native currency and uninterpreted named deployments, and
derives the eip155 Chain Profile hash as keccak256(abi.encode(chainId)). The
catalog starts with Eden testnet, whose hash matches its deployed verifier.

BREAKING CHANGE: LedgerId implementations must provide `chain`.

Assisted-by: Claude Opus 5.5
Signed-off-by: Wondertan <hlibwondertan@gmail.com>
@Wondertan
Wondertan force-pushed the feat/ledger-catalog branch from 93f3dc7 to 5c9d301 Compare October 2, 2026 20:14
@Wondertan Wondertan changed the title feat(ledger): add chain identifiers and the supported ledger catalog feat(ledger)!: add chain identifiers and the supported ledger catalog Oct 2, 2026

This branch has not been deployed

No deployments
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant