From b58e470747c80024fc83b75b91c6f4561be63d1a Mon Sep 17 00:00:00 2001 From: Felix Puscasu Date: Tue, 7 Jan 2025 17:05:01 +0000 Subject: [PATCH] PROTO/RISC-V: origination PVM to use the protocol implementation --- .../sc_rollup_origination_machine.ml | 30 +++++++++---------- .../sc_rollup_origination_machine.mli | 12 +++----- src/proto_alpha/lib_protocol/sc_rollups.ml | 2 +- 3 files changed, 20 insertions(+), 24 deletions(-) diff --git a/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.ml b/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.ml index da5b328b9aa2..baaf738154cc 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.ml +++ b/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.ml @@ -33,10 +33,6 @@ let void = (fun _ -> Error "void has no inhabitant") unit) -type t = Context_binary.t - -type tree = Context_binary.tree - let empty_tree () = Context_binary.(make_empty_context () |> Tree.empty) module Context_no_proofs = struct @@ -57,22 +53,26 @@ module Context_no_proofs = struct let proof_encoding = void end -module type S = Sc_rollup_PVM_sig.PROTO_ORIGINATION with type state = tree +module type S = sig + include Sc_rollup_PVM_sig.PROTO_ORIGINATION -module Arith : S = Sc_rollup_arith.Make (Context_no_proofs) + val empty_state : unit -> state +end -module Wasm : S = - Sc_rollup_wasm.V2_0_0.Make (Wasm_2_0_0.Make) (Context_no_proofs) +module Arith : S = struct + include Sc_rollup_arith.Make (Context_no_proofs) -module Riscv : S = struct - type state = tree + let empty_state = empty_tree +end - type hash = Smart_rollup.State_hash.t +module Wasm : S = struct + include Sc_rollup_wasm.V2_0_0.Make (Wasm_2_0_0.Make) (Context_no_proofs) - let state_hash _state = - Sc_rollup_riscv.(Protocol_implementation.state_hash (make_empty_state ())) + let empty_state = empty_tree +end - let initial_state ~empty = Lwt.return empty +module Riscv : S = struct + include Sc_rollup_riscv.Protocol_implementation - let install_boot_sector state _bs = Lwt.return state + let empty_state = Sc_rollup_riscv.make_empty_state end diff --git a/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.mli b/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.mli index 0e3b7add1fe8..85f4aa7f5348 100644 --- a/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.mli +++ b/src/proto_alpha/lib_protocol/sc_rollup_origination_machine.mli @@ -28,15 +28,11 @@ be used to perform rollup origination, {b but} cannot be used to compute proofs or run computations. *) -type void = | +module type S = sig + include Sc_rollup_PVM_sig.PROTO_ORIGINATION -type t = Context_binary.t - -type tree = Context_binary.tree - -val empty_tree : unit -> tree - -module type S = Sc_rollup_PVM_sig.PROTO_ORIGINATION with type state = tree + val empty_state : unit -> state +end module Arith : S diff --git a/src/proto_alpha/lib_protocol/sc_rollups.ml b/src/proto_alpha/lib_protocol/sc_rollups.ml index 6058c4661ace..30ae99ccc450 100644 --- a/src/proto_alpha/lib_protocol/sc_rollups.ml +++ b/src/proto_alpha/lib_protocol/sc_rollups.ml @@ -107,7 +107,7 @@ end let genesis_state_hash_of ~boot_sector kind = let open Lwt_syntax in let (module Machine) = Kind.no_proof_machine_of kind in - let empty = Sc_rollup_origination_machine.empty_tree () in + let empty = Machine.empty_state () in let* tree = Machine.initial_state ~empty in let* tree = Machine.install_boot_sector tree boot_sector in Machine.state_hash tree -- GitLab