Skip to content

Commit d32192f

Browse files
committed
CDDL: Move cddl-files to cddl/data.
Improve `writeSpec` to validate filepath.
1 parent badd547 commit d32192f

File tree

48 files changed

+72
-114
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

48 files changed

+72
-114
lines changed

CONTRIBUTING.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -133,7 +133,7 @@ Using the current date should ensure that this is the case.
133133
## CDDL files
134134

135135
For each era, the serialization protocol is defined by a corresponding cddl file,
136-
located at: `eras/<era>/impl/cddl-files/<era>.cddl`.
136+
located at: `eras/<era>/impl/cddl/data/<era>.cddl`.
137137

138138
These files are generated using [cuddle](https://github.com/input-output-hk/cuddle),
139139
based on the Haskell definitions in: `eras/<era>/impl/testlib/Test/Cardano/Ledger/<era>/CDDL.hs`.

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,12 +21,12 @@ following links:
2121
Era | Design Documents | Formal Specification | CDDL
2222
----|------------------|----------------------|-----
2323
Byron | | [Chain Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/byron-blockchain.pdf "Specification of the Blockchain Layer"), [Ledger Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/byron-ledger.pdf "A Formal Specification of the Cardano Ledger") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/byron/ledger/impl/cddl-spec/byron.cddl), [PDF](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/byron-binary.pdf)
24-
Shelley | [Design](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/shelley-delegation.pdf "Design Specification for Delegation and Incentives in Cardano") | [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/shelley-ledger.pdf "A Formal Specification of the Cardano Ledger") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/shelley/impl/cddl-files)
25-
Allegra | Same as Mary era below | Same as Mary era below | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/allegra/impl/cddl-files)
26-
Mary | [Multi-Currency](https://eprint.iacr.org/2020/895 "Multi-Currency Ledgers"), [UTXOma](https://iohk.io/en/research/library/papers/utxoma-utxo-with-multi-asset-support/ "UTXOma:UTXO with Multi-Asset Support") | [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/mary-ledger.pdf "A Formal Specification of the Cardano Ledger with a Native Multi-Asset Implementation") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/mary/impl/cddl-files)
27-
Alonzo | [eUTXO](https://iohk.io/en/research/library/papers/the-extended-utxo-model/ "The Extended UTXO Model")| [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/alonzo-ledger.pdf "A Formal Specification of the Cardano Ledger integrating Plutus Core") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/alonzo/impl/cddl-files)
28-
Babbage | [batch-verification](https://iohk.io/en/research/library/papers/on-uc-secure-range-extension-and-batch-verification-for-ecvrf/ "On UC-Secure Range Extension and Batch Verification for ECVRF"), [CIP-31](https://github.com/cardano-foundation/CIPs/pull/159 "Reference inputs"), [CIP-32](https://github.com/cardano-foundation/CIPs/pull/160 "Inline datums"), [CIP-33](https://github.com/cardano-foundation/CIPs/pull/161 "Reference scripts") | [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/babbage-ledger.pdf "Formal Specification of the Cardano Ledger for the Babbage era") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/babbage/impl/cddl-files)
29-
Conway | [CIP-1694](https://github.com/cardano-foundation/CIPs/tree/master/CIP-1694) | [Spec (WIP)](https://github.com/intersectmbo/formal-ledger-specifications) | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/conway/impl/cddl-files)
24+
Shelley | [Design](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/shelley-delegation.pdf "Design Specification for Delegation and Incentives in Cardano") | [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/shelley-ledger.pdf "A Formal Specification of the Cardano Ledger") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/shelley/impl/cddl/data)
25+
Allegra | Same as Mary era below | Same as Mary era below | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/allegra/impl/cddl/data)
26+
Mary | [Multi-Currency](https://eprint.iacr.org/2020/895 "Multi-Currency Ledgers"), [UTXOma](https://iohk.io/en/research/library/papers/utxoma-utxo-with-multi-asset-support/ "UTXOma:UTXO with Multi-Asset Support") | [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/mary-ledger.pdf "A Formal Specification of the Cardano Ledger with a Native Multi-Asset Implementation") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/mary/impl/cddl/data)
27+
Alonzo | [eUTXO](https://iohk.io/en/research/library/papers/the-extended-utxo-model/ "The Extended UTXO Model")| [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/alonzo-ledger.pdf "A Formal Specification of the Cardano Ledger integrating Plutus Core") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/alonzo/impl/cddl/data)
28+
Babbage | [batch-verification](https://iohk.io/en/research/library/papers/on-uc-secure-range-extension-and-batch-verification-for-ecvrf/ "On UC-Secure Range Extension and Batch Verification for ECVRF"), [CIP-31](https://github.com/cardano-foundation/CIPs/pull/159 "Reference inputs"), [CIP-32](https://github.com/cardano-foundation/CIPs/pull/160 "Inline datums"), [CIP-33](https://github.com/cardano-foundation/CIPs/pull/161 "Reference scripts") | [Spec](https://github.com/intersectmbo/cardano-ledger/releases/latest/download/babbage-ledger.pdf "Formal Specification of the Cardano Ledger for the Babbage era") | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/babbage/impl/cddl/data)
29+
Conway | [CIP-1694](https://github.com/cardano-foundation/CIPs/tree/master/CIP-1694) | [Spec (WIP)](https://github.com/intersectmbo/formal-ledger-specifications) | [CDDL](https://github.com/intersectmbo/cardano-ledger/tree/master/eras/conway/impl/cddl/data)
3030

3131

3232
Other Documents:
@@ -58,7 +58,7 @@ The directory structure of this repository is as follows:
5858
- [formal-spec](./eras/shelley/formal-spec)
5959
- [implementation](./eras/shelley/impl)
6060
- [tests](./eras/shelley/test-suite)
61-
- [cddl](./eras/shelley/impl/cddl-files)
61+
- [cddl](./eras/shelley/impl/cddl/data)
6262
- [Allegra - Timelocks](./eras/allegra)
6363
- [formal-spec](./eras/shelley-ma/formal-spec)
6464
- [implementation](./eras/allegra/impl)
@@ -70,17 +70,17 @@ The directory structure of this repository is as follows:
7070
- [Alonzo - Smart Contracts](./eras/alonzo)
7171
- [formal-spec](./eras/alonzo/formal-spec)
7272
- [implementation](./eras/alonzo/impl)
73-
- [cddl](./eras/alonzo/impl/cddl-files)
73+
- [cddl](./eras/alonzo/impl/cddl/data)
7474
- [tests](./eras/alonzo/test-suite)
7575
- [Babbage](./eras/babbage)
7676
- [formal-spec](./eras/babbage/formal-spec)
7777
- [implementation](./eras/babbage/impl)
78-
- [cddl](./eras/babbage/impl/cddl-files)
78+
- [cddl](./eras/babbage/impl/cddl/data)
7979
- [tests](./eras/babbage/impl/test)
8080
- [Conway - Governance](./eras/conway)
8181
- [formal-spec](./eras/conway/formal-spec)
8282
- [implementation](./eras/conway/impl)
83-
- [cddl](./eras/conway/impl/cddl-files)
83+
- [cddl](./eras/conway/impl/cddl/data)
8484
- [tests](./eras/conway/impl/test)
8585
- [Libraries](./libs)
8686

@@ -191,4 +191,4 @@ $ curl -sSLO https://raw.githubusercontent.com/IntersectMBO/cardano-ledger/refs/
191191
$ git clone -c fetch.fsck.skipList=.git-fsck-skiplist ...
192192
...
193193
$ rm .git-fsck-skiplist
194-
```
194+
```

eras/allegra/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
### `cddl`
1616

17+
* Move `cddl-files` to `cddl/data`.
1718
* Make `max_int64`, `min_int64` and `int64` era generic.
1819
* Export for cross-era reuse:
1920
- `auxiliaryScriptsRule`, `auxiliaryDataArrayRule`, `auxiliaryDataRule`

eras/allegra/impl/cardano-ledger-allegra.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ description:
1111

1212
category: Network
1313
build-type: Simple
14-
data-files: cddl-files/allegra.cddl
14+
data-files: cddl/data/allegra.cddl
1515
extra-source-files: CHANGELOG.md
1616

1717
source-repository head
@@ -125,8 +125,6 @@ executable generate-cddl
125125
base,
126126
cardano-ledger-binary:testlib >=1.4,
127127
cddl,
128-
directory,
129-
filepath,
130128

131129
library testlib
132130
exposed-modules:
Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
; This file was auto-generated from huddle. Please do not modify it directly!
1+
; This file was auto-generated using generate-cddl. Please do not modify it directly!
22

33
block =
44
[ header

eras/allegra/impl/cddl/exe/Main.hs

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,7 @@ module Main where
22

33
import Cardano.Ledger.Allegra.HuddleSpec (allegraCDDL)
44
import Paths_cardano_ledger_allegra (getDataFileName)
5-
import System.Directory (createDirectoryIfMissing)
6-
import System.FilePath (takeDirectory)
75
import Test.Cardano.Ledger.Binary.Cuddle (writeSpec)
86

97
main :: IO ()
10-
main = do
11-
outputPath <- getDataFileName "cddl-files/allegra.cddl"
12-
createDirectoryIfMissing True (takeDirectory outputPath)
13-
writeSpec allegraCDDL outputPath
14-
putStrLn $ "Generated CDDL file at: " ++ outputPath
8+
main = writeSpec allegraCDDL =<< getDataFileName "cddl/data/allegra.cddl"

eras/allegra/impl/huddle-cddl/Main.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,4 +5,4 @@ import Test.Cardano.Ledger.Allegra.CDDL (allegraCDDL)
55
import Test.Cardano.Ledger.Binary.Cuddle (writeSpec)
66

77
main :: IO ()
8-
main = writeSpec allegraCDDL =<< getDataFileName "cddl-files/allegra.cddl"
8+
main = writeSpec allegraCDDL =<< getDataFileName "cddl/data/allegra.cddl"

eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/Binary/Cddl.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,7 @@ import Paths_cardano_ledger_allegra
88

99
readAllegraCddlFileNames :: IO [FilePath]
1010
readAllegraCddlFileNames = do
11-
base <- getDataFileName "cddl-files/allegra.cddl"
11+
base <- getDataFileName "cddl/data/allegra.cddl"
1212
pure [base]
1313

1414
readAllegraCddlFiles :: IO [BSL.ByteString]

eras/alonzo/impl/CHANGELOG.md

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,7 @@
5252

5353
### `cddl`
5454

55+
* Move `cddl-files` to `cddl/data`.
5556
* Export `exUnitPricesRule` and `requiredSignersRule` for reuse.
5657
* Make `plutus_v1_script` and `plutus_data` era generic.
5758
* Add full `HuddleSpec`.

eras/alonzo/impl/cardano-ledger-alonzo.cabal

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ description:
1313
category: Network
1414
build-type: Simple
1515
data-files:
16-
cddl-files/alonzo.cddl
16+
cddl/data/alonzo.cddl
1717
golden/*.cbor
1818
golden/*.json
1919

@@ -145,8 +145,6 @@ executable generate-cddl
145145
base,
146146
cardano-ledger-binary:testlib >=1.5,
147147
cddl,
148-
directory,
149-
filepath,
150148

151149
library testlib
152150
exposed-modules:

0 commit comments

Comments
 (0)