diff --git a/docs/src/architecture/08_concepts/immutable_ledger/cddl/Earthfile b/docs/src/architecture/08_concepts/immutable_ledger/cddl/Earthfile index 1b863ba5f8..c9c7ac1145 100644 --- a/docs/src/architecture/08_concepts/immutable_ledger/cddl/Earthfile +++ b/docs/src/architecture/08_concepts/immutable_ledger/cddl/Earthfile @@ -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 diff --git a/docs/src/architecture/08_concepts/immutable_ledger/cddl/block.cddl b/docs/src/architecture/08_concepts/immutable_ledger/cddl/block.cddl index 048d653534..d65f0fc78a 100644 --- a/docs/src/architecture/08_concepts/immutable_ledger/cddl/block.cddl +++ b/docs/src/architecture/08_concepts/immutable_ledger/cddl/block.cddl @@ -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, @@ -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 diff --git a/docs/src/architecture/08_concepts/immutable_ledger/cddl/genesis_to_prev_hash.cddl b/docs/src/architecture/08_concepts/immutable_ledger/cddl/genesis_to_prev_hash.cddl index f6b22766eb..c30ecbf995 100644 --- a/docs/src/architecture/08_concepts/immutable_ledger/cddl/genesis_to_prev_hash.cddl +++ b/docs/src/architecture/08_concepts/immutable_ledger/cddl/genesis_to_prev_hash.cddl @@ -1,8 +1,8 @@ -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, ] @@ -10,9 +10,6 @@ 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 -) \ No newline at end of file +kid = hash-bytes ; hash of the x509/c509 certificate + +;# include hash diff --git a/docs/src/architecture/08_concepts/immutable_ledger/cddl/hash.cddl b/docs/src/architecture/08_concepts/immutable_ledger/cddl/hash.cddl new file mode 100644 index 0000000000..32ca39ae72 --- /dev/null +++ b/docs/src/architecture/08_concepts/immutable_ledger/cddl/hash.cddl @@ -0,0 +1,5 @@ +hash-bytes = ( + #6.32781(bytes) / ; Blake3 hash + #6.32782(bytes) / ; Blake2b hash + #6.32783(bytes) ; Blake2s hash +)