Skip to content

Commit 030309c

Browse files
committed
Add Disk CDDLs
1 parent 19382fd commit 030309c

File tree

9 files changed

+104
-0
lines changed

9 files changed

+104
-0
lines changed

ouroboros-consensus-cardano/cddl/base.cddl

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

3131
withOrigin<v> = [] / [v]
32+
withOriginTH<v> = [0] / [1, v]
3233

3334
;; Collections
3435
either<x, y> = [0, x] / [1, y]
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
chunkFile = bytes .cborseq block.cardanoBlock
2+
3+
;# import block as block
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
headerState =
2+
[withOrigin<headerStateTip>, headerStateChainDep]
3+
4+
headerStateTip =
5+
ns7<byronAnnTip, annTip, annTip, annTip, annTip, annTip, annTip>
6+
7+
byronAnnTip = [slotno,
8+
hash,
9+
blockno,
10+
bool]
11+
12+
annTip = [slotno,
13+
hash,
14+
blockno]
15+
16+
headerStateChainDep =
17+
telescope7<versionedPbftState,
18+
versionedTPraosState,
19+
versionedTPraosState,
20+
versionedTPraosState,
21+
versionedTPraosState,
22+
versionedPraosState,
23+
versionedPraosState>
24+
25+
;# import withOrigin, ns7, telescope7, slotno, hash, blockno from base
26+
;# import versionedPbftState from pbft
27+
;# import versionedPraosState from praos
28+
;# import versionedTPraosState from tpraos
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
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<eraSt1> = [ shelleyVersion2, shelleyLedgerState<eraSt1> ]
11+
12+
shelleyVersion2 = 2
13+
14+
shelleyLedgerState<eraSt2> = [ withOrigin<shelleyTip>, eraSt2, shelleyTransition ]
15+
16+
shelleyTip = [slotno, blockno, hash]
17+
18+
shelleyTransition = word32
19+
20+
; TODO these should be imports from the ledger however they do not
21+
; provide these definitions yet.
22+
byron.ledgerstate = any
23+
shelley.ledgerstate = any
24+
allegra.ledgerstate = any
25+
mary.ledgerstate = any
26+
alonzo.ledgerstate = any
27+
babbage.ledgerstate = any
28+
conway.ledgerstate = any
29+
30+
;# import telescope7, withOrigin, slotno, blockno, hash, word32 from base
Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
versionedPbftState = [serializationFormat1, {* keyhash => [* slotno]}]
2+
3+
serializationFormat1 = 1
4+
5+
;# import keyhash, slotno from base
Lines changed: 13 additions & 0 deletions
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 withOrigin, slotno, keyhash, word64, nonce from base
Lines changed: 9 additions & 0 deletions
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 headerState from headerstate
9+
;# import ledgerState from ledgerstate
Lines changed: 12 additions & 0 deletions
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 withOriginTH, slotno, keyhash, word64, nonce from base
Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
blockDatFile = bytes .cborseq block.cardanoBlock
2+
3+
;# import block as block

0 commit comments

Comments
 (0)