fix(event): blocking delivery for ordering-critical ledger.chainsync (#2366)
Signed-off-by: Chris Gianelloni <[email protected]>
Signed-off-by: Chris Gianelloni <[email protected]>
Mempend a small OuroborosBundle with leiosNotify/leiosFetch on the Hot temperature onto the existing five-protocol bundle in initiator and initiatorAndResponder. Define the matching ingress-queue limits from the demo's LeiosFetchStaticEnv. This matches the upstream leios-prototype pattern - the change is contained to consensus and leaves the network NodeToNodeProtocols record untouched. Co-Authored-By: Claude Opus 4.7 <[email protected]>
Signed-off-by: Chris Gianelloni <[email protected]>
'LeiosOfferBlock' / 'LeiosOfferBlockTxs' are constructor names from an
earlier iteration of the notification ADT. The current type
('LeiosEbNotification' in 'LeiosDemoDb.Common') has 'AcquiredEb' /
'AcquiredEbTxs'; the old names linger only in stale comments.
Four sites updated: the 'leiosDbInsertTxs' haddock in
'LeiosDemoDb.Common' and three test comments in
'Test.LeiosDemoDb'.
Comment-only change; no behaviour delta.
ChainSel must not select a chain that includes a CertRB whose certified
EB closure is not locally available; otherwise 'resolveLeiosBlock'
crashes when the block-add path tries to recover the closure.
Wire-up:
- 'CDB' carries 'cdbLeiosDbHandle :: LeiosDbHandle m' so ChainSel can
read the closure cache on the block-add hot path without threading
the snapshot through every caller.
- 'chainSelectionForBlock' reads 'readCompletedClosures' on each
iteration; the read is O(1) (TVar) so this is cheap.
- New 'ignorePendingCertRBs' wrapper around 'lookupBlockInfo'. Mirrors
the existing 'ignoreInvalid' wrapper. Both lookup paths
('lookupBlockInfo'' and 'succsOf'') filter against the same set.
Filter body itself is a stub:
'computeCertRBsWithPendingEbClosures' returns 'Set.empty'. The real
implementation walks the VolatileDB forward from the immutable tip and,
for each header satisfying 'headerIsCertRB', extracts the certified
'EbHash' from the parent's 'headerEbAnnouncement' and checks it against
'readCompletedClosures'. Lands in the next step of the late-join
workstream.
'Node.hs' / 'Test/ThreadNet/Network.hs' pass the handle to
'openChainDB'; no more 'LeiosOutstanding' MVar lifting.
Add 'readCompletedClosures :: m (Set EbHash)' to 'LeiosDbHandle'. The handle owns a TVar; ChainSel will read it on the block-add hot path (O(1) 'readTVarIO'). Seed at construction: - SQLite: 'SELECT ebHashBytes FROM ebs WHERE missingTxCount IS NOT NULL AND missingTxCount <= 0'. Covers both "just completed" (0) and "completed and notified" (-1); both states mean the closure is in the DB. Run on a short-lived connection that also guarantees schema initialisation before any 'open'-ed connection later. - In-memory: derive from 'imTxs' / 'imEbBodies' via the same predicate the insert paths use. Update inside the existing insert paths: - Both SQLite insert paths share a 'findAndMarkCompletedEbs' helper inside the BEGIN and a 'notifyAndCacheCompleted' helper after COMMIT. The notify+cache step pushes the just-transitioned closures into the cache. - In-memory insert paths do the same update inside their STM transaction, so the state mutation and the cache update are atomic. 'LeiosDemoLogic.msgLeiosBlock' now also emits 'TraceLeiosBlockTxsAcquired' for closures completed by a body insert (not just tx inserts), matching the symmetry the cache update exposes. Cache is unbounded for now; future work caps it to a k-window with DB query on miss. See 'readCompletedClosures' TODO and the late-join plan.
Add 'hbIsCertRB' to 'HeaderBody' (and mirror on 'HeaderView') for the CIP-0164 header bit signalling that this RB certifies a previously-announced EB. Thread the bit through 'mkHeader' (Praos and TPraos; the latter ignores it) and the Shelley forge path. Encode canonically: every header is len=12 carrying @(Bool, Maybe EbAnnouncement)@. Decode still accepts len=10 (pre-Leios) and len=11 (announcement-only) for back-compat with existing on-disk data; new encodings never produce those shapes. Two valid encodings for the same logical header would have made hashing / signature over the encoded form non-canonical. Per-header cost: one byte for the Bool plus one for the Maybe-Nothing tag when no announcement is present.
Parameterise runThreadNet over NodeJoinPlan and add a new property that starts node 3 at a random slot while nodes 0-2 run from slot 0. Demonstrates the crash in 'resolveLeiosBlock' when a late-joining node encounters a CertRB referencing an EB it never received. The fix lives later in the workstream; this commit just makes the gap visible.
ChainSel needs two header-level queries to identify CertRBs whose certified EB closure is not locally available: 'headerIsCertRB' on the candidate header, and 'headerEbAnnouncement' on its parent. Add both methods to 'ResolveLeiosBlock' without defaults: a silent 'False' / 'Nothing' default would let a future block-type author forget to override, and ChainSel would silently degrade to "never filter a CertRB" without a compile error. Every instance now defines all three methods. The Praos Shelley instance reads 'hbIsCertRB' / 'hbMayEbAnnouncement' off the body. Cardano dispatches to Conway for both methods. Every other instance (Byron, mock, test, single-era HFC wrappers) spells out the "never a CertRB" stance explicitly.
* fix(utxorpc): Made changes to bound WaitForTx streams with a timeout where I have added a configurable WaitForTx timeout and return DeadlineExceeded on expiry Signed-off-by: Akhil Repala <[email protected]> * fix(utxorpc): Removed the default WaitForTx timeout and added a general Server timeout where we can use it for all request handlers of utxorpc server. removed all the places with waitfortx timeout accordingly Signed-off-by: Akhil Repala <[email protected]> * fix(utxorpc): Fixed the busy wait loop in tests Signed-off-by: Akhil Repala <[email protected]> --------- Signed-off-by: Akhil Repala <[email protected]>
Signed-off-by: Chris Gianelloni <[email protected]>
Signed-off-by: Sai Asish Y <[email protected]>
Signed-off-by: cryptodj413 <[email protected]>
Signed-off-by: cryptodj413 <[email protected]>
'LeiosOfferBlock' / 'LeiosOfferBlockTxs' are constructor names from an
earlier iteration of the notification ADT. The current type
('LeiosEbNotification' in 'LeiosDemoDb.Common') has 'AcquiredEb' /
'AcquiredEbTxs'; the old names linger only in stale comments.
Four sites updated: the 'leiosDbInsertTxs' haddock in
'LeiosDemoDb.Common' and three test comments in
'Test.LeiosDemoDb'.
Comment-only change; no behaviour delta.
Add 'hbIsCertRB' to 'HeaderBody' (and mirror on 'HeaderView') for the CIP-0164 header bit signalling that this RB certifies a previously-announced EB. Thread the bit through 'mkHeader' (Praos and TPraos; the latter ignores it) and the Shelley forge path. Encode canonically: every header is len=12 carrying @(Bool, Maybe EbAnnouncement)@. Decode still accepts len=10 (pre-Leios) and len=11 (announcement-only) for back-compat with existing on-disk data; new encodings never produce those shapes. Two valid encodings for the same logical header would have made hashing / signature over the encoded form non-canonical. Per-header cost: one byte for the Bool plus one for the Maybe-Nothing tag when no announcement is present.
ChainSel must not select a chain that includes a CertRB whose certified
EB closure is not locally available; otherwise 'resolveLeiosBlock'
crashes when the block-add path tries to recover the closure.
Wire-up:
- 'CDB' carries 'cdbLeiosDbHandle :: LeiosDbHandle m' so ChainSel can
read the closure cache on the block-add hot path without threading
the snapshot through every caller.
- 'chainSelectionForBlock' reads 'readCompletedClosures' on each
iteration; the read is O(1) (TVar) so this is cheap.
- New 'ignorePendingCertRBs' wrapper around 'lookupBlockInfo'. Mirrors
the existing 'ignoreInvalid' wrapper. Both lookup paths
('lookupBlockInfo'' and 'succsOf'') filter against the same set.
Filter body itself is a stub:
'computeCertRBsWithPendingEbClosures' returns 'Set.empty'. The real
implementation walks the VolatileDB forward from the immutable tip and,
for each header satisfying 'headerIsCertRB', extracts the certified
'EbHash' from the parent's 'headerEbAnnouncement' and checks it against
'readCompletedClosures'. Lands in the next step of the late-join
workstream.
'Node.hs' / 'Test/ThreadNet/Network.hs' pass the handle to
'openChainDB'; no more 'LeiosOutstanding' MVar lifting.
ChainSel needs two header-level queries to identify CertRBs whose certified EB closure is not locally available: 'headerIsCertRB' on the candidate header, and 'headerEbAnnouncement' on its parent. Add both methods to 'ResolveLeiosBlock' without defaults: a silent 'False' / 'Nothing' default would let a future block-type author forget to override, and ChainSel would silently degrade to "never filter a CertRB" without a compile error. Every instance now defines all three methods. The Praos Shelley instance reads 'hbIsCertRB' / 'hbMayEbAnnouncement' off the body. Cardano dispatches to Conway for both methods. Every other instance (Byron, mock, test, single-era HFC wrappers) spells out the "never a CertRB" stance explicitly.
Add 'readCompletedClosures :: m (Set EbHash)' to 'LeiosDbHandle'. The handle owns a TVar; ChainSel will read it on the block-add hot path (O(1) 'readTVarIO'). Seed at construction: - SQLite: 'SELECT ebHashBytes FROM ebs WHERE missingTxCount IS NOT NULL AND missingTxCount <= 0'. Covers both "just completed" (0) and "completed and notified" (-1); both states mean the closure is in the DB. Run on a short-lived connection that also guarantees schema initialisation before any 'open'-ed connection later. - In-memory: derive from 'imTxs' / 'imEbBodies' via the same predicate the insert paths use. Update inside the existing insert paths: - Both SQLite insert paths share a 'findAndMarkCompletedEbs' helper inside the BEGIN and a 'notifyAndCacheCompleted' helper after COMMIT. The notify+cache step pushes the just-transitioned closures into the cache. - In-memory insert paths do the same update inside their STM transaction, so the state mutation and the cache update are atomic. 'LeiosDemoLogic.msgLeiosBlock' now also emits 'TraceLeiosBlockTxsAcquired' for closures completed by a body insert (not just tx inserts), matching the symmetry the cache update exposes. Cache is unbounded for now; future work caps it to a k-window with DB query on miss. See 'readCompletedClosures' TODO and the late-join plan.
Bumps [github.com/btcsuite/btcd/chaincfg/chainhash](https://github.com/btcsuite/btcd) from 1.1.0 to 1.2.0. - [Release notes](https://github.com/btcsuite/btcd/releases) - [Changelog](https://github.com/btcsuite/btcd/blob/master/CHANGES) - [Commits](https://github.com/btcsuite/btcd/compare/btcutil/v1.1.0...btcutil/v1.2.0) --- updated-dependencies: - dependency-name: github.com/btcsuite/btcd/chaincfg/chainhash dependency-version: 1.2.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <[email protected]> Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com>
Signed-off-by: Doc Holiday <[email protected]> Signed-off-by: Doc Holiday <[email protected]>
Signed-off-by: Doc Holiday <[email protected]> Signed-off-by: Doc Holiday <[email protected]>