diff --git a/contrib/kaitai-struct-files/files/alpha__smart_rollup__game.ksy b/contrib/kaitai-struct-files/files/alpha__smart_rollup__game.ksy index b45db8af99024c044cc1f698b25f2617f08a077b..1ebedfc81d371e2c4e2d71de3bdb06090fdcdced 100644 --- a/contrib/kaitai-struct-files/files/alpha__smart_rollup__game.ksy +++ b/contrib/kaitai-struct-files/files/alpha__smart_rollup__game.ksy @@ -15,12 +15,12 @@ types: type: n attested: seq: - - id: level - type: s4 - - id: index + - id: attested_tag type: u1 - - id: commitment - size: 48 + enum: attested_tag + - id: v0 + type: v0 + if: (attested_tag == attested_tag::v0) back_pointers: seq: - id: back_pointers_entries @@ -176,7 +176,17 @@ types: type: s4 - id: index type: u1 + v0: + seq: + - id: level + type: s4 + - id: index + type: u1 + - id: commitment + size: 48 enums: + attested_tag: + 0: v0 bool: 0: false 255: true diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index adc528fa144aa15a13fa5726dd9548cbb756b5e4..21b383c08b7bec6b201cbcfc8a5534d856bb95aa 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -84,7 +84,21 @@ module Header = struct conv (fun {id; commitment} -> (id, commitment)) (fun (id, commitment) -> {id; commitment}) - (merge_objs id_encoding (obj1 (req "commitment" Commitment.encoding))) + (* A tag is added to ensure we can migrate from this encoding to + different version if we decide to change the encoding. *) + (union + [ + case + ~title:"v0" + (Tag 0) + (merge_objs + (obj1 (req "version" (constant "0"))) + (merge_objs + id_encoding + (obj1 (req "commitment" Commitment.encoding)))) + (fun x -> Some ((), x)) + (fun ((), x) -> x); + ]) let pp_id fmt {published_level; index} = Format.fprintf diff --git a/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_applies_dal_pages).out b/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_applies_dal_pages).out index 25e3bf89329f395800eaa63e9f6fa9f4b0a282b9..fb1cdb8f63a4808b8c2f0b69ac3beceef092d628 100644 --- a/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_applies_dal_pages).out +++ b/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_applies_dal_pages).out @@ -64,7 +64,7 @@ This sequence of operations was run: GET http://[HOST]:[PORT]/global/block/head/dal/slot_headers 200 OK -[{"level":4,"index":0,"commitment":"[DAL_SLOT_HEADER]"},{"level":4,"index":1,"commitment":"[DAL_SLOT_HEADER]"},{"level":4,"index":2,"commitment":"[DAL_SLOT_HEADER]"}] +[{"version":"0","level":4,"index":0,"commitment":"[DAL_SLOT_HEADER]"},{"version":"0","level":4,"index":1,"commitment":"[DAL_SLOT_HEADER]"},{"version":"0","level":4,"index":2,"commitment":"[DAL_SLOT_HEADER]"}] GET http://[HOST]:[PORT]/global/block/head/dal/processed_slots 200 OK diff --git a/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_downloads_slots).out b/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_downloads_slots).out index 88eb1e74003e39fb869a25423ca619b22f6b824d..fb3f446ffc2b4851469e754a76e226646e68a73b 100644 --- a/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_downloads_slots).out +++ b/tezt/tests/expected/dal.ml/Alpha- Testing DAL rollup and node with L1 (rollup_node_downloads_slots).out @@ -64,7 +64,7 @@ This sequence of operations was run: GET http://[HOST]:[PORT]/global/block/head/dal/slot_headers 200 OK -[{"level":4,"index":0,"commitment":"[DAL_SLOT_HEADER]"},{"level":4,"index":1,"commitment":"[DAL_SLOT_HEADER]"},{"level":4,"index":2,"commitment":"[DAL_SLOT_HEADER]"}] +[{"version":"0","level":4,"index":0,"commitment":"[DAL_SLOT_HEADER]"},{"version":"0","level":4,"index":1,"commitment":"[DAL_SLOT_HEADER]"},{"version":"0","level":4,"index":2,"commitment":"[DAL_SLOT_HEADER]"}] GET http://[HOST]:[PORT]/global/block/head/dal/processed_slots 200 OK