Skip to content

Commit a1b749e

Browse files
committed
More changes
1 parent fa7bfbb commit a1b749e

17 files changed

+202
-227
lines changed

ouroboros-consensus-cardano/cddl/base.cddl

+16-8
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
cardanoTelescope<byron, shelley, allegra, mary, alonzo, babbage, conway>
1+
telescope7<byron, shelley, allegra, mary, alonzo, babbage, conway>
22
= [pastEra, pastEra, pastEra, pastEra, pastEra, pastEra, currentEra<conway>] /
33
[pastEra, pastEra, pastEra, pastEra, pastEra, currentEra<babbage>] /
44
[pastEra, pastEra, pastEra, pastEra, currentEra<alonzo>] /
@@ -7,7 +7,7 @@ cardanoTelescope<byron, shelley, allegra, mary, alonzo, babbage, conway>
77
[pastEra, currentEra<shelley>] /
88
[currentEra<byron>]
99

10-
cardanoNs<byron, shelley, allegra, mary, alonzo, babbage, conway>
10+
ns7<byron, shelley, allegra, mary, alonzo, babbage, conway>
1111
= [6, conway] /
1212
[5, babbage] /
1313
[4, alonzo] /
@@ -16,28 +16,36 @@ cardanoNs<byron, shelley, allegra, mary, alonzo, babbage, conway>
1616
[1, shelley] /
1717
[0, byron]
1818

19+
;; Blockchain types
20+
pastEra = [bound, bound]
21+
currentEra<st> = [bound, st]
1922
blockno = word64
2023
bound = [relativeTime, slotno, epochno]
2124
coin = word64
22-
either<x, y> = [0, x] / [1, y]
2325
epochno = word64
2426
eraIdx = word8
2527
hash = bstr
2628
individualPoolStake = [stake, hash]
2729
keyhash = bstr
28-
map<x, y> = { * x => y }
29-
maybe<x> = [] / [x]
3030
nonce = [0] / [1, hash]
3131
point = [] / [ slotno, hash ]
3232
poolDistr = map<keyhash, individualPoolStake>
3333
rational = [int, int]
3434
relativeTime = int
35-
seq<x> = [*23 x] / [24* x] ; encoded with indefinite-length encoding
36-
set<x> = #6.258([* x])
3735
slotno = word64
3836
stake = rational
37+
3938
withOrigin<v> = [] / [v]
4039
withOriginTH<v> = [0] / [1, v]
40+
41+
;; Collections
42+
either<x, y> = [0, x] / [1, y]
43+
map<x, y> = { * x => y }
44+
maybe<x> = [] / [x]
45+
seq<x> = [*23 x] / [24* x] ; encoded with indefinite-length encoding
46+
set<x> = #6.258([* x])
47+
48+
;; Base word types
49+
word8 = 0..255
4150
word32 = 0..4294967295
4251
word64 = 0..18446744073709551615
43-
word8 = 0..255

ouroboros-consensus-cardano/cddl/cddlc.sh

+17-3
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,3 @@
1-
export CDDL_INCLUDE_PATH=ledger-cddls/eras/byron/cddl-spec:ledger-cddls/eras/shelley/impl/cddl-files:ledger-cddls/eras/allegra/impl/cddl-files:ledger-cddls/eras/mary/impl/cddl-files:ledger-cddls/eras/alonzo/impl/cddl-files:ledger-cddls/eras/babbage/impl/cddl-files:ledger-cddls/eras/conway/impl/cddl-files:disk:.:
2-
31
mkdir -p out
42

