Skip to content

Commit 83c5eb5

Browse files
committed
Add NodeToNode CDDLs
1 parent b607520 commit 83c5eb5

File tree

8 files changed

+165
-0
lines changed

8 files changed

+165
-0
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,17 @@ jobs:
5555
steps:
5656
- uses: actions/checkout@v4
5757

58+
- name: Clone Blueprints
59+
uses: actions/checkout@v4
60+
with:
61+
repository: 'cardano-scaling/cardano-blueprint'
62+
path: 'blueprints'
63+
64+
- name: Check CDDLs up-to-date with Blueprints
65+
continue-on-error: true
66+
run: |
67+
./scripts/ci/diff-cddls.sh
68+
5869
- name: Install base libraries
5970
uses: input-output-hk/actions/base@latest
6071
with:
Lines changed: 52 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,52 @@
1+
telescope7<byron, shelley, allegra, mary, alonzo, babbage, conway>
2+
= [pastEra, pastEra, pastEra, pastEra, pastEra, pastEra, currentEra<conway>] /
3+
[pastEra, pastEra, pastEra, pastEra, pastEra, currentEra<babbage>] /
4+
[pastEra, pastEra, pastEra, pastEra, currentEra<alonzo>] /
5+
[pastEra, pastEra, pastEra, currentEra<mary>] /
6+
[pastEra, pastEra, currentEra<allegra>] /
7+
[pastEra, currentEra<shelley>] /
8+
[currentEra<byron>]
9+
10+
ns7<byron, shelley, allegra, mary, alonzo, babbage, conway>
11+
= [6, conway] /
12+
[5, babbage] /
13+
[4, alonzo] /
14+
[3, mary] /
15+
[2, allegra] /
16+
[1, shelley] /
17+
[0, byron]
18+
19+
;; Blockchain types
20+
pastEra = [bound, bound]
21+
currentEra<st> = [bound, st]
22+
bound = [relativeTime, slotno, epochno]
23+
eraIdx = word8
24+
individualPoolStake = [stake, hash]
25+
nonce = [0] / [1, hash]
26+
point = [] / [ slotno, hash ]
27+
poolDistr = map<keyhash, individualPoolStake>
28+
slotno = word64
29+
stake = rational
30+
31+
withOrigin<v> = [] / [v]
32+
33+
;; Collections
34+
either<x, y> = [0, x] / [1, y]
35+
map<x, y> = { * x => y }
36+
maybe<x> = [] / [x]
37+
seq<x> = [*23 x] / [24* x] ; encoded with indefinite-length encoding
38+
set<x> = #6.258([* x])
39+
40+
;; Types from other packages
41+
blockno = word64
42+
epochno = word64
43+
coin = word64
44+
rational = [int, int]
45+
keyhash = bstr .size 28
46+
hash = bstr .size 32
47+
relativeTime = int
48+
49+
;; Base word types
50+
word8 = uint .size 1
51+
word32 = uint .size 4
52+
word64 = uint .size 8
Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
serialisedCardanoBlock = #6.24(bytes .cbor cardanoBlock)
2+
3+
cardanoBlock = byron.block
4+
/ [2, shelley.block]
5+
/ [3, allegra.block]
6+
/ [4, mary.block]
7+
/ [5, alonzo.block]
8+
/ [6, babbage.block]
9+
/ [7, conway.block]
10+
11+
;# import byron as byron
12+
;# import shelley as shelley
13+
;# import allegra as allegra
14+
;# import mary as mary
15+
;# import alonzo as alonzo
16+
;# import babbage as babbage
17+
;# import conway as conway
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
header
2+
= base.ns7<byronHeader,
3+
serialisedShelleyHeader<shelley.header>,
4+
serialisedShelleyHeader<allegra.header>,
5+
serialisedShelleyHeader<mary.header>,
6+
serialisedShelleyHeader<alonzo.header>,
7+
serialisedShelleyHeader<babbage.header>,
8+
serialisedShelleyHeader<conway.header>>
9+
10+
byronHeader = [byronRegularIdx, #6.24(bytes .cbor byron.blockhead)]
11+
/ [byronBoundaryIdx, #6.24(bytes .cbor byron.ebbhead)]
12+
13+
byronBoundaryIdx = [0, base.word32]
14+
byronRegularIdx = [1, base.word32]
15+
16+
serialisedShelleyHeader<era> = #6.24(bytes .cbor era)
17+
18+
;# include byron as byron
19+
;# include shelley as shelley
20+
;# include allegra as allegra
21+
;# include mary as mary
22+
;# include alonzo as alonzo
23+
;# include babbage as babbage
24+
;# include conway as conway
25+
;# import base as base
Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
tx =
2+
base.ns7<byron.tx,
3+
serialisedShelleyTx<shelley.transaction>,
4+
serialisedShelleyTx<allegra.transaction>,
5+
serialisedShelleyTx<mary.transaction>,
6+
serialisedShelleyTx<alonzo.transaction>,
7+
serialisedShelleyTx<babbage.transaction>,
8+
serialisedShelleyTx<conway.transaction>>
9+
10+
serialisedShelleyTx<era> = #6.24(bytes .cbor era)
11+
12+
;# include byron as byron
13+
;# include shelley as shelley
14+
;# include allegra as allegra
15+
;# include mary as mary
16+
;# include alonzo as alonzo
17+
;# include babbage as babbage
18+
;# include conway as conway
19+
;# import base as base
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
txId =
2+
base.ns7<byronTxId,
3+
shelley.transaction_id,
4+
allegra.transaction_id,
5+
mary.transaction_id,
6+
alonzo.transaction_id,
7+
conway.transaction_id,
8+
babbage.transaction_id>
9+
10+
byronTxId = [0, byron.txid]
11+
/ [1, byron.certificateid]
12+
/ [2, byron.updid]
13+
/ [3, byron.voteid]
14+
15+
;# include byron as byron
16+
;# include shelley as shelley
17+
;# include allegra as allegra
18+
;# include mary as mary
19+
;# include alonzo as alonzo
20+
;# include babbage as babbage
21+
;# include conway as conway
22+
;# import base as base

ouroboros-consensus-cardano/ouroboros-consensus-cardano.cabal

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,9 @@ extra-doc-files:
2323
CHANGELOG.md
2424
README.md
2525

26+
data-files:
27+
cddl/**/*.cddl
28+
2629
source-repository head
2730
type: git
2831
location: https://github.com/IntersectMBO/ouroboros-consensus

scripts/ci/diff-cddls.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
3+
check_diff () {
4+
diff "ouroboros-consensus-cardano/cddl/node-to-node/$1" "blueprints/src/network/node-to-node/$1"
5+
if [ $? -ne 0 ]
6+
then
7+
echo "::warning ouroboros-consensus-cardano/cddl/node-to-node/$1 differs from blueprints/src/network/node-to-node/$1"
8+
else
9+
echo "$1 OK"
10+
fi
11+
}
12+
13+
check_diff "blockfetch/block.cddl"
14+
check_diff "chainsync/header.cddl"
15+
check_diff "txsubmission2/txId.cddl"
16+
check_diff "txsubmission2/tx.cddl"

0 commit comments

Comments
 (0)