diff --git a/src/proto_alpha/lib_protocol/src/init_storage.ml b/src/proto_alpha/lib_protocol/src/init_storage.ml index c1f3a1a7a..356f0eaa7 100644 --- a/src/proto_alpha/lib_protocol/src/init_storage.ml +++ b/src/proto_alpha/lib_protocol/src/init_storage.ml @@ -43,43 +43,7 @@ let prepare_first_block ctxt ~typecheck ~level ~timestamp ~fitness = Vote_storage.init ctxt >>=? fun ctxt -> Storage.Last_block_priority.init ctxt 0 >>=? fun ctxt -> return ctxt - | Alpha_002 -> - Storage.Delegates.fold ctxt ~init:(Ok ctxt) ~f:begin fun delegate ctxt -> - Lwt.return ctxt >>=? fun ctxt -> - Storage.Contract.Inactive_delegate.mem ctxt - (Contract_repr.implicit_contract delegate) >>= fun inactive -> - if inactive then - return ctxt - else - Storage.Roll.Delegate_roll_list.get_option ctxt delegate >>=? function - | None -> - return ctxt - | Some _ -> - Storage.Active_delegates_with_rolls.add ctxt delegate >>= fun ctxt -> - return ctxt - end >>=? fun ctxt -> - let { Level_repr.cycle = current_cycle } = Raw_context.current_level ctxt in - let { Constants_repr.preserved_cycles } = Raw_context.constants ctxt in - let first_cycle = - match Cycle_repr.sub current_cycle preserved_cycles with - | None -> Cycle_repr.root - | Some first_cycle -> first_cycle in - Storage.Delegates.fold ctxt ~init:(Ok ctxt) ~f:begin fun delegate ctxt -> - Lwt.return ctxt >>=? fun ctxt -> - let rec loop ctxt cycle = - if Cycle_repr.(cycle > current_cycle) then - return ctxt - else - Delegate_storage.has_frozen_balance ctxt delegate cycle >>=? fun has_frozen_balance -> - begin - if has_frozen_balance then - Storage.Delegates_with_frozen_balance.add (ctxt, cycle) delegate - else - Lwt.return ctxt - end >>= fun ctxt -> - loop ctxt (Cycle_repr.succ cycle) in - loop ctxt first_cycle - end >>=? fun ctxt -> + | Alpha_previous -> return ctxt let prepare ctxt ~level ~timestamp ~fitness = diff --git a/src/proto_alpha/lib_protocol/src/raw_context.ml b/src/proto_alpha/lib_protocol/src/raw_context.ml index 5730188ea..257fd0819 100644 --- a/src/proto_alpha/lib_protocol/src/raw_context.ml +++ b/src/proto_alpha/lib_protocol/src/raw_context.ml @@ -318,7 +318,7 @@ let storage_error err = fail (Storage_error err) (* This key should always be populated for every version of the protocol. It's absence meaning that the context is empty. *) let version_key = ["version"] -let version_value = "alpha_003" +let version_value = "alpha_current" let version = "v1" let first_level_key = [ version ; "first_level" ] @@ -462,7 +462,7 @@ let prepare ~level ~timestamp ~fitness ctxt = type 'a previous_protocol = | Genesis of 'a - | Alpha_002 + | Alpha_previous let check_first_block ctxt = Context.get ctxt version_key >>= function @@ -474,22 +474,23 @@ let check_first_block ctxt = failwith "Internal error: previously initialized context." else if Compare.String.(s = "genesis") then return (Genesis ()) - else if Compare.String.(s = "alpha_002") then - return Alpha_002 + else if Compare.String.(s = "alpha_previous") then + return Alpha_previous else storage_error (Incompatible_protocol_version s) let prepare_first_block ~level ~timestamp ~fitness ctxt = check_first_block ctxt >>=? fun previous_protocol -> - begin match previous_protocol with + begin + match previous_protocol with | Genesis () -> Lwt.return (Raw_level_repr.of_int32 level) >>=? fun first_level -> get_proto_param ctxt >>=? fun (param, ctxt) -> set_first_level ctxt first_level >>=? fun ctxt -> set_constants ctxt param.constants >>= fun ctxt -> return (Genesis param, ctxt) - | Alpha_002 -> - return (Alpha_002, ctxt) + | Alpha_previous -> + return (Alpha_previous, ctxt) end >>=? fun (previous_proto, ctxt) -> Context.set ctxt version_key (MBytes.of_string version_value) >>= fun ctxt -> diff --git a/src/proto_alpha/lib_protocol/src/raw_context.mli b/src/proto_alpha/lib_protocol/src/raw_context.mli index 10ce3fa66..940d00abc 100644 --- a/src/proto_alpha/lib_protocol/src/raw_context.mli +++ b/src/proto_alpha/lib_protocol/src/raw_context.mli @@ -60,7 +60,7 @@ val prepare: type 'a previous_protocol = | Genesis of 'a - | Alpha_002 + | Alpha_previous val prepare_first_block: level:int32 ->