From ea7722183cf09d4bccc1e15fd45a0b93ad9e7854 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Fri, 18 Nov 2022 15:15:27 +0100 Subject: [PATCH 01/17] Proto,SCORU: Clean up error registration of WASM PVM Errors were not registered. Signed-off-by: Yann Regis-Gianas --- .../lib_protocol/sc_rollup_wasm.ml | 53 +++++++++++++++---- 1 file changed, 43 insertions(+), 10 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index a8c4184ee494..fa99cc42fb8b 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -24,6 +24,47 @@ (* *) (*****************************************************************************) +type error += WASM_proof_verification_failed + +type error += WASM_proof_production_failed + +type error += WASM_output_proof_production_failed + +type error += WASM_invalid_claim_about_outbox + +let () = + let open Data_encoding in + let msg = "Invalid claim about outbox" in + register_error_kind + `Permanent + ~id:"sc_rollup_wasm_invalid_claim_about_outbox" + ~title:msg + ~pp:(fun fmt () -> Format.pp_print_string fmt msg) + ~description:msg + unit + (function WASM_invalid_claim_about_outbox -> Some () | _ -> None) + (fun () -> WASM_invalid_claim_about_outbox) ; + let msg = "Output proof production failed" in + register_error_kind + `Permanent + ~id:"sc_rollup_wasm_output_proof_production_failed" + ~title:msg + ~pp:(fun fmt () -> Format.fprintf fmt "%s" msg) + ~description:msg + unit + (function WASM_output_proof_production_failed -> Some () | _ -> None) + (fun () -> WASM_output_proof_production_failed) ; + let msg = "Proof production failed" in + register_error_kind + `Permanent + ~id:"sc_rollup_wasm_proof_production_failed" + ~title:msg + ~pp:(fun fmt () -> Format.fprintf fmt "%s" msg) + ~description:msg + unit + (function WASM_proof_production_failed -> Some () | _ -> None) + (fun () -> WASM_proof_production_failed) + module V2_0_0 = struct (* This is the state hash of reference that both the prover of the @@ -340,8 +381,6 @@ module V2_0_0 = struct in return (state, request) - type error += WASM_proof_verification_failed - let verify_proof input_given proof = let open Lwt_result_syntax in let*! result = Context.verify_proof proof (step_transition input_given) in @@ -349,8 +388,6 @@ module V2_0_0 = struct | None -> tzfail WASM_proof_verification_failed | Some (_state, request) -> return request - type error += WASM_proof_production_failed - let produce_proof context input_given state = let open Lwt_result_syntax in let*! result = @@ -438,10 +475,6 @@ module V2_0_0 = struct let* result = Context.verify_proof p.output_proof transition in match result with None -> return false | Some _ -> return true - type error += Wasm_output_proof_production_failed - - type error += Wasm_invalid_claim_about_outbox - let produce_output_proof context state output_proof_output = let open Lwt_result_syntax in let*! output_proof_state = state_hash state in @@ -453,8 +486,8 @@ module V2_0_0 = struct match result with | Some (output_proof, true) -> return {output_proof; output_proof_state; output_proof_output} - | Some (_, false) -> fail Wasm_invalid_claim_about_outbox - | None -> fail Wasm_output_proof_production_failed + | Some (_, false) -> fail WASM_invalid_claim_about_outbox + | None -> fail WASM_output_proof_production_failed module Internal_for_tests = struct let insert_failure state = -- GitLab From 365807a0344a818e5ba5c905abd1f02e6e244a9a Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Fri, 18 Nov 2022 15:20:38 +0100 Subject: [PATCH 02/17] Proto,SCORU: Make Arith PVM handle hex-encoded internal messages Signed-off-by: Yann Regis-Gianas --- src/proto_alpha/lib_protocol/sc_rollup_arith.ml | 4 +++- .../lib_protocol/test/unit/test_sc_rollup_arith.ml | 4 ++-- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index 6be368695bad..c6eeea24414a 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -952,7 +952,9 @@ module Make (Context : P) : match metadata with | Some {address; _} when Address.(destination = address) -> ( match Micheline.root payload with - | String (_, payload) -> return (Some payload) + | Bytes (_, payload) -> + let payload = Bytes.to_string payload in + return (Some payload) | _ -> return None) | _ -> return None) | Ok (Internal Start_of_level) -> diff --git a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml index 97102e99436b..0da9f177af53 100644 --- a/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/test/unit/test_sc_rollup_arith.ml @@ -455,12 +455,12 @@ let dummy_internal_transfer address = (Tezos_crypto.Signature.Public_key_hash.of_b58check "tz1RjtZUVeLhADFHDL8UwDZA6vjWWhojpu5w") in - let*? payload = Environment.wrap_tzresult (Script_string.of_string "foo") in + let payload = Bytes.of_string "foo" in let* payload, _ctxt = Script_ir_translator.unparse_data ctxt Script_ir_unparser.Optimized - String_t + Bytes_t payload >|= Environment.wrap_tzresult in -- GitLab From 00e146bb7bb426586374d28d8916fa7c5b02ce47 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 15 Nov 2022 08:39:33 +0100 Subject: [PATCH 03/17] Tezt: Make tezt aware of rich rollup client rpc command Signed-off-by: Yann Regis-Gianas --- tezt/lib_tezos/sc_rollup_client.ml | 12 ++++++++++++ tezt/lib_tezos/sc_rollup_client.mli | 9 +++++++++ 2 files changed, 21 insertions(+) diff --git a/tezt/lib_tezos/sc_rollup_client.ml b/tezt/lib_tezos/sc_rollup_client.ml index f8ef977e0d00..c4ed70d3f7fb 100644 --- a/tezt/lib_tezos/sc_rollup_client.ml +++ b/tezt/lib_tezos/sc_rollup_client.ml @@ -195,6 +195,18 @@ let rpc_post ?hooks sc_client path data = |> Runnable.map @@ fun output -> JSON.parse ~origin:(Client.string_of_path path ^ " response") output +let rpc_get_rich ?hooks sc_client path parameters = + let parameters = + if parameters = [] then "" + else + "?" ^ String.concat "&" + @@ List.map (fun (k, v) -> Format.asprintf "%s=%s" k v) parameters + in + let uri = Client.string_of_path path ^ parameters in + let process = spawn_command ?hooks sc_client ["rpc"; "get"; uri] in + let* output = Process.check_and_read_stdout process in + return (JSON.parse ~origin:(Client.string_of_path path ^ " response") output) + let ticks ?hooks ?(block = "head") sc_client = let res = rpc_get ?hooks sc_client ["global"; "block"; block; "ticks"] in Runnable.map JSON.as_int res diff --git a/tezt/lib_tezos/sc_rollup_client.mli b/tezt/lib_tezos/sc_rollup_client.mli index 3cb0fd6372b1..ab28af6fa0ff 100644 --- a/tezt/lib_tezos/sc_rollup_client.mli +++ b/tezt/lib_tezos/sc_rollup_client.mli @@ -67,6 +67,15 @@ val rpc_get : val rpc_post : ?hooks:Process.hooks -> t -> Client.path -> JSON.t -> JSON.t Runnable.process +(** [rpc_get_rich client path parameters] issues a GET request for [path] + passing [parameters]. *) +val rpc_get_rich : + ?hooks:Process.hooks -> + t -> + Client.path -> + (string * string) list -> + JSON.t Lwt.t + (** [total_ticks ?block client] gets the total number of ticks for the PVM. *) val total_ticks : ?hooks:Process.hooks -> ?block:string -> t -> int Runnable.process -- GitLab From 21c7734828588311fd78a7329d485fc3034063b5 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 15 Nov 2022 08:41:47 +0100 Subject: [PATCH 04/17] SCORU: Extend get_outbox with outbox_level parameter Signed-off-by: Yann Regis-Gianas --- .../bin_sc_rollup_node/RPC_server.ml | 4 ++-- src/proto_alpha/bin_sc_rollup_node/pvm.ml | 6 +++--- .../lib_protocol/alpha_context.mli | 4 ++-- .../lib_protocol/sc_rollup_arith.ml | 10 ++++++++-- .../lib_protocol/sc_rollup_arith.mli | 6 ++++-- .../lib_protocol/sc_rollup_wasm.ml | 6 +++--- .../lib_protocol/sc_rollup_wasm.mli | 6 ++++-- .../lib_sc_rollup/sc_rollup_services.ml | 19 +++++++++++++++++-- tezt/lib_tezos/sc_rollup_client.ml | 9 +++++++-- tezt/lib_tezos/sc_rollup_client.mli | 8 ++++---- tezt/tests/sc_rollup.ml | 8 ++++---- 11 files changed, 58 insertions(+), 28 deletions(-) diff --git a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml index 5be7b9fbcd22..151379a223ac 100644 --- a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml @@ -388,10 +388,10 @@ module Make (Simulation : Simulation.S) (Batcher : Batcher.S) = struct let () = Block_directory.register0 Sc_rollup_services.Global.Block.outbox - @@ fun (node_ctxt, block) () () -> + @@ fun (node_ctxt, block) outbox_level () -> let open Lwt_result_syntax in let* state = get_state node_ctxt block in - let*! outbox = PVM.get_outbox state in + let*! outbox = PVM.get_outbox outbox_level state in return outbox let () = diff --git a/src/proto_alpha/bin_sc_rollup_node/pvm.ml b/src/proto_alpha/bin_sc_rollup_node/pvm.ml index 37a10fcf3229..566c49e1d52e 100644 --- a/src/proto_alpha/bin_sc_rollup_node/pvm.ml +++ b/src/proto_alpha/bin_sc_rollup_node/pvm.ml @@ -49,9 +49,9 @@ module type S = sig (** [string_of_status status] returns a string representation of [status]. *) val string_of_status : status -> string - (** [get_outbox state] returns a list of outputs available in the - outbox of [state]. *) - val get_outbox : state -> Sc_rollup.output list Lwt.t + (** [get_outbox outbox_level state] returns a list of outputs + available in the outbox of [state] at a given [outbox_level]. *) + val get_outbox : Raw_level.t -> state -> Sc_rollup.output list Lwt.t (** [eval_many ~max_steps s0] returns a state [s1] resulting from the execution of up to [~max_steps] steps of the rollup at state [s0]. *) diff --git a/src/proto_alpha/lib_protocol/alpha_context.mli b/src/proto_alpha/lib_protocol/alpha_context.mli index 6f0c6573d7bd..7b43a2d5907a 100644 --- a/src/proto_alpha/lib_protocol/alpha_context.mli +++ b/src/proto_alpha/lib_protocol/alpha_context.mli @@ -3661,7 +3661,7 @@ module Sc_rollup : sig val get_status : state -> status Lwt.t - val get_outbox : state -> output list Lwt.t + val get_outbox : Raw_level.t -> state -> output list Lwt.t end val reference_initial_state_hash : State_hash.t @@ -3716,7 +3716,7 @@ module Sc_rollup : sig val get_status : state -> status Lwt.t - val get_outbox : state -> output list Lwt.t + val get_outbox : Raw_level.t -> state -> output list Lwt.t val produce_proof : context -> input option -> state -> proof tzresult Lwt.t diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index c6eeea24414a..e125d9a72c21 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -136,7 +136,8 @@ module type S = sig val get_status : state -> status Lwt.t - val get_outbox : state -> Sc_rollup_PVM_sig.output list Lwt.t + val get_outbox : + Raw_level_repr.t -> state -> Sc_rollup_PVM_sig.output list Lwt.t type instruction = | IPush : int -> instruction @@ -914,9 +915,14 @@ module Make (Context : P) : let get_status = result_of ~default:Waiting_for_input_message @@ Status.get - let get_outbox state = + let get_outbox outbox_level state = let open Lwt_syntax in let+ entries = result_of ~default:[] Output.entries state in + let entries = + List.filter + (fun (_, msg) -> Raw_level_repr.(msg.PS.outbox_level = outbox_level)) + entries + in List.map snd entries let get_code = result_of ~default:[] @@ Code.to_list diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli index 4b8ba4520ab7..0983dd3a9587 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.mli @@ -102,8 +102,10 @@ module type S = sig (** [get_status state] returns the machine status in [state]. *) val get_status : state -> status Lwt.t - (** [get_outbox state] returns the outbox in [state]. *) - val get_outbox : state -> Sc_rollup_PVM_sig.output list Lwt.t + (** [get_outbox outbox_level state] returns the outbox in [state] + for a given [outbox_level]. *) + val get_outbox : + Raw_level_repr.t -> state -> Sc_rollup_PVM_sig.output list Lwt.t (** The machine has only three instructions. *) type instruction = diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index fa99cc42fb8b..c4add6d00e84 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -142,7 +142,8 @@ module V2_0_0 = struct (** [get_status state] gives you the current execution status for the PVM. *) val get_status : state -> status Lwt.t - val get_outbox : state -> Sc_rollup_PVM_sig.output list Lwt.t + val get_outbox : + Raw_level_repr.t -> state -> Sc_rollup_PVM_sig.output list Lwt.t end (* [Make (Make_backend) (Context)] creates a PVM. @@ -317,9 +318,8 @@ module V2_0_0 = struct let get_status : state -> status Lwt.t = result_of get_status - let get_outbox _state = + let get_outbox outbox_level state = (* FIXME: https://gitlab.com/tezos/tezos/-/issues/3790 *) - let open Lwt_syntax in return [] let set_input_state input = diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli b/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli index 20268f7c386b..3d42188d8863 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli @@ -61,8 +61,10 @@ module V2_0_0 : sig (** [get_status state] gives you the current execution status for the PVM. *) val get_status : state -> status Lwt.t - (** [get_outbox state] returns the outbox in [state]. *) - val get_outbox : state -> Sc_rollup_PVM_sig.output list Lwt.t + (** [get_outbox outbox_level state] returns the outbox in [state] + for a given [outbox_level]. *) + val get_outbox : + Raw_level_repr.t -> state -> Sc_rollup_PVM_sig.output list Lwt.t end module type P = sig diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml index 660d1a615e87..aabb1020d2b1 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml @@ -475,10 +475,25 @@ module Global = struct ~output:Data_encoding.string (path / "status") + let outbox_level_query = + let open Tezos_rpc.Query in + query (fun outbox_level -> + let req name f = function + | None -> + raise + (Invalid + (Format.sprintf "Query parameter %s is required" name)) + | Some arg -> f arg + in + req "outbox_level" Raw_level.of_int32_exn outbox_level) + |+ opt_field "outbox_level" Tezos_rpc.Arg.int32 (fun o -> + Some (Raw_level.to_int32 o)) + |> seal + let outbox = Tezos_rpc.Service.get_service - ~description:"Outbox at block" - ~query:Tezos_rpc.Query.empty + ~description:"Outbox at block for a given outbox level" + ~query:outbox_level_query ~output:Data_encoding.(list Sc_rollup.output_encoding) (path / "outbox") diff --git a/tezt/lib_tezos/sc_rollup_client.ml b/tezt/lib_tezos/sc_rollup_client.ml index c4ed70d3f7fb..196273450bd4 100644 --- a/tezt/lib_tezos/sc_rollup_client.ml +++ b/tezt/lib_tezos/sc_rollup_client.ml @@ -223,8 +223,13 @@ let status ?hooks ?(block = "head") sc_client = rpc_get ?hooks sc_client ["global"; "block"; block; "status"] |> Runnable.map JSON.as_string -let outbox ?hooks ?(block = "cemented") sc_client = - rpc_get ?hooks sc_client ["global"; "block"; block; "outbox"] +let outbox ?hooks ?(block = "cemented") ~outbox_level sc_client = + let open Lwt.Syntax in + rpc_get_rich + ?hooks + sc_client + ["global"; "block"; block; "outbox"] + [("outbox_level", string_of_int outbox_level)] let last_stored_commitment ?hooks sc_client = rpc_get ?hooks sc_client ["global"; "last_stored_commitment"] diff --git a/tezt/lib_tezos/sc_rollup_client.mli b/tezt/lib_tezos/sc_rollup_client.mli index ab28af6fa0ff..cb7324b616b8 100644 --- a/tezt/lib_tezos/sc_rollup_client.mli +++ b/tezt/lib_tezos/sc_rollup_client.mli @@ -103,11 +103,11 @@ val state_value : val status : ?hooks:Process.hooks -> ?block:string -> t -> string Runnable.process -(** [outbox ?block client] gets the rollup outbox for the [block] (default - ["cemented"] which is the block corresponding to the last cemented - level). *) +(** [outbox ?block outbox_level client] gets the rollup outbox of + [outbox_level] as known to the [block] (default ["cemented"] which + is the block corresponding to the last cemented level). *) val outbox : - ?hooks:Process.hooks -> ?block:string -> t -> JSON.t Runnable.process + ?hooks:Process.hooks -> ?block:string -> outbox_level:int -> t -> JSON.t Lwt.t type outbox_proof = {commitment_hash : string; proof : string} diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 6f52454f41ec..b8f9a48049ce 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -3328,7 +3328,7 @@ let test_outbox_message_generic ?regression ?expected_error ~skip ~earliness repeat blocks_to_wait @@ fun () -> Client.bake_for client in let trigger_outbox_message_execution address = - let*! outbox = Sc_rollup_client.outbox sc_client in + let*! outbox = Sc_rollup_client.outbox ~outbox_level:4 sc_client in Log.info "Outbox is %s" (JSON.encode outbox) ; let* answer = let message_index = 0 in @@ -3485,11 +3485,11 @@ let test_rpcs ~kind = sc_client ["global"; "block"; "head"; "state_hash"] in - let*! _outbox = - Sc_rollup_client.rpc_get + let* _outbox = + Sc_rollup_client.outbox ~hooks + ~outbox_level:l2_finalied_block_level sc_client - ["global"; "block"; "head"; "outbox"] in let*! _head = Sc_rollup_client.rpc_get ~hooks sc_client ["global"; "tezos_head"] -- GitLab From a7c3883bbf228a2875c0af972ad09fbf84f8a38e Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 15 Nov 2022 08:42:36 +0100 Subject: [PATCH 05/17] SCORU,WASM: Add get_outbox support in WASM PVM Signed-off-by: Yann Regis-Gianas --- .../lib_protocol/sc_rollup_wasm.ml | 30 +++++++++++++++++-- 1 file changed, 28 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index c4add6d00e84..4a3915cb7425 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -319,8 +319,34 @@ module V2_0_0 = struct let get_status : state -> status Lwt.t = result_of get_status let get_outbox outbox_level state = - (* FIXME: https://gitlab.com/tezos/tezos/-/issues/3790 *) - return [] + let outbox_level_int32 = + Raw_level_repr.to_int32_non_negative outbox_level + in + let open Lwt_syntax in + let rec aux outbox message_index = + let output = + Wasm_2_0_0.{outbox_level = outbox_level_int32; message_index} + in + let* res = WASM_machine.get_output output state in + match res with + | None -> return (List.rev outbox) + | Some msg -> ( + let serialized = + Sc_rollup_outbox_message_repr.unsafe_of_string msg + in + match Sc_rollup_outbox_message_repr.deserialize serialized with + | Error _ -> + (* The [write_output] host function does not guarantee that the contents + of the returned output is a valid encoding of an outbox message. + We choose to ignore such messages. An alternative choice would be to + craft an output with a payload witnessing the illformedness of the + output produced by the kernel. *) + aux outbox (Z.succ message_index) + | Ok message -> + let output = PS.{outbox_level; message_index; message} in + aux (output :: outbox) (Z.succ message_index)) + in + aux [] Z.zero let set_input_state input = let open Monad.Syntax in -- GitLab From 1427a7b8978f870bbd44c6a5ac9243271c157749 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 15 Nov 2022 13:54:01 +0100 Subject: [PATCH 06/17] SCORU,Tezt: Extend outbox message tests to WASM Signed-off-by: Yann Regis-Gianas --- .../test/integration/wasm_kernel/echo.wasm | Bin 0 -> 403 bytes tezt/lib_tezos/sc_rollup_client.ml | 15 ++ tezt/lib_tezos/sc_rollup_client.mli | 9 + tezt/tests/sc_rollup.ml | 207 ++++++++++++++---- 4 files changed, 190 insertions(+), 41 deletions(-) create mode 100644 src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wasm diff --git a/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wasm b/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wasm new file mode 100644 index 0000000000000000000000000000000000000000..be9e1532645971b3d674034c3013149d4a632836 GIT binary patch literal 403 zcmZQbEY4+QU|?X>WKUqJudlCXtWRJ9ldK>fh|5^dkiZCHFxA&HBrq^A#W4#M<>%y- z7Q`1PrlrOw=NF}N6{RMo#AoIel$J0sV94^67iE^D#^;xofaDo5l~j0#NdEDnxO7#xKh89)?+0Fx9qHwS|PgX0l~Y;I3RmU_oO5XFxF7<3sJ6qzA< zSrixrSQJ?mSQMDtSR51>9NDuJSOplRKqAZ#5ymV9Mn}eM0Y)iqZf*re#(Kv)jE)}| z9b1?jC&&meC^9& YMh3@UAexE6@ehb*U~v4$z|F`A0E`@6Z~y=R literal 0 HcmV?d00001 diff --git a/tezt/lib_tezos/sc_rollup_client.ml b/tezt/lib_tezos/sc_rollup_client.ml index 196273450bd4..403a2d68544f 100644 --- a/tezt/lib_tezos/sc_rollup_client.ml +++ b/tezt/lib_tezos/sc_rollup_client.ml @@ -182,6 +182,21 @@ let outbox_proof_single ?hooks ?expected_error ?entrypoint sc_client ~outbox_level [{destination; entrypoint; parameters}] +let encode_batch ?hooks ?expected_error sc_client batch = + let process = + spawn_command + ?hooks + sc_client + ["encode"; "outbox"; "message"; string_of_batch batch] + in + match expected_error with + | None -> + let* answer = Process.check_and_read_stdout process in + return (Some (String.trim answer)) + | Some msg -> + let* () = Process.check_error ~msg process in + return None + let rpc_get ?hooks sc_client path = spawn_command ?hooks sc_client ["rpc"; "get"; Client.string_of_path path] |> Runnable.map @@ fun output -> diff --git a/tezt/lib_tezos/sc_rollup_client.mli b/tezt/lib_tezos/sc_rollup_client.mli index cb7324b616b8..b49c6fc93eb2 100644 --- a/tezt/lib_tezos/sc_rollup_client.mli +++ b/tezt/lib_tezos/sc_rollup_client.mli @@ -143,6 +143,15 @@ val outbox_proof_batch : transaction list -> outbox_proof option Lwt.t +(** [encode_batch batch] returns the encoding of a [batch] of output + transactions. *) +val encode_batch : + ?hooks:Process.hooks -> + ?expected_error:Base.rex -> + t -> + transaction list -> + string option Lwt.t + (** [commitment_from_json] parses a commitment from its JSON representation. *) val commitment_from_json : JSON.t -> commitment option diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index b8f9a48049ce..18f99b0e7ff7 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -246,10 +246,15 @@ let wait_for_conflict_detected sc_node = A rollup node has a configuration file that must be initialized. *) -let setup_rollup ~kind ?boot_sector ?(operator = Constant.bootstrap1.alias) - tezos_node tezos_client = +let setup_rollup ~kind ?boot_sector ?(parameters_ty = "string") + ?(operator = Constant.bootstrap1.alias) tezos_node tezos_client = let* sc_rollup = - originate_sc_rollup ~kind ?boot_sector ~src:operator tezos_client + originate_sc_rollup + ~kind + ?boot_sector + ~parameters_ty + ~src:operator + tezos_client in let sc_rollup_node = Sc_rollup_node.create @@ -286,8 +291,9 @@ let test_l1_scenario ?regression ~kind ?boot_sector ?commitment_period scenario sc_rollup tezos_node tezos_client let test_full_scenario ?regression ~kind ?boot_sector ?commitment_period - ?challenge_window ?timeout ?max_number_of_messages_per_commitment_period - {variant; tags; description} scenario = + ?(parameters_ty = "string") ?challenge_window ?timeout + ?max_number_of_messages_per_commitment_period {variant; tags; description} + scenario = let tags = kind :: "rollup_node" :: tags in register_test ?regression @@ -311,7 +317,7 @@ let test_full_scenario ?regression ~kind ?boot_sector ?commitment_period protocol in let* rollup_node, rollup_client, sc_rollup = - setup_rollup ~kind ?boot_sector tezos_node tezos_client + setup_rollup ~parameters_ty ~kind ?boot_sector tezos_node tezos_client in scenario rollup_node rollup_client sc_rollup tezos_node tezos_client @@ -3261,23 +3267,31 @@ let test_refutation_reward_and_punishment ~kind = The input depends on the PVM. *) -let test_outbox_message_generic ?regression ?expected_error ~skip ~earliness - ?entrypoint ~input_message ~expected_storage ~kind = +let test_outbox_message_generic ?regression ?expected_error ~earliness + ?entrypoint ?boot_sector ~input_message ~expected_storage ~kind + ~message_kind = let commitment_period = 2 and challenge_window = 5 in + let message_kind_s = + match message_kind with `Internal -> "internal" | `External -> "external" + in + let entrypoint_s = Option.value ~default:"default" entrypoint in test_full_scenario ?regression + ?boot_sector + ~parameters_ty:"bytes" ~kind ~commitment_period ~challenge_window { - tags = ["outbox"]; + tags = ["outbox"; message_kind_s; entrypoint_s]; variant = Some (Format.sprintf - "entrypoint: %%%s, earliness: %d" - (Option.value ~default:"default" entrypoint) - earliness); - description = "an outbox message should be executable"; + "entrypoint: %%%s, earliness: %d, %s" + entrypoint_s + earliness + message_kind_s); + description = "trigger exec output"; } @@ fun rollup_node sc_client sc_rollup _node client -> let* () = Sc_rollup_node.run rollup_node [] in @@ -3320,19 +3334,75 @@ let test_outbox_message_generic ?regression ?expected_error ~skip ~earliness string ~error_msg:"Invalid contract storage: expecting '%R', got '%L'.") in - let perform_rollup_execution_and_cement address = - let* () = send_text_messages client [input_message address] in + let originate_source_contract () = + let prg = + Format.asprintf + {| + { + parameter (bytes %%default); + storage (unit); + + code + { + CAR; + PUSH address "%s"; + CONTRACT bytes; + IF_NONE { PUSH string "Invalid address"; FAILWITH; } + { + PUSH mutez 0; + DIG 2; + TRANSFER_TOKENS; + NIL operation; + SWAP; + CONS; + PUSH unit Unit; + SWAP; + PAIR; + } + } + } |} + sc_rollup + in + let* address = + Client.originate_contract + ~alias:"source" + ~amount:(Tez.of_int 100) + ~burn_cap:(Tez.of_int 100) + ~src + ~prg + ~init:"Unit" + client + in + let* () = Client.bake_for_and_wait client in + return address + in + let perform_rollup_execution_and_cement source_address target_address = + let* payload = input_message sc_client target_address in + let* () = + match payload with + | `External payload -> send_text_messages client [payload] + | `Internal payload -> + let payload = "0x" ^ payload in + Client.transfer + ~amount:Tez.(of_int 100) + ~burn_cap:Tez.(of_int 100) + ~storage_limit:100000 + ~giver:"bootstrap1" + ~receiver:source_address + ~arg:payload + client + in let blocks_to_wait = 2 + (2 * commitment_period) + challenge_window - earliness in repeat blocks_to_wait @@ fun () -> Client.bake_for client in let trigger_outbox_message_execution address = - let*! outbox = Sc_rollup_client.outbox ~outbox_level:4 sc_client in + let outbox_level = 5 in + let* outbox = Sc_rollup_client.outbox ~outbox_level sc_client in Log.info "Outbox is %s" (JSON.encode outbox) ; let* answer = let message_index = 0 in - let outbox_level = 4 in let destination = address in let parameters = "37" in Sc_rollup_client.outbox_proof_single @@ -3360,36 +3430,56 @@ let test_outbox_message_generic ?regression ?expected_error ~skip ~earliness in Client.bake_for client in - if skip then unit - else - let* target_contract_address = originate_target_contract () in - let* () = perform_rollup_execution_and_cement target_contract_address in - let* () = trigger_outbox_message_execution target_contract_address in - match expected_error with - | None -> - let* () = - check_contract_execution target_contract_address expected_storage - in - unit - | Some _ -> unit + let* target_contract_address = originate_target_contract () in + let* source_contract_address = originate_source_contract () in + let* () = + perform_rollup_execution_and_cement + source_contract_address + target_contract_address + in + let* () = trigger_outbox_message_execution target_contract_address in + match expected_error with + | None -> + let* () = + check_contract_execution target_contract_address expected_storage + in + unit + | Some _ -> unit let test_outbox_message ?regression ?expected_error ~earliness ?entrypoint ~kind - = - let skip, input_message, expected_storage = + ~message_kind = + let wrap payload = + match message_kind with + | `Internal -> `Internal payload + | `External -> `External payload + in + let boot_sector, input_message, expected_storage = match kind with | "arith" -> - ( false, - (fun contract_address -> + let input_message _client contract_address = + let payload = Printf.sprintf "37 %s%s" contract_address - (match entrypoint with Some e -> "%" ^ e | None -> "")), - "37" ) + (match entrypoint with Some e -> "%" ^ e | None -> "") + in + let payload = hex_encode payload in + return @@ wrap payload + in + (None, input_message, "37") | "wasm_2_0_0" -> - (* FIXME: https://gitlab.com/tezos/tezos/-/issues/3790 - For the moment, the WASM PVM has no support for - output. Hence, the storage is unchanged.*) - (true, Fun.const "", "0") + let bootsector = read_kernel "echo" in + let input_message client contract_address = + let transaction = + Sc_rollup_client. + {destination = contract_address; entrypoint; parameters = "37"} + in + let* answer = Sc_rollup_client.encode_batch client [transaction] in + match answer with + | None -> failwith "Encoding of batch should not fail." + | Some answer -> return (wrap answer) + in + (Some bootsector, input_message, "37") | _ -> (* There is no other PVM in the protocol. *) assert false @@ -3397,11 +3487,12 @@ let test_outbox_message ?regression ?expected_error ~earliness ?entrypoint ~kind test_outbox_message_generic ?regression ?expected_error - ~skip ~earliness ?entrypoint + ?boot_sector ~input_message ~expected_storage + ~message_kind ~kind let test_rpcs ~kind = @@ -3615,22 +3706,56 @@ let register ~kind ~protocols = test_reinject_failed_commitment protocols ~kind ; test_late_rollup_node protocols ~kind ; test_interrupt_rollup_node protocols ~kind ; - test_outbox_message ~regression:true ~earliness:0 protocols ~kind ; + test_outbox_message + ~regression:true + ~earliness:0 + ~message_kind:`Internal + ~kind + protocols ; + test_outbox_message + ~regression:true + ~earliness:0 + ~entrypoint:"aux" + ~message_kind:`Internal + protocols + ~kind ; + test_outbox_message + ~expected_error:(Base.rex ".*Invalid claim about outbox") + ~earliness:5 + ~message_kind:`Internal + protocols + ~kind ; + test_outbox_message + ~expected_error:(Base.rex ".*Invalid claim about outbox") + ~earliness:5 + ~entrypoint:"aux" + ~message_kind:`Internal + protocols + ~kind ; + test_outbox_message + ~regression:true + ~earliness:0 + ~message_kind:`External + protocols + ~kind ; test_outbox_message ~regression:true ~earliness:0 ~entrypoint:"aux" + ~message_kind:`External protocols ~kind ; test_outbox_message ~expected_error:(Base.rex ".*Invalid claim about outbox") ~earliness:5 + ~message_kind:`External protocols ~kind ; test_outbox_message ~expected_error:(Base.rex ".*Invalid claim about outbox") ~earliness:5 ~entrypoint:"aux" + ~message_kind:`External protocols ~kind -- GitLab From c3d04388db83b8759be2cc3db633bf1ad97357d3 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 15 Nov 2022 18:20:51 +0100 Subject: [PATCH 07/17] Client: Introduce an hexadecimal format for rollup inbox message Signed-off-by: Yann Regis-Gianas --- .../lib_client/client_proto_args.ml | 14 +++++++++++++- .../client_proto_context_commands.ml | 19 +++++++++++++++++-- tezt/tests/sc_rollup.ml | 12 +++++++++--- 3 files changed, 39 insertions(+), 6 deletions(-) diff --git a/src/proto_alpha/lib_client/client_proto_args.ml b/src/proto_alpha/lib_client/client_proto_args.ml index a6922ece7968..e5077349701f 100644 --- a/src/proto_alpha/lib_client/client_proto_args.ml +++ b/src/proto_alpha/lib_client/client_proto_args.ml @@ -935,7 +935,18 @@ module Sc_rollup_params = struct let messages_parameter = let open Lwt_result_syntax in let from_json text = - try return (`Json (Ezjsonm.from_string text)) + try + match Ezjsonm.from_string text with + | `A messages -> return (`Json (`A (`String "raw" :: messages))) + | _ -> failwith "Expecting a list of string" + with Ezjsonm.Parse_error _ -> + failwith "Given text is not valid JSON: '%s'" text + in + let from_json_hex text = + try + match Ezjsonm.from_string text with + | `A messages -> return (`Json (`A (`String "hex" :: messages))) + | _ -> failwith "Expecting a list of hex-encoded string" with Ezjsonm.Parse_error _ -> failwith "Given text is not valid JSON: '%s'" text in @@ -951,6 +962,7 @@ module Sc_rollup_params = struct Client_aliases.parse_alternatives [ ("text", from_json); + ("hex", from_json_hex); ("file", from_json_file cctxt); ("bin", from_bin_file cctxt); ] diff --git a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml index a61dcada6518..93caa1e848d7 100644 --- a/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml +++ b/src/proto_alpha/lib_client_commands/client_proto_context_commands.ml @@ -3092,7 +3092,8 @@ let commands_rw () = ~name:"messages" ~desc: "The message(s) to be sent to the rollup (syntax: \ - bin:|text:|text:|hex:|file:)." Sc_rollup_params.messages_parameter @@ prefixes ["from"] @@ -3119,7 +3120,21 @@ let commands_rw () = | exception _ -> failwith "Could not read list of messages (expected list of bytes)" - | messages -> return messages) + | "raw" :: messages -> return messages + | "hex" :: messages -> + let* messages = + List.map_es + (fun message -> + match Hex.to_string (`Hex message) with + | None -> + failwith + "'%s' is not a valid hex encoded message" + message + | Some msg -> return [msg]) + messages + in + return @@ List.flatten messages + | _messages -> assert false) in let* _, src_pk, src_sk = Client_keys.get_key cctxt source in let* _res = diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 18f99b0e7ff7..32f3f789314f 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -684,8 +684,14 @@ let to_text_messages_arg msgs = let json = Ezjsonm.list Ezjsonm.string msgs in "text:" ^ Ezjsonm.to_string ~minify:true json -let send_text_messages ?src client msgs = - send_message ?src client (to_text_messages_arg msgs) +let to_hex_messages_arg msgs = + let json = Ezjsonm.list Ezjsonm.string msgs in + "hex:" ^ Ezjsonm.to_string ~minify:true json + +let send_text_messages ?(format = `Raw) ?src client msgs = + match format with + | `Raw -> send_message ?src client (to_text_messages_arg msgs) + | `Hex -> send_message ?src client (to_hex_messages_arg msgs) let parse_inbox json = let go () = @@ -3380,7 +3386,7 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness let* payload = input_message sc_client target_address in let* () = match payload with - | `External payload -> send_text_messages client [payload] + | `External payload -> send_text_messages ~format:`Hex client [payload] | `Internal payload -> let payload = "0x" ^ payload in Client.transfer -- GitLab From 9a32c6ccce6797a13a8c09cdf3948e8bdd9190db Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 15 Nov 2022 19:32:44 +0100 Subject: [PATCH 08/17] SCORU,Tezt: Update regression traces Signed-off-by: Yann Regis-Gianas --- ...th - RPC API should work and be stable.out | 3 - ...ypoint- -aux- earliness- 0- external).out} | 15 ++-- ...rypoint- -aux- earliness- 0- internal).out | 34 +++++++++ ...int- -default- earliness- 0- external.out} | 15 ++-- ...oint- -default- earliness- 0- internal.out | 34 +++++++++ ..._0 - RPC API should work and be stable.out | 3 - ...ld be executable (entrypoint- -aux- ea.out | 34 --------- ...ld be executable (entrypoint- -default.out | 34 --------- ...ntrypoint- -aux- earliness- 0- externa.out | 72 +++++++++++++++++++ ...ntrypoint- -aux- earliness- 0- interna.out | 34 +++++++++ ...ntrypoint- -default- earliness- 0- ext.out | 72 +++++++++++++++++++ ...ntrypoint- -default- earliness- 0- int.out | 34 +++++++++ 12 files changed, 296 insertions(+), 88 deletions(-) rename tezt/tests/expected/sc_rollup.ml/{Alpha- arith - an outbox message should be executable (entrypoint- -aux- earline.out => Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- external).out} (84%) create mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out rename tezt/tests/expected/sc_rollup.ml/{Alpha- arith - an outbox message should be executable (entrypoint- -default- ear.out => Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- external.out} (84%) create mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out delete mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -aux- ea.out delete mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -default.out create mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out create mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out create mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out create mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out index 19c81ec26a6d..6c8bd958a269 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out @@ -252,9 +252,6 @@ This sequence of operations was run: ./octez-sc-rollup-client-alpha rpc get /global/block/head/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" -./octez-sc-rollup-client-alpha rpc get /global/block/head/outbox -[] - ./octez-sc-rollup-client-alpha rpc get /global/tezos_head "[BLOCK_HASH]" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - an outbox message should be executable (entrypoint- -aux- earline.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- external).out similarity index 84% rename from tezt/tests/expected/sc_rollup.ml/Alpha- arith - an outbox message should be executable (entrypoint- -aux- earline.out rename to tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- external).out index fc58697391a6..19cb7bcf47c5 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - an outbox message should be executable (entrypoint- -aux- earline.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- external).out @@ -1,5 +1,5 @@ -./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type string booting with --burn-cap 9999999 +./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 Node is bootstrapped. Estimated gas: 2709.909 units (will add 100 for safety) Estimated storage: 6520 bytes added (will add 20 for safety) @@ -21,7 +21,7 @@ This sequence of operations was run: payload fees(the block proposer) ....... +ꜩ0.000629 Smart contract rollup origination: Kind: arith - Parameter type: string + Parameter type: bytes Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' This smart contract rollup origination was successfully applied Consumed gas: 2709.909 @@ -33,7 +33,7 @@ This sequence of operations was run: storage fees ........................... +ꜩ1.63 -./octez-client --wait none send sc rollup message 'text:["37 [CONTRACT_HASH]%aux"]' from bootstrap2 +./octez-client --wait none send sc rollup message 'hex:["3337204b543153364537793463703851657451516a555467784d646f6d706a4b66386f7377675525617578"]' from bootstrap2 Node is bootstrapped. Estimated gas: 1001.191 units (will add 100 for safety) Estimated storage: no bytes added @@ -56,16 +56,17 @@ This sequence of operations was run: Smart contract rollup messages submission This smart contract rollup messages submission was successfully applied Consumed gas: 1001.191 - Resulting inbox state: { level = 4 + Resulting inbox state: { level = 5 current messages hash = hash: [SC_ROLLUP_INBOX_HASH] - level: 4 nb_messages_in_commitment_period = 8 + level: 5 nb_messages_in_commitment_period = 10 message_counter = 2 old_levels_messages = content = hash: [SC_ROLLUP_INBOX_HASH] - level: 3 - index = 3 + level: 4 + index = 4 back_pointers = [SC_ROLLUP_INBOX_HASH] [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out new file mode 100644 index 000000000000..c5bed18a6441 --- /dev/null +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out @@ -0,0 +1,34 @@ + +./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2909.925 units (will add 100 for safety) +Estimated storage: 6524 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000649 + Expected counter: 1 + Gas limit: 3010 + Storage limit: 6544 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000649 + payload fees(the block proposer) ....... +ꜩ0.000649 + Smart contract rollup origination: + Kind: arith + Parameter type: bytes + Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' + This smart contract rollup origination was successfully applied + Consumed gas: 2909.925 + Storage size: 6524 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.631 + storage fees ........................... +ꜩ1.631 + diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - an outbox message should be executable (entrypoint- -default- ear.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- external.out similarity index 84% rename from tezt/tests/expected/sc_rollup.ml/Alpha- arith - an outbox message should be executable (entrypoint- -default- ear.out rename to tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- external.out index c86304ed864d..dacd1607b7aa 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - an outbox message should be executable (entrypoint- -default- ear.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- external.out @@ -1,5 +1,5 @@ -./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type string booting with --burn-cap 9999999 +./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 Node is bootstrapped. Estimated gas: 2709.909 units (will add 100 for safety) Estimated storage: 6520 bytes added (will add 20 for safety) @@ -21,7 +21,7 @@ This sequence of operations was run: payload fees(the block proposer) ....... +ꜩ0.000629 Smart contract rollup origination: Kind: arith - Parameter type: string + Parameter type: bytes Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' This smart contract rollup origination was successfully applied Consumed gas: 2709.909 @@ -33,7 +33,7 @@ This sequence of operations was run: storage fees ........................... +ꜩ1.63 -./octez-client --wait none send sc rollup message 'text:["37 [CONTRACT_HASH]"]' from bootstrap2 +./octez-client --wait none send sc rollup message 'hex:["3337204b543153364537793463703851657451516a555467784d646f6d706a4b66386f73776755"]' from bootstrap2 Node is bootstrapped. Estimated gas: 1001.123 units (will add 100 for safety) Estimated storage: no bytes added @@ -56,16 +56,17 @@ This sequence of operations was run: Smart contract rollup messages submission This smart contract rollup messages submission was successfully applied Consumed gas: 1001.123 - Resulting inbox state: { level = 4 + Resulting inbox state: { level = 5 current messages hash = hash: [SC_ROLLUP_INBOX_HASH] - level: 4 nb_messages_in_commitment_period = 8 + level: 5 nb_messages_in_commitment_period = 10 message_counter = 2 old_levels_messages = content = hash: [SC_ROLLUP_INBOX_HASH] - level: 3 - index = 3 + level: 4 + index = 4 back_pointers = [SC_ROLLUP_INBOX_HASH] [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out new file mode 100644 index 000000000000..c5bed18a6441 --- /dev/null +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out @@ -0,0 +1,34 @@ + +./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2909.925 units (will add 100 for safety) +Estimated storage: 6524 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000649 + Expected counter: 1 + Gas limit: 3010 + Storage limit: 6544 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000649 + payload fees(the block proposer) ....... +ꜩ0.000649 + Smart contract rollup origination: + Kind: arith + Parameter type: bytes + Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' + This smart contract rollup origination was successfully applied + Consumed gas: 2909.925 + Storage size: 6524 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.631 + storage fees ........................... +ꜩ1.631 + diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out index 8a7d62d6b6c2..dbbd388d7c23 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out @@ -252,9 +252,6 @@ This sequence of operations was run: ./octez-sc-rollup-client-alpha rpc get /global/block/head/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" -./octez-sc-rollup-client-alpha rpc get /global/block/head/outbox -[] - ./octez-sc-rollup-client-alpha rpc get /global/tezos_head "[BLOCK_HASH]" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -aux- ea.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -aux- ea.out deleted file mode 100644 index 285f6c9a66cb..000000000000 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -aux- ea.out +++ /dev/null @@ -1,34 +0,0 @@ - -./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type string booting with 0061736d0100000001240660047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f777269746500020304030304050503010001071502036d656d02000b6b65726e656c5f6e65787400050a76032a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b2801027f41fd002d0000210220002d0000210320032002460440200041016a200141016b10011a0b0b2001017f41dc0141f00141840241901c100021004184022000100441840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fd000b0101 --burn-cap 9999999 -Node is bootstrapped. -Estimated gas: 2709.909 units (will add 100 for safety) -Estimated storage: 6520 bytes added (will add 20 for safety) -Operation successfully injected in the node. -Operation hash is '[OPERATION_HASH]' -NOT waiting for the operation to be included. -Use command - octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] -and/or an external block explorer to make sure that it has been included. -This sequence of operations was run: - Manager signed operations: - From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000989 - Expected counter: 1 - Gas limit: 2810 - Storage limit: 6540 bytes - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000989 - payload fees(the block proposer) ....... +ꜩ0.000989 - Smart contract rollup origination: - Kind: wasm_2_0_0 - Parameter type: string - Boot sector Blake2B hash: 'cd21483a93a238aad0f696ca1a754735f4126d609308c93039463918ad37444b' - This smart contract rollup origination was successfully applied - Consumed gas: 2709.909 - Storage size: 6520 bytes - Address: [SC_ROLLUP_HASH] - Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.63 - storage fees ........................... +ꜩ1.63 - diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -default.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -default.out deleted file mode 100644 index 285f6c9a66cb..000000000000 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - an outbox message should be executable (entrypoint- -default.out +++ /dev/null @@ -1,34 +0,0 @@ - -./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type string booting with 0061736d0100000001240660047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f777269746500020304030304050503010001071502036d656d02000b6b65726e656c5f6e65787400050a76032a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b2801027f41fd002d0000210220002d0000210320032002460440200041016a200141016b10011a0b0b2001017f41dc0141f00141840241901c100021004184022000100441840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fd000b0101 --burn-cap 9999999 -Node is bootstrapped. -Estimated gas: 2709.909 units (will add 100 for safety) -Estimated storage: 6520 bytes added (will add 20 for safety) -Operation successfully injected in the node. -Operation hash is '[OPERATION_HASH]' -NOT waiting for the operation to be included. -Use command - octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] -and/or an external block explorer to make sure that it has been included. -This sequence of operations was run: - Manager signed operations: - From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000989 - Expected counter: 1 - Gas limit: 2810 - Storage limit: 6540 bytes - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000989 - payload fees(the block proposer) ....... +ꜩ0.000989 - Smart contract rollup origination: - Kind: wasm_2_0_0 - Parameter type: string - Boot sector Blake2B hash: 'cd21483a93a238aad0f696ca1a754735f4126d609308c93039463918ad37444b' - This smart contract rollup origination was successfully applied - Consumed gas: 2709.909 - Storage size: 6520 bytes - Address: [SC_ROLLUP_HASH] - Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.63 - storage fees ........................... +ꜩ1.63 - diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out new file mode 100644 index 000000000000..32795ea7668a --- /dev/null +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out @@ -0,0 +1,72 @@ + +./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2911.537 units (will add 100 for safety) +Estimated storage: 6927 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.001059 + Expected counter: 1 + Gas limit: 3012 + Storage limit: 6947 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.001059 + payload fees(the block proposer) ....... +ꜩ0.001059 + Smart contract rollup origination: + Kind: wasm_2_0_0 + Parameter type: bytes + Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' + This smart contract rollup origination was successfully applied + Consumed gas: 2911.537 + Storage size: 6927 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.73175 + storage fees ........................... +ꜩ1.73175 + + +./octez-client --wait none send sc rollup message 'hex:["000000001f002501c00c5e4e94a48a49e267873112bbe3cf3373be5b0000000003617578"]' from bootstrap2 +Node is bootstrapped. +Estimated gas: 1001.072 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000379 + Expected counter: 1 + Gas limit: 1102 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000379 + payload fees(the block proposer) ....... +ꜩ0.000379 + Smart contract rollup messages submission + This smart contract rollup messages submission was successfully applied + Consumed gas: 1001.072 + Resulting inbox state: { level = 5 + current messages hash = hash: [SC_ROLLUP_INBOX_HASH] + level: 5 nb_messages_in_commitment_period = 10 + message_counter = 2 + old_levels_messages = + content = hash: [SC_ROLLUP_INBOX_HASH] + level: 4 + index = 4 + back_pointers = [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] + + } + diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out new file mode 100644 index 000000000000..138aa1644517 --- /dev/null +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out @@ -0,0 +1,34 @@ + +./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2911.537 units (will add 100 for safety) +Estimated storage: 6927 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.001059 + Expected counter: 1 + Gas limit: 3012 + Storage limit: 6947 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.001059 + payload fees(the block proposer) ....... +ꜩ0.001059 + Smart contract rollup origination: + Kind: wasm_2_0_0 + Parameter type: bytes + Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' + This smart contract rollup origination was successfully applied + Consumed gas: 2911.537 + Storage size: 6927 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.73175 + storage fees ........................... +ꜩ1.73175 + diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out new file mode 100644 index 000000000000..caaf635ae56c --- /dev/null +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out @@ -0,0 +1,72 @@ + +./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2911.537 units (will add 100 for safety) +Estimated storage: 6927 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.001059 + Expected counter: 1 + Gas limit: 3012 + Storage limit: 6947 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.001059 + payload fees(the block proposer) ....... +ꜩ0.001059 + Smart contract rollup origination: + Kind: wasm_2_0_0 + Parameter type: bytes + Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' + This smart contract rollup origination was successfully applied + Consumed gas: 2911.537 + Storage size: 6927 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.73175 + storage fees ........................... +ꜩ1.73175 + + +./octez-client --wait none send sc rollup message 'hex:["0000000023002501c00c5e4e94a48a49e267873112bbe3cf3373be5b000000000764656661756c74"]' from bootstrap2 +Node is bootstrapped. +Estimated gas: 1001.140 units (will add 100 for safety) +Estimated storage: no bytes added +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.000383 + Expected counter: 1 + Gas limit: 1102 + Storage limit: 0 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.000383 + payload fees(the block proposer) ....... +ꜩ0.000383 + Smart contract rollup messages submission + This smart contract rollup messages submission was successfully applied + Consumed gas: 1001.140 + Resulting inbox state: { level = 5 + current messages hash = hash: [SC_ROLLUP_INBOX_HASH] + level: 5 nb_messages_in_commitment_period = 10 + message_counter = 2 + old_levels_messages = + content = hash: [SC_ROLLUP_INBOX_HASH] + level: 4 + index = 4 + back_pointers = [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] + [SC_ROLLUP_INBOX_HASH] + + } + diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out new file mode 100644 index 000000000000..138aa1644517 --- /dev/null +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out @@ -0,0 +1,34 @@ + +./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 +Node is bootstrapped. +Estimated gas: 2911.537 units (will add 100 for safety) +Estimated storage: 6927 bytes added (will add 20 for safety) +Operation successfully injected in the node. +Operation hash is '[OPERATION_HASH]' +NOT waiting for the operation to be included. +Use command + octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] +and/or an external block explorer to make sure that it has been included. +This sequence of operations was run: + Manager signed operations: + From: [PUBLIC_KEY_HASH] + Fee to the baker: ꜩ0.001059 + Expected counter: 1 + Gas limit: 3012 + Storage limit: 6947 bytes + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ0.001059 + payload fees(the block proposer) ....... +ꜩ0.001059 + Smart contract rollup origination: + Kind: wasm_2_0_0 + Parameter type: bytes + Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' + This smart contract rollup origination was successfully applied + Consumed gas: 2911.537 + Storage size: 6927 bytes + Address: [SC_ROLLUP_HASH] + Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] + Balance updates: + [PUBLIC_KEY_HASH] ... -ꜩ1.73175 + storage fees ........................... +ꜩ1.73175 + -- GitLab From 727f7ae8b6190ae11d2c903cf2ef84e2835e716c Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Fri, 18 Nov 2022 16:58:08 +0100 Subject: [PATCH 09/17] Proto,SCORU: Make outbox RPC path more standard Signed-off-by: Yann Regis-Gianas --- .../bin_sc_rollup_node/RPC_server.ml | 24 +++++++++++++++-- .../lib_sc_rollup/sc_rollup_services.ml | 27 +++++++++++++++++++ tezt/lib_tezos/sc_rollup_client.ml | 5 ++-- 3 files changed, 51 insertions(+), 5 deletions(-) diff --git a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml index 151379a223ac..0f92f31f3656 100644 --- a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml @@ -196,6 +196,25 @@ module Block_directory = Make_directory (struct (Node_context.readonly node_ctxt, block) end) +module Outbox_directory = Make_directory (struct + include Sc_rollup_services.Global.Block.Outbox + + type context = + Node_context.t * Tezos_crypto.Block_hash.t * Alpha_context.Raw_level.t + + let context_of_prefix node_ctxt (((), block), level) = + let open Lwt_result_syntax in + let+ block = + match block with + | `Head -> get_head node_ctxt.Node_context.store + | `Hash b -> return b + | `Level l -> State.hash_of_level node_ctxt.store l >>= return + | `Finalized -> get_finalized node_ctxt.Node_context.store + | `Cemented -> get_last_cemented node_ctxt.Node_context.store + in + (node_ctxt, block, level) +end) + module Common = struct let () = Block_directory.register0 Sc_rollup_services.Global.Block.num_messages @@ -387,8 +406,8 @@ module Make (Simulation : Simulation.S) (Batcher : Batcher.S) = struct get_dal_slot_page node_ctxt.store block index page let () = - Block_directory.register0 Sc_rollup_services.Global.Block.outbox - @@ fun (node_ctxt, block) outbox_level () -> + Outbox_directory.register0 Sc_rollup_services.Global.Block.Outbox.messages + @@ fun (node_ctxt, block, outbox_level) () () -> let open Lwt_result_syntax in let* state = get_state node_ctxt block in let*! outbox = PVM.get_outbox outbox_level state in @@ -534,6 +553,7 @@ module Make (Simulation : Simulation.S) (Batcher : Batcher.S) = struct Local_directory.build_directory; Block_directory.build_directory; Proof_helpers_directory.build_directory; + Outbox_directory.build_directory; ] let start node_ctxt configuration = diff --git a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml index aabb1020d2b1..24199a2293df 100644 --- a/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml +++ b/src/proto_alpha/lib_sc_rollup/sc_rollup_services.ml @@ -565,6 +565,33 @@ module Global = struct (req "result" string) (opt "contents" Dal.Page.content_encoding)) (path / "dal" / "slot_page") + + module Outbox = struct + let level_param = + let destruct s = + match Int32.of_string_opt s with + | None -> Error "Invalid level" + | Some l -> ( + match Raw_level.of_int32 l with + | Error _ -> Error "Invalid level" + | Ok l -> Ok l) + in + let construct = Format.asprintf "%a" Raw_level.pp in + Tezos_rpc.Arg.make ~name:"level" ~construct ~destruct () + + include Make_services (struct + type nonrec prefix = prefix * Raw_level.t + + let prefix = prefix / "outbox" /: level_param + end) + + let messages = + Tezos_rpc.Service.get_service + ~description:"Outbox at block for a given outbox level" + ~query:Tezos_rpc.Query.empty + ~output:Data_encoding.(list Sc_rollup.output_encoding) + (path / "messages") + end end end diff --git a/tezt/lib_tezos/sc_rollup_client.ml b/tezt/lib_tezos/sc_rollup_client.ml index 403a2d68544f..837d55ec7382 100644 --- a/tezt/lib_tezos/sc_rollup_client.ml +++ b/tezt/lib_tezos/sc_rollup_client.ml @@ -240,11 +240,10 @@ let status ?hooks ?(block = "head") sc_client = let outbox ?hooks ?(block = "cemented") ~outbox_level sc_client = let open Lwt.Syntax in - rpc_get_rich + rpc_get ?hooks sc_client - ["global"; "block"; block; "outbox"] - [("outbox_level", string_of_int outbox_level)] + ["global"; "block"; block; "outbox"; string_of_int outbox_level; "messages"] let last_stored_commitment ?hooks sc_client = rpc_get ?hooks sc_client ["global"; "last_stored_commitment"] -- GitLab From c689f27d487850129bdc71a85523a2e29a4177bc Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Fri, 18 Nov 2022 17:06:26 +0100 Subject: [PATCH 10/17] Proto,SCORU: Describe the echo kernel Signed-off-by: Yann Regis-Gianas --- .../lib_protocol/test/integration/wasm_kernel/README.md | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/README.md b/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/README.md index d0ab49dbdac4..330c9678f645 100644 --- a/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/README.md +++ b/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/README.md @@ -41,3 +41,11 @@ cp target/wasm32-unknown-unknown/release/test_kernel.wasm computation_kernel.was wasm-strip computation_kernel.wasm ``` +# echo.wasm + +`echo.wasm` is the result of `wat2wasm echo.wast`. + +This simple kernel writes the external messages it receives in its outbox. + +To achieve that, it needs to take the encoding of the inputs into +account to extract the payload to push into the outbox. -- GitLab From 01e843c22f46870b5759362c6adc24524202cca1 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 08:35:50 +0100 Subject: [PATCH 11/17] Proto,SCORU: Add missing source file for echo kernel Signed-off-by: Yann Regis-Gianas --- .../test/integration/wasm_kernel/echo.wast | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wast diff --git a/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wast b/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wast new file mode 100644 index 000000000000..2d1bc46bd889 --- /dev/null +++ b/src/proto_alpha/lib_protocol/test/integration/wasm_kernel/echo.wast @@ -0,0 +1,104 @@ +(module + + (type $read_t (func (param i32 i32 i32 i32) (result i32))) + (type $write_t (func (param i32 i32) (result i32))) + (type $store_w_t (func (param i32 i32 i32 i32 i32) (result i32))) + + (import "rollup_safe_core" "read_input" (func $read_input (type $read_t))) + (import "rollup_safe_core" "write_output" (func $write_output (type $write_t))) + (import "rollup_safe_core" "store_write" + (func $store_write (type $store_w_t))) + + (data (i32.const 100) "/kernel/env/reboot") + (data (i32.const 120) "\00\01") ;;Start_of_level + (data (i32.const 122) "\00\02") ;;End_of_level + (data (i32.const 124) "\00\00") ;;Internal Transfer + (data (i32.const 126) "\01") ;;External + + (memory 1) + (export "mem" (memory 0)) + + (func $set_reboot_flag (param $input_offset i32) ;;location of input + (local $eol i32) + (local $input_header i32) + + (local.set $eol (i32.load16_u (i32.const 122))) + (local.set $input_header + (i32.load16_u (local.get $input_offset))) + (i32.ne (local.get $eol) (local.get $input_header)) + (if (then + (call $store_write + (i32.const 100) ;; offset + (i32.const 18) ;; key size + (i32.const 0) ;; offset in the durable storage page + (i32.const 100) ;; offset in memory for the value (placeholder here) + (i32.const 0)) ;; size of the value in memory (placeholder here) + (drop))) + ) + + ;; Internal message representation + ;; (see Data_encoding.Binary.describe Sc_rollup_inbox_message_repr.encoding): + ;; - Tag (1B) `t1` + ;; - Tag (1B) `t2` + ;; - Payload (variable) `payload`, expected as a Byte + ;; + Tag (1B) `tb` + ;; + Size (4B) `size_b` + ;; + bytes (variable) + ;; - Sender (20B) `sender` + ;; - Source (21B) `source` + ;; - Destination (20B) `destination` + ;; + ;; payload = len - (t1 + t2 + tb + size_b + sender + source + destination) + ;; ==> payload = len - (1 + 1 + 1 + 4 + 20 + 21 + 20) + ;; ==> payload = len - 68 + ;; and starts at offset 7 from the input + + (func $internal_payload_size (param $input_size i32) (result i32) + (i32.sub (local.get $input_size) (i32.const 68))) ;; tag + + (func $write_message (param $input_offset i32) (param $size i32) + (local $internal i32) + (local $external i32) + (local $input_header i32) + (local $payload_size i32) + + (local.set $internal (i32.load16_u (i32.const 124))) + (local.set $external (i32.load8_u (i32.const 126))) + (local.set $input_header + (i32.load16_u (local.get $input_offset))) + (local.set $payload_size + (call $internal_payload_size (local.get $size))) + + (if + (i32.eq (local.get $input_header) (local.get $internal)) + (then + (call $write_output ;;See comment for the internal message representation + (i32.add (local.get $input_offset) (i32.const 7)) + (local.get $payload_size)) + (drop)) + (else + (if + (i32.eq (local.get $input_header) (local.get $external)) + (then + (call $write_output + (i32.add (local.get $input_offset) (i32.const 1)) ;;Remove the header + (i32.sub (local.get $size) (i32.const 1))) ;;Size without the header + (drop)) + ) + ) + ) + ) + + (func (export "kernel_next") + (local $size i32) + (local.set $size (call $read_input + (i32.const 220) ;; level_offset + (i32.const 240) ;; id_offset + (i32.const 260) ;; dst + (i32.const 3600))) ;; max_bytes + + (call $write_message (i32.const 260) + (local.get $size)) + (call $set_reboot_flag (i32.const 260)) + ) +) -- GitLab From 31e341b1a469dd0836441cf124ee01296df6b02f Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 08:37:31 +0100 Subject: [PATCH 12/17] Proto,SCORU: Add a tailcall annotation Signed-off-by: Yann Regis-Gianas --- src/proto_alpha/lib_protocol/sc_rollup_wasm.ml | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index 4a3915cb7425..ab131be41395 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -341,10 +341,12 @@ module V2_0_0 = struct We choose to ignore such messages. An alternative choice would be to craft an output with a payload witnessing the illformedness of the output produced by the kernel. *) - aux outbox (Z.succ message_index) + (aux [@ocaml.tailcall]) outbox (Z.succ message_index) | Ok message -> let output = PS.{outbox_level; message_index; message} in - aux (output :: outbox) (Z.succ message_index)) + (aux [@ocaml.tailcall]) + (output :: outbox) + (Z.succ message_index)) in aux [] Z.zero -- GitLab From 190b81f78f1c837ea9596471b4371db243e902d3 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 08:40:40 +0100 Subject: [PATCH 13/17] Proto,SCORU: Minor refactoring Signed-off-by: Yann Regis-Gianas --- src/proto_alpha/lib_protocol/sc_rollup_arith.ml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml index e125d9a72c21..3d49179e2c38 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_arith.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_arith.ml @@ -918,12 +918,11 @@ module Make (Context : P) : let get_outbox outbox_level state = let open Lwt_syntax in let+ entries = result_of ~default:[] Output.entries state in - let entries = - List.filter - (fun (_, msg) -> Raw_level_repr.(msg.PS.outbox_level = outbox_level)) - entries - in - List.map snd entries + List.filter_map + (fun (_, msg) -> + if Raw_level_repr.(msg.PS.outbox_level = outbox_level) then Some msg + else None) + entries let get_code = result_of ~default:[] @@ Code.to_list -- GitLab From 9571d2291695a9723238db96f5c6cd32d3d98eba Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 08:42:26 +0100 Subject: [PATCH 14/17] Tezt,SCORU: Describe a smart contract used in the test Signed-off-by: Yann Regis-Gianas --- tezt/tests/sc_rollup.ml | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 32f3f789314f..149fe8932369 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -3341,6 +3341,10 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness ~error_msg:"Invalid contract storage: expecting '%R', got '%L'.") in let originate_source_contract () = + (* A script that receives bytes as a parameter and transfers them + to the rollup as is. The transfer will appear as an internal + message targetting this specific rollup in the rollups' + inbox. *) let prg = Format.asprintf {| -- GitLab From 4741e0e4f08190cc9212826ebcc2b898d9822375 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 08:56:14 +0100 Subject: [PATCH 15/17] Tezt,SCORU: Check that the outbox contents is the one expected Signed-off-by: Yann Regis-Gianas --- .../bin_sc_rollup_node/RPC_server.ml | 6 +-- tezt/tests/sc_rollup.ml | 54 ++++++++++++++----- 2 files changed, 43 insertions(+), 17 deletions(-) diff --git a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml index 0f92f31f3656..983c1ef176cc 100644 --- a/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml +++ b/src/proto_alpha/bin_sc_rollup_node/RPC_server.ml @@ -200,7 +200,7 @@ module Outbox_directory = Make_directory (struct include Sc_rollup_services.Global.Block.Outbox type context = - Node_context.t * Tezos_crypto.Block_hash.t * Alpha_context.Raw_level.t + Node_context.ro * Tezos_crypto.Block_hash.t * Alpha_context.Raw_level.t let context_of_prefix node_ctxt (((), block), level) = let open Lwt_result_syntax in @@ -212,7 +212,7 @@ module Outbox_directory = Make_directory (struct | `Finalized -> get_finalized node_ctxt.Node_context.store | `Cemented -> get_last_cemented node_ctxt.Node_context.store in - (node_ctxt, block, level) + (Node_context.readonly node_ctxt, block, level) end) module Common = struct @@ -302,7 +302,7 @@ module Make (Simulation : Simulation.S) (Batcher : Batcher.S) = struct Simulation.end_simulation node_ctxt sim in let num_ticks = Z.(num_ticks_0 + num_ticks_end) in - let*! outbox = PVM.get_outbox state in + let*! outbox = PVM.get_outbox inbox_level state in let output = List.filter (fun Sc_rollup.{outbox_level; _} -> outbox_level = inbox_level) diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 149fe8932369..aabcb973fcee 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -3409,21 +3409,47 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness in let trigger_outbox_message_execution address = let outbox_level = 5 in - let* outbox = Sc_rollup_client.outbox ~outbox_level sc_client in - Log.info "Outbox is %s" (JSON.encode outbox) ; - let* answer = - let message_index = 0 in - let destination = address in - let parameters = "37" in - Sc_rollup_client.outbox_proof_single - sc_client - ?expected_error - ~message_index - ~outbox_level - ~destination - ?entrypoint - ~parameters + let destination = address in + let parameters = "37" in + let message_index = 0 in + let check_expected_outbox () = + let* outbox = Sc_rollup_client.outbox ~outbox_level sc_client in + Log.info "Outbox is %s" (Ezjsonm.to_string outbox) ; + + match expected_error with + | None -> + let expected = + Ezjsonm.from_string + (Printf.sprintf + {| + [ { "outbox_level": %d, "message_index": "%d", + "message": + { "transactions": + [ { "parameters": { "int": "%s" }, + "destination": "%s"%s } ] } } ] |} + outbox_level + message_index + parameters + address + (match entrypoint with + | None -> "" + | Some entrypoint -> + Format.asprintf {| , "entrypoint" : "%s" |} entrypoint)) + in + assert (Ezjsonm.to_string expected = Ezjsonm.to_string outbox) ; + Sc_rollup_client.outbox_proof_single + sc_client + ?expected_error + ~message_index + ~outbox_level + ~destination + ?entrypoint + ~parameters + | Some _ -> + assert (Ezjsonm.to_string outbox = "[]") ; + return None in + let* answer = check_expected_outbox () in match (answer, expected_error) with | Some _, Some _ -> assert false | None, None -> failwith "Unexpected error during proof generation" -- GitLab From 064e63de315497d1340a8c25d3bafc1b459a9be2 Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 11:22:20 +0100 Subject: [PATCH 16/17] Tezt,SCORU: Adjust to the new expected type of arith internal msg Signed-off-by: Yann Regis-Gianas --- tezt/tests/contracts/proto_alpha/sc_rollup_forward.tz | 6 +++--- ...h - node advances PVM state with messages (external).out | 4 ++-- ...h - node advances PVM state with messages (internal).out | 4 ++-- ...0 - node advances PVM state with messages (external).out | 4 ++-- ...0 - node advances PVM state with messages (internal).out | 4 ++-- tezt/tests/sc_rollup.ml | 6 ++++-- 6 files changed, 15 insertions(+), 13 deletions(-) diff --git a/tezt/tests/contracts/proto_alpha/sc_rollup_forward.tz b/tezt/tests/contracts/proto_alpha/sc_rollup_forward.tz index 22789dbc3e16..0632b96496de 100644 --- a/tezt/tests/contracts/proto_alpha/sc_rollup_forward.tz +++ b/tezt/tests/contracts/proto_alpha/sc_rollup_forward.tz @@ -1,12 +1,12 @@ -parameter (pair address string) ; +parameter (pair address bytes) ; storage unit ; code { UNPAIR ; DIP { NIL operation }; UNPAIR ; - CONTRACT string ; + CONTRACT bytes ; ASSERT_SOME; SWAP; DIP { PUSH mutez 0 }; TRANSFER_TOKENS; CONS; - PAIR; } \ No newline at end of file + PAIR; } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (external).out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (external).out index 42770921f21d..c0e4e9c45815 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (external).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (external).out @@ -1,5 +1,5 @@ -./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type string booting with --burn-cap 9999999 +./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 Node is bootstrapped. Estimated gas: 2709.909 units (will add 100 for safety) Estimated storage: 6520 bytes added (will add 20 for safety) @@ -21,7 +21,7 @@ This sequence of operations was run: payload fees(the block proposer) ....... +ꜩ0.000629 Smart contract rollup origination: Kind: arith - Parameter type: string + Parameter type: bytes Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' This smart contract rollup origination was successfully applied Consumed gas: 2709.909 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (internal).out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (internal).out index f3b2ada5f2f5..a4a12ac667a7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (internal).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - node advances PVM state with messages (internal).out @@ -1,5 +1,5 @@ -./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type string booting with --burn-cap 9999999 +./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 Node is bootstrapped. Estimated gas: 2709.909 units (will add 100 for safety) Estimated storage: 6520 bytes added (will add 20 for safety) @@ -21,7 +21,7 @@ This sequence of operations was run: payload fees(the block proposer) ....... +ꜩ0.000629 Smart contract rollup origination: Kind: arith - Parameter type: string + Parameter type: bytes Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' This smart contract rollup origination was successfully applied Consumed gas: 2709.909 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (external).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (external).out index 4bc3a63698e8..efd8743af268 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (external).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (external).out @@ -1,5 +1,5 @@ -./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type string booting with 0061736d0100000001240660047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f777269746500020304030304050503010001071502036d656d02000b6b65726e656c5f6e65787400050a76032a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b2801027f41fd002d0000210220002d0000210320032002460440200041016a200141016b10011a0b0b2001017f41dc0141f00141840241901c100021004184022000100441840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fd000b0101 --burn-cap 9999999 +./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001240660047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f777269746500020304030304050503010001071502036d656d02000b6b65726e656c5f6e65787400050a76032a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b2801027f41fd002d0000210220002d0000210320032002460440200041016a200141016b10011a0b0b2001017f41dc0141f00141840241901c100021004184022000100441840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fd000b0101 --burn-cap 9999999 Node is bootstrapped. Estimated gas: 2709.909 units (will add 100 for safety) Estimated storage: 6520 bytes added (will add 20 for safety) @@ -21,7 +21,7 @@ This sequence of operations was run: payload fees(the block proposer) ....... +ꜩ0.000989 Smart contract rollup origination: Kind: wasm_2_0_0 - Parameter type: string + Parameter type: bytes Boot sector Blake2B hash: 'cd21483a93a238aad0f696ca1a754735f4126d609308c93039463918ad37444b' This smart contract rollup origination was successfully applied Consumed gas: 2709.909 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (internal).out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (internal).out index 1da514f54b1a..ece9c04b72c7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (internal).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages (internal).out @@ -1,5 +1,5 @@ -./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type string booting with 0061736d0100000001240660047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f777269746500020304030304050503010001071502036d656d02000b6b65726e656c5f6e65787400050a76032a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b2801027f41fd002d0000210220002d0000210320032002460440200041016a200141016b10011a0b0b2001017f41dc0141f00141840241901c100021004184022000100441840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fd000b0101 --burn-cap 9999999 +./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001240660047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f777269746500020304030304050503010001071502036d656d02000b6b65726e656c5f6e65787400050a76032a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b2801027f41fd002d0000210220002d0000210320032002460440200041016a200141016b10011a0b0b2001017f41dc0141f00141840241901c100021004184022000100441840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fd000b0101 --burn-cap 9999999 Node is bootstrapped. Estimated gas: 2709.909 units (will add 100 for safety) Estimated storage: 6520 bytes added (will add 20 for safety) @@ -21,7 +21,7 @@ This sequence of operations was run: payload fees(the block proposer) ....... +ꜩ0.000989 Smart contract rollup origination: Kind: wasm_2_0_0 - Parameter type: string + Parameter type: bytes Boot sector Blake2B hash: 'cd21483a93a238aad0f696ca1a754735f4126d609308c93039463918ad37444b' This smart contract rollup origination was successfully applied Consumed gas: 2709.909 diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index aabcb973fcee..11e543350054 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -1164,6 +1164,7 @@ let test_rollup_node_advances_pvm_state ?regression ~title ?boot_sector description = title; } ?boot_sector + ~parameters_ty:"bytes" ~kind @@ fun sc_rollup_node sc_rollup_client sc_rollup _tezos_node client -> let* genesis_info = @@ -1212,17 +1213,18 @@ let test_rollup_node_advances_pvm_state ?regression ~title ?boot_sector send_message client (sf "[%S]" message) | Some forwarder -> (* Internal message through forwarder *) + let message = hex_encode message in let* () = Client.transfer client ~amount:Tez.zero ~giver:Constant.bootstrap1.alias ~receiver:forwarder - ~arg:(sf "Pair %S %S" sc_rollup message) + ~arg:(sf "Pair %S 0x%s" sc_rollup message) in Client.bake_for_and_wait client in - let* _ = + let* (_ : int) = Sc_rollup_node.wait_for_level ~timeout:30. sc_rollup_node (level + i) in -- GitLab From c61600f90706a651d2ac31602a8d5172da2f03fa Mon Sep 17 00:00:00 2001 From: Yann Regis-Gianas Date: Tue, 22 Nov 2022 13:50:28 +0100 Subject: [PATCH 17/17] Tezt,SCORU: Update tezt tests to new tezt API Signed-off-by: Yann Regis-Gianas --- tezt/lib_tezos/sc_rollup_client.ml | 11 ++--- tezt/lib_tezos/sc_rollup_client.mli | 6 ++- ...th - RPC API should work and be stable.out | 3 ++ ...rypoint- -aux- earliness- 0- internal).out | 22 ++++----- ...oint- -default- earliness- 0- internal.out | 22 ++++----- ..._0 - RPC API should work and be stable.out | 3 ++ ...ntrypoint- -aux- earliness- 0- externa.out | 22 ++++----- ...ntrypoint- -aux- earliness- 0- interna.out | 22 ++++----- ...ntrypoint- -default- earliness- 0- ext.out | 22 ++++----- ...ntrypoint- -default- earliness- 0- int.out | 22 ++++----- tezt/tests/sc_rollup.ml | 47 +++++++++++-------- 11 files changed, 109 insertions(+), 93 deletions(-) diff --git a/tezt/lib_tezos/sc_rollup_client.ml b/tezt/lib_tezos/sc_rollup_client.ml index 837d55ec7382..c0b29db1a530 100644 --- a/tezt/lib_tezos/sc_rollup_client.ml +++ b/tezt/lib_tezos/sc_rollup_client.ml @@ -183,7 +183,7 @@ let outbox_proof_single ?hooks ?expected_error ?entrypoint sc_client [{destination; entrypoint; parameters}] let encode_batch ?hooks ?expected_error sc_client batch = - let process = + let runnable = spawn_command ?hooks sc_client @@ -191,10 +191,10 @@ let encode_batch ?hooks ?expected_error sc_client batch = in match expected_error with | None -> - let* answer = Process.check_and_read_stdout process in + let* answer = Process.check_and_read_stdout runnable.value in return (Some (String.trim answer)) | Some msg -> - let* () = Process.check_error ~msg process in + let* () = Process.check_error ~msg runnable.value in return None let rpc_get ?hooks sc_client path = @@ -218,8 +218,8 @@ let rpc_get_rich ?hooks sc_client path parameters = @@ List.map (fun (k, v) -> Format.asprintf "%s=%s" k v) parameters in let uri = Client.string_of_path path ^ parameters in - let process = spawn_command ?hooks sc_client ["rpc"; "get"; uri] in - let* output = Process.check_and_read_stdout process in + let runnable = spawn_command ?hooks sc_client ["rpc"; "get"; uri] in + let* output = Process.check_and_read_stdout runnable.value in return (JSON.parse ~origin:(Client.string_of_path path ^ " response") output) let ticks ?hooks ?(block = "head") sc_client = @@ -239,7 +239,6 @@ let status ?hooks ?(block = "head") sc_client = |> Runnable.map JSON.as_string let outbox ?hooks ?(block = "cemented") ~outbox_level sc_client = - let open Lwt.Syntax in rpc_get ?hooks sc_client diff --git a/tezt/lib_tezos/sc_rollup_client.mli b/tezt/lib_tezos/sc_rollup_client.mli index b49c6fc93eb2..aab60c108833 100644 --- a/tezt/lib_tezos/sc_rollup_client.mli +++ b/tezt/lib_tezos/sc_rollup_client.mli @@ -107,7 +107,11 @@ val status : [outbox_level] as known to the [block] (default ["cemented"] which is the block corresponding to the last cemented level). *) val outbox : - ?hooks:Process.hooks -> ?block:string -> outbox_level:int -> t -> JSON.t Lwt.t + ?hooks:Process.hooks -> + ?block:string -> + outbox_level:int -> + t -> + JSON.t Runnable.process type outbox_proof = {commitment_hash : string; proof : string} diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out index 6c8bd958a269..3a809380d2d7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - RPC API should work and be stable.out @@ -252,6 +252,9 @@ This sequence of operations was run: ./octez-sc-rollup-client-alpha rpc get /global/block/head/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" +./octez-sc-rollup-client-alpha rpc get /global/block/cemented/outbox/16/messages +[] + ./octez-sc-rollup-client-alpha rpc get /global/tezos_head "[BLOCK_HASH]" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out index c5bed18a6441..b87702ade564 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -aux- earliness- 0- internal).out @@ -1,8 +1,8 @@ ./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 2909.925 units (will add 100 for safety) -Estimated storage: 6524 bytes added (will add 20 for safety) +Estimated gas: 2709.909 units (will add 100 for safety) +Estimated storage: 6520 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -12,23 +12,23 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000649 + Fee to the baker: ꜩ0.000629 Expected counter: 1 - Gas limit: 3010 - Storage limit: 6544 bytes + Gas limit: 2810 + Storage limit: 6540 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000649 - payload fees(the block proposer) ....... +ꜩ0.000649 + [PUBLIC_KEY_HASH] ... -ꜩ0.000629 + payload fees(the block proposer) ....... +ꜩ0.000629 Smart contract rollup origination: Kind: arith Parameter type: bytes Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' This smart contract rollup origination was successfully applied - Consumed gas: 2909.925 - Storage size: 6524 bytes + Consumed gas: 2709.909 + Storage size: 6520 bytes Address: [SC_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.631 - storage fees ........................... +ꜩ1.631 + [PUBLIC_KEY_HASH] ... -ꜩ1.63 + storage fees ........................... +ꜩ1.63 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out index c5bed18a6441..b87702ade564 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- arith - trigger exec output (entrypoint- -default- earliness- 0- internal.out @@ -1,8 +1,8 @@ ./octez-client --wait none originate sc rollup from bootstrap1 of kind arith of type bytes booting with --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 2909.925 units (will add 100 for safety) -Estimated storage: 6524 bytes added (will add 20 for safety) +Estimated gas: 2709.909 units (will add 100 for safety) +Estimated storage: 6520 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -12,23 +12,23 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000649 + Fee to the baker: ꜩ0.000629 Expected counter: 1 - Gas limit: 3010 - Storage limit: 6544 bytes + Gas limit: 2810 + Storage limit: 6540 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000649 - payload fees(the block proposer) ....... +ꜩ0.000649 + [PUBLIC_KEY_HASH] ... -ꜩ0.000629 + payload fees(the block proposer) ....... +ꜩ0.000629 Smart contract rollup origination: Kind: arith Parameter type: bytes Boot sector Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' This smart contract rollup origination was successfully applied - Consumed gas: 2909.925 - Storage size: 6524 bytes + Consumed gas: 2709.909 + Storage size: 6520 bytes Address: [SC_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.631 - storage fees ........................... +ꜩ1.631 + [PUBLIC_KEY_HASH] ... -ꜩ1.63 + storage fees ........................... +ꜩ1.63 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out index dbbd388d7c23..1045150497fd 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - RPC API should work and be stable.out @@ -252,6 +252,9 @@ This sequence of operations was run: ./octez-sc-rollup-client-alpha rpc get /global/block/head/state_hash "[SC_ROLLUP_PVM_STATE_HASH]" +./octez-sc-rollup-client-alpha rpc get /global/block/cemented/outbox/16/messages +[] + ./octez-sc-rollup-client-alpha rpc get /global/tezos_head "[BLOCK_HASH]" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out index 32795ea7668a..705d240a6828 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- externa.out @@ -1,8 +1,8 @@ ./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 2911.537 units (will add 100 for safety) -Estimated storage: 6927 bytes added (will add 20 for safety) +Estimated gas: 2709.909 units (will add 100 for safety) +Estimated storage: 6520 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -12,25 +12,25 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.001059 + Fee to the baker: ꜩ0.001038 Expected counter: 1 - Gas limit: 3012 - Storage limit: 6947 bytes + Gas limit: 2810 + Storage limit: 6540 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.001059 - payload fees(the block proposer) ....... +ꜩ0.001059 + [PUBLIC_KEY_HASH] ... -ꜩ0.001038 + payload fees(the block proposer) ....... +ꜩ0.001038 Smart contract rollup origination: Kind: wasm_2_0_0 Parameter type: bytes Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' This smart contract rollup origination was successfully applied - Consumed gas: 2911.537 - Storage size: 6927 bytes + Consumed gas: 2709.909 + Storage size: 6520 bytes Address: [SC_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.73175 - storage fees ........................... +ꜩ1.73175 + [PUBLIC_KEY_HASH] ... -ꜩ1.63 + storage fees ........................... +ꜩ1.63 ./octez-client --wait none send sc rollup message 'hex:["000000001f002501c00c5e4e94a48a49e267873112bbe3cf3373be5b0000000003617578"]' from bootstrap2 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out index 138aa1644517..bf22b75c63ed 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -aux- earliness- 0- interna.out @@ -1,8 +1,8 @@ ./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 2911.537 units (will add 100 for safety) -Estimated storage: 6927 bytes added (will add 20 for safety) +Estimated gas: 2709.909 units (will add 100 for safety) +Estimated storage: 6520 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -12,23 +12,23 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.001059 + Fee to the baker: ꜩ0.001038 Expected counter: 1 - Gas limit: 3012 - Storage limit: 6947 bytes + Gas limit: 2810 + Storage limit: 6540 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.001059 - payload fees(the block proposer) ....... +ꜩ0.001059 + [PUBLIC_KEY_HASH] ... -ꜩ0.001038 + payload fees(the block proposer) ....... +ꜩ0.001038 Smart contract rollup origination: Kind: wasm_2_0_0 Parameter type: bytes Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' This smart contract rollup origination was successfully applied - Consumed gas: 2911.537 - Storage size: 6927 bytes + Consumed gas: 2709.909 + Storage size: 6520 bytes Address: [SC_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.73175 - storage fees ........................... +ꜩ1.73175 + [PUBLIC_KEY_HASH] ... -ꜩ1.63 + storage fees ........................... +ꜩ1.63 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out index caaf635ae56c..7b605460eaac 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- ext.out @@ -1,8 +1,8 @@ ./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 2911.537 units (will add 100 for safety) -Estimated storage: 6927 bytes added (will add 20 for safety) +Estimated gas: 2709.909 units (will add 100 for safety) +Estimated storage: 6520 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -12,25 +12,25 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.001059 + Fee to the baker: ꜩ0.001038 Expected counter: 1 - Gas limit: 3012 - Storage limit: 6947 bytes + Gas limit: 2810 + Storage limit: 6540 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.001059 - payload fees(the block proposer) ....... +ꜩ0.001059 + [PUBLIC_KEY_HASH] ... -ꜩ0.001038 + payload fees(the block proposer) ....... +ꜩ0.001038 Smart contract rollup origination: Kind: wasm_2_0_0 Parameter type: bytes Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' This smart contract rollup origination was successfully applied - Consumed gas: 2911.537 - Storage size: 6927 bytes + Consumed gas: 2709.909 + Storage size: 6520 bytes Address: [SC_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.73175 - storage fees ........................... +ꜩ1.73175 + [PUBLIC_KEY_HASH] ... -ꜩ1.63 + storage fees ........................... +ꜩ1.63 ./octez-client --wait none send sc rollup message 'hex:["0000000023002501c00c5e4e94a48a49e267873112bbe3cf3373be5b000000000764656661756c74"]' from bootstrap2 diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out index 138aa1644517..bf22b75c63ed 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - trigger exec output (entrypoint- -default- earliness- 0- int.out @@ -1,8 +1,8 @@ ./octez-client --wait none originate sc rollup from bootstrap1 of kind wasm_2_0_0 of type bytes booting with 0061736d0100000001290760047f7f7f7f017f60027f7f017f60057f7f7f7f7f017f60017f0060017f017f60027f7f00600000025e0310726f6c6c75705f736166655f636f72650a726561645f696e707574000010726f6c6c75705f736166655f636f72650c77726974655f6f7574707574000110726f6c6c75705f736166655f636f72650b73746f72655f77726974650002030504030405060503010001071502036d656d02000b6b65726e656c5f6e65787400060aa001042a01027f41fa002f0100210120002f010021022001200247044041e4004112410041e400410010021a0b0b0800200041c4006b0b4901047f41fc002f0100210241fe002d0000210320002f0100210420011004210520042002460440200041076a200510011a0520042003460440200041016a200141016b10011a0b0b0b2001017f41dc0141f00141840241901c100021004184022000100541840210030b0b38050041e4000b122f6b65726e656c2f656e762f7265626f6f740041f8000b0200010041fa000b0200020041fc000b0200000041fe000b0101 --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 2911.537 units (will add 100 for safety) -Estimated storage: 6927 bytes added (will add 20 for safety) +Estimated gas: 2709.909 units (will add 100 for safety) +Estimated storage: 6520 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' NOT waiting for the operation to be included. @@ -12,23 +12,23 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.001059 + Fee to the baker: ꜩ0.001038 Expected counter: 1 - Gas limit: 3012 - Storage limit: 6947 bytes + Gas limit: 2810 + Storage limit: 6540 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.001059 - payload fees(the block proposer) ....... +ꜩ0.001059 + [PUBLIC_KEY_HASH] ... -ꜩ0.001038 + payload fees(the block proposer) ....... +ꜩ0.001038 Smart contract rollup origination: Kind: wasm_2_0_0 Parameter type: bytes Boot sector Blake2B hash: '88a2a78ca83fb7dc5f9393763b7fcbf0c10e0a12da1fd446835a16dad2dabd86' This smart contract rollup origination was successfully applied - Consumed gas: 2911.537 - Storage size: 6927 bytes + Consumed gas: 2709.909 + Storage size: 6520 bytes Address: [SC_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.73175 - storage fees ........................... +ꜩ1.73175 + [PUBLIC_KEY_HASH] ... -ꜩ1.63 + storage fees ........................... +ꜩ1.63 diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 11e543350054..0061a29f7d52 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -920,14 +920,16 @@ let sc_rollup_node_simulate sc_rollup_node sc_rollup_client _sc_rollup node [msg1] in let* () = send_message client (to_text_messages_arg [msg1]) in - let* _ = - Sc_rollup_node.wait_for_level - ~timeout:3. - sc_rollup_node - (Node.get_level node) - in + let level = Node.get_level node in + let* _ = Sc_rollup_node.wait_for_level ~timeout:3. sc_rollup_node level in let*! real_state_hash = Sc_rollup_client.state_hash sc_rollup_client in - let*! real_outbox = Sc_rollup_client.outbox sc_rollup_client ~block:"head" in + let* real_outbox = + Runnable.run + @@ Sc_rollup_client.outbox + sc_rollup_client + ~outbox_level:level + ~block:"head" + in Check.((sim_result.state_hash = real_state_hash) string) ~error_msg:"Simulated resulting state hash is %L but should have been %R" ; Check.((JSON.encode sim_result.output = JSON.encode real_outbox) string) @@ -3304,6 +3306,7 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness @@ fun rollup_node sc_client sc_rollup _node client -> let* () = Sc_rollup_node.run rollup_node [] in let src = Constant.bootstrap1.public_key_hash in + let src2 = Constant.bootstrap2.public_key_hash in let originate_target_contract () = let prg = {| @@ -3415,14 +3418,16 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness let parameters = "37" in let message_index = 0 in let check_expected_outbox () = - let* outbox = Sc_rollup_client.outbox ~outbox_level sc_client in - Log.info "Outbox is %s" (Ezjsonm.to_string outbox) ; + let* outbox = + Runnable.run @@ Sc_rollup_client.outbox ~outbox_level sc_client + in + Log.info "Outbox is %s" (JSON.encode outbox) ; match expected_error with | None -> let expected = - Ezjsonm.from_string - (Printf.sprintf + JSON.parse ~origin:"trigger_outbox_message_execution" + @@ Printf.sprintf {| [ { "outbox_level": %d, "message_index": "%d", "message": @@ -3436,9 +3441,9 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness (match entrypoint with | None -> "" | Some entrypoint -> - Format.asprintf {| , "entrypoint" : "%s" |} entrypoint)) + Format.asprintf {| , "entrypoint" : "%s" |} entrypoint) in - assert (Ezjsonm.to_string expected = Ezjsonm.to_string outbox) ; + assert (JSON.encode expected = JSON.encode outbox) ; Sc_rollup_client.outbox_proof_single sc_client ?expected_error @@ -3448,7 +3453,7 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness ?entrypoint ~parameters | Some _ -> - assert (Ezjsonm.to_string outbox = "[]") ; + assert (JSON.encode outbox = "[]") ; return None in let* answer = check_expected_outbox () in @@ -3461,12 +3466,12 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness Client.Sc_rollup.execute_outbox_message ~burn_cap:(Tez.of_int 10) ~rollup:sc_rollup - ~src + ~src:src2 ~commitment_hash ~proof client in - Client.bake_for client + Client.bake_for_and_wait client in let* target_contract_address = originate_target_contract () in let* source_contract_address = originate_source_contract () in @@ -3475,6 +3480,7 @@ let test_outbox_message_generic ?regression ?expected_error ~earliness source_contract_address target_contract_address in + let* () = Client.bake_for_and_wait client in let* () = trigger_outbox_message_execution target_contract_address in match expected_error with | None -> @@ -3615,10 +3621,11 @@ let test_rpcs ~kind = ["global"; "block"; "head"; "state_hash"] in let* _outbox = - Sc_rollup_client.outbox - ~hooks - ~outbox_level:l2_finalied_block_level - sc_client + Runnable.run + @@ Sc_rollup_client.outbox + ~hooks + ~outbox_level:l2_finalied_block_level + sc_client in let*! _head = Sc_rollup_client.rpc_get ~hooks sc_client ["global"; "tezos_head"] -- GitLab