Skip to content

Commit

Permalink
fix immutable ledger cddl definitions
Browse files Browse the repository at this point in the history
  • Loading branch information
Mr-Leshiy committed Nov 4, 2024
1 parent ed6da67 commit 1269e0a
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 21 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,8 @@ check-cddl:

WORKDIR /cddl

COPY ./block.cddl ./genesis_to_prev_hash.cddl .
COPY ./block.cddl ./genesis_to_prev_hash.cddl ./hash.cddl .

RUN cddlc -2 hash.cddl
RUN cddlc -2 block.cddl
RUN cddlc -2 genesis_to_prev_hash.cddl
Original file line number Diff line number Diff line change
@@ -1,14 +1,14 @@
block = [
block_header,
block-header,
block-data,
validator-signature,
]

block_header = [
block-header = [
chain-id: ULID,
height: int,
timestamp: #6.1(uint .ge 1722470400), ; Epoch-based date/time
prev-block-id: hash_bytes, ; hash of the previous block
prev-block-id: hash-bytes, ; hash of the previous block
?ledger-type: UUID,
?purpose-id: ULID / UUID,
?validator,
Expand All @@ -20,14 +20,11 @@ block-data = encoded-cbor
UUID = #6.37(bytes) ; UUID type
ULID = #6.32780(bytes) ; ULID type

hash_bytes = (
#6.32781(bytes) / ; Blake3 hash
#6.32782(bytes) / ; Blake2b hash
#6.32783(bytes) ; Blake2s hash
)
kid = hash_bytes ; hash of the x509/c509 certificate
kid = hash-bytes ; hash of the x509/c509 certificate

validator = (kid / [2* kid])
metadata = [ *any ]

validator-signature = (bytes / [2* bytes])

;# include hash
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
genesis_to_prev_hash = [
chain_id: ULID,
timestamp: ~#6.1(uint .ge 1722470400), ; Epoch-based date/time
ledger_type: UUID,
purpose_id: ULID / UUID,
genesis-to-prev-hash = [
chain-id: ULID,
timestamp: #6.1(uint .ge 1722470400), ; Epoch-based date/time
ledger-type: UUID,
purpose-id: ULID / UUID,
validator,
]

UUID = #6.37(bytes) ; UUID type
ULID = #6.32780(bytes) ; ULID type

validator = (kid / [2* kid])
kid = hash_bytes ; hash of the x509/c509 certificate
hash_bytes = (
#6.32781(bytes) \ ; Blake3 hash
#6.32782(bytes) \ ; Blake2b hash
#6.32783(bytes) ; Blake2s hash
)
kid = hash-bytes ; hash of the x509/c509 certificate

;# include hash
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
hash-bytes = (
#6.32781(bytes) / ; Blake3 hash
#6.32782(bytes) / ; Blake2b hash
#6.32783(bytes) ; Blake2s hash
)

0 comments on commit 1269e0a

Please sign in to comment.