Merged
Conversation
$ cabal run ouroboros-consensus-cardano:run-threadnet -- run --threadnet-config run-threadnet-example-config/example-threadnet-config.json --slots 100 --txs-per-slot 10
("Node",CoreNodeId 0,"current slot",SlotNo 7,ShelleyLedgerLeiosState {sllsMaybeAnnouncedEb = Nothing, sllsTooSoonToCertify = False, sllsTouched = 0})
("Node",CoreNodeId 1,"current slot",SlotNo 7,ShelleyLedgerLeiosState {sllsMaybeAnnouncedEb = Nothing, sllsTooSoonToCertify = False, sllsTouched = 0})
("Node",CoreNodeId 2,"current slot",SlotNo 7,ShelleyLedgerLeiosState {sllsMaybeAnnouncedEb = Nothing, sllsTooSoonToCertify = False, sllsTouched = 0})
run-threadnet: FailureEvaluation FIXME(bladyjoker)
CallStack (from HasCallStack):
error, called at src/shelley/Ouroboros/Consensus/Shelley/Ledger/Ledger.hs:312:37 in ouroboros-consensus-cardano-0.25.1.0-inplace:Ouroboros.Consensus.Shelley.Ledger.Ledger
I had an assumption that turned out wrong. `applyTick` is called just before
`applyBlock`, and I thought it's applied on each "tick" (ie. new slot).
13:59 $ cabal run ouroboros-consensus-cardano:run-threadnet -- run --threadnet-config run-threadnet-example-config/example-threadnet-config.json --slots 15 --txs-per-slot 10
...
("Node",CoreNodeId 0,"current slot",SlotNo 14,ShelleyLedgerLeiosState {sllsMaybeAnnouncedEb = Nothing, sllsTooSoonToCertify = False, sllsApplyTickCount = 2, sllsApplyBlockCount = 2})
("Node",CoreNodeId 1,"current slot",SlotNo 14,ShelleyLedgerLeiosState {sllsMaybeAnnouncedEb = Nothing, sllsTooSoonToCertify = False, sllsApplyTickCount = 2, sllsApplyBlockCount = 2})
("Node",CoreNodeId 2,"current slot",SlotNo 14,ShelleyLedgerLeiosState {sllsMaybeAnnouncedEb = Nothing, sllsTooSoonToCertify = False, sllsApplyTickCount = 2, sllsApplyBlockCount = 2})
*** Exceptions?
Nothing
*** Tips
Just (SlotNo 14,fromList [(CoreId (CoreNodeId 0),At (BlockNo 1)),(CoreId (CoreNodeId 1),At (BlockNo 1)),(CoreId (CoreNodeId 2),At (BlockNo 1))])
*** Leios
("eb-slotno",fromList [(CoreId (CoreNodeId 0),fromList []),(CoreId (CoreNodeId 1),fromList []),(CoreId (CoreNodeId 2),fromList [])])
("eb-points",fromList [(CoreId (CoreNodeId 0),fromList []),(CoreId (CoreNodeId 1),fromList []),(CoreId (CoreNodeId 2),fromList [])])
("eb-txs",fromList [(CoreId (CoreNodeId 0),0),(CoreId (CoreNodeId 1),0),(CoreId (CoreNodeId 2),0)])
*** Outputting log files
Currently, the Shelley Block is used to convey the information rather than the header, namely `blockMayAnnouncedEb` and `blockCertifiesEb`. The addition to the `ShelleyLedgerState` called `ShelleyLedgerLeiosState` maintains two state variables, namely `sllsMaybeAnnouncedEb` which denotes the EB announcement of the last `Block`, and `sllsTooSoonToCertify` which denotes whether previous EB announcement is old enough to be used. Try with: 15:30 $ cabal run ouroboros-consensus-cardano:run-threadnet -- run --threadnet-config run-threadnet-example-config/example-threadnet-config.json --slots 30 --txs-per-slot 500
… it. WARN: This compiles and runs but is fundamentally broken
10:17 $ cabal run ouroboros-consensus-cardano:run-threadnet -- run --threadnet-config run-threadnet-example-config/example-threadnet-config.json --slots 100 --txs-per-slot 500 ... run-threadnet: FailureEvaluation In Shelley baby yea CallStack (from HasCallStack): error, called at src/shelley/Ouroboros/Consensus/Shelley/Ledger/Block.hs:161:47 in ouroboros-consensus-cardano-0.25.1.0-inplace:Ouroboros.Consensus.Shelley.Ledger.Block Still lots is broken, but we can run-threadnet and reach the Shelley `resolveLeiosBlock` call.
5c70494 to
3951cd0
Compare
Contributor
Author
Mempool partitioning with Certificatesforge leiosDb mempool = do
mayCertifiedEb <- getCertifiedEb leiosDb
case mayCertifiedEb of
-- As is now
Nothing -> do
mempoolTxs <- snapshotMempool mempool
(inlinedTxs, restTxs) <- splitTxs praosCapacity mempoolTxs
ebTxs <- splitTxs ebCapacity restTxs
forgeBlock (InlinedTxs inlinedTxs) ebTxs
-- With the Certificates
Just (cert, certifiedEbTxs) -> do
rebaseAndApplyMempool mempool certifiedEbTxs -- magic
mempoolTxs <- snapshotMempool mempool
(eb, restTxs) <- splitTxs ebCapacity mempoolTxs
forgeBlock cert ebTxs |
$ cabal run ouroboros-consensus-cardano:run-threadnet -- run --threadnet-config run-threadnet-example-config/example-threadnet-config.json --slots 100 --txs-per-slot 500
("certifying",LeiosCertificate {unLeiosCertificate = "trust me bruv"},MkLeiosPoint {pointSlotNo = SlotNo 10, pointEbHash = "\SUB\194\252%5\230\GS\139S\139\191\219\173\&5\211\189\207G>4\232\&4\136`<c\DLE\185bw}\DEL"})
run-threadnet: FailureEvaluation Certificate body must include EB transaction closure (I was expecting this to be resolved) Certificate {unCertificate = "trust me bruv"}
CallStack (from HasCallStack):
error, called at src/Cardano/Ledger/Block.hs:111:5 in cardano-ledger-core-1.17.0.0-inplace:Cardano.Ledger.Block
This is obviously not what we want to keep for long, but good for the workshop.
97aa3d0 to
5ef1406
Compare
This was referenced Apr 2, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
input-output-hk/ouroboros-leios#774
DONE
Ledger: [DO-NOT-MERGE] Leios prototype cardano-ledger#5626
BlockfieldsblockMayAnnouncedEb :: Maybe EbHashandblockCertifiesEb :: Bool(NOTE: Currently we keep this in the body and not the header)ShelleyLedgerStatein OuroborosConsensus is tracking the last announced EBForge: Issues a Block with EB announcement and Certificates
blockMayAnnouncedEb)blockCertifiesEb)When a Leader tries to forge a Block with a Certificate AND additionally wants to announce a new EB, the transaction in that EB are likely to be invalid wrt to the Ledger state induced by the application of the Certificate.
Instead, when a Certified EB is available during Forge, Mempool needs to be "rebased" to a Ledger state after the Certified EB application (and the surviving transactions can go to an EB and be announced)
ChainDB: When the
blkcontains a Leios Certificate we must resolve its transaction closure in order toapplyBlockresolveLeiosBlockcall (ResolveLeiosBlock blkclass method) was introduced in a call chain toapplyBlockto resolve the transactions if theblkcontains a Leios CertificateresolveLeiosBlockresolves the transaction closure and provides it to the LedgerTest
Sqlite implementation