From 4d9a4775da8684eaa2b8e85f3e68dbbc43593baa Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Thu, 11 Jul 2024 08:32:09 +0200 Subject: [PATCH 1/3] RISC-V PVM: Replace set_input function --- src/lib_riscv/pvm/backend.ml | 2 +- .../lib_sc_rollup_node/riscv_pvm.ml | 21 ++++++++++++------- src/riscv/lib/octez_riscv_api.ml | 2 +- src/riscv/lib/octez_riscv_api.mli | 2 +- src/riscv/lib/src/ocaml_api.rs | 4 ++-- src/riscv/lib/src/pvm/dummy_pvm.rs | 13 +++++++++--- 6 files changed, 28 insertions(+), 16 deletions(-) diff --git a/src/lib_riscv/pvm/backend.ml b/src/lib_riscv/pvm/backend.ml index e526d7087963..3a262a905869 100644 --- a/src/lib_riscv/pvm/backend.ml +++ b/src/lib_riscv/pvm/backend.ml @@ -49,7 +49,7 @@ let state_hash state = Api.octez_riscv_state_hash state let set_input state level message_counter payload = Lwt.return - (Api.octez_riscv_set_input + (Api.octez_riscv_set_input_message state level message_counter diff --git a/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml b/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml index 49c1c08a00fb..8d08a1f1e357 100644 --- a/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml +++ b/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml @@ -62,14 +62,19 @@ module PVM : let is_input_state ~is_reveal_enabled:_ state = let open Lwt_syntax in - let* level = Backend.get_current_level state in - match level with - | None -> return Sc_rollup.Initial - | Some level -> - let* message_counter = Backend.get_message_counter state in - return - (Sc_rollup.First_after - (Raw_level.of_int32_exn level, Z.of_int64 message_counter)) + let* status = Backend.get_status state in + match status with + | Evaluating -> return Sc_rollup.No_input_required + | WaitingForInput -> ( + let* level = Backend.get_current_level state in + match level with + | None -> return Sc_rollup.Initial + | Some level -> + let* message_counter = Backend.get_message_counter state in + return + (Sc_rollup.First_after + (Raw_level.of_int32_exn level, Z.of_int64 message_counter))) + | WaitingForMetadata -> return Sc_rollup.(Needs_reveal Reveal_metadata) let set_input input state = match input with diff --git a/src/riscv/lib/octez_riscv_api.ml b/src/riscv/lib/octez_riscv_api.ml index d61d7796d239..4409fb756d33 100644 --- a/src/riscv/lib/octez_riscv_api.ml +++ b/src/riscv/lib/octez_riscv_api.ml @@ -27,6 +27,6 @@ external octez_riscv_get_tick: state -> int64 = "octez_riscv_get_tick" external octez_riscv_get_level: state -> int32 option = "octez_riscv_get_level" external octez_riscv_install_boot_sector: state -> bytes -> state = "octez_riscv_install_boot_sector" external octez_riscv_state_hash: state -> bytes = "octez_riscv_state_hash" -external octez_riscv_set_input: state -> int32 -> int64 -> bytes -> state = "octez_riscv_set_input" +external octez_riscv_set_input_message: state -> int32 -> int64 -> bytes -> state = "octez_riscv_set_input_message" external octez_riscv_get_message_counter: state -> int64 = "octez_riscv_get_message_counter" external octez_riscv_storage_export_snapshot: repo -> id -> string -> (unit, [`Msg of string]) result = "octez_riscv_storage_export_snapshot" diff --git a/src/riscv/lib/octez_riscv_api.mli b/src/riscv/lib/octez_riscv_api.mli index d61d7796d239..4409fb756d33 100644 --- a/src/riscv/lib/octez_riscv_api.mli +++ b/src/riscv/lib/octez_riscv_api.mli @@ -27,6 +27,6 @@ external octez_riscv_get_tick: state -> int64 = "octez_riscv_get_tick" external octez_riscv_get_level: state -> int32 option = "octez_riscv_get_level" external octez_riscv_install_boot_sector: state -> bytes -> state = "octez_riscv_install_boot_sector" external octez_riscv_state_hash: state -> bytes = "octez_riscv_state_hash" -external octez_riscv_set_input: state -> int32 -> int64 -> bytes -> state = "octez_riscv_set_input" +external octez_riscv_set_input_message: state -> int32 -> int64 -> bytes -> state = "octez_riscv_set_input_message" external octez_riscv_get_message_counter: state -> int64 = "octez_riscv_get_message_counter" external octez_riscv_storage_export_snapshot: repo -> id -> string -> (unit, [`Msg of string]) result = "octez_riscv_storage_export_snapshot" diff --git a/src/riscv/lib/src/ocaml_api.rs b/src/riscv/lib/src/ocaml_api.rs index 5fe6656cc3c4..0537eba4bc88 100644 --- a/src/riscv/lib/src/ocaml_api.rs +++ b/src/riscv/lib/src/ocaml_api.rs @@ -239,7 +239,7 @@ pub fn octez_riscv_state_hash(state: Pointer) -> [u8; 32] { #[ocaml::func] #[ocaml::sig("state -> int32 -> int64 -> bytes -> state")] -pub fn octez_riscv_set_input( +pub fn octez_riscv_set_input_message( state: Pointer, level: u32, message_counter: u64, @@ -249,7 +249,7 @@ pub fn octez_riscv_set_input( state .as_ref() .0 - .set_input(level, message_counter, input.to_vec()), + .set_input_message(level, message_counter, input.to_vec()), ) .into() } diff --git a/src/riscv/lib/src/pvm/dummy_pvm.rs b/src/riscv/lib/src/pvm/dummy_pvm.rs index 3d2cd461ed1c..afe418628050 100644 --- a/src/riscv/lib/src/pvm/dummy_pvm.rs +++ b/src/riscv/lib/src/pvm/dummy_pvm.rs @@ -148,6 +148,7 @@ impl DummyPvm { let steps = state .pvm .eval_range_while(pvm_hooks, &(..=max_steps), |_| true); + // TODO: RV-78 update tick counter with number of steps state.tick.write(state.tick.read() + 1); (Self { backend }, steps as i64) } @@ -158,10 +159,16 @@ impl DummyPvm { .unwrap() } - pub fn set_input(&self, level: u32, message_counter: u64, _input: Vec) -> Self { + pub fn set_input_message(&self, level: u32, message_counter: u64, input: Vec) -> Self { self.with_new_backend(|state| { - let tick = state.tick.read(); - state.tick.write(tick + 1); + assert!( + state + .pvm + .provide_input(level, message_counter as u32, &input), + "Cannot accept input in current state ({})", + state.pvm.status() + ); + state.tick.write(state.tick.read() + 1); state.message_counter.write(message_counter); state.level_is_set.write(true); state.level.write(level); -- GitLab From 5aa872bab7703774ccdcb6d5d5df197a2cdcf9cf Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Thu, 11 Jul 2024 09:15:21 +0200 Subject: [PATCH 2/3] RISC-V PVM: Add set_metadata function --- src/lib_riscv/pvm/backend.ml | 3 +++ src/lib_riscv/pvm/backend.mli | 2 ++ src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml | 7 ++++++- src/riscv/lib/octez_riscv_api.ml | 1 + src/riscv/lib/octez_riscv_api.mli | 1 + src/riscv/lib/src/ocaml_api.rs | 11 +++++++++++ src/riscv/lib/src/pvm/dummy_pvm.rs | 13 +++++++++++++ 7 files changed, 37 insertions(+), 1 deletion(-) diff --git a/src/lib_riscv/pvm/backend.ml b/src/lib_riscv/pvm/backend.ml index 3a262a905869..13bd1846f3f2 100644 --- a/src/lib_riscv/pvm/backend.ml +++ b/src/lib_riscv/pvm/backend.ml @@ -54,3 +54,6 @@ let set_input state level message_counter payload = level message_counter (Bytes.of_string payload)) + +let set_metadata state address origination_level = + Lwt.return (Api.octez_riscv_set_metadata state address origination_level) diff --git a/src/lib_riscv/pvm/backend.mli b/src/lib_riscv/pvm/backend.mli index f62c1e0db394..214b4cafd32c 100644 --- a/src/lib_riscv/pvm/backend.mli +++ b/src/lib_riscv/pvm/backend.mli @@ -43,3 +43,5 @@ val get_current_level : state -> int32 option Lwt.t val state_hash : state -> bytes val set_input : state -> int32 -> int64 -> string -> state Lwt.t + +val set_metadata : state -> bytes -> int32 -> state Lwt.t diff --git a/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml b/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml index 8d08a1f1e357..e2830fcc849a 100644 --- a/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml +++ b/src/proto_alpha/lib_sc_rollup_node/riscv_pvm.ml @@ -84,7 +84,12 @@ module PVM : (Raw_level.to_int32 inbox_level) (Z.to_int64 message_counter) (Sc_rollup.Inbox_message.unsafe_to_string payload) - | Sc_rollup.Reveal _ -> assert false + | Sc_rollup.(Reveal (Metadata {address; origination_level})) -> + Backend.set_metadata + state + (Sc_rollup.Address.to_bytes address) + (Raw_level.to_int32 origination_level) + | _ -> assert false let eval state = Backend.compute_step state diff --git a/src/riscv/lib/octez_riscv_api.ml b/src/riscv/lib/octez_riscv_api.ml index 4409fb756d33..6b55b4357edd 100644 --- a/src/riscv/lib/octez_riscv_api.ml +++ b/src/riscv/lib/octez_riscv_api.ml @@ -28,5 +28,6 @@ external octez_riscv_get_level: state -> int32 option = "octez_riscv_get_level" external octez_riscv_install_boot_sector: state -> bytes -> state = "octez_riscv_install_boot_sector" external octez_riscv_state_hash: state -> bytes = "octez_riscv_state_hash" external octez_riscv_set_input_message: state -> int32 -> int64 -> bytes -> state = "octez_riscv_set_input_message" +external octez_riscv_set_metadata: state -> bytes -> int32 -> state = "octez_riscv_set_metadata" external octez_riscv_get_message_counter: state -> int64 = "octez_riscv_get_message_counter" external octez_riscv_storage_export_snapshot: repo -> id -> string -> (unit, [`Msg of string]) result = "octez_riscv_storage_export_snapshot" diff --git a/src/riscv/lib/octez_riscv_api.mli b/src/riscv/lib/octez_riscv_api.mli index 4409fb756d33..6b55b4357edd 100644 --- a/src/riscv/lib/octez_riscv_api.mli +++ b/src/riscv/lib/octez_riscv_api.mli @@ -28,5 +28,6 @@ external octez_riscv_get_level: state -> int32 option = "octez_riscv_get_level" external octez_riscv_install_boot_sector: state -> bytes -> state = "octez_riscv_install_boot_sector" external octez_riscv_state_hash: state -> bytes = "octez_riscv_state_hash" external octez_riscv_set_input_message: state -> int32 -> int64 -> bytes -> state = "octez_riscv_set_input_message" +external octez_riscv_set_metadata: state -> bytes -> int32 -> state = "octez_riscv_set_metadata" external octez_riscv_get_message_counter: state -> int64 = "octez_riscv_get_message_counter" external octez_riscv_storage_export_snapshot: repo -> id -> string -> (unit, [`Msg of string]) result = "octez_riscv_storage_export_snapshot" diff --git a/src/riscv/lib/src/ocaml_api.rs b/src/riscv/lib/src/ocaml_api.rs index 0537eba4bc88..69dc34f00c7a 100644 --- a/src/riscv/lib/src/ocaml_api.rs +++ b/src/riscv/lib/src/ocaml_api.rs @@ -254,6 +254,17 @@ pub fn octez_riscv_set_input_message( .into() } +#[ocaml::func] +#[ocaml::sig("state -> bytes -> int32 -> state")] +pub fn octez_riscv_set_metadata( + state: Pointer, + address: &[u8], + origination_level: u32, +) -> Pointer { + let address: &[u8; 20] = address.try_into().expect("Unexpected rollup address size"); + State(state.as_ref().0.set_metadata(address, origination_level)).into() +} + #[ocaml::func] #[ocaml::sig("state -> int64")] pub fn octez_riscv_get_message_counter(state: Pointer) -> u64 { diff --git a/src/riscv/lib/src/pvm/dummy_pvm.rs b/src/riscv/lib/src/pvm/dummy_pvm.rs index afe418628050..34c829d7fbec 100644 --- a/src/riscv/lib/src/pvm/dummy_pvm.rs +++ b/src/riscv/lib/src/pvm/dummy_pvm.rs @@ -175,6 +175,19 @@ impl DummyPvm { }) } + pub fn set_metadata(&self, rollup_address: &[u8; 20], origination_level: u32) -> Self { + self.with_new_backend(|state| { + assert!( + state + .pvm + .provide_metadata(rollup_address, origination_level), + "Cannot accept metadata in current state ({})", + state.pvm.status() + ); + state.tick.write(state.tick.read() + 1); + }) + } + pub fn to_bytes(&self) -> &[u8] { self.backend.borrow() } -- GitLab From 0a53083c9d1e2d82780c927b49cfd672b9dda688 Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Fri, 12 Jul 2024 16:47:47 +0200 Subject: [PATCH 3/3] RISC-V: update Tezt regressions --- ...cv - RPC API should work and be stable.out | 20 +- ...ces PVM state with messages (external).out | 54 ++--- ...ces PVM state with messages (internal).out | 195 ------------------ tezt/tests/sc_rollup.ml | 20 +- 4 files changed, 54 insertions(+), 235 deletions(-) delete mode 100644 tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (internal).out diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - RPC API should work and be stable.out b/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - RPC API should work and be stable.out index 9a70662d2b19..55cfcee8c167 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - RPC API should work and be stable.out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - RPC API should work and be stable.out @@ -1,7 +1,7 @@ -./octez-client --wait none originate smart rollup rollup from bootstrap1 of kind riscv of type string with kernel --burn-cap 9999999 +./octez-client --wait none originate smart rollup rollup from bootstrap1 of kind riscv of type string with kernel kernel:src/riscv/assets/riscv-dummy.elf:e162d416fa0c3909bbde908311e873dbb87cd1a22d8c7daee1c77074090fe593 --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 1930.030 units (will add 100 for safety) +Estimated gas: 1933.839 units (will add 100 for safety) Estimated storage: 6552 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -12,19 +12,19 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000441 + Fee to the baker: ꜩ0.000545 Expected counter: 1 - Gas limit: 2031 + Gas limit: 2034 Storage limit: 6572 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000441 - payload fees(the block proposer) ....... +ꜩ0.000441 + [PUBLIC_KEY_HASH] ... -ꜩ0.000545 + payload fees(the block proposer) ....... +ꜩ0.000545 Smart rollup origination: Kind: riscv Parameter type: string - Kernel Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' + Kernel Blake2B hash: '8711b89903907c10b84c8eeda35df72bfb5cb7b79216f3c93a9ad6a0ccc6ac2a' This smart rollup origination was successfully applied - Consumed gas: 1929.997 + Consumed gas: 1933.806 Storage size: 6552 bytes Address: [SMART_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] @@ -235,11 +235,11 @@ GET http://[HOST]:[PORT]/global/block/head/num_messages GET http://[HOST]:[PORT]/global/block/head/status 200 OK -"Evaluating" +"Waiting for input message" GET http://[HOST]:[PORT]/global/block/head/ticks 200 OK -"8" +"16" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (external).out b/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (external).out index d595d20afd09..3a68487d0c11 100644 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (external).out +++ b/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (external).out @@ -1,7 +1,7 @@ -./octez-client --wait none originate smart rollup rollup from bootstrap1 of kind riscv of type bytes with kernel --burn-cap 9999999 +./octez-client --wait none originate smart rollup rollup from bootstrap1 of kind riscv of type bytes with kernel kernel:src/riscv/assets/riscv-dummy.elf:e162d416fa0c3909bbde908311e873dbb87cd1a22d8c7daee1c77074090fe593 --burn-cap 9999999 Node is bootstrapped. -Estimated gas: 1930.030 units (will add 100 for safety) +Estimated gas: 1933.839 units (will add 100 for safety) Estimated storage: 6552 bytes added (will add 20 for safety) Operation successfully injected in the node. Operation hash is '[OPERATION_HASH]' @@ -12,19 +12,19 @@ and/or an external block explorer to make sure that it has been included. This sequence of operations was run: Manager signed operations: From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000441 + Fee to the baker: ꜩ0.000545 Expected counter: 1 - Gas limit: 2031 + Gas limit: 2034 Storage limit: 6572 bytes Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000441 - payload fees(the block proposer) ....... +ꜩ0.000441 + [PUBLIC_KEY_HASH] ... -ꜩ0.000545 + payload fees(the block proposer) ....... +ꜩ0.000545 Smart rollup origination: Kind: riscv Parameter type: bytes - Kernel Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' + Kernel Blake2B hash: '8711b89903907c10b84c8eeda35df72bfb5cb7b79216f3c93a9ad6a0ccc6ac2a' This smart rollup origination was successfully applied - Consumed gas: 1929.997 + Consumed gas: 1933.806 Storage size: 6552 bytes Address: [SMART_ROLLUP_HASH] Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] @@ -72,7 +72,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"4" +"11" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -80,7 +80,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"4" +"11" ./octez-client --wait none send smart rollup message '["2 8 + value"]' from bootstrap2 @@ -113,7 +113,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"8" +"19" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -121,7 +121,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"8" +"19" ./octez-client --wait none send smart rollup message '["3 10 + value"]' from bootstrap2 @@ -154,7 +154,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"12" +"27" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -162,7 +162,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"12" +"27" ./octez-client --wait none send smart rollup message '["4 12 + value"]' from bootstrap2 @@ -195,7 +195,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"16" +"35" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -203,7 +203,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"16" +"35" ./octez-client --wait none send smart rollup message '["5 14 + value"]' from bootstrap2 @@ -236,7 +236,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"20" +"43" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -244,7 +244,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"20" +"43" ./octez-client --wait none send smart rollup message '["6 16 + value"]' from bootstrap2 @@ -277,7 +277,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"24" +"51" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -285,7 +285,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"24" +"51" ./octez-client --wait none send smart rollup message '["7 18 + value"]' from bootstrap2 @@ -318,7 +318,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"28" +"59" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -326,7 +326,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"28" +"59" ./octez-client --wait none send smart rollup message '["8 20 + value"]' from bootstrap2 @@ -359,7 +359,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"32" +"67" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -367,7 +367,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"32" +"67" ./octez-client --wait none send smart rollup message '["9 22 + value"]' from bootstrap2 @@ -400,7 +400,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"36" +"75" GET http://[HOST]:[PORT]/global/block/head/state_hash 200 OK @@ -408,7 +408,7 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"36" +"75" ./octez-client --wait none send smart rollup message '["10 24 + value"]' from bootstrap2 @@ -441,5 +441,5 @@ GET http://[HOST]:[PORT]/global/block/head/state_hash GET http://[HOST]:[PORT]/global/block/head/total_ticks 200 OK -"40" +"83" diff --git a/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (internal).out b/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (internal).out deleted file mode 100644 index dcc2a0eee22e..000000000000 --- a/tezt/tests/expected/sc_rollup.ml/Alpha- riscv - node advances PVM state with messages (internal).out +++ /dev/null @@ -1,195 +0,0 @@ - -./octez-client --wait none originate smart rollup rollup from bootstrap1 of kind riscv of type bytes with kernel --burn-cap 9999999 -Node is bootstrapped. -Estimated gas: 1930.030 units (will add 100 for safety) -Estimated storage: 6552 bytes added (will add 20 for safety) -Operation successfully injected in the node. -Operation hash is '[OPERATION_HASH]' -NOT waiting for the operation to be included. -Use command - octez-client wait for [OPERATION_HASH] to be included --confirmations 1 --branch [BLOCK_HASH] -and/or an external block explorer to make sure that it has been included. -This sequence of operations was run: - Manager signed operations: - From: [PUBLIC_KEY_HASH] - Fee to the baker: ꜩ0.000441 - Expected counter: 1 - Gas limit: 2031 - Storage limit: 6572 bytes - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ0.000441 - payload fees(the block proposer) ....... +ꜩ0.000441 - Smart rollup origination: - Kind: riscv - Parameter type: bytes - Kernel Blake2B hash: '0e5751c026e543b2e8ab2eb06099daa1d1e5df47778f7787faab45cdf12fe3a8' - This smart rollup origination was successfully applied - Consumed gas: 1929.997 - Storage size: 6552 bytes - Address: [SMART_ROLLUP_HASH] - Genesis commitment hash: [SC_ROLLUP_COMMITMENT_HASH] - Balance updates: - [PUBLIC_KEY_HASH] ... -ꜩ1.638 - storage fees ........................... +ꜩ1.638 - -Smart rollup [SMART_ROLLUP_HASH] memorized as "rollup" -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"3" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"7" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"7" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"11" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"11" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"15" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"15" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"19" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"19" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"23" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"23" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"27" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"27" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"31" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"31" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"35" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"35" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"39" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"39" - -GET http://[HOST]:[PORT]/global/block/head/state_hash -200 OK -"[SC_ROLLUP_PVM_STATE_HASH]" - -GET http://[HOST]:[PORT]/global/block/head/total_ticks -200 OK -"43" - diff --git a/tezt/tests/sc_rollup.ml b/tezt/tests/sc_rollup.ml index 1a4ea0644376..34e7e5336d0f 100644 --- a/tezt/tests/sc_rollup.ml +++ b/tezt/tests/sc_rollup.ml @@ -5961,13 +5961,27 @@ let start_rollup_node_with_encrypted_key ~kind = in unit +(* TODO: https://linear.app/tezos/issue/RV-109/port-kernel-installer-to-risc-v + * Originate RISC-V kernels using installer kernel instead *) +let read_riscv_kernel (kernel_path : string) (checksum_path : string) : string = + let checksum = String.split_on_char ' ' (read_file checksum_path) in + "kernel:" ^ kernel_path ^ ":" ^ List.hd checksum + let register_riscv ~protocols = let kind = "riscv" in + let boot_sector = + read_riscv_kernel + "src/riscv/assets/riscv-dummy.elf" + "src/riscv/assets/riscv-dummy.elf.checksum" + in test_origination ~kind protocols ; - test_rpcs ~kind protocols ; + test_rpcs ~kind ~boot_sector protocols ; test_rollup_node_boots_into_initial_state protocols ~kind ; - test_rollup_node_advances_pvm_state protocols ~kind ~internal:false ; - test_rollup_node_advances_pvm_state protocols ~kind ~internal:true + test_rollup_node_advances_pvm_state + protocols + ~kind + ~boot_sector + ~internal:false let register ~kind ~protocols = test_origination ~kind protocols ; -- GitLab