diff --git a/docs/protocols/alpha.rst b/docs/protocols/alpha.rst index 208bdc385e5c1d2338b60e1dbff9f3279abb2a28..93ee416f1b79840237f47455780d066ba5c92016 100644 --- a/docs/protocols/alpha.rst +++ b/docs/protocols/alpha.rst @@ -37,6 +37,10 @@ Smart Rollups Now:: ./octez-client cement commitment from for smart rollup +- Enable the latest version of the WASM PVM (``2.0.0-r2``). Existing smart + rollups will see their PVM automatically upgrade, and newly originated smart + rollups will use this version directly (MR :gl:`!9051`) + Zero Knowledge Rollups (ongoing) -------------------------------- diff --git a/src/lib_protocol_environment/environment_V10.ml b/src/lib_protocol_environment/environment_V10.ml index 69e248bacb95179e32569bbf584ebaa90f597b8d..b8572734c7f7eaf09457cfb6f1765fbe75c4aa79 100644 --- a/src/lib_protocol_environment/environment_V10.ml +++ b/src/lib_protocol_environment/environment_V10.ml @@ -1157,7 +1157,7 @@ struct type version = Tezos_scoru_wasm.Wasm_pvm_state.version - let v1 = Tezos_scoru_wasm.Wasm_pvm_state.V1 + let v2 = Tezos_scoru_wasm.Wasm_pvm_state.V2 module Make (Tree : Context.TREE with type key = string list and type value = bytes) = diff --git a/src/lib_protocol_environment/sigs/v10.ml b/src/lib_protocol_environment/sigs/v10.ml index 3944900bfe6c98accdd3ac8e942259f627a83ae3..63c301469623c0d54bf723d6aaa5f00d01abf1d5 100644 --- a/src/lib_protocol_environment/sigs/v10.ml +++ b/src/lib_protocol_environment/sigs/v10.ml @@ -12077,7 +12077,7 @@ end type version -val v1 : version +val v2 : version type input = {inbox_level : Bounded.Non_negative_int32.t; message_counter : Z.t} diff --git a/src/lib_protocol_environment/sigs/v10/wasm_2_0_0.mli b/src/lib_protocol_environment/sigs/v10/wasm_2_0_0.mli index 0ecc4afac5d55ee925c2b9cd0e1c3cc2644eb8b9..9d1c18977328a16bbb5e6839b1d3beca003e5151 100644 --- a/src/lib_protocol_environment/sigs/v10/wasm_2_0_0.mli +++ b/src/lib_protocol_environment/sigs/v10/wasm_2_0_0.mli @@ -25,7 +25,7 @@ type version -val v1 : version +val v2 : version type input = {inbox_level : Bounded.Non_negative_int32.t; message_counter : Z.t} diff --git a/src/lib_scoru_wasm/test/test_protocol_migration.ml b/src/lib_scoru_wasm/test/test_protocol_migration.ml index 7bba5f0872c3b996955c7f16b4ffdb6b50e3cc32..37f255c45f7e6e3f39b823b43977607295537099 100644 --- a/src/lib_scoru_wasm/test/test_protocol_migration.ml +++ b/src/lib_scoru_wasm/test/test_protocol_migration.ml @@ -42,29 +42,40 @@ let noop_module = nop)) |} -let test_protocol_migration_message () = +let test_protocol_migration_message ~from_version ~to_version + ~after_protocol_activation:protocol () = let open Lwt_syntax in - let* tree = initial_tree ~version:V0 noop_module in + let* tree = initial_tree ~version:from_version noop_module in let* tree = eval_until_input_requested tree in let* version = Wasm.get_wasm_version tree in - assert (version = V0) ; + assert (version = from_version) ; let* tree = set_empty_inbox_step 0l tree in let* tree = eval_until_input_requested tree in let* version = Wasm.get_wasm_version tree in - assert (version = V0) ; - let* tree = set_empty_inbox_step ~migrate_to:Proto_alpha 0l tree in + assert (version = from_version) ; + let* tree = set_empty_inbox_step ~migrate_to:protocol 0l tree in let* tree = eval_until_input_requested tree in let* version = Wasm.get_wasm_version tree in - assert (version = V1) ; + assert (version = to_version) ; Lwt_result_syntax.return_unit +let proto_name : Tezos_scoru_wasm.Pvm_input_kind.protocol -> string = function + | Nairobi -> "Nairobi" + | Proto_alpha -> "Proto_alpha" + let tests = - [ - tztest - "protocol migration message handling by the WASM PVM" - `Quick - test_protocol_migration_message; - ] + List.map + (fun (from_version, to_version, protocol) -> + tztest + (sf + "protocol migration message handling by the WASM PVM (%s)" + (proto_name protocol)) + `Quick + (test_protocol_migration_message + ~from_version + ~to_version + ~after_protocol_activation:protocol)) + [(V0, V1, Nairobi); (V1, V2, Proto_alpha)] let () = Alcotest_lwt.run diff --git a/src/lib_scoru_wasm/wasm_vm.ml b/src/lib_scoru_wasm/wasm_vm.ml index 254e6fc3d739ce9f047c5ce1f3b211e0c4adbe7b..3f81064755554217d60ba2ce84732c96a755c999 100644 --- a/src/lib_scoru_wasm/wasm_vm.ml +++ b/src/lib_scoru_wasm/wasm_vm.ml @@ -28,7 +28,8 @@ open Wasm_pvm_state.Internal_state let version_for_protocol : Pvm_input_kind.protocol -> Wasm_pvm_state.version = function - | Nairobi | Proto_alpha -> V1 + | Nairobi -> V1 + | Proto_alpha -> V2 let link_finished (ast : Wasm.Ast.module_) offset = offset >= Wasm.Ast.Vector.num_elements ast.it.imports diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml index ce63d02be725041b75b85f0c9ffc202b71795e69..3be72d6007b3f5eb475f14aad15a7cb85b3e216a 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.ml @@ -81,7 +81,7 @@ let () = (fun () -> WASM_invalid_dissection_distribution) module V2_0_0 = struct - let current_version = Wasm_2_0_0.v1 + let current_version = Wasm_2_0_0.v2 let ticks_per_snapshot = Z.of_int64 11_000_000_000L @@ -121,7 +121,7 @@ module V2_0_0 = struct *) let reference_initial_state_hash = Sc_rollup_repr.State_hash.of_b58check_exn - "srs129wuRkckJpSyDhsqSvzE3qSVnvJZ7nD93r3b6oiBtPxa9LMBHu" + "srs11qkRe5cbDBixB2fuumn4tfkvQcxUSuFXa94Lv5c6kdzzfpM9UF" open Sc_rollup_repr module PS = Sc_rollup_PVM_sig 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 9f577510d67b98ee49558ef4f7cd06ed81b1db00..374d4e62cfa3f91c03e5dce81fa530add229f5c2 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 @@ -251,7 +251,7 @@ Smart rollup [SMART_ROLLUP_HASH] memorized as "rollup" null ./octez-smart-rollup-client-alpha rpc get '/global/block/head/durable/wasm_2_0_0/value?key=/readonly/wasm_version' -"322e302e302d7231" +"322e302e302d7232" ./octez-smart-rollup-client-alpha rpc get '/global/block/head/durable/wasm_2_0_0/length?key=/readonly/wasm_version' "8" diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 4f57b3ace8ed2d45985c0696961ff17e38b3dfcf..62b71bf3667899a21d6a90ed95ec7f8d4e2836ee 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -41,7 +41,8 @@ open Sc_rollup_helpers *) let default_wasm_pvm_revision = function - | Protocol.Nairobi | Protocol.Alpha -> "2.0.0-r1" + | Protocol.Alpha -> "2.0.0-r2" + | Protocol.Nairobi -> "2.0.0-r1" | Protocol.Mumbai -> "2.0.0" let assert_some_client_command cmd ~__LOC__ ?hooks client =