Skip to content

Commit

Permalink
Update conway.cddl with new comments
Browse files Browse the repository at this point in the history
  • Loading branch information
aniketd committed Dec 6, 2024
1 parent b564713 commit a410380
Showing 1 changed file with 58 additions and 27 deletions.
85 changes: 58 additions & 27 deletions eras/conway/impl/cddl-files/conway.cddl
Original file line number Diff line number Diff line change
Expand Up @@ -26,38 +26,38 @@ $vrf_vkey = bytes .size 32
addr_keyhash = $hash28

; address = bytes
; reward_account = bytes
;
; address format:
; [ 8 bit header | payload ];
; address format:
; [ 8 bit header | payload ];
;
; shelley payment addresses:
; bit 7: 0
; bit 6: base/other
; bit 5: pointer/enterprise [for base: stake cred is keyhash/scripthash]
; bit 4: payment cred is keyhash/scripthash
; bits 3-0: network id
; shelley payment addresses:
; bit 7: 0
; bit 6: base/other
; bit 5: pointer/enterprise [for base: stake cred is keyhash/scripthash]
; bit 4: payment cred is keyhash/scripthash
; bits 3-0: network id
;
; reward addresses:
; bits 7-5: 111
; bit 4: credential is keyhash/scripthash
; bits 3-0: network id
; reward addresses:
; bits 7-5: 111
; bit 4: credential is keyhash/scripthash
; bits 3-0: network id
;
; byron addresses:
; bits 7-4: 1000
; byron addresses:
; bits 7-4: 1000
;
; 0000: base address: keyhash28,keyhash28
; 0001: base address: scripthash28,keyhash28
; 0010: base address: keyhash28,scripthash28
; 0011: base address: scripthash28,scripthash28
; 0100: pointer address: keyhash28, 3 variable length uint
; 0101: pointer address: scripthash28, 3 variable length uint
; 0110: enterprise address: keyhash28
; 0111: enterprise address: scripthash28
; 1000: byron address
; 1110: reward account: keyhash28
; 1111: reward account: scripthash28
; 1001-1101: future formats
;
; 0000: base address: keyhash28,keyhash28
; 0001: base address: scripthash28,keyhash28
; 0010: base address: keyhash28,scripthash28
; 0011: base address: scripthash28,scripthash28
; 0100: pointer address: keyhash28, 3 variable length uint
; 0101: pointer address: scripthash28, 3 variable length uint
; 0110: enterprise address: keyhash28
; 0111: enterprise address: scripthash28
; 1000: byron address
; 1110: reward account: keyhash28
; 1111: reward account: scripthash28
; 1001 - 1101: future formats
address = h'001000000000000000000000000000000000000000000000000000000011000000000000000000000000000000000000000000000000000000'
/ h'102000000000000000000000000000000000000000000000000000000022000000000000000000000000000000000000000000000000000000'
/ h'203000000000000000000000000000000000000000000000000000000033000000000000000000000000000000000000000000000000000000'
Expand Down Expand Up @@ -106,6 +106,17 @@ bootstrap_witness = [public_key : $vkey
, chain_code : bytes .size 32
, attributes : bytes]

; The real bounded_bytes does not have this limit. it instead has
; a different limit which cannot be expressed in CDDL.
;
; The limit is as follows:
; - bytes with a definite-length encoding are limited to size 0..64
; - for bytes with an indefinite-length CBOR encoding, each chunk is
; limited to size 0..64
; ( reminder: in CBOR, the indefinite-length encoding of
; bytestrings consists of a token #2.31 followed by a sequence
; of definite-length encoded bytestrings and a stop code )
;
bounded_bytes = bytes .size (0 .. 64)

certificate = [stake_registration
Expand Down Expand Up @@ -151,6 +162,9 @@ datum_hash = $hash32

datum_option = [0, $hash32 // 1, data]

; A type for distinct values.
; The type parameter must support .size, for example: bytes or uint
;
distinct_VBytes = bytes .size 8
/ bytes .size 16
/ bytes .size 20
Expand Down Expand Up @@ -348,6 +362,8 @@ relay = [single_host_addr // single_host_name // multi_host_name]

required_signers = nonempty_set<addr_keyhash>

; reward_account = bytes
;
reward_account = h'E090000000000000000000000000000000000000000000000000000000'
/ h'F0A0000000000000000000000000000000000000000000000000000000'

Expand Down Expand Up @@ -495,6 +511,21 @@ transaction_witness_set = {? 0 : nonempty_set<vkeywitness>
, ? 6 : nonempty_set<plutus_v2_script>
, ? 7 : nonempty_set<plutus_v3_script>}

; The real unit_interval is: #6.30([uint, uint])
;
; A unit interval is a number in the range between 0 and 1, which
; means there are two extra constraints:
; 1. numerator <= denominator
; 2. denominator > 0
;
; The relation between numerator and denominator can be
; expressed in CDDL, but we have a limitation currently
; (see: https://github.com/input-output-hk/cuddle/issues/30)
; which poses a problem for testing. We need to be able to
; generate random valid data for testing implementation of
; our encoders/decoders. Which means we cannot use the actual
; definition here and we hard code the value to 1/2
;
unit_interval = #6.30([1, 2])

url = text .size (0 .. 128)
Expand Down

0 comments on commit a410380

Please sign in to comment.