diff --git a/client-libs/kaitai-struct-files/files/alpha__operation.ksy b/client-libs/kaitai-struct-files/files/alpha__operation.ksy index 9f66406482094f70b04a8a85e034ea5755a23ef4..11f17279097f8a01e61a82c221d9b83ecb77218d 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation.ksy @@ -419,7 +419,31 @@ types: - id: committee type: committee size: len_committee + committee_1: + seq: + - id: committee_entries + type: committee_entries_0 + repeat: eos + committee_2: + seq: + - id: len_committee + type: u4be + valid: + max: 1073741823 + - id: committee + type: committee_1 + size: len_committee committee_entries: + seq: + - id: slot + type: u2be + - id: dal_attestation_tag + type: u1 + enum: bool + - id: dal_attestation + type: z + if: (dal_attestation_tag == bool::true) + committee_entries_0: seq: - id: committee_elt type: u2be @@ -907,7 +931,7 @@ types: - id: consensus_content type: consensus_content - id: committee - type: committee_0 + type: committee_2 price: seq: - id: id diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__bls_mode_unsigned.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__bls_mode_unsigned.ksy index 454865ebe155d84c3985c064965a72907a75400c..35f9c4982714bf1aea0cdbf2af6c985f0e2e81cc 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__bls_mode_unsigned.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__bls_mode_unsigned.ksy @@ -420,7 +420,31 @@ types: - id: committee type: committee size: len_committee + committee_1: + seq: + - id: committee_entries + type: committee_entries_0 + repeat: eos + committee_2: + seq: + - id: len_committee + type: u4be + valid: + max: 1073741823 + - id: committee + type: committee_1 + size: len_committee committee_entries: + seq: + - id: slot + type: u2be + - id: dal_attestation_tag + type: u1 + enum: bool + - id: dal_attestation + type: z + if: (dal_attestation_tag == bool::true) + committee_entries_0: seq: - id: committee_elt type: u2be @@ -908,7 +932,7 @@ types: - id: consensus_content type: consensus_content - id: committee - type: committee_0 + type: committee_2 price: seq: - id: id diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy index 28bc8c0b027c69c1b6fddc53195f06c5c37284e8..9f60bce9852ebf6e7696a8b135a3f4370e0dcdc7 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__contents.ksy @@ -400,7 +400,31 @@ types: - id: committee type: committee size: len_committee + committee_1: + seq: + - id: committee_entries + type: committee_entries_0 + repeat: eos + committee_2: + seq: + - id: len_committee + type: u4be + valid: + max: 1073741823 + - id: committee + type: committee_1 + size: len_committee committee_entries: + seq: + - id: slot + type: u2be + - id: dal_attestation_tag + type: u1 + enum: bool + - id: dal_attestation + type: z + if: (dal_attestation_tag == bool::true) + committee_entries_0: seq: - id: committee_elt type: u2be @@ -884,7 +908,7 @@ types: - id: consensus_content type: consensus_content - id: committee - type: committee_0 + type: committee_2 price: seq: - id: id diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy index 66d84ed954f3af393a56b569e8e60c4efc40bfe1..9d4cda5bb78760be3df48a6ff8c40df537f1272e 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__contents_list.ksy @@ -404,7 +404,31 @@ types: - id: committee type: committee size: len_committee + committee_1: + seq: + - id: committee_entries + type: committee_entries_0 + repeat: eos + committee_2: + seq: + - id: len_committee + type: u4be + valid: + max: 1073741823 + - id: committee + type: committee_1 + size: len_committee committee_entries: + seq: + - id: slot + type: u2be + - id: dal_attestation_tag + type: u1 + enum: bool + - id: dal_attestation + type: z + if: (dal_attestation_tag == bool::true) + committee_entries_0: seq: - id: committee_elt type: u2be @@ -888,7 +912,7 @@ types: - id: consensus_content type: consensus_content - id: committee - type: committee_0 + type: committee_2 price: seq: - id: id diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy index 63c7638002ba6ace1217951cd72267e8a7f27c36..317c0144f339a5ff50ca1fbfbf8f51375c2a6e6f 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__protocol_data.ksy @@ -419,7 +419,31 @@ types: - id: committee type: committee size: len_committee + committee_1: + seq: + - id: committee_entries + type: committee_entries_0 + repeat: eos + committee_2: + seq: + - id: len_committee + type: u4be + valid: + max: 1073741823 + - id: committee + type: committee_1 + size: len_committee committee_entries: + seq: + - id: slot + type: u2be + - id: dal_attestation_tag + type: u1 + enum: bool + - id: dal_attestation + type: z + if: (dal_attestation_tag == bool::true) + committee_entries_0: seq: - id: committee_elt type: u2be @@ -907,7 +931,7 @@ types: - id: consensus_content type: consensus_content - id: committee - type: committee_0 + type: committee_2 price: seq: - id: id diff --git a/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy b/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy index f6125dbda13a7f3174290eafd907e571f5120727..94fc086df82e6e13719767611e4d612cdbd1b7a6 100644 --- a/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy +++ b/client-libs/kaitai-struct-files/files/alpha__operation__unsigned.ksy @@ -407,7 +407,31 @@ types: - id: committee type: committee size: len_committee + committee_1: + seq: + - id: committee_entries + type: committee_entries_0 + repeat: eos + committee_2: + seq: + - id: len_committee + type: u4be + valid: + max: 1073741823 + - id: committee + type: committee_1 + size: len_committee committee_entries: + seq: + - id: slot + type: u2be + - id: dal_attestation_tag + type: u1 + enum: bool + - id: dal_attestation + type: z + if: (dal_attestation_tag == bool::true) + committee_entries_0: seq: - id: committee_elt type: u2be @@ -895,7 +919,7 @@ types: - id: consensus_content type: consensus_content - id: committee - type: committee_0 + type: committee_2 price: seq: - id: id diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index ca9d76c3e8777bd7f92cc562522ca597b1859e8e..6a9e3cfea6ace3f43651445a336c88d6d5bbb70f 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -1159,10 +1159,15 @@ module Encoding = struct (varopt "signature" Signature.encoding))) let dal_content_encoding = - obj1 (req "dal_attestation" Dal_attestation_repr.encoding) + conv + (fun {attestation} -> attestation) + (fun attestation -> {attestation}) + Dal_attestation_repr.encoding let consensus_content_with_dal_encoding = - merge_objs consensus_content_encoding dal_content_encoding + merge_objs + consensus_content_encoding + (obj1 (req "dal_attestation" dal_content_encoding)) (* Precondition: [dal_content = None]. *) let attestation_encoding_proj @@ -1177,10 +1182,10 @@ module Encoding = struct (Attestation {consensus_content; dal_content}) = match dal_content with | None -> assert false - | Some dal_content -> (consensus_content, dal_content.attestation) + | Some dal_content -> (consensus_content, dal_content) - let attestation_with_dal_encoding_inj (consensus_content, attestation) = - Attestation {consensus_content; dal_content = Some {attestation}} + let attestation_with_dal_encoding_inj (consensus_content, dal_content) = + Attestation {consensus_content; dal_content = Some dal_content} let attestation_case = Case @@ -1251,7 +1256,12 @@ module Encoding = struct let attestations_aggregate_encoding = obj2 (req "consensus_content" consensus_aggregate_content_encoding) - (req "committee" (list Slot_repr.encoding)) + (req + "committee" + (list + (obj2 + (req "slot" Slot_repr.encoding) + (opt "dal_attestation" dal_content_encoding)))) let attestations_aggregate_case = Case @@ -1264,13 +1274,9 @@ module Encoding = struct | Contents (Attestations_aggregate _ as op) -> Some op | _ -> None); proj = (fun (Attestations_aggregate {consensus_content; committee}) -> - (* TODO: https://gitlab.com/tezos/tezos/-/issues/7935 - Take dal_content into account. *) - let committee = tmp_to_old_committee committee in (consensus_content, committee)); inj = (fun (consensus_content, committee) -> - let committee = tmp_of_old_committee committee in Attestations_aggregate {consensus_content; committee}); } diff --git a/tezt/tests/encoding_samples/alpha/operation.unsigned/operation.unsigned-attestations-aggregate.sample.json b/tezt/tests/encoding_samples/alpha/operation.unsigned/operation.unsigned-attestations-aggregate.sample.json index 4c1dfeb71fc6a34e0bb69a1d1ac38f23be4bae8c..aac83e147faeeac8a3c2cd623f4f56209f8e97ab 100644 --- a/tezt/tests/encoding_samples/alpha/operation.unsigned/operation.unsigned-attestations-aggregate.sample.json +++ b/tezt/tests/encoding_samples/alpha/operation.unsigned/operation.unsigned-attestations-aggregate.sample.json @@ -8,7 +8,23 @@ "round": 0, "block_payload_hash": "vh1g87ZG6scSYxKhspAUzprQVuLAyoa5qMBKcUfjgnQGnFb3dJcG" }, - "committee": [ 0, 23, 51, 893 ] + "committee": [ + { + "slot": 0 + }, + { + "slot": 23, + "dal_attestation": "2048" + }, + { + "slot": 51, + "dal_attestation": "0" + }, + { + "slot": 893, + "dal_attestation": "1" + } + ] } ] } diff --git a/tezt/tests/encoding_samples/alpha/operation/operation-attestations_aggregate.sample.json b/tezt/tests/encoding_samples/alpha/operation/operation-attestations_aggregate.sample.json index f6889bd9f2f858e02f8ec2d44f7d4622562c1a07..859824ef0952c5796ffb220ff0b2e29a075c5a96 100644 --- a/tezt/tests/encoding_samples/alpha/operation/operation-attestations_aggregate.sample.json +++ b/tezt/tests/encoding_samples/alpha/operation/operation-attestations_aggregate.sample.json @@ -8,7 +8,23 @@ "round": 0, "block_payload_hash": "vh1g87ZG6scSYxKhspAUzprQVuLAyoa5qMBKcUfjgnQGnFb3dJcG" }, - "committee": [ 0, 23, 51, 893 ] + "committee": [ + { + "slot": 0 + }, + { + "slot": 23, + "dal_attestation": "2048" + }, + { + "slot": 51, + "dal_attestation": "0" + }, + { + "slot": 893, + "dal_attestation": "1" + } + ] } ], "signature": "BLsigBANTUiNcB2UB7VMj1yTn4SgX9NZabdSY3cHBZgDvFoDcJWrtYZZZshA8LEjY46wqxoWM7PvDTatLiDoiCTmc4p2LVdsXLC9CPtDmZYe7mr33uPgLyVutVSqMmrxRF1ej9Ce7p7nRH" diff --git a/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.out b/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.out index 8eff237d57a6db6852c64a102264c8f01e6f5a80..2f33acacf984afe089b9712b17821179d42c0979 100644 --- a/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.out +++ b/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.out @@ -82,18 +82,29 @@ "block_payload_hash": "vh1g87ZG6scSYxKhspAUzprQVuLAyoa5qMBKcUfjgnQGnFb3dJcG" }, "committee": [ - 0, - 23, - 51, - 893 + { + "slot": 0 + }, + { + "slot": 23, + "dal_attestation": "2048" + }, + { + "slot": 51, + "dal_attestation": "0" + }, + { + "slot": 893, + "dal_attestation": "1" + } ] } ], "signature": "BLsigBANTUiNcB2UB7VMj1yTn4SgX9NZabdSY3cHBZgDvFoDcJWrtYZZZshA8LEjY46wqxoWM7PvDTatLiDoiCTmc4p2LVdsXLC9CPtDmZYe7mr33uPgLyVutVSqMmrxRF1ej9Ce7p7nRH" }' -0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f0000053300000000000000000000000000000000000000000000000000000000000000000000000000000008000000170033037dff03aa9d7b7d96832a1d687a1be9a330ed89ba3fcb293de1dbbede4d9f69a22555f2e2c661f68ed427c4cafc7568554207ce0e2d6daa5abb0a07031ed7e5ee3d5c9c17cf827b1824a4b03afd7f13cdde07e37d8c38b053fd928815e462bdf9eb062d +0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f00000533000000000000000000000000000000000000000000000000000000000000000000000000000000100000000017ff80200033ff00037dff01ff03aa9d7b7d96832a1d687a1be9a330ed89ba3fcb293de1dbbede4d9f69a22555f2e2c661f68ed427c4cafc7568554207ce0e2d6daa5abb0a07031ed7e5ee3d5c9c17cf827b1824a4b03afd7f13cdde07e37d8c38b053fd928815e462bdf9eb062d -./octez-codec decode alpha.operation from 0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f0000053300000000000000000000000000000000000000000000000000000000000000000000000000000008000000170033037dff03aa9d7b7d96832a1d687a1be9a330ed89ba3fcb293de1dbbede4d9f69a22555f2e2c661f68ed427c4cafc7568554207ce0e2d6daa5abb0a07031ed7e5ee3d5c9c17cf827b1824a4b03afd7f13cdde07e37d8c38b053fd928815e462bdf9eb062d +./octez-codec decode alpha.operation from 0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f00000533000000000000000000000000000000000000000000000000000000000000000000000000000000100000000017ff80200033ff00037dff01ff03aa9d7b7d96832a1d687a1be9a330ed89ba3fcb293de1dbbede4d9f69a22555f2e2c661f68ed427c4cafc7568554207ce0e2d6daa5abb0a07031ed7e5ee3d5c9c17cf827b1824a4b03afd7f13cdde07e37d8c38b053fd928815e462bdf9eb062d { "branch": "BKpbfCvh777DQHnXjU2sqHvVUNZ7dBAdqEfKkdw8EGSkD9LSYXb", "contents": [ { "kind": "attestations_aggregate", @@ -101,7 +112,10 @@ { "level": 1331, "round": 0, "block_payload_hash": "vh1g87ZG6scSYxKhspAUzprQVuLAyoa5qMBKcUfjgnQGnFb3dJcG" }, - "committee": [ 0, 23, 51, 893 ] } ], + "committee": + [ { "slot": 0 }, { "slot": 23, "dal_attestation": "2048" }, + { "slot": 51, "dal_attestation": "0" }, + { "slot": 893, "dal_attestation": "1" } ] } ], "signature": "BLsigBANTUiNcB2UB7VMj1yTn4SgX9NZabdSY3cHBZgDvFoDcJWrtYZZZshA8LEjY46wqxoWM7PvDTatLiDoiCTmc4p2LVdsXLC9CPtDmZYe7mr33uPgLyVutVSqMmrxRF1ej9Ce7p7nRH" } diff --git a/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.unsigned.out b/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.unsigned.out index 416b19714b5535f62126f13c0efbdc7304f3b3e9..69a7b869fb0c205bbc62559ff82f98eb9b3fe00c 100644 --- a/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.unsigned.out +++ b/tezt/tests/expected/encoding.ml/Alpha- protocol encoding regression test- operation.unsigned.out @@ -73,17 +73,28 @@ "block_payload_hash": "vh1g87ZG6scSYxKhspAUzprQVuLAyoa5qMBKcUfjgnQGnFb3dJcG" }, "committee": [ - 0, - 23, - 51, - 893 + { + "slot": 0 + }, + { + "slot": 23, + "dal_attestation": "2048" + }, + { + "slot": 51, + "dal_attestation": "0" + }, + { + "slot": 893, + "dal_attestation": "1" + } ] } ] }' -0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f0000053300000000000000000000000000000000000000000000000000000000000000000000000000000008000000170033037d +0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f00000533000000000000000000000000000000000000000000000000000000000000000000000000000000100000000017ff80200033ff00037dff01 -./octez-codec decode alpha.operation.unsigned from 0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f0000053300000000000000000000000000000000000000000000000000000000000000000000000000000008000000170033037d +./octez-codec decode alpha.operation.unsigned from 0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a81f00000533000000000000000000000000000000000000000000000000000000000000000000000000000000100000000017ff80200033ff00037dff01 { "branch": "BKpbfCvh777DQHnXjU2sqHvVUNZ7dBAdqEfKkdw8EGSkD9LSYXb", "contents": [ { "kind": "attestations_aggregate", @@ -91,7 +102,10 @@ { "level": 1331, "round": 0, "block_payload_hash": "vh1g87ZG6scSYxKhspAUzprQVuLAyoa5qMBKcUfjgnQGnFb3dJcG" }, - "committee": [ 0, 23, 51, 893 ] } ] } + "committee": + [ { "slot": 0 }, { "slot": 23, "dal_attestation": "2048" }, + { "slot": 51, "dal_attestation": "0" }, + { "slot": 893, "dal_attestation": "1" } ] } ] } ./octez-codec encode alpha.operation.unsigned from '{ "branch": "BKpbfCvh777DQHnXjU2sqHvVUNZ7dBAdqEfKkdw8EGSkD9LSYXb",