diff --git a/.gitlab/ci/opam-ci.yml b/.gitlab/ci/opam-ci.yml index 11a3654ff29c3197a5fbdc82930e2253d4ef5b01..68981ddc3e5703b92c03ec9af846ae15ae702521 100644 --- a/.gitlab/ci/opam-ci.yml +++ b/.gitlab/ci/opam-ci.yml @@ -539,7 +539,7 @@ opam:tezos-client-base-unix: opam:tezos-client-commands: extends: - .opam_template - - .rules_template__trigger_opam_batch_4 + - .rules_template__trigger_opam_batch_5 variables: package: tezos-client-commands @@ -910,7 +910,7 @@ opam:tezos-protocol-007-PsDELPH1: opam:tezos-protocol-008-PtEdo2Zk: extends: - .opam_template - - .rules_template__trigger_opam_batch_5 + - .rules_template__trigger_opam_batch_4 variables: package: tezos-protocol-008-PtEdo2Zk @@ -1232,7 +1232,7 @@ opam:tezos-sc-rollup-node-alpha: opam:tezos-scoru-wasm: extends: - .opam_template - - .rules_template__trigger_opam_batch_6 + - .rules_template__trigger_opam_batch_5 variables: package: tezos-scoru-wasm @@ -1435,7 +1435,7 @@ opam:tezt-performance-regression: opam:tezt-self-tests: extends: - .opam_template - - .rules_template__trigger_opam_batch_5 + - .rules_template__trigger_opam_batch_6 variables: package: tezt-self-tests diff --git a/manifest/main.ml b/manifest/main.ml index e13532143c91c51e279849179a9d723c4c6e11d3..9f896bb1c0207c203baadec8b673818921f9c018 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -528,6 +528,38 @@ let tezos_error_monad = ] ~js_compatible:true +let tezos_webassembly_interpreter = + public_lib + "tezos-webassembly-interpreter" + ~path:"src/lib_webassembly/interpreter" + ~license:"Apache License 2.0" + ~extra_authors:["WebAssembly Authors"] + ~synopsis:"WebAssembly reference interpreter with tweaks for Tezos" + ~all_modules_except:["main"] + ~dune:Dune.[[S "include"; S "dune.inc"]] + ~deps:[tezos_lwt_result_stdlib] + +let _tezos_webassembly_repl = + private_exe + "main" + ~path:"src/lib_webassembly/interpreter" + ~modules:["main"] + ~opam:"" + ~deps:[tezos_webassembly_interpreter |> open_] + +let _tezos_webassembly_test = + test + "main" + ~path:"src/lib_webassembly/test" + ~opam:"tezos-webassembly-interpreter" + ~deps: + [ + tezos_webassembly_interpreter |> open_; + qcheck_core; + qcheck_alcotest; + alcotest; + ] + let tezos_hacl = let js_stubs = ["random.js"; "evercrypt.js"] in let js_generated = "runtime-generated.js" in @@ -1400,6 +1432,20 @@ let tezos_context_sigs = ~path:"src/lib_context/sigs" ~deps:[tezos_base |> open_ ~m:"TzPervasives"; tezos_stdlib |> open_] +let tezos_scoru_wasm = + public_lib + "tezos-scoru-wasm" + ~path:"src/lib_scoru_wasm" + ~synopsis: + "Protocol environment dependency providing WASM functionality for SCORU" + ~deps: + [ + tezos_webassembly_interpreter; + tezos_context_sigs; + tezos_lwt_result_stdlib; + data_encoding; + ] + let tezos_context_encoding = public_lib "tezos-context.encoding" @@ -1634,6 +1680,7 @@ let tezos_protocol_environment_structs = tezos_stdlib; tezos_crypto; tezos_lwt_result_stdlib; + tezos_scoru_wasm; data_encoding; bls12_381; ] @@ -1668,6 +1715,7 @@ protocols.|} tezos_protocol_environment_structs; tezos_micheline |> open_; tezos_context_memory; + tezos_scoru_wasm; tezos_event_logging; ] ~wrapped:false @@ -2587,46 +2635,6 @@ let tezos_openapi = format" ~deps:[ezjsonm; json_data_encoding; tezt] -let tezos_webassembly_interpreter = - public_lib - "tezos-webassembly-interpreter" - ~path:"src/lib_webassembly/interpreter" - ~license:"Apache License 2.0" - ~extra_authors:["WebAssembly Authors"] - ~synopsis:"WebAssembly reference interpreter with tweaks for Tezos" - ~all_modules_except:["main"] - ~dune:Dune.[[S "include"; S "dune.inc"]] - ~deps:[tezos_lwt_result_stdlib] - -let _tezos_webassembly_repl = - private_exe - "main" - ~path:"src/lib_webassembly/interpreter" - ~modules:["main"] - ~opam:"" - ~deps:[tezos_webassembly_interpreter |> open_] - -let _tezos_webassembly_test = - test - "main" - ~path:"src/lib_webassembly/test" - ~opam:"tezos-webassembly-interpreter" - ~deps: - [ - tezos_webassembly_interpreter |> open_; - qcheck_core; - qcheck_alcotest; - alcotest; - ] - -let _tezos_scoru_wasm = - public_lib - "tezos-scoru-wasm" - ~path:"src/lib_scoru_wasm" - ~synopsis: - "Protocol environment dependency providing WASM functionality for SCORU" - ~deps:[tezos_webassembly_interpreter] - let _tezos_protocol_compiler_bin = public_exe "tezos-protocol-compiler" diff --git a/opam/tezos-protocol-environment.opam b/opam/tezos-protocol-environment.opam index c1fa5003255e5e30c0f6ae366cd5f8506fd5b69c..d4d49344f228fe101b9aaadc1429154c14dd9e3f 100644 --- a/opam/tezos-protocol-environment.opam +++ b/opam/tezos-protocol-environment.opam @@ -13,6 +13,7 @@ depends: [ "tezos-stdlib" "tezos-crypto" "tezos-lwt-result-stdlib" + "tezos-scoru-wasm" "data-encoding" { >= "0.5.3" & < "0.6" } "bls12-381" { >= "3.0.0" & < "3.1.0" } "zarith" { >= "1.12" & < "1.13" } diff --git a/opam/tezos-scoru-wasm.opam b/opam/tezos-scoru-wasm.opam index b431ee62ebb5ffaaed8e9d9eefad4a18783fd644..da38c9d830d7c470a428ead444e5f4952e211cb0 100644 --- a/opam/tezos-scoru-wasm.opam +++ b/opam/tezos-scoru-wasm.opam @@ -10,6 +10,9 @@ license: "MIT" depends: [ "dune" { >= "3.0" } "tezos-webassembly-interpreter" + "tezos-context" + "tezos-lwt-result-stdlib" + "data-encoding" { >= "0.5.3" & < "0.6" } ] build: [ ["rm" "-r" "vendors"] diff --git a/src/lib_protocol_environment/dune b/src/lib_protocol_environment/dune index 4889c9df429ca1a49da1c70ba2ae0002e6e0cbb9..646c6269702074c42a140a9af60d4f65ad8b5240 100644 --- a/src/lib_protocol_environment/dune +++ b/src/lib_protocol_environment/dune @@ -17,6 +17,7 @@ tezos-protocol-environment.structs tezos-micheline tezos-context.memory + tezos-scoru-wasm tezos-event-logging) (flags (:standard) -open Tezos_base.TzPervasives diff --git a/src/lib_protocol_environment/environment_V6.ml b/src/lib_protocol_environment/environment_V6.ml index 2aedf2545728a6ea792c23cb58a5d4071184f3dc..687c637789cfacf056d6ece596c85ea508fb5089 100644 --- a/src/lib_protocol_environment/environment_V6.ml +++ b/src/lib_protocol_environment/environment_V6.ml @@ -1107,7 +1107,9 @@ struct (* TODO: https://gitlab.com/tezos/tezos/-/issues/3090 The expected implementation of this function is the step function implemented in `lib_webassembly'. *) - let step (t : Tree.tree) = Lwt.return t + module Wasm = Tezos_scoru_wasm.Make (Tree) + + let step (t : Tree.tree) = Wasm.step t end end diff --git a/src/lib_protocol_environment/structs/dune b/src/lib_protocol_environment/structs/dune index a29444a8f54e879f29681ae9e462215db7c9ea4d..d305f7eeed77b3566285aa4600c835769343eb87 100644 --- a/src/lib_protocol_environment/structs/dune +++ b/src/lib_protocol_environment/structs/dune @@ -9,5 +9,6 @@ tezos-stdlib tezos-crypto tezos-lwt-result-stdlib + tezos-scoru-wasm data-encoding bls12-381)) diff --git a/src/lib_scoru_wasm/dune b/src/lib_scoru_wasm/dune index fbb20af913535946d563553bef540b3aacdcec12..e14537164ff236832e36e142362bbe7288014a05 100644 --- a/src/lib_scoru_wasm/dune +++ b/src/lib_scoru_wasm/dune @@ -6,4 +6,7 @@ (public_name tezos-scoru-wasm) (instrumentation (backend bisect_ppx)) (libraries - tezos-webassembly-interpreter)) + tezos-webassembly-interpreter + tezos-context.sigs + tezos-lwt-result-stdlib + data-encoding)) diff --git a/src/lib_scoru_wasm/sigs.ml b/src/lib_scoru_wasm/sigs.ml new file mode 100644 index 0000000000000000000000000000000000000000..8af7de7e3877a43d706c568f8163242f0671f40d --- /dev/null +++ b/src/lib_scoru_wasm/sigs.ml @@ -0,0 +1,29 @@ +(*****************************************************************************) +(* *) +(* Open Source License *) +(* Copyright (c) 2022 TriliTech *) +(* *) +(* Permission is hereby granted, free of charge, to any person obtaining a *) +(* copy of this software and associated documentation files (the "Software"),*) +(* to deal in the Software without restriction, including without limitation *) +(* the rights to use, copy, modify, merge, publish, distribute, sublicense, *) +(* and/or sell copies of the Software, and to permit persons to whom the *) +(* Software is furnished to do so, subject to the following conditions: *) +(* *) +(* The above copyright notice and this permission notice shall be included *) +(* in all copies or substantial portions of the Software. *) +(* *) +(* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR*) +(* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, *) +(* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL *) +(* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER*) +(* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING *) +(* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER *) +(* DEALINGS IN THE SOFTWARE. *) +(* *) +(*****************************************************************************) + +open Tezos_context_sigs + +module type TreeS = + Context.TREE with type key = string list and type value = bytes diff --git a/src/lib_scoru_wasm/tezos_scoru_wasm.ml b/src/lib_scoru_wasm/tezos_scoru_wasm.ml index c7dc971f99ff6872b0a9f177a96bf2ab0acce0f1..cbf96acaeb614c640f146ab39cf3bdcdbfb38e93 100644 --- a/src/lib_scoru_wasm/tezos_scoru_wasm.ml +++ b/src/lib_scoru_wasm/tezos_scoru_wasm.ml @@ -29,3 +29,15 @@ must be exposed to the protocol via the environment shall be added here. *) + +open Sigs + +module Make (T : TreeS) : sig + val step : T.tree -> T.tree Lwt.t +end = struct + module Tree = struct + include T + end + + let step = Lwt.return +end diff --git a/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli b/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli index b9615deefbd66b694c29865174f2940a2fff63ca..cdd9b1f83cc2473301ac3d6e132e3154222e5195 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_wasm.mli @@ -88,12 +88,14 @@ module V2_0_0 : sig val proof_encoding : 'a Data_encoding.t -> 'a proof Data_encoding.t + (** Build a WebAssembly PVM using the given proof-supporting context. *) module Make (Context : P) : S with type context = Context.Tree.t and type state = Context.tree and type proof = Context.proof proof + (** This PVM is used for verification in the Protocol. [produce_proof] always returns [None]. *) module ProtocolImplementation : S with type context = Context.t