Skip to content

ADR 0010: Leios (Musashi) serialization & BlockChainDataListener integration design #170

Open

Description

@beanbot-gh

Summary

With the transport-only Leios mini-protocols (leios-notify = 18, leios-fetch = 19) landed for the Musashi prototype testnet (#167, ADR 0007), the next layer is serialization for the Leios data structures and integration into the existing sync surface.

ADR 0010 designs that layer with four goals:

  1. Apps using BlockSync / BlockRangeSync (e.g. yaci-store) keep receiving ranking blocks through BlockChainDataListener.onBlock(era, block, txs) with zero listener API change — on mainnet and on Musashi.
  2. New default listener methods (onEndorserBlock, onLeiosVotes) surface Endorser Blocks and votes to apps that opt in, on the same listener and the same connection.
  3. The same application code works against mainnet (Leios inactive) and Musashi (Leios active), selected by network magic + handshake — not by code changes.
  4. yaci-store's mandatory change reduces to mapping the new Era.Dijkstra constant.

Design (three additive layers)

  • Layer 1 — Dijkstra era & ranking-block continuity (core): Era.Dijkstra(8) + EraUtil mapping; shape-guarded parsing of the RB header's trailing [eb_hash, eb_size] announcement extension; nullable raw leios_cert / peras_cert body fields; a robust pre-/post-Babbage header routing heuristic.
  • Layer 2 — Leios domain models & serializers (core): model/leios/* (EndorserBlock, LeiosVote, EndorserBlockTx, …) with shape-tolerant deserializers (both EB dialects, 3/4-element votes, ns8 tx-era mapping) that decode the opaque LeiosRawCbor payloads above the transport layer, always retaining raw CBOR.
  • Layer 3 — Listener & sync integration (helper): event-carrier callbacks on BlockChainDataListener, an internal LeiosSyncCoordinator (offer-gated fetch, per-point state machine), and opt-in LeiosConfig wiring (AUTO | ENABLED | DISABLED) that attaches the Leios agents to the same TCPNodeClient connection.

Everything is pinned to what the live Musashi network speaks today (cardano-blueprint leios-prototype @ 188183b), with a future-proofing map for known drift (blueprint head vote/body changes, CIP-0164 final shapes).

Plan

  • PR-A: core era continuity + fixtures captured from the live network
  • PR-B: Leios models & serializers + golden tests
  • PR-C: helper listener/coordinator integration + default-disabled Musashi integration test
  • yaci-store validation run against a local Musashi relay

ADR: adr/0010-leios-musashi-serialization-and-listener-integration.md (PR to follow).

Activity

  1. beanbot-gh commented on Nov 7, 2026

    @beanbot-gh
    Author

    A note on overlap with the Dijkstra ledger work for 0.5.0.

    The ledger CBOR reader in CCL (bloxbean/cardano-client-lib#748, ADR 0003 and ADR 0004) reads Dijkstra blocks, and Yaci's 0.5.0 work (in progress, not yet pushed) maps it into Yaci's models, marked experimental:

    • Overlaps Layer 1 here: the Dijkstra block and header, the Leios certificate and the Peras certificate on Block, and leiosCertInBody and the endorser-block announcement (hash and size) on HeaderBody.
    • Not covered by this issue: transaction-level fields. These are sub-transactions, guards (in Dijkstra, requiredSigners is derived from the key guards, as the ledger does), required top-level guards, direct deposits, account balance intervals, Plutus V4 scripts in witnesses and aux data, the pool BLS key, protocol parameter keys 34-56, RedeemerTag.Guarding and the guard native script.

    So Layer 1 can build on those fields rather than parse them a second time. Endorser blocks, votes and the listener integration (Layers 2 and 3) are untouched.

    Still open on the Yaci side:

    • Local-state query results for Dijkstra keep their Conway shape until Dijkstra is final.
    • Transaction.utxos lists only top-level outputs (its Javadoc says so). Applying sub-transactions is left to the consumer's ledger, since it depends on the top-level transaction's validity.
    • The native image has not been built with the new models.

    Yano's side is tracked in bloxbean/yano#239.

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions