Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
62ca861
LeiosDemo202510: draft Leios mini protocols
nfrisby Oct 8, 2025
79d58e4
leiosdemo202510: add this demo exe
nfrisby Oct 13, 2025
97a4949
leiosdemo202510: combine via join
nfrisby Oct 13, 2025
1e71416
leiosdemo202510: suggestive check on MsgLeiosBlockTxsRequest
nfrisby Oct 13, 2025
35af3c9
leiosdemo202510: add msgLeiosBlockRequest and also stub limit on popC…
nfrisby Oct 14, 2025
f514ce0
leiosdemo202510: relocate SQL definitions near use
nfrisby Oct 14, 2025
231a2a1
leiosdemo202510: avoid reversing long lists
nfrisby Oct 14, 2025
7efc564
leiosdemo202510: fallback for requests of many txs
nfrisby Oct 14, 2025
cc1e3b6
leiosdemo202510: avoid reversing lists 2
nfrisby Oct 14, 2025
ee4871b
leiosdemo202510: use map CBOR and handle MsgLeiosBlock
nfrisby Oct 14, 2025
9ad22ea
leiosdemo202510: handle MsgLeiosBlockTxs
nfrisby Oct 14, 2025
d2ab9f1
leiosdemo202510: merge ebBodies and ebClosures, use only points in CL…
nfrisby Oct 15, 2025
9e3d427
leiosdemo202510: minor refactor
nfrisby Oct 15, 2025
7036dd2
leiosdemo202510: add fetch-decision and hash-txs commands
nfrisby Oct 15, 2025
c9a6d68
leiosdemo202510: only use "point" in the table name ebPoints
nfrisby Oct 15, 2025
1c2a031
leiosdemo202510: add some of the missing Haddock
nfrisby Oct 15, 2025
59587e8
leiosdemo202510: redo the fetch iteration logic and MsgLeiosBlockTxs …
nfrisby Oct 22, 2025
fb92641
leiosdemo202510: add the first bash script that mimics requests and r…
nfrisby Oct 22, 2025
02dc37e
leiosdemo202510: add tx sharing to the generator
nfrisby Oct 22, 2025
1ce37c7
leiosdemo202510: fix off-by-one sterraf noticed
nfrisby Oct 22, 2025
464dfb0
leiosdemo202510: some renamings, add MkLeiosBlockRequest ctor
nfrisby Oct 23, 2025
88d080d
leiosdemo202510: some renamings, add EB body requests etc
nfrisby Oct 23, 2025
5eca7c5
leiosdemo202510: small polishing pass
nfrisby Oct 23, 2025
bdee13c
leiosdemo202510: also insert into TxCache
nfrisby Oct 23, 2025
e7e3104
leiosdemo202510: do not fetch txs already in TxCache
nfrisby Oct 23, 2025
3d5487e
leiosdemo202510: add cache-copy command
nfrisby Oct 24, 2025
ccbe693
leiosdemo202510: rename binder to nickname in myManifest.json
nfrisby Oct 24, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
40 changes: 40 additions & 0 deletions leiosdemo202510-first-script
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#! /bin/bash
rm -f tmp/my.db tmp/up.db tmp/my.lfst tmp/demo tmp/reqs
set -eux
cabal build exe:leiosdemo202510
ln -s $(cabal list-bin exe:leiosdemo202510) tmp/demo
tmp/demo generate tmp/up.db tmp/my.lfst tmp/myManifest.json
cp tmp/{up,my}.db
sqlite3 tmp/my.db "SELECT ebSlot, PRINTF('%X', ebId), ebId FROM ebPoints ORDER BY ebId ASC" # dump points
sqlite3 tmp/my.db 'SELECT ebId, MAX(txOffset) FROM ebTxs GROUP BY ebId' # dump sizes
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
sqlite3 tmp/my.db 'UPDATE ebTxs SET txBytes = NULL WHERE ebId = -9223372036843241473'
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
tmp/demo MsgLeiosBlockTxsOffer tmp/my.lfst Alice -9223372036848484353 -9223372036843241473
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
tmp/demo MsgLeiosBlockTxsOffer tmp/my.lfst Bob -9223372036848484353 -9223372036843241473
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
sqlite3 tmp/my.db 'UPDATE ebTxs SET txBytes = NULL WHERE ebId = -9223372036848484353'
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
tmp/demo fetch-logic-iteration tmp/my.db tmp/my.lfst | tee -a tmp/reqs
jq . tmp/my.lfst
sqlite3 tmp/my.db 'SELECT ebId FROM ebTxs WHERE txBytes IS NULL GROUP BY ebId' # dump incompletes
set +x
cat tmp/reqs | grep -e MSG | grep -e Alice | cut -d' ' -f3- | while IFS= read -r line; do
set -x
tmp/demo MsgLeiosBlockTxsRequest tmp/up.db $line | xxd -plain -revert >tmp/foo.bin
tmp/demo MsgLeiosBlockTxs tmp/my.db tmp/my.lfst Alice tmp/foo.bin
set +x
jq . tmp/my.lfst
sqlite3 tmp/my.db 'SELECT ebId FROM ebTxs WHERE txBytes IS NULL GROUP BY ebId' # dump incompletes
done
cat tmp/reqs | grep -e MSG | grep -e Bob | cut -d' ' -f3- | while IFS= read -r line; do
set -x
tmp/demo MsgLeiosBlockTxsRequest tmp/up.db $line | xxd -plain -revert >tmp/foo.bin
tmp/demo MsgLeiosBlockTxs tmp/my.db tmp/my.lfst Bob tmp/foo.bin
jq . tmp/my.lfst
sqlite3 tmp/my.db 'SELECT ebId FROM ebTxs WHERE txBytes IS NULL GROUP BY ebId' # dump incompletes
set +x
done
55 changes: 55 additions & 0 deletions myManifest.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -124,6 +124,8 @@ import Ouroboros.Network.TxSubmission.Mempool.Reader
import Ouroboros.Network.TxSubmission.Outbound


import qualified Ouroboros.Network.Mux as ON

{-------------------------------------------------------------------------------
Handlers
-------------------------------------------------------------------------------}
Expand Down Expand Up @@ -838,6 +840,28 @@ initiator miniProtocolParameters version versionData Apps {..} =
})
version
versionData
<>
mempty { ON.withHot = ON.WithHot [
ON.MiniProtocol {
ON.miniProtocolNum = leiosNotifyMiniProtocolNum,
ON.miniProtocolStart = ON.StartOnDemand,
ON.miniProtocolLimits = ON.MiniProtocolLimits {
ON.maximumIngressQueue = addSafetyMargin $ 1 * 2 ^ (20 :: Int) -- 1 mebibyte
},
ON.miniProtocolRun = InitiatorProtocolOnly (MiniProtocolCb undefined)
}
, ON.MiniProtocol {
ON.miniProtocolNum = leiosFetchMiniProtocolNum,
ON.miniProtocolStart = ON.StartOnDemand,
ON.miniProtocolLimits = ON.MiniProtocolLimits {
ON.maximumIngressQueue = addSafetyMargin $ 50 * 2 ^ (20 :: Int) -- 50 mebibytes
},
ON.miniProtocolRun = InitiatorProtocolOnly (MiniProtocolCb undefined)
}
]
}
where
addSafetyMargin x = x + x `div` 10

-- | A bi-directional network application.
--
Expand Down Expand Up @@ -878,3 +902,32 @@ initiatorAndResponder miniProtocolParameters version versionData Apps {..} =
})
version
versionData
<>
mempty { ON.withHot = ON.WithHot [
ON.MiniProtocol {
ON.miniProtocolNum = leiosNotifyMiniProtocolNum,
ON.miniProtocolStart = ON.StartOnDemand,
ON.miniProtocolLimits = ON.MiniProtocolLimits {
ON.maximumIngressQueue = addSafetyMargin $ 1 * 2 ^ (20 :: Int) -- 1 mebibyte
},
ON.miniProtocolRun = InitiatorAndResponderProtocol (MiniProtocolCb undefined) (MiniProtocolCb undefined)
}
, ON.MiniProtocol {
ON.miniProtocolNum = leiosFetchMiniProtocolNum,
ON.miniProtocolStart = ON.StartOnDemand,
ON.miniProtocolLimits = ON.MiniProtocolLimits {
ON.maximumIngressQueue = addSafetyMargin $ 50 * 2 ^ (20 :: Int) -- 50 mebibytes
},
ON.miniProtocolRun = InitiatorAndResponderProtocol (MiniProtocolCb undefined) (MiniProtocolCb undefined)
}
]
}
where
addSafetyMargin x = x + x `div` 10


leiosNotifyMiniProtocolNum :: MiniProtocolNum
leiosNotifyMiniProtocolNum = MiniProtocolNum 18

leiosFetchMiniProtocolNum :: MiniProtocolNum
leiosFetchMiniProtocolNum = MiniProtocolNum 19
Loading
Loading