Skip to content

Commit 0bc4cbf

Browse files
committed
More control over ordering
1 parent ef543cb commit 0bc4cbf

File tree

14 files changed

+236
-2138
lines changed

14 files changed

+236
-2138
lines changed

cabal.project

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ source-repository-package
2121
source-repository-package
2222
type: git
2323
location: https://github.com/input-output-hk/cuddle.git
24-
tag: d7972fedf613f45bc4f5d773366930e025e8eaf7
24+
tag: 11bf04472123122ae579ff3b913aa7adf35cf321
2525

2626
-- NOTE: If you would like to update the above,
2727
-- see CONTRIBUTING.md#to-update-the-referenced-agda-ledger-spec

eras/allegra/impl/cddl-files/allegra.cddl

Lines changed: 0 additions & 307 deletions
Original file line numberDiff line numberDiff line change
@@ -10,312 +10,5 @@ block =
1010
]
1111

1212

13-
header = [header_body, body_signature: kes_signature]
14-
15-
header_body =
16-
[ block_number: uint
17-
, slot : uint
18-
, prev_hash : hash32/ nil
19-
, issuer_vkey : vkey
20-
, vrf_vkey : vrf_vkey
21-
, nonce_vrf : vrf_cert
22-
, leader_vrf : vrf_cert
23-
, block_body_size: uint .size 4
24-
, block_body_hash: hash32
25-
, operational_cert
26-
, protocol_version
27-
]
28-
29-
30-
hash32 = bytes .size 32
31-
32-
vkey = bytes .size 32
33-
34-
vrf_vkey = bytes .size 32
35-
36-
vrf_cert = [bytes, bytes .size 80]
37-
38-
operational_cert =
39-
( hot_vkey: kes_vkey
40-
, sequence_number: uint
41-
, kes_period : uint
42-
, sigma : signature
43-
)
44-
45-
kes_vkey = bytes .size 32
46-
47-
signature = bytes .size 64
48-
49-
protocol_version = (major_protocol_version, uint)
50-
51-
major_protocol_version = 1 .. 3
52-
53-
kes_signature = bytes .size 448
54-
55-
;Allegra transaction body adds the validity interval start at index 8
56-
transaction_body =
57-
{ 0: set<transaction_input>
58-
, 1: [*transaction_output]
59-
, 2: coin
60-
, 3: uint
61-
, ?4: [*certificate]
62-
, ?5: withdrawals
63-
, ?6: update
64-
, ?7: metadata_hash
65-
, ?8: uint
66-
}
67-
68-
69-
set<a0> = [*a0]
70-
71-
transaction_input = [transaction_id: hash32, index: uint .size 2]
72-
73-
transaction_output = [address, amount: coin]
74-
75-
;address format:
76-
; [ 8 bit header | payload ];
77-
;
78-
;shelley payment addresses:
79-
; bit 7: 0
80-
; bit 6: base/other
81-
; bit 5: pointer/enterprise [for base: stake cred is keyhash/scripthash]
82-
; bit 4: payment cred is keyhash/scripthash
83-
; bits 3-0: network id
84-
;
85-
;reward addresses:
86-
; bits 7-5: 111
87-
; bit 4: credential is keyhash/scripthash
88-
; bits 3-0: network id
89-
;
90-
;byron addresses:
91-
; bits 7-4: 1000
92-
;
93-
; 0000: base address: keyhash28,keyhash28
94-
; 0001: base address: scripthash28,keyhash28
95-
; 0010: base address: keyhash28,scripthash28
96-
; 0011: base address: scripthash28,scripthash28
97-
; 0100: pointer address: keyhash28, 3 variable length uint
98-
; 0101: pointer address: scripthash28, 3 variable length uint
99-
; 0110: enterprise address: keyhash28
100-
; 0111: enterprise address: scripthash28
101-
; 1000: byron address
102-
; 1110: reward account: keyhash28
103-
; 1111: reward account: scripthash28
104-
;1001-1101: future formats
105-
address = bytes
106-
107-
coin = uint
108-
109-
certificate =
110-
[ stake_registration
111-
// stake_deregistration
112-
// stake_delegation
113-
// pool_registration
114-
// pool_retirement
115-
// genesis_key_delegation
116-
// move_instantaneous_rewards_cert
117-
]
118-
119-
120-
;This will be deprecated in a future era
121-
stake_registration = (0, stake_credential)
122-
123-
stake_credential = credential
124-
125-
credential = [0, addr_keyhash// 1, script_hash]
126-
127-
addr_keyhash = hash28
128-
129-
hash28 = bytes .size 28
130-
131-
;To compute a script hash, note that you must prepend
132-
;a tag to the bytes of the script before hashing.
133-
;The tag is determined by the language.
134-
;The tags in the Conway era are:
135-
; "\x00" for multisig scripts
136-
; "\x01" for Plutus V1 scripts
137-
; "\x02" for Plutus V2 scripts
138-
; "\x03" for Plutus V3 scripts
139-
script_hash = hash28
140-
141-
;This will be deprecated in a future era
142-
stake_deregistration = (1, stake_credential)
143-
144-
stake_delegation = (2, stake_credential, pool_keyhash)
145-
146-
pool_keyhash = hash28
147-
148-
pool_registration = (3, pool_params)
149-
150-
pool_params =
151-
( operator: pool_keyhash
152-
, vrf_keyhash : vrf_keyhash
153-
, pledge : coin
154-
, cost : coin
155-
, margin : unit_interval
156-
, reward_account: reward_account
157-
, pool_owners : set<addr_keyhash>
158-
, relays : [*relay]
159-
, pool_metadata : pool_metadata/ nil
160-
)
161-
162-
vrf_keyhash = hash32
163-
164-
;A unit interval is a number in the range between 0 and 1, which
165-
;means there are two extra constraints:
166-
; 1. numerator <= denominator
167-
; 2. denominator > 0
168-
unit_interval = #6.30([uint, uint])
169-
170-
;reward_account = bytes
171-
reward_account =
172-
h'E090000000000000000000000000000000000000000000000000000000'
173-
/ h'F0A0000000000000000000000000000000000000000000000000000000'
174-
175-
relay = [single_host_addr// single_host_name// multi_host_name]
176-
177-
single_host_addr = (0, port/ nil, ipv4/ nil, ipv6/ nil)
178-
179-
port = uint .le 65535
180-
181-
ipv4 = bytes .size 4
182-
183-
ipv6 = bytes .size 16
184-
185-
;dns_name: An A or AAAA DNS record
186-
single_host_name = (1, port/ nil, dns_name)
187-
188-
dns_name = text .size (0 .. 64)
189-
190-
;dns_name: An SRV DNS record
191-
multi_host_name = (2, dns_name)
192-
193-
pool_metadata = [url, metadata_hash]
194-
195-
url = text .size (0 .. 64)
196-
197-
metadata_hash = hash32
198-
199-
pool_retirement = (4, pool_keyhash, epoch)
200-
201-
epoch = uint
202-
203-
genesis_key_delegation = (5, genesis_hash, genesis_delegate_hash, vrf_keyhash)
204-
205-
genesis_hash = hash28
206-
207-
genesis_delegate_hash = hash28
208-
209-
move_instantaneous_rewards_cert = (6, move_instantaneous_reward)
210-
211-
;The first field determines where the funds are drawn from.
212-
; 0 denotes the reserves,
213-
; 1 denotes the treasury.
214-
;If the second field is a map, funds are moved to stake credentials.
215-
;Otherwise, the funds are given to the other accounting pot.
216-
;NOTE:
217-
; This has been safely backported to Shelley from Alonzo.
218-
move_instantaneous_reward = [0/ 1, {*stake_credential: delta_coin}/ coin]
219-
220-
;This too has been introduced in Shelley as a backport from Alonzo.
221-
delta_coin = int
222-
223-
withdrawals = {*reward_account: coin}
224-
225-
update = [proposed_protocol_parameter_updates, epoch]
226-
227-
proposed_protocol_parameter_updates = {*genesis_hash: protocol_param_update}
228-
229-
protocol_param_update =
230-
{ ?0: uint ;minfee A
231-
, ?1 : uint ;minfee B
232-
, ?2 : uint ;max block body size
233-
, ?3 : uint ;max transaction size
234-
, ?4 : uint .size 2 ;max block header size
235-
, ?5 : coin ;key deposit
236-
, ?6 : coin ;pool deposit
237-
, ?7 : epoch ;maximum epoch
238-
, ?8 : uint .size 2 ;n_opt: desired number of stake pools
239-
, ?9 : nonnegative_interval ;pool pledge influence
240-
, ?10: unit_interval ;expansion rate
241-
, ?11: unit_interval ;treasury growth rate
242-
, ?12: unit_interval ;decentralization constant
243-
, ?13: nonce ;extra entropy
244-
, ?14: [protocol_version] ;protocol version
245-
, ?15: coin ;min utxo value
246-
}
247-
248-
249-
nonnegative_interval = #6.30([uint, positive_int])
250-
251-
positive_int = 1 .. maxWord64
252-
253-
maxWord64 = 18446744073709551615
254-
255-
nonce = [0// 1, bytes .size 32]
256-
257-
transaction_witness_set =
258-
{?0: [*vkeywitness], ?1: [*native_script], ?2: [*bootstrap_witness]}
259-
260-
vkeywitness = [vkey, signature]
261-
262-
;Timelock validity intervals are half-open intervals [a, b).
263-
;
264-
; invalid_before:
265-
; specifies the left (included) endpoint a.
266-
;
267-
; invalid_hereafter:
268-
; specifies the right (excluded) endpoint b.
269-
native_script =
270-
[ script_pubkey
271-
// script_all
272-
// script_any
273-
// script_n_of_k
274-
// invalid_before
275-
// invalid_hereafter
276-
]
277-
278-
279-
script_pubkey = (0, addr_keyhash)
280-
281-
script_all = (1, [*native_script])
282-
283-
script_any = (2, [*native_script])
284-
285-
script_n_of_k = (3, n: int64, [*native_script])
286-
287-
int64 = -9223372036854775808 .. 9223372036854775807
288-
289-
invalid_before = (4, uint)
290-
291-
invalid_hereafter = (5, uint)
292-
293-
bootstrap_witness =
294-
[ public_key: vkey
295-
, signature : signature
296-
, chain_code: bytes .size 32
297-
, attributes: bytes
298-
]
299-
300-
301-
transaction_index = uint .size 2
302-
303-
auxiliary_data =
304-
metadata
305-
/ [transaction_metadata: metadata, auxiliary_scripts: auxiliary_scripts]
306-
307-
metadata = {*transaction_metadatum_label: transaction_metadatum}
308-
309-
transaction_metadatum_label = uint
310-
311-
transaction_metadatum =
312-
{*transaction_metadatum: transaction_metadatum}
313-
/ [*transaction_metadatum]
314-
/ int
315-
/ bytes .size (0 .. 64)
316-
/ text .size (0 .. 64)
317-
318-
auxiliary_scripts = [*native_script]
319-
32013
transaction = [transaction_body, transaction_witness_set, auxiliary_data/ nil]
32114

eras/allegra/impl/testlib/Test/Cardano/Ledger/Allegra/CDDL.hs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ import Test.Cardano.Ledger.Shelley.CDDL hiding (
2323
import Text.Heredoc
2424

2525
allegraCDDL :: Huddle
26-
allegraCDDL = collectFrom [block, transaction]
26+
allegraCDDL = collectFrom [HIRule block, HIRule transaction]
2727

2828
native_script :: Rule
2929
native_script =

0 commit comments

Comments
 (0)