Skip to content

Commit ccaf276

Browse files
authored
Merge pull request #5843 from IntersectMBO/jj/transaction-cddl
Add `transaction_mempool`
2 parents 4119d72 + 3784799 commit ccaf276

3 files changed

Lines changed: 38 additions & 10 deletions

File tree

eras/dijkstra/impl/CHANGELOG.md

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

6666
### cddl
6767

68+
* Add `transaction_mempool` rule
6869
* Add `peras_certificate`, `block_body`
6970
* Extend `constr` CDDL rule to include tags 1280–1400 for Plutus `Data` constructor indexes
7071

eras/dijkstra/impl/cddl/data/dijkstra.cddl

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,10 +2,20 @@
22

33
block = [header, block_body]
44

5-
transaction =
6-
[ transaction_body, transaction_witness_set, true, auxiliary_data/ nil
7-
// transaction_body, transaction_witness_set, auxiliary_data/ nil
8-
]
5+
transaction = [transaction_body, transaction_witness_set, auxiliary_data/ nil]
6+
7+
; In Dijkstra we're deprecating the `is_valid` flag, but for backwards
8+
; compatibility we still allow this flag to be present in incoming
9+
; transactions. Once the transaction is added to a block, the flag will
10+
; be stripped, so the `is_valid` flag cannot appear in transactions that
11+
; are in a block.
12+
;
13+
; In the next era `is_valid` flags will not be allowed even in mempool
14+
; transactions, so it's strongly recommended to encode transactions
15+
; according to the `transaction` rule.
16+
transaction_mempool =
17+
transaction
18+
/ [transaction_body, transaction_witness_set, true, auxiliary_data/ nil]
919

1020
kes_signature = bytes .size 448
1121

eras/dijkstra/impl/cddl/lib/Cardano/Ledger/Dijkstra/HuddleSpec.hs

Lines changed: 23 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ dijkstraCDDL =
5454
collectFromInit
5555
[ HIRule $ huddleRule @"block" (Proxy @DijkstraEra)
5656
, HIRule $ huddleRule @"transaction" (Proxy @DijkstraEra)
57+
, HIRule $ huddleRule @"transaction_mempool" (Proxy @DijkstraEra)
5758
, HIRule $ huddleRule @"kes_signature" (Proxy @DijkstraEra)
5859
, HIRule $ huddleRule @"language" (Proxy @DijkstraEra)
5960
, HIRule $ huddleRule @"potential_languages" (Proxy @DijkstraEra)
@@ -780,16 +781,32 @@ instance HuddleRule "script_data_hash" DijkstraEra where
780781
|]
781782
$ scriptDataHashRule pname p
782783

784+
instance HuddleRule "transaction_mempool" DijkstraEra where
785+
huddleRuleNamed pname p =
786+
comment
787+
[str| In Dijkstra we're deprecating the `is_valid` flag, but for backwards
788+
| compatibility we still allow this flag to be present in incoming
789+
| transactions. Once the transaction is added to a block, the flag will
790+
| be stripped, so the `is_valid` flag cannot appear in transactions that
791+
| are in a block.
792+
|
793+
| In the next era `is_valid` flags will not be allowed even in mempool
794+
| transactions, so it's strongly recommended to encode transactions
795+
| according to the `transaction` rule.
796+
|]
797+
$ pname
798+
=.= huddleRule @"transaction" p
799+
/ sarr
800+
[ a $ huddleRule @"transaction_body" p
801+
, a $ huddleRule @"transaction_witness_set" p
802+
, a $ bool True
803+
, a (huddleRule @"auxiliary_data" p / VNil)
804+
]
805+
783806
instance HuddleRule "transaction" DijkstraEra where
784807
huddleRuleNamed pname p =
785808
pname
786809
=.= arr
787-
[ a $ huddleRule @"transaction_body" p
788-
, a $ huddleRule @"transaction_witness_set" p
789-
, a $ (bool True)
790-
, a (huddleRule @"auxiliary_data" p / VNil)
791-
]
792-
/ arr
793810
[ a $ huddleRule @"transaction_body" p
794811
, a $ huddleRule @"transaction_witness_set" p
795812
, a (huddleRule @"auxiliary_data" p / VNil)

0 commit comments

Comments
 (0)