Skip to content

Commit 46085c0

Browse files
committed
Check CDDLs in CI
1 parent f0db693 commit 46085c0

File tree

10 files changed

+67
-37
lines changed

10 files changed

+67
-37
lines changed

.github/workflows/ci.yml

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -138,6 +138,17 @@ jobs:
138138
- name: Build projects [build]
139139
run: cabal build all -j
140140

141+
- name: Clone Blueprints
142+
uses: actions/checkout@v4
143+
with:
144+
repo: 'cardano-scaling/cardano-blueprint'
145+
path: 'blueprints'
146+
147+
- name: Check CDDLs up-to-date with Blueprints
148+
continue-on-error: true
149+
run: |
150+
./scripts/ci/diff-cddls.sh
151+
141152
- name: Install cddl tools
142153
run: |
143154
gem install cddlc

ouroboros-consensus-cardano/cddl/base.cddl

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@ slotno = word64
2929
stake = rational
3030

3131
withOrigin<v> = [] / [v]
32-
withOriginTH<v> = [0] / [1, v]
3332

3433
;; Collections
3534
either<x, y> = [0, x] / [1, y]
Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,17 @@
11
serialisedCardanoBlock = #6.24(bytes .cbor cardanoBlock)
22

3-
;# import cardanoBlock from block
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

ouroboros-consensus-cardano/cddl/node-to-node/blockfetch/point.cddl

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
header
2-
= 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>>
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>>
99

1010
byronHeader = [byronRegularIdx, #6.24(bytes .cbor byron.blockhead)]
1111
/ [byronBoundaryIdx, #6.24(bytes .cbor byron.ebbhead)]
1212

13-
byronBoundaryIdx = [0, word32]
14-
byronRegularIdx = [1, word32]
13+
byronBoundaryIdx = [0, base.word32]
14+
byronRegularIdx = [1, base.word32]
1515

1616
serialisedShelleyHeader<era> = #6.24(bytes .cbor era)
1717

@@ -22,4 +22,4 @@ serialisedShelleyHeader<era> = #6.24(bytes .cbor era)
2222
;# include alonzo as alonzo
2323
;# include babbage as babbage
2424
;# include conway as conway
25-
;# import base
25+
;# import base as base

ouroboros-consensus-cardano/cddl/node-to-node/chainsync/point.cddl

Lines changed: 0 additions & 3 deletions
This file was deleted.

ouroboros-consensus-cardano/cddl/node-to-node/chainsync/tip.cddl

Lines changed: 0 additions & 3 deletions
This file was deleted.
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
tx =
2-
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>>
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>>
99

1010
serialisedShelleyTx<era> = #6.24(bytes .cbor era)
1111

@@ -16,4 +16,4 @@ serialisedShelleyTx<era> = #6.24(bytes .cbor era)
1616
;# include alonzo as alonzo
1717
;# include babbage as babbage
1818
;# include conway as conway
19-
;# import base
19+
;# import base as base
Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
txId =
2-
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>
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>
99

1010
byronTxId = [0, byron.txid]
1111
/ [1, byron.certificateid]
@@ -19,4 +19,4 @@ byronTxId = [0, byron.txid]
1919
;# include alonzo as alonzo
2020
;# include babbage as babbage
2121
;# include conway as conway
22-
;# import base
22+
;# import base as base

scripts/ci/diff-cddls.sh

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

0 commit comments

Comments
 (0)