From 5404e3b4f7991b067c2fa6009fe794984a4d7ea3 Mon Sep 17 00:00:00 2001 From: Albin Coquereau Date: Mon, 4 Sep 2023 10:45:06 +0200 Subject: [PATCH] alpha/baker: remove highwatermarks encoding that allow legacy attestation name --- .../lib_delegate/baking_highwatermarks.ml | 37 +++---------------- 1 file changed, 5 insertions(+), 32 deletions(-) diff --git a/src/proto_alpha/lib_delegate/baking_highwatermarks.ml b/src/proto_alpha/lib_delegate/baking_highwatermarks.ml index d4e3201795c8..695d348e3e79 100644 --- a/src/proto_alpha/lib_delegate/baking_highwatermarks.ml +++ b/src/proto_alpha/lib_delegate/baking_highwatermarks.ml @@ -123,7 +123,7 @@ type highwatermarks = { type t = highwatermarks -let encoding ~use_legacy_attestation_name = +let encoding = let open Data_encoding in conv (fun {blocks; preattestations; attestations} -> @@ -132,32 +132,8 @@ let encoding ~use_legacy_attestation_name = {blocks; preattestations; attestations}) (obj3 (req "blocks" highwatermark_delegate_map_encoding) - (req - (if use_legacy_attestation_name then "preendorsements" - else "preattestations") - highwatermark_delegate_map_encoding) - (req - (if use_legacy_attestation_name then "endorsements" - else "attestations") - highwatermark_delegate_map_encoding)) - -let load_encoding = - let open Data_encoding in - union - [ - case - ~title:"new" - (Tag 0) - (encoding ~use_legacy_attestation_name:false) - Option.some - Fun.id; - case - ~title:"old" - (Tag 1) - (encoding ~use_legacy_attestation_name:true) - Option.some - Fun.id; - ] + (req "preattestations" highwatermark_delegate_map_encoding) + (req "attestations" highwatermark_delegate_map_encoding)) let empty = { @@ -169,16 +145,13 @@ let empty = (* We do not lock these functions. The caller will be already locked. *) let load (cctxt : #Protocol_client_context.full) location : t tzresult Lwt.t = protect (fun () -> - cctxt#load (Baking_files.filename location) load_encoding ~default:empty) + cctxt#load (Baking_files.filename location) encoding ~default:empty) let save_highwatermarks (cctxt : #Protocol_client_context.full) filename highwatermarks : unit tzresult Lwt.t = protect (fun () -> (* TODO: improve the backend so we don't write partial informations *) - cctxt#write - filename - highwatermarks - (encoding ~use_legacy_attestation_name:false)) + cctxt#write filename highwatermarks encoding) let may_sign highwatermarks ~delegate ~level ~round = match DelegateMap.find delegate highwatermarks with -- GitLab