fix(domain): preserve path and query in DIDUrl serialization
Resolves #634 Signed-off-by: iammdzaidalam <[email protected]>
Resolves #634 Signed-off-by: iammdzaidalam <[email protected]>
Per the rebase plan's C7. Brings up the Leios threadnet QuickCheck test
on the new structural foundation (chunks C1-C5). The November-demo
scripts ('scripts/leios-demo/', 'nix/leios-mvd/') are intentionally
dropped; the 'run-threadnet' executable is also deferred (its prototype
has upstream API drift — see follow-up).
- 'test/cardano-test/Test/ThreadNet/Leios.hs': the property test
itself — verifies cert blocks happen, no vacuous runs, gap >
minCertificationGap, all nodes converge, and an independent replay
of each node's chain through 'resolveLeiosBlock' produces the same
final ledger as the live node.
- 'unstable-diffusion-testlib/Test/ThreadNet/Network.hs' is the
central rebase: 'NodeInfo' parametrises over a Leios state functor
so the live version holds a 'StrictTVar m' and the snapshot reader
produces 'Identity'; 'mkArgs' threads the TVar to
'fromMinimalChainDbArgs' via the new 'mcdbLeiosDbVar' field on
'MinimalChainDbArgs'; 'mkTestOutput' returns the snapshotted LeiosDb
so the post-hoc 'replayNodeChain' / 'sumChainTxBytes' can resolve
EBs (without this, every test would crash at the first cert block).
Per-node 'leiosVotingKey' wired so voting fires.
- All other test-side call sites updated for new ChainDB / forge /
mempool signatures (ChainDB.Unit, StateMachine, FollowerPromptness,
LedgerSnapshots, BlockFetch.Client, LocalStateQuery.Server,
PeerSimulator, Genesis tests, HardFork.Combinator tests).
- 'unstable-cardano-testlib': 'Test.Consensus.Cardano.ProtocolInfo'
gains a 'hardForkInto Dijkstra' entry; 'Test.ThreadNet.TxGen.Cardano'
projects DijkstraEra from the cardano TxGen.
- 'unstable-shelley-testlib': generators / examples updated for the
new Praos header field and ShelleyLedgerState cumulative tx bytes.
Refs: #1883, #1906
Co-Authored-By: Claude <[email protected]>
Per the rebase plan's C5. Adds an era-abstract running total of transaction bytes applied so far on the Shelley-based ledger, and lands the real 'ResolveLeiosBlock' splice for Dijkstra-era CardanoBlocks (C3 only added the structural class; the actual EB-closure read sits in Shelley/Ledger/Ledger.hs and lands here together with the cumulative tx-bytes change since they share the same file). - 'Ouroboros.Consensus.Ledger.SupportsMempool' gains a per-block 'blockTxBytes' projection that the cumulative counter updates from. - 'shelleyCumulativeTxBytes :: Word64' on 'ShelleyLedgerState' and 'tickedShelleyCumulativeTxBytes' on the ticked variant; both CBOR-versioned through (en|de)codeShelleyLedgerState. - 'HardFork.Combinator.Mempool' threads cumulative tx bytes through per-era projections. - 'ResolveLeiosBlock (ShelleyBlock (Praos c) DijkstraEra)': reads the parent's 'praosStateLeiosAnnouncement' + 'praosStateLastSlot', queries 'leiosDbQueryCompletedEbByPoint', and splices the EB's tx closure into the body via 'Core.txSeqBlockBodyL'. Errors with a clear message if the announced EB isn't available locally (matches the prototype's FIXME — race that the threadnet harness avoids by snapshotting LeiosDb per node, see C7). Refs: #1988 Co-Authored-By: Claude <[email protected]>
Per the rebase plan's C4. The forging pipeline learns to (1) emit EB
announcements in Dijkstra blocks and (2) decide between announcing a
new EB and certifying a previously-announced one, gated by
'minCertificationGap'. Other eras are unaffected.
- 'Block.Forging.ForgeBlockArgs' gains 'fbEbTxs', 'fbLeiosDb',
'fbCurrentTickedLedgerState', 'fbChainDepState' (for the certify
decision), and 'fbLeiosTracer'. The HFC's 'Combinator.Forging'
dispatches the new fields per-era; only Dijkstra reads them.
- 'Shelley.Ledger.Forge.forgeShelleyBlock' grows 'decideLeios':
certify if a previously-announced EB has gap > minCertificationGap
and is available locally; otherwise forge a new EB from 'fbEbTxs'
(honest forger only emits an EB when the mempool has txs) and
embed its announcement on the header. The cert lives in the body
via 'leiosCertBlockBodyL' (no header certify flag).
- 'Cardano.CanHardFork.ebCapacityTxMeasure' ported verbatim from the
prototype so the HFC mempool knows the Dijkstra EB capacity.
- DBSynthesizer / DBAnalyser call sites updated for the new
'ForgeBlockArgs' shape ('fbEbTxs = mempty' for non-Leios tools).
Refs: #1888, #2018
Co-Authored-By: Claude <[email protected]>
Per the rebase plan's C3, threads a 'ResolveLeiosBlock' typeclass through
the block-application pipeline so that Dijkstra-era blocks carrying a
'SJust LeiosCert' get their (empty) tx list filled in from the EB
closure in 'LeiosDb' before validation. Plumbing only — no chain-
selection rule change (per resolved decision #1, decision #3).
- 'Storage.LedgerDB.Forker' grows a 'ResolveLeiosBlock' class and the
'applyBlock' hook calls 'resolveLeiosBlock leiosDb hdrSt b' before
'tickThen{Apply,Reapply}'. The forker's 'ExtLedgerState' is read to
extract 'headerState' for the splice (used to look up the previous
EB announcement on the chain-dep state).
- 'Storage.LedgerDB.V2.validate' threads 'LeiosDbConnection' alongside
the existing args, so the new applyBlock signature reaches the V2
pipeline.
- Default 'ResolveLeiosBlock' instances ('return blk') for every block
type that doesn't carry Leios: Byron, mock SimpleBlock', DualBlock,
TestBlock, HardForkBlock, ShelleyBlock (TPraos). The Dijkstra-era
'ShelleyBlock (Praos c)' splice lives next to the cumulative tx
bytes change in C5 since both live in
'Ouroboros.Consensus.Shelley.Ledger.Ledger'.
- CardanoBlock dispatch in 'Ouroboros.Consensus.Cardano.Block' routes
per-era to the appropriate instance.
Refs: #1873, #1889
Co-Authored-By: Claude <[email protected]>
Per the rebase plan's C2, extends the Praos header and chain-dep state to carry the optional Leios EB announcement (the certify flag is gone — the cert lives on 'DijkstraBody' instead, per resolved decision #3). - 'Header': add 'hbLeiosEbAnnouncement :: !(StrictMaybe EbAnnouncement)'; emit / decode it alongside the existing header fields. - 'PraosState': add 'praosStateLeiosAnnouncement :: !(StrictMaybe ...)' and update it from the applied block's signed header view. The announcement is intentionally *non-sticky* — every block overwrites the slot with that block's own announcement (or 'SNothing'), so a certifying block can only be the *direct* successor of the announcer. Simpler than the prototype's 'LeiosState' record; we drop the unused 'leiosStateCumulativeEbAnnouncementSize'. - 'ProtocolHeaderSupportsKES.protocolStateLeiosInfo': new class method returning '(EbAnnouncement, WithOrigin SlotNo)' for the forger's certify decision. TPraos default returns 'Nothing'; Praos reads from 'PraosState'. - 'Block.SupportsProtocol' / Shelley protocol shims threaded accordingly. Test generators updated to populate the new field. Refs: #1978, #1921 Co-Authored-By: Claude <[email protected]>
Per the rebase plan's C1, brings the prototype's Leios scaffolding into
'ouroboros-consensus' / 'ouroboros-consensus-diffusion'. Self-contained
infrastructure that later chunks (C2-C7) build on top of:
- LeiosDemo{Types, Db, Logic, Exception, OnlyTest{Fetch, Notify}} and
'LeiosVoteState' under 'ouroboros-consensus/src/ouroboros-consensus/'.
Module names kept flat-and-prefixed, matching the prototype layout.
- 'LeiosNotify' / 'LeiosFetch' mini-protocols (types, codecs, server
+ client, handlers) and 'leiosFetchLogic' background thread, plumbed
through 'NodeToNode' and 'NodeKernel'. The voting thread and voting
message paths land in this chunk too — splitting them out would
fracture single files for no review benefit; C6 only contributes the
threadnet-side voting key wire.
- 'LeiosDbConnection' threaded into 'ChainDbArgs' (cdbsLeiosDb), the
ChainDB.Impl pipeline, and the LedgerDB args. Real-node start path
('Ouroboros.Consensus.Node') opens the DB.
- 'cabal.project' SRP pins flipped to the rebased ledger fork
('cardano-ledger-leios-prototype-remake-on-chap') and the network
fork that carries the demo-tuning add-ons.
- 'cardano-blueprint' submodule added at the new prototype branch tip,
so consensus / network can pull the Leios CDDL from one place.
- New modules registered in 'ouroboros-consensus.cabal'.
Refs: #1832, #1837, #1979
Co-Authored-By: Claude <[email protected]>
Introduce 'Maybe LeiosCert' (mirrored after the existing 'Maybe PerasCert')
as an optional field on the Dijkstra-era 'BlockBody'. Other eras are
unaffected — this is the entire Leios-related ledger change per the
rebase plan's decision #3 (no 'Body'/'BodyInline'/'BodyCertificate' sum,
no early-era touch).
The change spans four pieces, all kept together so the type, codec,
hashing, and lens story land coherent:
- 'LeiosCert' / 'PerasCert' placeholders encode as @encodeListLen 0@
rather than @encCBOR ()@ — the latter is 'encodeNull' (0xf6), which
collides with the null-tag of 'encodeNullStrictMaybe' and made
'SJust LeiosCert' indistinguishable from 'SNothing' on the wire.
Adds a regression test in 'BaseTypesSpec' covering both certs.
- 'DijkstraBlockBody' carries pre-encoded bytes for body / wits /
aux-data / is-valid / Leios cert / Peras cert, six slots total
(numSegComponents = 6). The Leios and Peras cert slots always emit
a CBOR token (null when absent) so the on-wire layout is fixed.
- Lens setters ('txSeqBlockBodyL', 'leiosCertBlockBodyL',
'perasCertBlockBodyL') rebuild via the bidirectional
'DijkstraBlockBody' pattern. The previous setters only updated the
structural field and silently kept the stale pre-encoded bytes, so
e.g. setting txs left 'dbbTxsBodyBytes' as the empty list and the
block on the wire had no transactions even though the in-memory
rep was correct. Mirrors the Alonzo idiom
@lens abbTxs (\_ s -> AlonzoBlockBody s)@.
- 'Arbitrary' and 'TreeDiff' instances for the body extended to
generate / show the new cert slot.
Co-Authored-By: Claude <[email protected]>
The Leios prototype rebase doesn't need 'cardano-ledger-canonical-state', 'cardano-ledger-conformance', 'cardano-ledger-test', 'plutus-preprocessor', 'ledger-state', or 'cardano-ledger-repl-environment'. They depend on 'cardano-cls', whose source-repository-package isn't trivially compatible with this base — comment them out so the rebase builds cleanly while we focus on Leios scope. Co-Authored-By: Claude <[email protected]>
Re-authored on top of c175b1b317 (the cardano-ledger commit compatible with consensus main's CHaP index-state 2026-04-13) to match the older fat-constructor DijkstraBlockBody shape (pre-memoization refactor). Equivalent to b6b2feb006 on leios-prototype-remake, which targeted the post-memoization shape (DijkstraBlockBodyRaw + lensMemoRawType). Adds: * `dbbLeiosCert :: StrictMaybe LeiosCert` field and matching `dbbLeiosCertBytes :: Maybe BSL.ByteString` byte-cache, mirroring the PerasCert pattern in this older shape. * `LeiosCert` placeholder newtype over ByteString with derived EncCBOR/DecCBOR/NoThunks/NFData (the real type lands with the Leios voting machinery). * `leiosCertBlockBodyL` lens method on `DijkstraEraBlockBody`. * Pattern synonym extended with a third `StrictMaybe LeiosCert` arg; body threads the bytes through `hashDijkstraSegWits` (now takes the Leios bytes arg too). * `EncCBORGroup` appends the optional Leios cert bytes after the optional Peras cert bytes. * `DecCBOR` handles three list-length cases: 4 (neither), 5 (Peras only, legacy), 6 (Peras + Leios). A Leios-only encoding is not expressible without ambiguity at len 5 \-- intentional: Dijkstra-era blocks aren't on the wire yet. * `NoThunks` `AllowThunksIn` list extended with `dbbLeiosCertBytes`. * Testlib: `Arbitrary LeiosCert` (and `DijkstraBlockBody <*> arbitrary <*> arbitrary <*> arbitrary`); `ToExpr LeiosCert` and updated `ToExpr (DijkstraBlockBody era)` constraint set. Only the Dijkstra era is Leios-enabled \-- earlier eras are untouched. Verified: `cabal build cardano-ledger-dijkstra:lib:cardano-ledger-dijkstra` and `cabal build cardano-ledger-dijkstra:lib:testlib` both clean. Co-Authored-By: Claude Opus 4.7 <[email protected]>
feat/refactor: probabilistic light client extracted module
Resolves #634 Signed-off-by: iammdzaidalam <[email protected]>
Signed-off-by: KtorZ <[email protected]>