From b0efaa8227b20820e24e6c83fb885146b765012f Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Mon, 21 Oct 2024 17:23:17 +0300 Subject: [PATCH 01/10] add new tx v2 spec --- .../08_concepts/catalyst_voting/crypto.md | 10 +++--- .../catalyst_voting/transaction.md | 15 ++++++-- .../08_concepts/catalyst_voting/tx_v2.cddl | 34 +++++++++++++++++++ 3 files changed, 51 insertions(+), 8 deletions(-) create mode 100644 docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl diff --git a/docs/src/architecture/08_concepts/catalyst_voting/crypto.md b/docs/src/architecture/08_concepts/catalyst_voting/crypto.md index 04c6f5d8d4..8a7d22c8b9 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/crypto.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/crypto.md @@ -65,7 +65,6 @@ Before any voting will start an initial setup procedure should be performed. * As most of the crypto algorithms are group dependent (more about this you can read in [appendix A](#a-group-definition)), it is needed to specifically define which cryptographically secure group would be used. -* Define a hash function which will be used by the underlying crypto algorithms. * Define a commitment key $ck$, which will be used during the voter proof generation and verification procedures. @@ -502,7 +501,7 @@ To compute it, prover needs to perform the next steps: * $A_l = g^{i_l * \beta_l} \circ ck^{\delta_l}, A_l \in \mathbb{G}$. 5. Calculate a first verifier challenge $ch_1 = H(ck, pk, \{c_j\}, \{I_l\}, \{B_l\}, \{A_l\})$, - where $H$ is a hash function, + where $H$ is [BLAKE2b-512] hash function, $j \in [0, \ldots, N-1]$ and $l \in [0, \ldots, log_2(N)-1]$. 6. For $j \in [0, \ldots, N-1]$ calculate polynomials @@ -518,7 +517,7 @@ To compute it, prover needs to perform the next steps: and $p_{j,l}$ - corresponding coefficients of the polynomial $p_j(x)$ calculated on step `7`. 9. Calculate a second verifier challenge $ch_2 = H(ch_1, \{D_l\})$, - where $H$ is a hash function + where $H$ is [BLAKE2b-512] hash function and $l \in [0, \ldots, log_2(N)-1]$. 10. For $l \in [0, \ldots, log_2(N)-1]$ calculate: * $z_l = i_l * ch_2 + \beta_l, z_l \in \mathbb{Z}_q$. @@ -558,12 +557,12 @@ verifier needs to perform the next steps: So the resulted $\mathbf{c} = (c_1, \ldots, c_M, \{c_j\})$. 2. Calculate the first verifier challenge $ch_1 = H(ck, pk, \{c_j\}, \{I_l\}, \{B_l\}, \{A_l\})$, - where $H$ is a hash function, + where $H$ is [BLAKE2b-512] hash function, $j \in [0, \ldots, N-1]$ and $l \in [0, \ldots, log_2(N)-1]$. 3. Calculate a second verifier challenge $ch_2 = H(ch_1, \{D_l\})$, - where $H$ is a hash function + where $H$ is [BLAKE2b-512] hash function and $l \in [0, \ldots, log_2(N)-1]$. 4. For $l \in [0, \ldots, log_2(N)-1]$ verify that the following statements are `true`, where $g$ is the group generator: @@ -683,3 +682,4 @@ If step `6` returns `true` so the final result is `true` otherwise return `false [treasury_system_paper]: https://eprint.iacr.org/2018/435.pdf [treasury_system_spec]: https://github.com/input-output-hk/treasury-crypto/blob/master/docs/voting_protocol_spec/Treasury_voting_protocol_spec.pdf [crypto_book]: https://gnanavelrec.wordpress.com/wp-content/uploads/2019/06/2.understanding-cryptography-by-christof-paar-.pdf +[BLAKE2b-512]: https://www.blake2.net/blake2.pdf diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index fa60732db1..b58ef1550f 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -1,8 +1,8 @@ -# Transaction +# Transactions --- -Title: Voting Transaction +Title: Voting Transactions Status: Proposed @@ -87,7 +87,6 @@ the following properties are used: 1. Each proposal, defined by the "Vote plan id" and "Proposal index", defines a number of possible options. 2. [ristretto255] as a backend cryptographic group. -3. [BLAKE2b-512] hash function. 4. A commitment key $ck$ defined as a [BLAKE2b-512] hash of the "Vote plan id" bytes. #### Transaction signing (witness generation) @@ -119,6 +118,16 @@ Expected witness (includes signature) ``` +### v2 + + +??? note "V2 vote transaction definition: `tx_v1.abnf`" + + ```CDDL + {{ include_file('src/architecture/08_concepts/catalyst_voting/tx_v2.cddl', indent=4) }} + ``` + + ## Rationale ## Path to Active diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl new file mode 100644 index 0000000000..4f723045a5 --- /dev/null +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -0,0 +1,34 @@ +vote_tx = [ + network_id: UUID, ; e.g. Midnight, Catalyst etc. + campaign_id: UUID, ; e.g. Fund 1, Fund 2 etc. + challenge_info, + votes, +] + +challenge_info = [ + challenge_id: UUID, + proposals: ? [+ UUID], +] + +votes = [+ vote] +vote = (public_vote / private_vote) + +public_vote = [2* bool] +; public_vote = [2* scalar] +; public_vote = [2* bytes] +private_vote = [2* (encrypted_vote, vote_proof)] + +encrypted_vote = ciphertext +vote_proof = ( [2* (announcement, ciphertext, r_response)], scalar) + +ciphertext = (group_element, group_element) +announcement = (group_element, group_element, group_element) +r_response = (scalar, scalar, scalar) + +; encrypted_vote = bytes +; vote_proof = bytes + +scalar = (bytes .size 32) +group_element = (bytes .size 32) + +UUID = #6.37(bytes) ; UUID type From 9ed8ca2bb45a7dc29254b9b3c6782db3864a741f Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 11:10:05 +0300 Subject: [PATCH 02/10] wip --- .../08_concepts/catalyst_voting/tx_v2.cddl | 18 ++++++++++++------ 1 file changed, 12 insertions(+), 6 deletions(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl index 4f723045a5..56b263bfc2 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -1,17 +1,21 @@ vote_tx = [ - network_id: UUID, ; e.g. Midnight, Catalyst etc. + brand_id: UUID, ; e.g. Midnight, Catalyst etc. campaign_id: UUID, ; e.g. Fund 1, Fund 2 etc. + event_id: UUID, ; + category_id: UUID, + vote_type: UUID, challenge_info, votes, -] - -challenge_info = [ - challenge_id: UUID, - proposals: ? [+ UUID], + voters_data: encoded_cbor ] votes = [+ vote] vote = (public_vote / private_vote) +;--- +vote = [ choices, ? proof, ? prop_id ] +choices = [ + choice ] +choice = encoded-cbor +;--- public_vote = [2* bool] ; public_vote = [2* scalar] @@ -32,3 +36,5 @@ scalar = (bytes .size 32) group_element = (bytes .size 32) UUID = #6.37(bytes) ; UUID type + +#6.24( bstr( biguint ) ) From 06f11ec40980eb2727ed1f6e4f75d91547ec84e5 Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 14:26:20 +0300 Subject: [PATCH 03/10] wip --- .../catalyst_voting/transaction.md | 29 ++++++++++- .../08_concepts/catalyst_voting/tx_v2.cddl | 52 +++++++------------ 2 files changed, 47 insertions(+), 34 deletions(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index b58ef1550f..991f5d5c10 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -128,6 +128,29 @@ Expected witness (includes signature) ``` +#### Transaction signing + +[COSE] is used to define a transaction's signature structure. +[COSE] is a flexible security protocol that supports various types of security messages. +However, only `COSE Signed Data Object` or `COSE_Sign` type is used. + +The following header must be included in the [COSE] signasture. + +`protected`: +* `content type`: `application/cbor` + (this parameter is used to indicate the content type of the data in the payload or ciphertext fields). + +Any other headers as `alg`, `kid` etc. could be specified of any kind and not defined by this spec. + +##### Signature payload + +As mentioned earlier, the content type of the [COSE] signature payload is `application/cbor`. +In particular it must be a [CBOR] encoded [BLAKE2b-256] hash bytes: + +```CDDL +payload = #6.32782(bytes .size 32) +``` + ## Rationale ## Path to Active @@ -140,6 +163,8 @@ Expected witness (includes signature) -[BLAKE2b-256]: https://www.blake2.net/blake2.pdf\ -[BLAKE2b-512]: https://www.blake2.net/blake2.pdf\ +[BLAKE2b-256]: https://www.blake2.net/blake2.pdf +[BLAKE2b-512]: https://www.blake2.net/blake2.pdf [ristretto255]: https://ristretto.group +[COSE]: https://datatracker.ietf.org/doc/rfc9052/ +[CBOR]: https://datatracker.ietf.org/doc/rfc8949/ diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl index 56b263bfc2..d33c207359 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -1,40 +1,28 @@ vote_tx = [ - brand_id: UUID, ; e.g. Midnight, Catalyst etc. - campaign_id: UUID, ; e.g. Fund 1, Fund 2 etc. - event_id: UUID, ; - category_id: UUID, - vote_type: UUID, - challenge_info, + vote_tx_body, + signature +] + +vote_tx_body = [ + vote_info, votes, voters_data: encoded_cbor ] -votes = [+ vote] -vote = (public_vote / private_vote) -;--- -vote = [ choices, ? proof, ? prop_id ] -choices = [ + choice ] -choice = encoded-cbor -;--- - -public_vote = [2* bool] -; public_vote = [2* scalar] -; public_vote = [2* bytes] -private_vote = [2* (encrypted_vote, vote_proof)] - -encrypted_vote = ciphertext -vote_proof = ( [2* (announcement, ciphertext, r_response)], scalar) - -ciphertext = (group_element, group_element) -announcement = (group_element, group_element, group_element) -r_response = (scalar, scalar, scalar) - -; encrypted_vote = bytes -; vote_proof = bytes +vote_info = { + brand_id: UUID, ; e.g. Midnight, Catalyst etc. + campaign_id: UUID, ; e.g. treasury campaign + event_id: UUID, ; e.g. Fund 1, Fund 2 etc. + category_id: UUID, + vote_type: UUID, ; e.g. Public or Private vote +} -scalar = (bytes .size 32) -group_element = (bytes .size 32) +votes = [+ vote] +vote = [ + choice: encoded-cbor, + proof: encoded-cbor / null, + prop_id: UUID / null, +] UUID = #6.37(bytes) ; UUID type - -#6.24( bstr( biguint ) ) +signature = #6.98(COSE_Sign) ; COSE signature From 0ce7e32829d19d4044fcf14f9f00e15091f971a8 Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 14:51:41 +0300 Subject: [PATCH 04/10] wip --- .../catalyst_voting/transaction.md | 19 +++++++++++++++++++ .../08_concepts/catalyst_voting/tx_v2.cddl | 5 +++-- 2 files changed, 22 insertions(+), 2 deletions(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index 991f5d5c10..6ad4988bc9 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -128,6 +128,25 @@ Expected witness (includes signature) ``` +`event_info` - a set of different identifiers which is uniquely define a particular voting event. + +Vote info: + + * `brand_id` - a unique identifier which represents a "brand" who is running the voting, + e.g. Catalyst, Midnight. + * `campaign_id` - a unique identifier which defines a "campaign" of voting, + e.g. "treasury campaign". + * `event_id` - a unique identifier which defines an event of voting, + e.g. "Catalyst Fund 1", "Catalyst Fund 2". + * `category_id` - a unique identifier which defines a voting category as a collection of proposals, + e.g. "Development & Infrastructure", "Products & Integrations". + +Vote: + + * `choice` - a voter choice. + * `proof` - a voter proof, could be `null`. + * `prop_id` - a proposal id for which `choice` is made, could be `null`. + #### Transaction signing [COSE] is used to define a transaction's signature structure. diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl index d33c207359..d92a888677 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -4,17 +4,18 @@ vote_tx = [ ] vote_tx_body = [ - vote_info, + event_info, votes, voters_data: encoded_cbor ] +event_info = [* UUID] vote_info = { brand_id: UUID, ; e.g. Midnight, Catalyst etc. campaign_id: UUID, ; e.g. treasury campaign event_id: UUID, ; e.g. Fund 1, Fund 2 etc. category_id: UUID, - vote_type: UUID, ; e.g. Public or Private vote + ; vote_type: UUID, ; e.g. Public or Private vote } votes = [+ vote] From 97d0bb06c90f4d03d8ff722de1ecd60fd5e199ab Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 15:10:40 +0300 Subject: [PATCH 05/10] wip --- .../architecture/08_concepts/catalyst_voting/transaction.md | 3 +++ docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl | 2 +- 2 files changed, 4 insertions(+), 1 deletion(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index 6ad4988bc9..d04879f82e 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -146,6 +146,9 @@ Vote: * `choice` - a voter choice. * `proof` - a voter proof, could be `null`. * `prop_id` - a proposal id for which `choice` is made, could be `null`. + For that case where for the voting event defined only **one** proposal, + so it's redundant to provide an additional identifier for the proposal, + so it could be placed `null`. #### Transaction signing diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl index d92a888677..65c459ab89 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -9,7 +9,7 @@ vote_tx_body = [ voters_data: encoded_cbor ] -event_info = [* UUID] +event_info = [+ UUID] vote_info = { brand_id: UUID, ; e.g. Midnight, Catalyst etc. campaign_id: UUID, ; e.g. treasury campaign From 8a2d6b2f0085d5f0776e6f384620d863b7bb04bf Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 15:12:31 +0300 Subject: [PATCH 06/10] wip --- .../src/architecture/08_concepts/catalyst_voting/transaction.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index d04879f82e..3136742d09 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -150,6 +150,8 @@ Vote: so it's redundant to provide an additional identifier for the proposal, so it could be placed `null`. +`voters_data` - an any additional voter's specific data. + #### Transaction signing [COSE] is used to define a transaction's signature structure. From 68633d97d7d499a458efc1e0228108275ae959ab Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 16:53:39 +0300 Subject: [PATCH 07/10] wip --- .../catalyst_voting/transaction.md | 17 +++-------------- .../08_concepts/catalyst_voting/tx_v2.cddl | 19 ++++++++----------- .../catalyst_voting/tx_v2_cose_payload.cddl | 2 ++ 3 files changed, 13 insertions(+), 25 deletions(-) create mode 100644 docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index 3136742d09..c8626c3b26 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -121,25 +121,14 @@ Expected witness (includes signature) ### v2 -??? note "V2 vote transaction definition: `tx_v1.abnf`" +??? note "V2 vote transaction definition: `tx_v2.cddl`" ```CDDL {{ include_file('src/architecture/08_concepts/catalyst_voting/tx_v2.cddl', indent=4) }} ``` -`event_info` - a set of different identifiers which is uniquely define a particular voting event. - -Vote info: - - * `brand_id` - a unique identifier which represents a "brand" who is running the voting, - e.g. Catalyst, Midnight. - * `campaign_id` - a unique identifier which defines a "campaign" of voting, - e.g. "treasury campaign". - * `event_id` - a unique identifier which defines an event of voting, - e.g. "Catalyst Fund 1", "Catalyst Fund 2". - * `category_id` - a unique identifier which defines a voting category as a collection of proposals, - e.g. "Development & Infrastructure", "Products & Integrations". +`event` - a set of different identifiers which is uniquely define a particular voting event. Vote: @@ -172,7 +161,7 @@ As mentioned earlier, the content type of the [COSE] signature payload is `appli In particular it must be a [CBOR] encoded [BLAKE2b-256] hash bytes: ```CDDL -payload = #6.32782(bytes .size 32) +{{ include_file('src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl') }} ``` ## Rationale diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl index 65c459ab89..2e472a7254 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -4,26 +4,23 @@ vote_tx = [ ] vote_tx_body = [ - event_info, + vote_type: UUID ; e.g. Public or Private vote + event, votes, voters_data: encoded_cbor ] -event_info = [+ UUID] -vote_info = { - brand_id: UUID, ; e.g. Midnight, Catalyst etc. - campaign_id: UUID, ; e.g. treasury campaign - event_id: UUID, ; e.g. Fund 1, Fund 2 etc. - category_id: UUID, - ; vote_type: UUID, ; e.g. Public or Private vote -} +event = { * event_key => any } +event_key = int / tstr votes = [+ vote] vote = [ - choice: encoded-cbor, + choices: encoded-cbor, proof: encoded-cbor / null, - prop_id: UUID / null, + prop_id: encoded-cbor / null, ] +choices = [+ choice] +choice = encoded-cbor UUID = #6.37(bytes) ; UUID type signature = #6.98(COSE_Sign) ; COSE signature diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl new file mode 100644 index 0000000000..01491ef25d --- /dev/null +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl @@ -0,0 +1,2 @@ +cose_payload = Blake2b-256 +Blake2b-256 = #6.32782(bytes .size 32) ; Blake2b-256 hash bytes \ No newline at end of file From e35c435addddef4a7d0208c34dc3b5a626d69a80 Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 17:14:25 +0300 Subject: [PATCH 08/10] fix CI checks --- .../catalyst_voting/transaction.md | 21 +++++++++++-------- .../08_concepts/catalyst_voting/tx_v2.cddl | 2 +- .../catalyst_voting/tx_v2_cose_payload.cddl | 4 ++-- 3 files changed, 15 insertions(+), 12 deletions(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index c8626c3b26..9d26616778 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -87,7 +87,7 @@ the following properties are used: 1. Each proposal, defined by the "Vote plan id" and "Proposal index", defines a number of possible options. 2. [ristretto255] as a backend cryptographic group. -4. A commitment key $ck$ defined as a [BLAKE2b-512] hash of the "Vote plan id" bytes. +3. A commitment key $ck$ defined as a [BLAKE2b-512] hash of the "Vote plan id" bytes. #### Transaction signing (witness generation) @@ -114,7 +114,7 @@ Expected witness (includes signature) ```hex - 0200000000e6c8aa48925e37fdab75db13aca7c4f39068e12eeb3af8fd1f342005cae5ab9a1ef5344fab2374e9436a67f57041899693d333610dfe785d329988736797950d +0200000000e6c8aa48925e37fdab75db13aca7c4f39068e12eeb3af8fd1f342005cae5ab9a1ef5344fab2374e9436a67f57041899693d333610dfe785d329988736797950d ``` @@ -132,12 +132,12 @@ Expected witness (includes signature) Vote: - * `choice` - a voter choice. - * `proof` - a voter proof, could be `null`. - * `prop_id` - a proposal id for which `choice` is made, could be `null`. - For that case where for the voting event defined only **one** proposal, - so it's redundant to provide an additional identifier for the proposal, - so it could be placed `null`. +* `choice` - a voter choice. +* `proof` - a voter proof, could be `null`. +* `prop_id` - a proposal id for which `choice` is made, could be `null`. + For that case where for the voting event defined only **one** proposal, + so it's redundant to provide an additional identifier for the proposal, + so it could be placed `null`. `voters_data` - an any additional voter's specific data. @@ -147,9 +147,10 @@ Vote: [COSE] is a flexible security protocol that supports various types of security messages. However, only `COSE Signed Data Object` or `COSE_Sign` type is used. -The following header must be included in the [COSE] signasture. +The following header must be included in the [COSE] signature. `protected`: + * `content type`: `application/cbor` (this parameter is used to indicate the content type of the data in the payload or ciphertext fields). @@ -160,9 +161,11 @@ Any other headers as `alg`, `kid` etc. could be specified of any kind and not de As mentioned earlier, the content type of the [COSE] signature payload is `application/cbor`. In particular it must be a [CBOR] encoded [BLAKE2b-256] hash bytes: + ```CDDL {{ include_file('src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl') }} ``` + ## Rationale diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl index 2e472a7254..673586b6cd 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2.cddl @@ -11,7 +11,7 @@ vote_tx_body = [ ] event = { * event_key => any } -event_key = int / tstr +event_key = int / text votes = [+ vote] vote = [ diff --git a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl index 01491ef25d..e91264e8e4 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl +++ b/docs/src/architecture/08_concepts/catalyst_voting/tx_v2_cose_payload.cddl @@ -1,2 +1,2 @@ -cose_payload = Blake2b-256 -Blake2b-256 = #6.32782(bytes .size 32) ; Blake2b-256 hash bytes \ No newline at end of file +cose_payload = blake2b-256 +blake2b-256 = #6.32782(bytes .size 32) ; Blake2b-256 hash bytes \ No newline at end of file From 5f9192dadf06fad10054377ecbc9ee20accc96a0 Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Tue, 22 Oct 2024 17:21:29 +0300 Subject: [PATCH 09/10] wip --- .../src/architecture/08_concepts/catalyst_voting/transaction.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index 9d26616778..dbfb676da9 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -132,7 +132,7 @@ Expected witness (includes signature) Vote: -* `choice` - a voter choice. +* `choices` - a collection of voter choices for the proposal. * `proof` - a voter proof, could be `null`. * `prop_id` - a proposal id for which `choice` is made, could be `null`. For that case where for the voting event defined only **one** proposal, From 254681195b330049888433f7770d1966d7d1aefa Mon Sep 17 00:00:00 2001 From: Mr-Leshiy Date: Wed, 23 Oct 2024 11:43:48 +0300 Subject: [PATCH 10/10] fix --- .../architecture/08_concepts/catalyst_voting/transaction.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md index dbfb676da9..2ded6f5ca6 100644 --- a/docs/src/architecture/08_concepts/catalyst_voting/transaction.md +++ b/docs/src/architecture/08_concepts/catalyst_voting/transaction.md @@ -46,7 +46,7 @@ V1 transaction representation in hex: 1. Transaction size (u32): `0000037e` -2. `00` +2. Jörmungandr specific tag (u8): `00` 3. Jörmungandr specific tag (u8): `0b` 4. Vote plan id (32 byte hash): `36ad42885189a0ac3438cdb57bc8ac7f6542e05a59d1f2e4d1d38194c9d4ac7b` 5. Proposal index (u8): `00` @@ -135,7 +135,7 @@ Vote: * `choices` - a collection of voter choices for the proposal. * `proof` - a voter proof, could be `null`. * `prop_id` - a proposal id for which `choice` is made, could be `null`. - For that case where for the voting event defined only **one** proposal, + For that case where for the `event` defined only **one** proposal, so it's redundant to provide an additional identifier for the proposal, so it could be placed `null`.