From 55677c6affbdf7e9d4bb2ff700dff2c771dbc754 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 12 Oct 2022 19:29:27 +0200 Subject: [PATCH 1/4] Proto/DAL: fix ignored context --- src/proto_alpha/lib_protocol/sc_rollup_storage.ml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_storage.ml index ec7e3384f17e..931adb6a5e32 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_storage.ml @@ -227,7 +227,7 @@ module Dal_slot = struct let open Lwt_tzresult_syntax in let* _slot_index = fail_if_slot_index_invalid ctxt slot_index in (* Check if the rollup exists by looking for the initial level *) - let* _initial_level = genesis_info ctxt rollup in + let* ctxt, _initial_level = genesis_info ctxt rollup in let {Level_repr.level; _} = Raw_context.current_level ctxt in let* subscribed_slots = subscribed_slots_at_level ctxt rollup level in let*? slot_already_subscribed = @@ -264,7 +264,7 @@ module Dal_slot = struct in let open Lwt_tzresult_syntax in (* Check if the rollup exists by looking for the initial level *) - let* _initial_level = genesis_info ctxt rollup in + let* ctxt, _initial_level = genesis_info ctxt rollup in let* subscribed_slots = subscribed_slots_at_level ctxt rollup level in let*? result = to_dal_slot_index_list subscribed_slots in return result -- GitLab From cbe6cb579e67f668581cca1da02a6185601a6088 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 12 Oct 2022 19:30:05 +0200 Subject: [PATCH 2/4] Proto/Michelson: remove useless ignored value --- src/proto_alpha/lib_protocol/script_interpreter_logging.ml | 1 - 1 file changed, 1 deletion(-) diff --git a/src/proto_alpha/lib_protocol/script_interpreter_logging.ml b/src/proto_alpha/lib_protocol/script_interpreter_logging.ml index d09762eca53a..4822a9d5fb26 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter_logging.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter_logging.ml @@ -1737,7 +1737,6 @@ let log_entry logger ctxt gas k sty accu stack = logger.log_entry k ctxt (kinstr_location k) sty (accu, stack) let log_exit logger ctxt gas loc_prev k sty accu stack = - let _loc = kinstr_location k in let ctxt = Local_gas_counter.update_context gas ctxt in logger.log_exit k ctxt loc_prev sty (accu, stack) -- GitLab From 265a50c977867a62d463cfb5363dc771210a26f4 Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 12 Oct 2022 19:30:29 +0200 Subject: [PATCH 3/4] Proto: do not ignore unit --- src/proto_alpha/lib_protocol/merkle_list.ml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/proto_alpha/lib_protocol/merkle_list.ml b/src/proto_alpha/lib_protocol/merkle_list.ml index 9f9aaa0c6da9..bc41e7f1651a 100644 --- a/src/proto_alpha/lib_protocol/merkle_list.ml +++ b/src/proto_alpha/lib_protocol/merkle_list.ml @@ -31,7 +31,7 @@ let max_depth ~count_limit = let log2 n = Z.numbits (Z.of_int n) in log2 count_limit -let _ = +let () = register_error_kind `Temporary ~id:"Merkle_list_invalid_position" -- GitLab From c83d75d0168882c0066e3e9456de8c176319cabe Mon Sep 17 00:00:00 2001 From: Mehdi Bouaziz Date: Wed, 12 Oct 2022 19:30:45 +0200 Subject: [PATCH 4/4] Proto: add types to ignored values --- src/proto_alpha/lib_protocol/dal_slot_repr.ml | 4 ++-- src/proto_alpha/lib_protocol/sc_rollup_arith.ml | 6 +++--- src/proto_alpha/lib_protocol/sc_rollup_storage.ml | 4 +++- src/proto_alpha/lib_protocol/script_interpreter_defs.ml | 5 +++-- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/src/proto_alpha/lib_protocol/dal_slot_repr.ml b/src/proto_alpha/lib_protocol/dal_slot_repr.ml index f467d706a268..515927adb828 100644 --- a/src/proto_alpha/lib_protocol/dal_slot_repr.ml +++ b/src/proto_alpha/lib_protocol/dal_slot_repr.ml @@ -230,7 +230,7 @@ module History = struct end module Content_prefix = struct - let _prefix = "dash1" + let (_prefix : string) = "dash1" (* 32 *) let b58check_prefix = "\002\224\072\094\219" (* dash1(55) *) @@ -248,7 +248,7 @@ module History = struct (* Pointers of the skip lists are used to encode the content and the backpointers. *) module Pointer_prefix = struct - let _prefix = "dask1" + let (_prefix : string) = "dask1" (* 32 *) let b58check_prefix = "\002\224\072\115\035" (* dask1(55) *) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index 2bf84893ec42..2449001859ca 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -1047,7 +1047,7 @@ module Make (Context : P) : let parse : unit t = let open Monad.Syntax in let produce_add = - let* _ = lexeme in + let* (_ : string) = lexeme in let* () = next_char in let* () = Code.inject IAdd in return () @@ -1111,12 +1111,12 @@ module Make (Context : P) : | Some (' ' | '\n') -> next_char | Some '+' -> produce_add | Some d when is_digit d -> - let* _ = lexeme in + let* (_ : string) = lexeme in let* () = next_char in let* () = Parser_state.set ParseInt in return () | Some d when is_letter d -> - let* _ = lexeme in + let* (_ : string) = lexeme in let* () = next_char in let* () = Parser_state.set ParseVar in return () diff --git a/src/proto_alpha/lib_protocol/sc_rollup_storage.ml b/src/proto_alpha/lib_protocol/sc_rollup_storage.ml index 931adb6a5e32..d6f35b9efccd 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_storage.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_storage.ml @@ -225,7 +225,9 @@ module Dal_slot = struct let subscribe ctxt rollup ~slot_index = let open Lwt_tzresult_syntax in - let* _slot_index = fail_if_slot_index_invalid ctxt slot_index in + let* (_slot_index : Dal_slot_repr.Index.t) = + fail_if_slot_index_invalid ctxt slot_index + in (* Check if the rollup exists by looking for the initial level *) let* ctxt, _initial_level = genesis_info ctxt rollup in let {Level_repr.level; _} = Raw_context.current_level ctxt in diff --git a/src/proto_alpha/lib_protocol/script_interpreter_defs.ml b/src/proto_alpha/lib_protocol/script_interpreter_defs.ml index 08e3ef4451cc..0a87b0a38213 100644 --- a/src/proto_alpha/lib_protocol/script_interpreter_defs.ml +++ b/src/proto_alpha/lib_protocol/script_interpreter_defs.ml @@ -136,7 +136,7 @@ let cost_of_instr : type a s r f. (a, s, r, f) kinstr -> a -> s -> Gas.cost = let ss = accu in Interp_costs.concat_string_precheck ss | ISlice_string _ -> - let _offset = accu in + let (_offset : Script_int.n Script_int.num) = accu in let _length, (s, _) = stack in Interp_costs.slice_string s | IConcat_bytes_pair _ -> @@ -353,7 +353,8 @@ let cost_of_instr : type a s r f. (a, s, r, f) kinstr -> a -> s -> Gas.cost = | ITicket _ | ITicket_deprecated _ -> Interp_costs.ticket | IRead_ticket _ -> Interp_costs.read_ticket | IOpen_chest _ -> - let _chest_key = accu and chest, (time, _) = stack in + let (_chest_key : Script_timelock.chest_key) = accu + and chest, (time, _) = stack in Interp_costs.open_chest ~chest ~time:(Script_int.to_zint time) | IEmit _ -> Interp_costs.emit | ILog _ -> Gas.free -- GitLab