diff --git a/src/proto_alpha/lib_protocol/operation_repr.ml b/src/proto_alpha/lib_protocol/operation_repr.ml index 7800df44295d1600d33d1bf73aeee9e2f6fc1f1a..5fcefe0170e9e7677360c34fed80bc7f57e3070a 100644 --- a/src/proto_alpha/lib_protocol/operation_repr.ml +++ b/src/proto_alpha/lib_protocol/operation_repr.ml @@ -1112,9 +1112,7 @@ module Encoding = struct obj3 (req "rollup" Sc_rollup_repr.encoding) (req "opponent" Sc_rollup_repr.Staker.encoding) - (req - "refutation" - (option Sc_rollup_game_repr.refutation_encoding)); + (opt "refutation" Sc_rollup_game_repr.refutation_encoding); select = (function | Manager (Sc_rollup_refute _ as op) -> Some op | _ -> None); diff --git a/src/proto_alpha/lib_protocol/sc_rollup_errors.ml b/src/proto_alpha/lib_protocol/sc_rollup_errors.ml index e5dc0c84f84bd1de44052d8cef892ada2ef78cdd..0e66e086f5368ef56c2a52d56c96bc8eb62792b4 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_errors.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_errors.ml @@ -256,11 +256,11 @@ let () = Data_encoding.empty (function Sc_rollup_not_staked_on_lcc -> Some () | _ -> None) (fun () -> Sc_rollup_not_staked_on_lcc) ; - let description = "Parent is not cemented." in + let description = "Parent is not the last cemented commitment." in register_error_kind `Temporary ~id:"Sc_rollup_parent_not_lcc" - ~title:"Parent not cemented" + ~title:"Parent is not the last cemented commitment" ~description ~pp:(fun ppf () -> Format.fprintf ppf "%s" description) Data_encoding.empty diff --git a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml index 03b63228744c5cc61c426edffdf2b4cb969c5b91..6109671ffb0a83f4f19cbe16caa32ea2aa3fd4f7 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_game_repr.ml @@ -109,7 +109,7 @@ module V1 = struct (fun {state_hash; tick} -> (state_hash, tick)) (fun (state_hash, tick) -> {state_hash; tick}) (obj2 - (req "state" (option State_hash.encoding)) + (opt "state" State_hash.encoding) (req "tick" Sc_rollup_tick_repr.encoding))) let encoding = diff --git a/tezt/lib_tezos/client.ml b/tezt/lib_tezos/client.ml index 7e5c355679473a7f0b99743a4173e95ea36c102f..b48b946ddc9f24ec9fac7cd1dbdd0d006a4ab1bf 100644 --- a/tezt/lib_tezos/client.ml +++ b/tezt/lib_tezos/client.ml @@ -1705,20 +1705,20 @@ module Sc_rollup = struct let parse process = Process.check process in {value = process; run = parse} - let spawn_cement_commitment ?hooks ?(wait = "none") ?burn_cap ~hash ~src ~dst - client = - spawn_command - ?hooks - client - (["--wait"; wait] - @ ["cement"; "commitment"; hash; "from"; src; "for"; "sc"; "rollup"; dst] - @ optional_arg "burn-cap" Tez.to_string burn_cap) - - let cement_commitment ?hooks ?wait ?burn_cap ~hash ~src ~dst client = + let cement_commitment ?hooks ?(wait = "none") ?burn_cap ~hash ~src ~dst client + = let process = - spawn_cement_commitment ?hooks ?wait ?burn_cap ~hash ~src ~dst client + spawn_command + ?hooks + client + (["--wait"; wait] + @ [ + "cement"; "commitment"; hash; "from"; src; "for"; "sc"; "rollup"; dst; + ] + @ optional_arg "burn-cap" Tez.to_string burn_cap) in - Process.check process + let parse process = Process.check process in + {value = process; run = parse} let submit_recover_bond ?(wait = "none") ?burn_cap ?storage_limit ?fee ?hooks ~rollup ~src client = diff --git a/tezt/lib_tezos/client.mli b/tezt/lib_tezos/client.mli index 298417903ac3b14104ab68b78b4ce9e57711b434..68267fa3fe00f96197ebc9a4bd786de00e15387a 100644 --- a/tezt/lib_tezos/client.mli +++ b/tezt/lib_tezos/client.mli @@ -1280,18 +1280,7 @@ module Sc_rollup : sig src:string -> dst:string -> t -> - unit Lwt.t - - (** Same as [cement_commitment], but do not wait for the process to exit. *) - val spawn_cement_commitment : - ?hooks:Process.hooks -> - ?wait:string -> - ?burn_cap:Tez.t -> - hash:string -> - src:string -> - dst:string -> - t -> - Process.t + unit Runnable.process (** Run [tezos-client submit sc rollup recover bond to from ]. *) val submit_recover_bond : diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 88eb31b37057135a1bc28525e051a74689e908a6..bc6531344dc9d858be26fe3557fe10f1e111335e 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -212,16 +212,17 @@ let first_published_at_level (_hash, (_ : Sc_rollup_client.commitment), level) = let predecessor (_hash, {Sc_rollup_client.predecessor; _}, _level) = predecessor -let cement_commitment client ~sc_rollup ~hash = - let* () = - Client.Sc_rollup.cement_commitment - ~hooks - ~src:"bootstrap1" - ~dst:sc_rollup - ~hash - client - in - Client.bake_for_and_wait client +let cement_commitment ?(src = "bootstrap1") ?fail ~sc_rollup ~hash client = + let p = + Client.Sc_rollup.cement_commitment ~hooks ~dst:sc_rollup ~src ~hash client + in + match fail with + | None -> + let*! () = p in + Client.bake_for_and_wait client + | Some failure -> + let*? process = p in + Process.check_error ~msg:(rex failure) process let publish_commitment ?(src = Constant.bootstrap1.public_key_hash) ~commitment client sc_rollup = @@ -1906,16 +1907,16 @@ let test_rollup_client_list_keys = pp maybe_keys) -let publish_dummy_commitment ~inbox_level ~predecessor ~sc_rollup ~src client = +let publish_dummy_commitment ?(number_of_ticks = 1) ~inbox_level ~predecessor + ~sc_rollup ~src client = let commitment : Sc_rollup_client.commitment = { compressed_state = Constant.sc_rollup_compressed_state; inbox_level; predecessor; - number_of_ticks = 1; + number_of_ticks; } in - let*! () = publish_commitment ~src ~commitment client sc_rollup in Client.bake_for_and_wait client