From 41fead97d921bf7548fce3e68d3d7836dab04173 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Fri, 28 Oct 2022 16:28:33 +0100 Subject: [PATCH 1/4] SCORU: WASM: Introduce start state --- src/lib_scoru_wasm/test/helpers/wasm_utils.ml | 3 +- src/lib_scoru_wasm/test/test_wasm_pvm.ml | 2 +- src/lib_scoru_wasm/wasm_pvm.ml | 5 +++ src/lib_scoru_wasm/wasm_pvm_state.ml | 1 + src/lib_scoru_wasm/wasm_vm.ml | 15 +++++-- ...ances PVM state with internal messages.out | 40 +++++++++---------- ... node advances PVM state with messages.out | 38 +++++++++--------- ...handling of commitments (batcher_does_.out | 2 +- ...handling of commitments (commitment_is.out | 4 +- ...handling of commitments (first_publish.out | 6 +-- ...handling of commitments (handles_chain.out | 4 +- ...handling of commitments (maintenance_p.out | 4 +- ...handling of commitments (no_commitment.out | 6 +-- ...handling of commitments (node_use_prot.out | 4 +- ...handling of commitments (observer_does.out | 2 +- ...handling of commitments (operator_publ.out | 4 +- ...handling of commitments (robust_to_fai.out | 4 +- ...with kernel - no_parse_bad_fingerprint.out | 38 +++++++++--------- ...0 - runs with kernel - no_parse_random.out | 38 +++++++++--------- tezt/tests/sc_rollup.ml | 2 +- 20 files changed, 119 insertions(+), 103 deletions(-) diff --git a/src/lib_scoru_wasm/test/helpers/wasm_utils.ml b/src/lib_scoru_wasm/test/helpers/wasm_utils.ml index b70726029ffd..635840140525 100644 --- a/src/lib_scoru_wasm/test/helpers/wasm_utils.ml +++ b/src/lib_scoru_wasm/test/helpers/wasm_utils.ml @@ -100,7 +100,8 @@ let set_input_step message message_counter tree = let pp_state fmt state = let pp_s s = Format.fprintf fmt "%s" s in match state with - | Wasm_pvm_state.Internal_state.Decode _ -> pp_s "Decode" + | Wasm_pvm_state.Internal_state.Start -> pp_s "Start" + | Decode _ -> pp_s "Decode" | Eval _ -> pp_s "Eval" | Stuck e -> Format.fprintf fmt "Stuck (%a)" Test_wasm_pvm_encodings.pp_error_state e diff --git a/src/lib_scoru_wasm/test/test_wasm_pvm.ml b/src/lib_scoru_wasm/test/test_wasm_pvm.ml index 05985a6ed10a..43254187a73e 100644 --- a/src/lib_scoru_wasm/test/test_wasm_pvm.ml +++ b/src/lib_scoru_wasm/test/test_wasm_pvm.ml @@ -547,7 +547,7 @@ let test_snapshotable_state () = let*! tree = set_input_step "test" 1 tree in let*! state = Wasm.Internal_for_tests.get_tick_state tree in match state with - | Decode _ -> return_unit + | Start -> return_unit | _ -> failwith "Unexpected state after set_input_step: %a" diff --git a/src/lib_scoru_wasm/wasm_pvm.ml b/src/lib_scoru_wasm/wasm_pvm.ml index b1adf912ff21..595af442e544 100644 --- a/src/lib_scoru_wasm/wasm_pvm.ml +++ b/src/lib_scoru_wasm/wasm_pvm.ml @@ -34,6 +34,11 @@ let tick_state_encoding = ~default:(fun () -> Snapshot) (value [] Data_encoding.string) [ + case + "start" + (return ()) + (function Start -> Some () | _ -> None) + (fun () -> Start); case "decode" Parsing.Decode.encoding diff --git a/src/lib_scoru_wasm/wasm_pvm_state.ml b/src/lib_scoru_wasm/wasm_pvm_state.ml index 213c90462630..eeb4a2cb19aa 100644 --- a/src/lib_scoru_wasm/wasm_pvm_state.ml +++ b/src/lib_scoru_wasm/wasm_pvm_state.ml @@ -67,6 +67,7 @@ type info = { For use in lib_scoru_wasm only. *) module Internal_state = struct type tick_state = + | Start | Decode of Tezos_webassembly_interpreter.Decode.decode_kont | Link of { ast_module : Tezos_webassembly_interpreter.Ast.module_; diff --git a/src/lib_scoru_wasm/wasm_vm.ml b/src/lib_scoru_wasm/wasm_vm.ml index 7fe4337b85b9..46c7dd9b0aea 100644 --- a/src/lib_scoru_wasm/wasm_vm.ml +++ b/src/lib_scoru_wasm/wasm_vm.ml @@ -79,7 +79,7 @@ let unsafe_next_tick_state ({buffers; durable; tick_state; _} as pvm_state) = let* has_reboot_flag = has_reboot_flag durable in if has_reboot_flag then let* durable = Durable.(delete durable Constants.reboot_flag_key) in - return ~durable (initial_boot_state ()) + return ~durable Start else return ~status:Failing @@ -97,6 +97,7 @@ let unsafe_next_tick_state ({buffers; durable; tick_state; _} as pvm_state) = | _ when is_time_for_snapshot pvm_state -> (* Execution took too many ticks *) return ~status:Failing (Stuck Too_many_ticks) + | Start -> return (initial_boot_state ()) | Decode {module_kont = MKStop ast_module; _} -> return (Link @@ -212,7 +213,8 @@ let next_tick_state pvm_state = | Link _ -> Link_error error.Wasm_pvm_errors.raw_exception | Init _ -> Init_error error | Eval _ -> Eval_error error - | Stuck _ | Snapshot | Padding -> Unknown_error error.raw_exception) + | Start | Stuck _ | Snapshot | Padding -> + Unknown_error error.raw_exception) | `Unknown raw_exception -> Unknown_error raw_exception in Lwt.return (pvm_state.durable, Stuck wasm_error, Failing) @@ -337,7 +339,11 @@ let set_input_step input_info message pvm_state = (* TODO: https://gitlab.com/tezos/tezos/-/issues/3157 The goal is to read a complete inbox. *) (* Go back to decoding *) - initial_boot_state () + Start + | Start -> + Lwt.return + (Stuck + (Wasm_pvm_errors.invalid_state "No input required during start")) | Decode _ -> Lwt.return (Stuck @@ -371,6 +377,9 @@ let reveal_step payload pvm_state = | Eval {config; module_reg} -> let* config = Eval.reveal_step module_reg payload config in return (Eval {config; module_reg}) + | Start -> + return + (Stuck (Wasm_pvm_errors.invalid_state "No reveal expected during start")) | Decode _ -> return (Stuck diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with internal messages.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with internal messages.out index c4ed906436d6..47a24ef31cb7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with internal messages.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with internal messages.out @@ -41,118 +41,118 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"3" +"4" ./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/total_ticks -"6" +"7" ./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/total_ticks -"6" +"7" ./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/total_ticks -"9" +"10" ./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/total_ticks -"9" +"10" ./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/total_ticks -"12" +"13" ./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/total_ticks -"12" +"13" ./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/total_ticks -"15" +"16" ./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/total_ticks -"15" +"16" ./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/total_ticks -"18" +"19" ./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/total_ticks -"18" +"19" ./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/total_ticks -"21" +"22" ./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/total_ticks -"21" +"22" ./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/total_ticks -"24" +"25" ./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/total_ticks -"24" +"25" ./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/total_ticks -"27" +"28" ./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/total_ticks -"27" +"28" ./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/total_ticks -"30" +"31" ./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/total_ticks -"30" +"31" ./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/total_ticks -"33" +"34" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages.out index 60fbb7f5e96e..a482518914b7 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - node advances PVM state with messages.out @@ -84,13 +84,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"4" +"5" ./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/total_ticks -"4" +"5" ./octez-client --wait none send sc rollup message '["2 8 + value"]' from bootstrap2 Node is bootstrapped. @@ -133,13 +133,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"7" +"8" ./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/total_ticks -"7" +"8" ./octez-client --wait none send sc rollup message '["3 10 + value"]' from bootstrap2 Node is bootstrapped. @@ -183,13 +183,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"10" +"11" ./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/total_ticks -"10" +"11" ./octez-client --wait none send sc rollup message '["4 12 + value"]' from bootstrap2 Node is bootstrapped. @@ -233,13 +233,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"13" +"14" ./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/total_ticks -"13" +"14" ./octez-client --wait none send sc rollup message '["5 14 + value"]' from bootstrap2 Node is bootstrapped. @@ -283,13 +283,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"16" +"17" ./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/total_ticks -"16" +"17" ./octez-client --wait none send sc rollup message '["6 16 + value"]' from bootstrap2 Node is bootstrapped. @@ -333,13 +333,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"19" +"20" ./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/total_ticks -"19" +"20" ./octez-client --wait none send sc rollup message '["7 18 + value"]' from bootstrap2 Node is bootstrapped. @@ -384,13 +384,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"22" +"23" ./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/total_ticks -"22" +"23" ./octez-client --wait none send sc rollup message '["8 20 + value"]' from bootstrap2 Node is bootstrapped. @@ -436,13 +436,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"25" +"26" ./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/total_ticks -"25" +"26" ./octez-client --wait none send sc rollup message '["9 22 + value"]' from bootstrap2 Node is bootstrapped. @@ -488,13 +488,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"28" +"29" ./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/total_ticks -"28" +"29" ./octez-client --wait none send sc rollup message '["10 24 + value"]' from bootstrap2 Node is bootstrapped. @@ -540,4 +540,4 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"31" +"32" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (batcher_does_.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (batcher_does_.out index 99353541a0b9..36652ca54d22 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (batcher_does_.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (batcher_does_.out @@ -2500,7 +2500,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (commitment_is.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (commitment_is.out index 1d6f815d0b6f..9da08a8daea0 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (commitment_is.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (commitment_is.out @@ -1244,7 +1244,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -1253,6 +1253,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (first_publish.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (first_publish.out index 075be6be0e53..f55b029fb9ed 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (first_publish.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (first_publish.out @@ -43,7 +43,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -52,7 +52,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } @@ -62,6 +62,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (handles_chain.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (handles_chain.out index ed8c52752a52..ab7a2415c7b9 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (handles_chain.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (handles_chain.out @@ -84,7 +84,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -93,5 +93,5 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (maintenance_p.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (maintenance_p.out index 98f627d38414..5a5d0855260a 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (maintenance_p.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (maintenance_p.out @@ -2500,7 +2500,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } @@ -2510,6 +2510,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (no_commitment.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (no_commitment.out index 932b34f358e8..5dd1e00bcbab 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (no_commitment.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (no_commitment.out @@ -43,7 +43,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -52,7 +52,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-client rpc get /chains/main/blocks/head/context/constants @@ -266,7 +266,7 @@ null "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "61" }, + "number_of_ticks": "62" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (node_use_prot.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (node_use_prot.out index 317cd9ddcbb1..4a33675c2677 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (node_use_prot.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (node_use_prot.out @@ -629,7 +629,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 17, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "151" }, + "number_of_ticks": "152" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /local/last_published_commitment @@ -638,6 +638,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 17, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "151" }, + "number_of_ticks": "152" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 20 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (observer_does.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (observer_does.out index 99353541a0b9..36652ca54d22 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (observer_does.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (observer_does.out @@ -2500,7 +2500,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (operator_publ.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (operator_publ.out index 98f627d38414..5a5d0855260a 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (operator_publ.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (operator_publ.out @@ -2500,7 +2500,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } @@ -2510,6 +2510,6 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]", "published_at_level": 35 } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (robust_to_fai.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (robust_to_fai.out index 7b82ed154663..319de75ee796 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (robust_to_fai.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - rollup node - correct handling of commitments (robust_to_fai.out @@ -1244,7 +1244,7 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } ./octez-sc-rollup-client-alpha rpc get /global/last_stored_commitment @@ -1253,5 +1253,5 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]", "inbox_level": 32, "predecessor": "[SC_ROLLUP_COMMITMENT_HASH]", - "number_of_ticks": "526" }, + "number_of_ticks": "527" }, "hash": "[SC_ROLLUP_COMMITMENT_HASH]" } diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_bad_fingerprint.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_bad_fingerprint.out index 4a9220cd9e40..a6a95c862aee 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_bad_fingerprint.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_bad_fingerprint.out @@ -84,13 +84,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"4" +"5" ./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/total_ticks -"4" +"5" ./octez-client --wait none send sc rollup message '["2 8 + value"]' from bootstrap2 Node is bootstrapped. @@ -133,13 +133,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"7" +"8" ./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/total_ticks -"7" +"8" ./octez-client --wait none send sc rollup message '["3 10 + value"]' from bootstrap2 Node is bootstrapped. @@ -183,13 +183,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"10" +"11" ./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/total_ticks -"10" +"11" ./octez-client --wait none send sc rollup message '["4 12 + value"]' from bootstrap2 Node is bootstrapped. @@ -233,13 +233,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"13" +"14" ./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/total_ticks -"13" +"14" ./octez-client --wait none send sc rollup message '["5 14 + value"]' from bootstrap2 Node is bootstrapped. @@ -283,13 +283,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"16" +"17" ./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/total_ticks -"16" +"17" ./octez-client --wait none send sc rollup message '["6 16 + value"]' from bootstrap2 Node is bootstrapped. @@ -333,13 +333,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"19" +"20" ./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/total_ticks -"19" +"20" ./octez-client --wait none send sc rollup message '["7 18 + value"]' from bootstrap2 Node is bootstrapped. @@ -384,13 +384,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"22" +"23" ./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/total_ticks -"22" +"23" ./octez-client --wait none send sc rollup message '["8 20 + value"]' from bootstrap2 Node is bootstrapped. @@ -436,13 +436,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"25" +"26" ./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/total_ticks -"25" +"26" ./octez-client --wait none send sc rollup message '["9 22 + value"]' from bootstrap2 Node is bootstrapped. @@ -488,13 +488,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"28" +"29" ./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/total_ticks -"28" +"29" ./octez-client --wait none send sc rollup message '["10 24 + value"]' from bootstrap2 Node is bootstrapped. @@ -540,4 +540,4 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"31" +"32" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_random.out b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_random.out index ee74787d490e..cbcf08a8c3fe 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_random.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- wasm_2_0_0 - runs with kernel - no_parse_random.out @@ -84,13 +84,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"4" +"5" ./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/total_ticks -"4" +"5" ./octez-client --wait none send sc rollup message '["2 8 + value"]' from bootstrap2 Node is bootstrapped. @@ -133,13 +133,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"7" +"8" ./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/total_ticks -"7" +"8" ./octez-client --wait none send sc rollup message '["3 10 + value"]' from bootstrap2 Node is bootstrapped. @@ -183,13 +183,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"10" +"11" ./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/total_ticks -"10" +"11" ./octez-client --wait none send sc rollup message '["4 12 + value"]' from bootstrap2 Node is bootstrapped. @@ -233,13 +233,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"13" +"14" ./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/total_ticks -"13" +"14" ./octez-client --wait none send sc rollup message '["5 14 + value"]' from bootstrap2 Node is bootstrapped. @@ -283,13 +283,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"16" +"17" ./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/total_ticks -"16" +"17" ./octez-client --wait none send sc rollup message '["6 16 + value"]' from bootstrap2 Node is bootstrapped. @@ -333,13 +333,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"19" +"20" ./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/total_ticks -"19" +"20" ./octez-client --wait none send sc rollup message '["7 18 + value"]' from bootstrap2 Node is bootstrapped. @@ -384,13 +384,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"22" +"23" ./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/total_ticks -"22" +"23" ./octez-client --wait none send sc rollup message '["8 20 + value"]' from bootstrap2 Node is bootstrapped. @@ -436,13 +436,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"25" +"26" ./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/total_ticks -"25" +"26" ./octez-client --wait none send sc rollup message '["9 22 + value"]' from bootstrap2 Node is bootstrapped. @@ -488,13 +488,13 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"28" +"29" ./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/total_ticks -"28" +"29" ./octez-client --wait none send sc rollup message '["10 24 + value"]' from bootstrap2 Node is bootstrapped. @@ -540,4 +540,4 @@ This sequence of operations was run: "[SC_ROLLUP_PVM_STATE_HASH]" ./octez-sc-rollup-client-alpha rpc get /global/block/head/total_ticks -"31" +"32" diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 01b9b5a3f0fa..3e10b1c821c8 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -1612,7 +1612,7 @@ let commitments_reorgs ~kind protocol sc_rollup_node sc_rollup node client = let additional_ticks = match kind with | "arith" -> 1 (* boot sector *) + 1 (* metadata *) - | "wasm_2_0_0" -> 1 (* boot_sector *) + | "wasm_2_0_0" -> 1 (* boot_sector *) + 1 (* TODO: ??? *) | _ -> assert false in Check.( -- GitLab From e68239d17695d39cf5572285ee6689606bd5637a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Fri, 28 Oct 2022 16:32:19 +0100 Subject: [PATCH 2/4] SCORU: WASM: Generate PVM module from VM module --- src/lib_scoru_wasm/wasm_pvm.ml | 234 ++++++++++++++++---------------- src/lib_scoru_wasm/wasm_pvm.mli | 2 + 2 files changed, 118 insertions(+), 118 deletions(-) diff --git a/src/lib_scoru_wasm/wasm_pvm.ml b/src/lib_scoru_wasm/wasm_pvm.ml index 595af442e544..0d49ca78f150 100644 --- a/src/lib_scoru_wasm/wasm_pvm.ml +++ b/src/lib_scoru_wasm/wasm_pvm.ml @@ -176,145 +176,143 @@ let pvm_state_encoding = ["pvm"; "maximum_reboots_per_input"] Data_encoding.n)) -module Make (T : Tezos_tree_encoding.TREE) : +module Make_pvm (Wasm_vm : Wasm_vm_sig.S) (T : Tezos_tree_encoding.TREE) : Wasm_pvm_sig.S with type tree = T.tree = struct - module Raw = struct - type tree = T.tree + type tree = T.tree - module Tree_encoding_runner = Tezos_tree_encoding.Runner.Make (T) + module Tree_encoding_runner = Tezos_tree_encoding.Runner.Make (T) - let decode tree = Tree_encoding_runner.decode pvm_state_encoding tree + let decode tree = Tree_encoding_runner.decode pvm_state_encoding tree - let encode pvm_state tree = - let open Lwt.Syntax in - (* {{Note tick state clean-up}} + let encode pvm_state tree = + let open Lwt.Syntax in + (* {{Note tick state clean-up}} - The "wasm" directory in the Irmin tree of the PVM is used to - maintain a lot of information across tick, but as of now, it - was never cleaned up. It meant that the tree would become - crowded with data that were no longer needed. + The "wasm" directory in the Irmin tree of the PVM is used to + maintain a lot of information across tick, but as of now, it + was never cleaned up. It meant that the tree would become + crowded with data that were no longer needed. - It turns out it is very simple to clean up, thanks to subtree - move. Because we keep in the lazy-containers the original - subtree, and we inject it prior to updating read keys, the - tree-encoding library does not rely on the input tree at - encoding time. + It turns out it is very simple to clean up, thanks to subtree + move. Because we keep in the lazy-containers the original + subtree, and we inject it prior to updating read keys, the + tree-encoding library does not rely on the input tree at + encoding time. - With this, we gain an additional 5% of proof size in the - worst tick of the computation.wasm kernel. *) - let* tree = T.remove tree ["wasm"] in - Tree_encoding_runner.encode pvm_state_encoding pvm_state tree + With this, we gain an additional 5% of proof size in the + worst tick of the computation.wasm kernel. *) + let* tree = T.remove tree ["wasm"] in + Tree_encoding_runner.encode pvm_state_encoding pvm_state tree - let install_boot_sector bs tree = - let bs = Tezos_lazy_containers.Chunked_byte_vector.of_string bs in - Tree_encoding_runner.encode - Tezos_tree_encoding.( - scope ["durable"; "kernel"; "boot.wasm"; "_"] chunked_byte_vector) - bs - tree + let install_boot_sector bs tree = + let bs = Tezos_lazy_containers.Chunked_byte_vector.of_string bs in + Tree_encoding_runner.encode + Tezos_tree_encoding.( + scope ["durable"; "kernel"; "boot.wasm"; "_"] chunked_byte_vector) + bs + tree - let compute_step_many ~max_steps tree = - let open Lwt.Syntax in - let* pvm_state = decode tree in - let* pvm_state, executed_ticks = - Wasm_vm.compute_step_many ~max_steps pvm_state - in - let+ tree = encode pvm_state tree in - (tree, executed_ticks) + let compute_step_many ~max_steps tree = + let open Lwt.Syntax in + let* pvm_state = decode tree in + let* pvm_state, executed_ticks = + Wasm_vm.compute_step_many ~max_steps pvm_state + in + let+ tree = encode pvm_state tree in + (tree, executed_ticks) - let compute_step tree = - let open Lwt.Syntax in - let* initial_state = decode tree in - let* final_state = Wasm_vm.compute_step initial_state in - encode final_state tree + let compute_step tree = + let open Lwt.Syntax in + let* initial_state = decode tree in + let* final_state = Wasm_vm.compute_step initial_state in + encode final_state tree - let get_output output_info tree = - let open Lwt_syntax in - let* candidate = - Tree_encoding_runner.decode - (Tezos_tree_encoding.option durable_buffers_encoding) - tree - in - Lwt.catch - (fun () -> - match candidate with - | Some {output; _} -> - let+ result = Wasm_vm.get_output output_info output in - Some result - | None -> Lwt.return None) - (fun _ -> Lwt.return None) + let get_output output_info tree = + let open Lwt_syntax in + let* candidate = + Tree_encoding_runner.decode + (Tezos_tree_encoding.option durable_buffers_encoding) + tree + in + Lwt.catch + (fun () -> + match candidate with + | Some {output; _} -> + let+ result = Wasm_vm.get_output output_info output in + Some result + | None -> Lwt.return None) + (fun _ -> Lwt.return None) - let get_info tree = - let open Lwt_syntax in - let* pvm_state = decode tree in - Wasm_vm.get_info pvm_state + let get_info tree = + let open Lwt_syntax in + let* pvm_state = decode tree in + Wasm_vm.get_info pvm_state - let set_input_step input_info message tree = - let open Lwt_syntax in - let* pvm_state = decode tree in - let* pvm_state = Wasm_vm.set_input_step input_info message pvm_state in - encode pvm_state tree + let set_input_step input_info message tree = + let open Lwt_syntax in + let* pvm_state = decode tree in + let* pvm_state = Wasm_vm.set_input_step input_info message pvm_state in + encode pvm_state tree - let reveal_step payload tree = - let open Lwt_syntax in - let* pvm_state = decode tree in - let* pvm_state = Wasm_vm.reveal_step payload pvm_state in - encode pvm_state tree + let reveal_step payload tree = + let open Lwt_syntax in + let* pvm_state = decode tree in + let* pvm_state = Wasm_vm.reveal_step payload pvm_state in + encode pvm_state tree - module Internal_for_tests = struct - let get_tick_state tree = - let open Lwt_syntax in - let+ pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in - pvm_state.tick_state + module Internal_for_tests = struct + let get_tick_state tree = + let open Lwt_syntax in + let+ pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in + pvm_state.tick_state - let get_module_instance_exn tree = - let open Lwt_syntax in - let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in - match pvm_state.tick_state with - | Eval config -> - Wasm.Instance.ModuleMap.get - Constants.wasm_main_module_name - config.module_reg - | _ -> raise (Invalid_argument "get_module_instance") + let get_module_instance_exn tree = + let open Lwt_syntax in + let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in + match pvm_state.tick_state with + | Eval config -> + Wasm.Instance.ModuleMap.get + Constants.wasm_main_module_name + config.module_reg + | _ -> raise (Invalid_argument "get_module_instance") - let is_stuck tree = - let open Lwt.Syntax in - let* pvm = Tree_encoding_runner.decode pvm_state_encoding tree in - match pvm.tick_state with - | Stuck error -> Lwt.return_some error - | _ -> Lwt.return_none + let is_stuck tree = + let open Lwt.Syntax in + let* pvm = Tree_encoding_runner.decode pvm_state_encoding tree in + match pvm.tick_state with + | Stuck error -> Lwt.return_some error + | _ -> Lwt.return_none - let set_max_nb_ticks n tree = - let open Lwt_syntax in - let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in - let pvm_state = {pvm_state with max_nb_ticks = n} in - Tree_encoding_runner.encode pvm_state_encoding pvm_state tree + let set_max_nb_ticks n tree = + let open Lwt_syntax in + let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in + let pvm_state = {pvm_state with max_nb_ticks = n} in + Tree_encoding_runner.encode pvm_state_encoding pvm_state tree - let set_maximum_reboots_per_input n tree = - let open Lwt_syntax in - let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in - let pvm_state = {pvm_state with maximum_reboots_per_input = n} in - Tree_encoding_runner.encode pvm_state_encoding pvm_state tree + let set_maximum_reboots_per_input n tree = + let open Lwt_syntax in + let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in + let pvm_state = {pvm_state with maximum_reboots_per_input = n} in + Tree_encoding_runner.encode pvm_state_encoding pvm_state tree - let reset_reboot_counter tree = - let open Lwt_syntax in - let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in - let pvm_state = - {pvm_state with reboot_counter = pvm_state.maximum_reboots_per_input} - in - Tree_encoding_runner.encode pvm_state_encoding pvm_state tree + let reset_reboot_counter tree = + let open Lwt_syntax in + let* pvm_state = Tree_encoding_runner.decode pvm_state_encoding tree in + let pvm_state = + {pvm_state with reboot_counter = pvm_state.maximum_reboots_per_input} + in + Tree_encoding_runner.encode pvm_state_encoding pvm_state tree - let get_output_buffer tree = - let open Lwt.Syntax in - let+ pvm = Tree_encoding_runner.decode pvm_state_encoding tree in - pvm.buffers.output + let get_output_buffer tree = + let open Lwt.Syntax in + let+ pvm = Tree_encoding_runner.decode pvm_state_encoding tree in + pvm.buffers.output - let get_input_buffer tree = - let open Lwt.Syntax in - let+ pvm = Tree_encoding_runner.decode pvm_state_encoding tree in - pvm.buffers.input - end + let get_input_buffer tree = + let open Lwt.Syntax in + let+ pvm = Tree_encoding_runner.decode pvm_state_encoding tree in + pvm.buffers.input end - - include Raw end + +module Make = Make_pvm (Wasm_vm) diff --git a/src/lib_scoru_wasm/wasm_pvm.mli b/src/lib_scoru_wasm/wasm_pvm.mli index 5cf75212f13b..203d16c188f8 100644 --- a/src/lib_scoru_wasm/wasm_pvm.mli +++ b/src/lib_scoru_wasm/wasm_pvm.mli @@ -32,3 +32,5 @@ val durable_buffers_encoding : module Make (T : Tezos_tree_encoding.TREE) : Wasm_pvm_sig.S with type tree = T.tree + +module Make_pvm (Wasm_vm : Wasm_vm_sig.S) : module type of Make -- GitLab From c810d2b4eeccc8c8d59303b749beda1db39ccf77 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Fri, 28 Oct 2022 16:36:05 +0100 Subject: [PATCH 3/4] SCORU: WASM: Enable Fast Execution --- .gitlab/ci/opam-ci.yml | 9 +- dune-project | 1 + manifest/main.ml | 20 +- opam/octez-sc-rollup-node-alpha.opam | 2 +- opam/tezos-scoru-wasm-fast.opam | 24 ++ opam/tezos-scoru-wasm-test-helpers.opam | 1 + src/lib_scoru_wasm/fast/dune | 17 + src/lib_scoru_wasm/fast/exec.ml | 307 ++++++++++++++++++ src/lib_scoru_wasm/fast/pvm.ml | 26 ++ src/lib_scoru_wasm/fast/vm.ml | 109 +++++++ src/lib_scoru_wasm/fast/vm.mli | 30 ++ src/lib_scoru_wasm/test/helpers/dune | 1 + src/lib_scoru_wasm/wasm_vm.mli | 8 + src/proto_alpha/bin_sc_rollup_node/dune | 2 +- .../bin_sc_rollup_node/wasm_2_0_0_pvm.ml | 2 +- 15 files changed, 553 insertions(+), 6 deletions(-) create mode 100644 opam/tezos-scoru-wasm-fast.opam create mode 100644 src/lib_scoru_wasm/fast/dune create mode 100644 src/lib_scoru_wasm/fast/exec.ml create mode 100644 src/lib_scoru_wasm/fast/pvm.ml create mode 100644 src/lib_scoru_wasm/fast/vm.ml create mode 100644 src/lib_scoru_wasm/fast/vm.mli diff --git a/.gitlab/ci/opam-ci.yml b/.gitlab/ci/opam-ci.yml index 7c0f5a32d280..980f0dddca53 100644 --- a/.gitlab/ci/opam-ci.yml +++ b/.gitlab/ci/opam-ci.yml @@ -937,7 +937,7 @@ opam:tezos-expect-helper: opam:tezos-hacl: extends: - .opam_template - - .rules_template__trigger_opam_batch_6 + - .rules_template__trigger_opam_batch_7 variables: package: tezos-hacl @@ -1438,6 +1438,13 @@ opam:tezos-scoru-wasm: variables: package: tezos-scoru-wasm +opam:tezos-scoru-wasm-fast: + extends: + - .opam_template + - .rules_template__trigger_opam_batch_6 + variables: + package: tezos-scoru-wasm-fast + opam:tezos-shell: extends: - .opam_template diff --git a/dune-project b/dune-project index 9b4d42dce0f8..4386de9b5e8d 100644 --- a/dune-project +++ b/dune-project @@ -186,6 +186,7 @@ (package (name tezos-sc-rollup-alpha)) (package (name tezos-scoru-wasm)) (package (name tezos-scoru-wasm-benchmark)(allow_empty)) +(package (name tezos-scoru-wasm-fast)) (package (name tezos-scoru-wasm-test)(allow_empty)) (package (name tezos-scoru-wasm-test-helpers)(allow_empty)) (package (name tezos-shell)) diff --git a/manifest/main.ml b/manifest/main.ml index 9b2a454dde70..f1113e0fb3aa 100644 --- a/manifest/main.ml +++ b/manifest/main.ml @@ -1577,7 +1577,7 @@ let _octez_p2p_tests = ]; ]) -let _octez_wasmer = +let octez_wasmer = public_lib "tezos-wasmer" ~path:"src/lib_wasmer" @@ -1615,6 +1615,21 @@ let octez_scoru_wasm = data_encoding; ] +let octez_scoru_wasm_fast = + public_lib + "tezos-scoru-wasm-fast" + ~path:"src/lib_scoru_wasm/fast" + ~synopsis:"WASM functionality for SCORU Fast Execution" + ~deps: + [ + octez_base |> open_ ~m:"TzPervasives"; + tree_encoding; + octez_webassembly_interpreter; + lazy_containers; + octez_scoru_wasm; + octez_wasmer; + ] + let octez_context_encoding = public_lib "tezos-context.encoding" @@ -3206,6 +3221,7 @@ let octez_scoru_wasm_tests_helpers = octez_base_test_helpers |> open_; octez_test_helpers; octez_scoru_wasm; + octez_scoru_wasm_fast; qcheck_alcotest; alcotest_lwt; tezt_lib; @@ -4762,7 +4778,7 @@ module Protocol = Protocol ringo; ringo_lwt; injector |> if_some |> open_; - octez_scoru_wasm; + octez_scoru_wasm_fast; octez_crypto_dal |> if_ N.(number >= 016) |> open_; ] in diff --git a/opam/octez-sc-rollup-node-alpha.opam b/opam/octez-sc-rollup-node-alpha.opam index 4800d6b99fb0..b22f5090fc35 100644 --- a/opam/octez-sc-rollup-node-alpha.opam +++ b/opam/octez-sc-rollup-node-alpha.opam @@ -34,7 +34,7 @@ depends: [ "ringo" { >= "0.9" } "ringo-lwt" { >= "0.9" } "tezos-injector-alpha" - "tezos-scoru-wasm" + "tezos-scoru-wasm-fast" "tezos-crypto-dal" ] build: [ diff --git a/opam/tezos-scoru-wasm-fast.opam b/opam/tezos-scoru-wasm-fast.opam new file mode 100644 index 000000000000..4366b64570fc --- /dev/null +++ b/opam/tezos-scoru-wasm-fast.opam @@ -0,0 +1,24 @@ +# This file was automatically generated, do not edit. +# Edit file manifest/main.ml instead. +opam-version: "2.0" +maintainer: "contact@tezos.com" +authors: ["Tezos devteam"] +homepage: "https://www.tezos.com/" +bug-reports: "https://gitlab.com/tezos/tezos/issues" +dev-repo: "git+https://gitlab.com/tezos/tezos.git" +license: "MIT" +depends: [ + "dune" { >= "3.0" } + "tezos-base" + "tezos-tree-encoding" + "tezos-webassembly-interpreter" + "tezos-lazy-containers" + "tezos-scoru-wasm" + "tezos-wasmer" +] +build: [ + ["rm" "-r" "vendors"] + ["dune" "build" "-p" name "-j" jobs] + ["dune" "runtest" "-p" name "-j" jobs] {with-test} +] +synopsis: "WASM functionality for SCORU Fast Execution" diff --git a/opam/tezos-scoru-wasm-test-helpers.opam b/opam/tezos-scoru-wasm-test-helpers.opam index 8452670e9fbb..02c7da4c7f90 100644 --- a/opam/tezos-scoru-wasm-test-helpers.opam +++ b/opam/tezos-scoru-wasm-test-helpers.opam @@ -17,6 +17,7 @@ depends: [ "tezos-base-test-helpers" "tezos-test-helpers" "tezos-scoru-wasm" + "tezos-scoru-wasm-fast" "qcheck-alcotest" { >= "0.18" } "alcotest-lwt" { >= "1.5.0" } "tezt" diff --git a/src/lib_scoru_wasm/fast/dune b/src/lib_scoru_wasm/fast/dune new file mode 100644 index 000000000000..7dbd84507089 --- /dev/null +++ b/src/lib_scoru_wasm/fast/dune @@ -0,0 +1,17 @@ +; This file was automatically generated, do not edit. +; Edit file manifest/main.ml instead. + +(library + (name tezos_scoru_wasm_fast) + (public_name tezos-scoru-wasm-fast) + (instrumentation (backend bisect_ppx)) + (libraries + tezos-base + tezos-tree-encoding + tezos-webassembly-interpreter + tezos-lazy-containers + tezos-scoru-wasm + tezos-wasmer) + (flags + (:standard) + -open Tezos_base.TzPervasives)) diff --git a/src/lib_scoru_wasm/fast/exec.ml b/src/lib_scoru_wasm/fast/exec.ml new file mode 100644 index 000000000000..fd23640409aa --- /dev/null +++ b/src/lib_scoru_wasm/fast/exec.ml @@ -0,0 +1,307 @@ +(*****************************************************************************) +(* *) +(* 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_scoru_wasm +module Wasmer = Tezos_wasmer +module Lazy_containers = Tezos_lazy_containers + +let kernel_key = Durable.key_of_string_exn "/kernel/boot.wasm" + +let store = + (* TODO: Making this global is potentially not a great idea. Maybe lazy? *) + let engine = Wasmer.Engine.create Wasmer.Config.{compiler = SINGLEPASS} in + Wasmer.Store.create engine + +let load_kernel durable = + let open Lwt.Syntax in + let* kernel = Durable.find_value_exn durable kernel_key in + let+ kernel = Lazy_containers.Chunked_byte_vector.to_string kernel in + Wasmer.Module.(create store Binary kernel) + +let to_ref_memory mem = + let open Wasmer.Memory in + let get_chunk page_id = + let start_address = + Int64.mul page_id Lazy_containers.Chunked_byte_vector.Chunk.size + in + let body = + Bytes.init + (Int64.to_int Lazy_containers.Chunked_byte_vector.Chunk.size) + (fun i -> + Wasmer.Memory.get mem Int64.(add start_address (of_int i) |> to_int) + |> Unsigned.UInt8.to_int |> Char.chr) + in + Lwt.return (Lazy_containers.Chunked_byte_vector.Chunk.of_bytes body) + in + let length = Wasmer.Memory.length mem |> Int64.of_int in + let chunked = Lazy_containers.Chunked_byte_vector.create ~get_chunk length in + let min = Unsigned.UInt32.to_int32 mem.min in + let max = Option.map Unsigned.UInt32.to_int32 mem.max in + Tezos_webassembly_interpreter.( + Partial_memory.of_chunks (MemoryType {min; max}) chunked) + +let commit_memory mem partial_memory = + let chunks = + Lazy_containers.Chunked_byte_vector.loaded_chunks + (Tezos_webassembly_interpreter.Partial_memory.content partial_memory) + in + List.iter + (fun (chunk_id, chunk) -> + let start = + Int64.mul chunk_id Lazy_containers.Chunked_byte_vector.Chunk.size + in + let body = Lazy_containers.Chunked_byte_vector.Chunk.to_bytes chunk in + Bytes.iteri + (fun i char -> + let addr = Int64.(add start (of_int i) |> to_int) in + Wasmer.Memory.set mem addr (Char.code char |> Unsigned.UInt8.of_int)) + body) + chunks + +let compute durable (buffers : Tezos_webassembly_interpreter.Eval.buffers) = + let open Lwt.Syntax in + let* module_ = load_kernel durable in + + let main_mem = ref None in + let retrieve_mem () = + match !main_mem with Some x -> x () | None -> assert false + in + let with_mem f = + let mem = retrieve_mem () in + let ref_mem = to_ref_memory mem in + let+ value = f ref_mem in + commit_memory mem ref_mem ; + value + in + + let durable_ref = ref durable in + + let host_funcs = + let open Wasmer in + let read_input = + fn + (i32 @-> i32 @-> i32 @-> i32 @-> returning1 i32) + (fun level_offset id_offset dst max_bytes -> + with_mem @@ fun memory -> + Host_funcs.Aux.read_input + ~input_buffer:buffers.input + ~output_buffer:buffers.output + ~memory + ~level_offset + ~id_offset + ~dst + ~max_bytes) + in + let write_output = + fn + (i32 @-> i32 @-> returning1 i32) + (fun src num_bytes -> + with_mem @@ fun memory -> + Host_funcs.Aux.write_output + ~output_buffer:buffers.output + ~memory + ~src + ~num_bytes) + in + let store_has = + fn + (i32 @-> i32 @-> returning1 i32) + (fun key_offset key_length -> + with_mem @@ fun memory -> + let+ result = + Host_funcs.Aux.store_has + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length + in + result) + in + let store_list_size = + fn + (i32 @-> i32 @-> returning1 i64) + (fun key_offset key_length -> + with_mem @@ fun memory -> + let+ durable, result = + Host_funcs.Aux.store_list_size + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length + in + durable_ref := durable ; + result) + in + let store_delete = + fn + (i32 @-> i32 @-> returning nothing) + (fun key_offset key_length -> + with_mem @@ fun memory -> + let+ durable, result = + Host_funcs.Aux.store_delete + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length + in + durable_ref := durable ; + (* XXX: This function shall return an int32 but the kernel doesn't + expect that yet. *) + ignore (result : int32)) + in + let write_debug = + fn + (i32 @-> i32 @-> returning nothing) + (fun key_offset key_length -> + let mem = retrieve_mem () in + let str = + String.init (Int32.to_int key_length) (fun i -> + Wasmer.Memory.get mem (Int32.to_int key_offset + i) + |> Unsigned.UInt8.to_int |> Char.chr) + in + Printf.printf "DEBUG: %s\n" str ; + Lwt.return ()) + in + let store_copy = + fn + (i32 @-> i32 @-> i32 @-> i32 @-> returning1 i32) + (fun from_key_offset from_key_length to_key_offset to_key_length -> + with_mem @@ fun memory -> + let+ durable, result = + Host_funcs.Aux.store_copy + ~durable:!durable_ref + ~memory + ~from_key_offset + ~from_key_length + ~to_key_offset + ~to_key_length + in + durable_ref := durable ; + result) + in + let store_move = + fn + (i32 @-> i32 @-> i32 @-> i32 @-> returning1 i32) + (fun from_key_offset from_key_length to_key_offset to_key_length -> + with_mem @@ fun memory -> + let+ durable, result = + Host_funcs.Aux.store_move + ~durable:!durable_ref + ~memory + ~from_key_offset + ~from_key_length + ~to_key_offset + ~to_key_length + in + durable_ref := durable ; + result) + in + let store_read = + fn + (i32 @-> i32 @-> i32 @-> i32 @-> i32 @-> returning1 i32) + (fun key_offset key_length value_offset dest max_bytes -> + with_mem @@ fun memory -> + Host_funcs.Aux.store_read + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length + ~value_offset + ~dest + ~max_bytes) + in + let store_write = + fn + (i32 @-> i32 @-> i32 @-> i32 @-> i32 @-> returning1 i32) + (fun key_offset key_length value_offset src num_bytes -> + with_mem @@ fun memory -> + let+ durable, ret = + Host_funcs.Aux.store_write + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length + ~value_offset + ~src + ~num_bytes + in + durable_ref := durable ; + ret) + in + let store_get_nth_key = + fn + (i32 @-> i32 @-> i64 @-> i32 @-> i32 @-> returning1 i32) + (fun key_offset key_length index dst max_size -> + with_mem @@ fun memory -> + Host_funcs.Aux.store_get_nth_key + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length + ~index + ~dst + ~max_size) + in + let store_value_size = + fn + (i32 @-> i32 @-> returning1 i32) + (fun key_offset key_length -> + with_mem @@ fun memory -> + Host_funcs.Aux.store_value_size + ~durable:!durable_ref + ~memory + ~key_offset + ~key_length) + in + [ + ("rollup_safe_core", "read_input", read_input); + ("rollup_safe_core", "write_output", write_output); + ("rollup_safe_core", "write_debug", write_debug); + ("rollup_safe_core", "store_has", store_has); + ("rollup_safe_core", "store_list_size", store_list_size); + ("rollup_safe_core", "store_value_size", store_value_size); + ("rollup_safe_core", "store_delete", store_delete); + ("rollup_safe_core", "store_copy", store_copy); + ("rollup_safe_core", "store_move", store_move); + ("rollup_safe_core", "store_read", store_read); + ("rollup_safe_core", "store_write", store_write); + ("rollup_safe_core", "store_get_nth_key", store_get_nth_key); + ] + in + + let* instance = Wasmer.Instance.create store module_ host_funcs in + + let exports = Wasmer.Exports.from_instance instance in + let kernel_next = + Wasmer.(Exports.fn exports "kernel_next" (producer nothing)) + in + + main_mem := Some (fun () -> Wasmer.Exports.mem0 exports) ; + + let* () = kernel_next () in + + Wasmer.Instance.delete instance ; + Wasmer.Module.delete module_ ; + Lwt.return !durable_ref diff --git a/src/lib_scoru_wasm/fast/pvm.ml b/src/lib_scoru_wasm/fast/pvm.ml new file mode 100644 index 000000000000..f6dcf9e599cd --- /dev/null +++ b/src/lib_scoru_wasm/fast/pvm.ml @@ -0,0 +1,26 @@ +(*****************************************************************************) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +module Make = Tezos_scoru_wasm.Wasm_pvm.Make_pvm (Vm) diff --git a/src/lib_scoru_wasm/fast/vm.ml b/src/lib_scoru_wasm/fast/vm.ml new file mode 100644 index 000000000000..12e29175c0fc --- /dev/null +++ b/src/lib_scoru_wasm/fast/vm.ml @@ -0,0 +1,109 @@ +(*****************************************************************************) +(* *) +(* 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_scoru_wasm +open Wasm_pvm_state.Internal_state + +include (Wasm_vm : Wasm_vm_sig.S) + +let compute_until_start ~max_steps pvm_state = + Wasm_vm.compute_step_many_until + ~max_steps + (fun pvm_state -> + match pvm_state.tick_state with + | Start -> Lwt.return false + | _ -> Wasm_vm.should_compute pvm_state) + pvm_state + +module Internal_for_tests = struct + let run_counter = ref Z.zero + + let record_successful_run () = run_counter := Z.succ !run_counter + + let get_successful_runs () = !run_counter +end + +let rec compute_step_many ~max_steps pvm_state = + let open Lwt.Syntax in + assert (max_steps > 0L) ; + let eligible_for_fast_exec = + Z.Compare.(Z.of_int64 max_steps >= pvm_state.max_nb_ticks) + in + if eligible_for_fast_exec then + let goto_start_and_retry () = + let* pvm_state, ticks = compute_until_start ~max_steps pvm_state in + let max_steps = Int64.sub max_steps ticks in + let* may_compute_more = Wasm_vm.should_compute pvm_state in + if may_compute_more && max_steps > 0L then + (* TODO: Make tail recursive! *) + let+ pvm_state, more_ticks = compute_step_many ~max_steps pvm_state in + (pvm_state, Int64.add ticks more_ticks) + else Lwt.return (pvm_state, ticks) + in + let go_like_the_wind () = + (* First we must clear any remainder of a reboot flag. *) + let durable = pvm_state.durable in + let* has_reboot_flag = Wasm_vm.has_reboot_flag durable in + let* durable = + if has_reboot_flag then + Durable.(delete durable Constants.reboot_flag_key) + else Lwt.return durable + in + (* Execute! *) + (* TODO: Call multiple times? *) + let* durable = Exec.compute durable pvm_state.buffers in + (* Compute the new tick counter. *) + let ticks = Z.pred pvm_state.max_nb_ticks in + let current_tick = Z.add pvm_state.current_tick ticks in + (* Figure out reboot. *) + let+ status = Wasm_vm.mark_for_reboot pvm_state.reboot_counter durable in + let tick_state = + if status = Failing then Stuck Too_many_reboots else Snapshot + in + let reboot_counter = Wasm_vm.next_reboot_counter pvm_state status in + (* Assemble state *) + let pvm_state = + { + pvm_state with + durable; + current_tick; + tick_state; + reboot_counter; + last_top_level_call = current_tick; + } + in + Internal_for_tests.record_successful_run () ; + (pvm_state, Z.to_int64 ticks) + in + match pvm_state.tick_state with + | Start -> + Lwt.catch go_like_the_wind (fun _ -> + Tezos_scoru_wasm.Wasm_vm.compute_step_many ~max_steps pvm_state) + | _ -> goto_start_and_retry () + else + (* The number of ticks we're asked to do is lower than the maximum number + of ticks for a top-level cycle. Fast Execution cannot be applied in this + case. *) + Tezos_scoru_wasm.Wasm_vm.compute_step_many ~max_steps pvm_state diff --git a/src/lib_scoru_wasm/fast/vm.mli b/src/lib_scoru_wasm/fast/vm.mli new file mode 100644 index 000000000000..7643d849bba6 --- /dev/null +++ b/src/lib_scoru_wasm/fast/vm.mli @@ -0,0 +1,30 @@ +(*****************************************************************************) +(* *) +(* 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. *) +(* *) +(*****************************************************************************) + +include Tezos_scoru_wasm.Wasm_vm_sig.S + +module Internal_for_tests : sig + val get_successful_runs : unit -> Z.t +end diff --git a/src/lib_scoru_wasm/test/helpers/dune b/src/lib_scoru_wasm/test/helpers/dune index 61d7cef1fd59..6c6822a4c782 100644 --- a/src/lib_scoru_wasm/test/helpers/dune +++ b/src/lib_scoru_wasm/test/helpers/dune @@ -13,6 +13,7 @@ tezos-base-test-helpers tezos-test-helpers tezos-scoru-wasm + tezos-scoru-wasm-fast qcheck-alcotest alcotest-lwt tezt diff --git a/src/lib_scoru_wasm/wasm_vm.mli b/src/lib_scoru_wasm/wasm_vm.mli index f2335c29e289..6d4f43eee473 100644 --- a/src/lib_scoru_wasm/wasm_vm.mli +++ b/src/lib_scoru_wasm/wasm_vm.mli @@ -46,3 +46,11 @@ val compute_step_many_until : (pvm_state * int64) Lwt.t val eval_has_finished : tick_state -> bool + +val should_compute : pvm_state -> bool Lwt.t + +val has_reboot_flag : Durable.t -> bool Lwt.t + +val mark_for_reboot : Z.t -> Durable.t -> computation_status Lwt.t + +val next_reboot_counter : pvm_state -> computation_status -> Z.t diff --git a/src/proto_alpha/bin_sc_rollup_node/dune b/src/proto_alpha/bin_sc_rollup_node/dune index f1b2012a4dc7..cecf581350b2 100644 --- a/src/proto_alpha/bin_sc_rollup_node/dune +++ b/src/proto_alpha/bin_sc_rollup_node/dune @@ -35,7 +35,7 @@ ringo ringo-lwt tezos-injector-alpha - tezos-scoru-wasm + tezos-scoru-wasm-fast tezos-crypto-dal) (link_flags (:standard) diff --git a/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml b/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml index ce756990da53..92dde90354fc 100644 --- a/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml +++ b/src/proto_alpha/bin_sc_rollup_node/wasm_2_0_0_pvm.ml @@ -52,7 +52,7 @@ module type TreeS = module Make_backend (Tree : TreeS) = struct type Tezos_lazy_containers.Lazy_map.tree += PVM_tree of Tree.tree - include Tezos_scoru_wasm.Wasm_pvm.Make (struct + include Tezos_scoru_wasm_fast.Pvm.Make (struct include Tree let select = function -- GitLab From caf4dfe9117f6ff3e07bcef62092493e24c7d78d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ole=20Kr=C3=BCger?= Date: Fri, 28 Oct 2022 16:37:30 +0100 Subject: [PATCH 4/4] SCORU: WASM: Test Fast Execution consistency --- src/lib_scoru_wasm/test/helpers/wasm_utils.ml | 11 +- src/lib_scoru_wasm/test/test_fast.ml | 170 ++++++++++++++++++ src/lib_scoru_wasm/test/test_scoru_wasm.ml | 1 + .../test/wasm_kernels/computation.wasm | Bin 0 -> 9863 bytes tezt/tests/sc_rollup.ml | 2 +- 5 files changed, 180 insertions(+), 4 deletions(-) create mode 100644 src/lib_scoru_wasm/test/test_fast.ml create mode 100644 src/lib_scoru_wasm/test/wasm_kernels/computation.wasm diff --git a/src/lib_scoru_wasm/test/helpers/wasm_utils.ml b/src/lib_scoru_wasm/test/helpers/wasm_utils.ml index 635840140525..546b85517e0b 100644 --- a/src/lib_scoru_wasm/test/helpers/wasm_utils.ml +++ b/src/lib_scoru_wasm/test/helpers/wasm_utils.ml @@ -28,6 +28,7 @@ open Tezos_scoru_wasm open Test_encodings_util open Tezos_lazy_containers module Wasm = Wasm_pvm.Make (Tree) +module Wasm_fast = Tezos_scoru_wasm_fast.Pvm.Make (Tree) let parse_module code = let def = Parse.string_to_module code in @@ -65,13 +66,17 @@ let eval_until_stuck ?(max_steps = 20000L) tree = in go max_steps tree -let rec eval_until_input_requested ?(max_steps = Int64.max_int) tree = +let rec eval_until_input_requested ?(fast_exec = false) + ?(max_steps = Int64.max_int) tree = let open Lwt_syntax in + let run = + if fast_exec then Wasm_fast.compute_step_many else Wasm.compute_step_many + in let* info = Wasm.get_info tree in match info.input_request with | No_input_required -> - let* tree, _ = Wasm.compute_step_many ~max_steps tree in - eval_until_input_requested tree + let* tree, _ = run ~max_steps tree in + eval_until_input_requested ~fast_exec ~max_steps tree | Input_required | Reveal_required _ -> return tree let rec eval_until_init tree = diff --git a/src/lib_scoru_wasm/test/test_fast.ml b/src/lib_scoru_wasm/test/test_fast.ml new file mode 100644 index 000000000000..981764dfc434 --- /dev/null +++ b/src/lib_scoru_wasm/test/test_fast.ml @@ -0,0 +1,170 @@ +(*****************************************************************************) +(* *) +(* 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 Tztest + +let apply_fast counter tree = + let open Lwt.Syntax in + let run_counter_before = + Tezos_scoru_wasm_fast.Vm.Internal_for_tests.get_successful_runs () + in + let+ tree = + Wasm_utils.eval_until_input_requested + ~fast_exec:true + ~max_steps:Int64.max_int + tree + in + (if counter > 0 then + (* Assert that the FE actual ran. We must consider that before the first + message is inserted, FE is unlikely to run. *) + let run_counter_after = + Tezos_scoru_wasm_fast.Vm.Internal_for_tests.get_successful_runs () + in + assert (Z.Compare.(run_counter_after > run_counter_before))) ; + tree + +let apply_slow = + Wasm_utils.eval_until_input_requested + ~fast_exec:false + ~max_steps:Int64.max_int + +let test_against_both ~from_binary ~kernel ~messages = + let open Lwt.Syntax in + let rec go_in_parallel counter messages start_tree = + let* slow_tree = apply_slow start_tree in + let* fast_tree = apply_fast counter start_tree in + + let fast_hash = Tezos_context_memory.Context_binary.Tree.hash fast_tree in + let slow_hash = Tezos_context_memory.Context_binary.Tree.hash slow_tree in + assert (Context_hash.(slow_hash = fast_hash)) ; + + let* stuck = Wasm_utils.Wasm.Internal_for_tests.is_stuck fast_tree in + assert (Option.is_none stuck) ; + match messages with + | [] -> Lwt.return_unit + | message :: messages -> + let* tree = Wasm_utils.set_input_step message counter fast_tree in + go_in_parallel (succ counter) messages tree + in + + let* tree = + Wasm_utils.initial_tree ~max_tick:Int64.max_int ~from_binary kernel + in + let* () = go_in_parallel 0 messages tree in + + Lwt_result_syntax.return_unit + +let test_computation = + Wasm_utils.test_with_kernel "computation" (fun kernel -> + (* Providing 4 empty messages basically means calling the kernel + entrypoint 4 times. *) + test_against_both ~from_binary:true ~kernel ~messages:[""; ""; ""; ""]) + +let test_store_read_write () = + let kernel = + {| + (module + (import + "rollup_safe_core" + "write_debug" + (func $write_debug (param i32 i32)) + ) + + (import + "rollup_safe_core" + "store_write" + (func $store_write (param i32 i32 i32 i32 i32) (result i32)) + ) + + (import + "rollup_safe_core" + "store_read" + (func $store_read (param i32 i32 i32 i32 i32) (result i32)) + ) + + (memory 1) + (export "memory" (memory 0)) + + (data (i32.const 0) "Hello World") + (data (i32.const 100) "/foo") + + (func (export "kernel_next") (local $n i64) + (call $write_debug (i32.const 0) (i32.const 5)) + (call $write_debug (i32.const 6) (i32.const 5)) + (call $write_debug (i32.const 0) (i32.const 11)) + + ;; Write the initial value to the durable store + (call $store_write + (i32.const 100) (i32.const 4) ;; Key + (i32.const 0) ;; Offset to write + (i32.const 1000) (i32.const 4) ;; Bytes to write + ) + (drop) + + ;; Set the loop counter + (local.set $n (i64.const 100)) + + (loop + ;; Read from store to memory + (call $store_read + (i32.const 100) (i32.const 4) ;; Key + (i32.const 0) ;; Offset to write + (i32.const 1000) (i32.const 4) ;; Bytes to write + ) + (drop) + + ;; Increment the value in memory + (i32.store + (i32.const 1000) + (i32.add + (i32.load (i32.const 1000)) + (i32.const 1))) + + ;; Write value from memory to durable store + (call $store_write + (i32.const 100) (i32.const 4) + (i32.const 0) + (i32.const 1000) (i32.const 4) + ) + (drop) + + ;; Decrement loop counter + (local.set $n (i64.sub (local.get $n) (i64.const 1))) + + ;; Check if we ought to loop again + (i32.eq (i32.const 0) (i64.eq (local.get $n) (i64.const 0))) + (br_if 0) + ) + ) +) + |} + in + test_against_both ~from_binary:false ~kernel ~messages:(List.repeat 100 "") + +let tests = + [ + tztest "Computation kernel" `Quick test_computation; + tztest "Store read/write kernel" `Quick test_store_read_write; + ] diff --git a/src/lib_scoru_wasm/test/test_scoru_wasm.ml b/src/lib_scoru_wasm/test/test_scoru_wasm.ml index ac721436e3c8..623001feedb5 100644 --- a/src/lib_scoru_wasm/test/test_scoru_wasm.ml +++ b/src/lib_scoru_wasm/test/test_scoru_wasm.ml @@ -47,5 +47,6 @@ let () = ("Max nb of ticks", Test_fixed_nb_ticks.tests); ("Hash correspondence", Test_hash_consistency.tests); ("Reveal", Test_reveal.tests); + ("Fast Execution", Test_fast.tests); ] |> Lwt_main.run diff --git a/src/lib_scoru_wasm/test/wasm_kernels/computation.wasm b/src/lib_scoru_wasm/test/wasm_kernels/computation.wasm new file mode 100644 index 0000000000000000000000000000000000000000..da2df75b0e18b30e75d76eb42438c28f1d2c6148 GIT binary patch literal 9863 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 literal 0 HcmV?d00001 diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 3e10b1c821c8..d5f7eed5f762 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -1612,7 +1612,7 @@ let commitments_reorgs ~kind protocol sc_rollup_node sc_rollup node client = let additional_ticks = match kind with | "arith" -> 1 (* boot sector *) + 1 (* metadata *) - | "wasm_2_0_0" -> 1 (* boot_sector *) + 1 (* TODO: ??? *) + | "wasm_2_0_0" -> 1 (* boot_sector *) + 1 (* moving through start state *) | _ -> assert false in Check.( -- GitLab