@@ -45,14 +45,14 @@ withCDDLs f =
4545 setupCDDLCEnv
4646
4747 ntnBlock <- cddlc " cddl/node-to-node/blockfetch/block.cddl"
48- ntnBlock' <- fixupBlockCDDL ntnBlock
48+ ntnBlock' <- fixupLedgerCDDL ntnBlock
4949 BS. writeFile " ntnblock.cddl" . cddlSpec $ ntnBlock'
5050
5151 ntnHeader <- cddlc " cddl/node-to-node/chainsync/header.cddl"
5252 BS. writeFile " ntnheader.cddl" . cddlSpec $ ntnHeader
5353
5454 ntnTx <- cddlc " cddl/node-to-node/txsubmission2/tx.cddl"
55- ntnTx' <- fixupBlockCDDL ntnTx
55+ ntnTx' <- fixupLedgerCDDL ntnTx
5656 BS. writeFile " ntntx.cddl" . cddlSpec $ ntnTx'
5757
5858 ntnTxId <- cddlc " cddl/node-to-node/txsubmission2/txId.cddl"
@@ -66,17 +66,20 @@ withCDDLs f =
6666 )
6767 (\ _ -> f)
6868
69- -- | The Ledger CDDL specs are not _exactly_ correct. Here we do some dirty
70- -- sed-replace to make them able to validate blocks. See cardano-ledger#5054.
71- fixupBlockCDDL :: CDDLSpec -> IO CDDLSpec
72- fixupBlockCDDL spec =
69+ -- | The Ledger CDDL specs for transactions and blocks are too restrictive.
70+ -- Here we do some dirty sed-replace to make them able to validate blocks.
71+ -- See cardano-ledger#5054.
72+ fixupLedgerCDDL :: CDDLSpec -> IO CDDLSpec
73+ fixupLedgerCDDL spec =
7374 withTempFile " ." " block-temp.cddl" $ \ fp h -> do
7475 hClose h
7576 BS. writeFile fp . cddlSpec $ spec
7677 -- For plutus, the type is actually `bytes`, but the distinct construct is
7778 -- for forcing generation of different values. See cardano-ledger#5054
78- sed fp [" -i" , " s/\\ (conway\\ .distinct_VBytes = \\ )/\\ 1 bytes ;\\ //g" ]
79- sed fp [" -i" , " s/\\ (dijkstra\\ .distinct_VBytes = \\ )/\\ 1 bytes ;\\ //g" ]
79+ sed fp [" -i" , " s/\\ (alonzo\\ .distinct_bytes = \\ )/\\ 1 bytes ;\\ //g" ]
80+ sed fp [" -i" , " s/\\ (babbage\\ .distinct_bytes = \\ )/\\ 1 bytes ;\\ //g" ]
81+ sed fp [" -i" , " s/\\ (conway\\ .distinct_bytes = \\ )/\\ 1 bytes ;\\ //g" ]
82+ sed fp [" -i" , " s/\\ (dijkstra\\ .distinct_bytes = \\ )/\\ 1 bytes ;\\ //g" ]
8083 -- These 3 below are hardcoded for generation. See cardano-ledger#5054
8184 sed fp [" -i" , " s/\\ ([yaoye]\\ .address = \\ )/\\ 1 bytes ;/g" ]
8285 sed fp [" -i" , " s/\\ (reward_account = \\ )/\\ 1 bytes ;/g" ]
0 commit comments