@@ -72,6 +72,47 @@ Which is well suited where it comes to process some temporary event e.g. voting.
7272
7373### Block structure
7474
75+ Immutable ledger block is a [ Catalyst Signed Document] ,
76+ so its fully follows the structure of the [ Catalyst Signed Document] specification.
77+
78+ ### Metadata Fields
79+
80+ * [ ` id ` ] ( ./../signed_doc/spec.md#id ) .
81+ Used as a unique identifier of the chain.
82+ So all blocks from the same chain must have the same
83+ [ ` id ` ] ( ./../signed_doc/spec.md#id ) field value.
84+ * [ ` ver ` ] ( ./../signed_doc/spec.md#ver ) .
85+ Used as a unique identifier of the block itself.
86+ Also the block's creation ` timestamp ` value is determined from the
87+ [ ` ver ` ] ( ./../signed_doc/spec.md#ver ) field.
88+ * [ ` content type ` ] ( ./../signed_doc/spec.md#content-type ) : ` application/cbor ` .
89+ [ Catalyst Signed Document content] must be a [ CBOR] encoded.
90+
91+ ``` CDDL
92+ 3 => 50
93+ ```
94+
95+ * [ ` content encoding ` ] ( ./../signed_doc/spec.md#content-encoding-optional ) :
96+ [ Catalyst Signed Document content] must be [ Brotli] compressed.
97+
98+ ``` CDDL
99+ "content-type" => "br"
100+ ```
101+
102+ * [ ` type ` ] ( ./../signed_doc/spec.md#type ) : ` d9e7e6ce-2401-4d7d-9492-f4f7c64241c3 ` [ UUID] value.
103+
104+ ``` CDDL
105+ "type" => 37(h'D9E7E6CE24014D7D9492F4F7C64241C3')
106+ ```
107+
108+ * [ ` ref_hash ` ] ( ./../signed_doc/meta.md#ref-hash-secured-document-reference ) .
109+ Previous block reference.
110+ A [ ` ref ` ] ( ./../signed_doc/meta.md#ref-document-reference ) part ** must** be a pair of
111+ [ ` id ` ] ( ./../signed_doc/spec.md#id ) and
112+ [ ` ver ` ] ( ./../signed_doc/spec.md#ver ) .
113+
114+ ### Content format
115+
75116<!-- markdownlint-disable max-one-sentence-per-line code-block-style -->
76117??? note "Block CDDL definition: ` block.cddl ` "
77118
@@ -82,12 +123,9 @@ Which is well suited where it comes to process some temporary event e.g. voting.
82123
83124Header:
84125
85- * ` chain-id ` - unique identifier of the chain.
86126* ` height ` - block's height.
87127 Also is used to identify the block type: * genesis* , * regular* , * final*
88128 (in more details described in [ validation section] ( #block-validation-rules ) ).
89- * ` timestamp ` - block's timestamp.
90- * ` prev-block-id ` - previous block hash.
91129* ` ledger-type ` - unique identifier of the ledger type.
92130 In general, this is the way to strictly bound and specify ` block-data ` of the ledger for the specific ` ledger-type ` .
93131 But such rules will be a part of the specific ledger type definition,
@@ -97,63 +135,42 @@ Header:
97135 each Ledger instance will have a strict time boundaries,
98136 so each of them will run for different purposes.
99137 This is the way to distinguish them.
100- * ` validator ` - identifier or identifiers of the entity who was produced and processed a block.
101- * ` metadata ` - fully optional field, to add some arbitrary metadata to the block.
138+ * ` extra-header-data ` - fully optional field, to add some arbitrary data to the block header.
102139
103140Block:
104141
105142* ` block-header ` - block header described above,
106143* ` block-data ` - an array of some CBOR encoded data
107- * ` validator-signature ` - a signature or signatures of the validator's.
108144
109145### Block validation rules
110146
111- * ` chain-id ` ** MUST** be the same as for the previous block (except for genesis).
147+ * [ ` id ` ] ( ./../signed_doc/spec.md#id )
148+ ** MUST** be the same as for the previous block (except for genesis).
112149* ` height ` ** MUST** be incremented by ` 1 ` from the previous block height value (except for genesis and final block).
113150 * Genesis* block ** MUST** have ` 0 ` value.
114151 * Final* block ** MUST** hash be incremented by ` 1 ` from the previous block height and changed the sign to negative.
115152 E.g. previous block height is ` 9 ` and the * Final* block height is ` -10 ` .
116153* * Final* block is the last one for the specific chain and any other block could not be referenced to the * Final* one.
117154
118- * ` timestamp ` ** MUST** be greater or equals than the ` timestamp ` of the previous block (except for genesis).
119- * ` prev-block-id ` ** MUST** be a hash of the previous block bytes (except for genesis).
120-
155+ * [ ` ver ` ] ( ./../signed_doc/spec.md#ver )
156+ timestamp value ** MUST** be greater or equals than the corresponding ` timestamp `
157+ of the previous block (except for genesis).
158+ * [ ` ref_hash ` ] ( ./../signed_doc/meta.md#ref-hash-secured-document-reference )
159+ ** MUST** be a reference to the previous block (except for genesis).
121160* ` ledger-type ` ** MUST** be the same as for the previous block if present (except for genesis).
122161 ** MANDATORY** field for * Genesis* and * Final* blocks.
123162* ` purpose-id ` ** MUST** be the same as for the previous block if present (except for genesis).
124163 ** MANDATORY** field for * Genesis* and * Final* blocks.
125- * ` validator ` ** MUST** be the same as for the previous block if present (except for genesis).
126- ** MANDATORY** field for * Genesis* and * Final* blocks.
127- * ` prev-block-id ` 's CBOR tag value and ` bstr ` size ** MUST** be the same as for the previous block (except for genesis).
164+ * [ ` kid ` ] ( ./../signed_doc/spec.md#cose-signature-protected-header ) field
165+ ** MUST** be the same as for the previous block (except for genesis).
166+ * [ ` ref_hash ` ] ( ./../signed_doc/meta.md#ref-hash-secured-document-reference ) 's
167+ ` hash-bytes ` CBOR tag value and ` bytes ` size
168+ ** MUST** be the same as for the previous block (except for genesis).
128169 Means that the hash function type and hash size itself must be the same.
129- * ` prev-block-id ` and ` validator-signature ` ** MUST** use the same hash function, defined with the
130- ` hash-bytes ` .
131-
132- * ` prev-block-id ` for the * Genesis* block ** MUST** be a hash of the ` genesis-to-prev-hash ` bytes.
133-
170+ * [ ` ref_hash ` ] ( ./../signed_doc/meta.md#ref-hash-secured-document-reference )
171+ field for the * Genesis* block ** MUST** be omitted.
134172* ` block-data ` ** MUST** be a [ deterministically] [ CBOR-deterministically-encoded ] encoded CBOR.
135173
136- <!-- markdownlint-disable max-one-sentence-per-line code-block-style -->
137- ??? note "Genesis to previous block hash CDDL definition: ` genesis-to-prev-hash.cddl ` "
138-
139- ```CDDL
140- {{ include_file('src/architecture/08_concepts/immutable_ledger/cddl/genesis_to_prev_hash.cddl',indent=4) }}
141- ```
142- <!-- markdownlint-enable max-one-sentence-per-line code-block-style -->
143-
144- #### Signature rules
145-
146- ` validator-signature `
147- ** MUST** be a signature of the hashed ` block-header ` bytes and the ` block-data ` bytes
148- (with the order the same as defined for ` block ` ).
149- Signed by the validator's keys defined in the corresponding certificates referenced by the ` validator ` .
150- Signature algorithm is defined by the certificate.
151- The format and size of this field ** MUST** be totally the same as ` validator ` field:
152-
153- * if ` validator ` is only one id => ` validator-signature ` contains only 1 signature;
154- * if ` validator ` is array => ` validator-signature ` contains an array with the same length;
155- * order of signatures from the ` validator-signature ` 's array corresponds to the validators order of ` validator ` 's array.
156-
157174## Rationale
158175
159176## Path to Active
@@ -166,4 +183,5 @@ The format and size of this field **MUST** be totally the same as `validator` fi
166183
167184<!-- OPTIONAL SECTIONS: see CIP-0001 > Document > Structure table -->
168185
186+ [ Catalyst Signed Document ] : ./../signed_doc/spec.md
169187[ CBOR-deterministically-encoded ] : https://datatracker.ietf.org/doc/html/rfc8949#name-deterministically-encoded-c
0 commit comments