53
gen () {
@@ -9,14 +7,30 @@ gen () {
97
echo " ok"
108
}
119

12-
IN=$(fd -e cddl -E ledger-cddls -E out -E base.cddl -E node-to-client/localstatequery/query.cddl -E node-to-client/localstatequery/result.cddl)
10+
CDDL_INCLUDE_PATH=""
11+
for f in $(fd -t d); do
12+
CDDL_INCLUDE_PATH+="$f:"
13+
done
14+
15+
export CDDL_INCLUDE_PATH=$CDDL_INCLUDE_PATH.:
16+
17+
IN=$(fd -e cddl \
18+
-E ledger-cddls \
19+
-E out \
20+
-E base.cddl \
21+
-E node-to-client/localstatequery/shelley \
22+
-E node-to-client/localstatequery/byron \
23+
-E node-to-client/localstatequery/consensus \
24+
-E disk/snapshot
25+
)
1326

1427
echo "Generating complete CDDLs:"
1528
for f in $IN; do
1629
gen $(echo $f | cut -d'.' -f1)
1730
done
1831

1932
UNDEFINEDS=$(grep -R undefined out)
33+
2034
if [ ! -z "$UNDEFINEDS" ]; then
2135
echo -e "\033[0;31mThere were undefined references!\n$UNDEFINEDS\033[0m"
2236

ouroboros-consensus-cardano/cddl/disk/ledger-state-snapshot.cddl

-132
This file was deleted.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
ledgerStateSnapshot =
2+
[snapshotEncodingVersion1, extLedgerState]
3+
4+
snapshotEncodingVersion1 = 1
5+
6+
extLedgerState = [ledgerState, headerState]
7+
8+
;# import ledgerstate
9+
;# import headerstate
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
headerState =
2+
[withOrigin<headerStateTip>, headerStateChainDep]
3+
4+
headerStateTip =
5+
ns7<byronAnnTip, annTip, annTip, annTip, annTip, annTip, annTip>
6+
7+
byronAnnTip = [slotno, hash, blockno, bool]
8+
annTip = [slotno, hash, blockno]
9+
10+
headerStateChainDep =
11+
telescope7<versionedPbftState,
12+
versionedTPraosState,
13+
versionedTPraosState,
14+
versionedTPraosState,
15+
versionedTPraosState,
16+
versionedPraosState,
17+
versionedPraosState>
18+
19+
versionedPbftState = [serializationFormat1, {* keyhash => [* slotno]}]
20+
21+
;# import base
22+
;# import praos
23+
;# import tpraos
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
ledgerState =
2+
telescope7<byron.ledgerstate,
3+
versionedShelleyLedgerState<shelley.ledgerstate>,
4+
versionedShelleyLedgerState<allegra.ledgerstate>,
5+
versionedShelleyLedgerState<mary.ledgerstate>,
6+
versionedShelleyLedgerState<alonzo.ledgerstate>,
7+
versionedShelleyLedgerState<babbage.ledgerstate>,
8+
versionedShelleyLedgerState<conway.ledgerstate>>
9+
10+
versionedShelleyLedgerState<era> = [ shelleyVersion2, shelleyLedgerState<era> ]
11+
12+
shelleyVersion2 = 2
13+
14+
shelleyLedgerState<era> = [ withOrigin<shelleyTip>, era, shelleyTransition ]
15+
16+
shelleyTip = [slotno, blockno, hash]
17+
18+
shelleyTransition = word32
19+
20+
;# import base
21+
;# import byron as byron
22+
;# import shelley as shelley
23+
;# import allegra as allegra
24+
;# import mary as mary
25+
;# import alonzo as alonzo
26+
;# import babbage as babbage
27+
;# import conway as conway
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
versionedPraosState = [praosVersion, praosState]
2+
3+
praosVersion = 0
4+
5+
praosState = [withOrigin<slotno>,
6+
{* keyhash => word64},
7+
nonce,
8+
nonce,
9+
nonce,
10+
nonce,
11+
nonce]
12+
13+
;# import base
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
versionedTPraosState =
2+
[serializationFormat1, [withOriginTH<slotno>, tpraosState]]
3+
4+
tpraosState = [prtclState, ticknState, nonce]
5+
6+
prtclState = [{* keyhash => word64}, nonce, nonce]
7+
8+
ticknState = [nonce, nonce]
9+
10+
serializationFormat1 = 1
11+
12+
;# import base

0 commit comments

Comments
 (0)