From 82379ff26361c30386ef234293bb5e1d40144200 Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Thu, 19 Jun 2025 15:49:56 +0200 Subject: [PATCH 1/3] RISC-V: Update cargo workspace and configuration --- etherlink/lib_wasm_runtime/Cargo.toml | 1 + src/riscv/.cargo/config.toml | 7 --- src/riscv/Cargo.toml | 76 +++++---------------------- src/riscv/api/Cargo.toml | 16 ++---- src/rust_deps/Cargo.toml | 1 + 5 files changed, 18 insertions(+), 83 deletions(-) diff --git a/etherlink/lib_wasm_runtime/Cargo.toml b/etherlink/lib_wasm_runtime/Cargo.toml index 89f408caddb2..d3d7c6c32a2f 100644 --- a/etherlink/lib_wasm_runtime/Cargo.toml +++ b/etherlink/lib_wasm_runtime/Cargo.toml @@ -3,6 +3,7 @@ name = "octez-evm-node-wasm-runtime" version = "0.0.0-dev" authors = ["Etherlink Core Engineers "] edition = "2021" +resolver = "3" [lib] crate-type = ["staticlib", "cdylib", "rlib"] diff --git a/src/riscv/.cargo/config.toml b/src/riscv/.cargo/config.toml index 71b190c085da..5b43b349c29b 100644 --- a/src/riscv/.cargo/config.toml +++ b/src/riscv/.cargo/config.toml @@ -4,10 +4,3 @@ rustdocflags = ["--deny", "warnings"] # Required in order to build OCaml bindings with ocaml-rs on MacOS [target.'cfg(target_os = "macos")'] rustflags = ["-C", "link-args=-Wl,-undefined,dynamic_lookup"] - -[profile.profiling] -inherits = "release" -debug = true - -[profile.test] -opt-level = 1 diff --git a/src/riscv/Cargo.toml b/src/riscv/Cargo.toml index 01239785d013..77ba7acd090c 100644 --- a/src/riscv/Cargo.toml +++ b/src/riscv/Cargo.toml @@ -1,88 +1,38 @@ [workspace] -resolver = "2" +resolver = "3" members = ["api"] -exclude = ["jstz", "dummy_kernel"] [workspace.lints.clippy] allow_attributes = "deny" +allow_attributes_without_reason = "deny" [workspace.lints.rustdoc] broken_intra_doc_links = "deny" private_intra_doc_links = "allow" [workspace.dependencies] -bincode = "1.3.3" -cfg-if = "1.0.0" -comfy-table = "7.1.1" -cranelift = "0.111.2" -cranelift-jit = "0.111.2" -cranelift-module = "0.111.2" -cranelift-native = "0.111.2" -derive_more = "0.99.17" -ed25519-dalek = "2.1.0" -elf = "0.7.4" -enum-tag = "0.3.0" -gdbstub = "0.7.3" -gdbstub_arch = "0.3.1" -ieee-apsqrt = "0.1.1" -itertools = "0.12.1" -lazy_static = "1.4.0" -meansd = "2.1.0" +arbitrary-int = "1.2.7" num_enum = "0.7.2" -numfmt = "1.1.1" ocaml-build = "1.0.0" -paste = "1.0.14" -proptest = "1.4.0" -quanta = "0.12.3" -rand = "0.8.5" -rustc_apfloat = "0.2.0" -serde_json = "1.0.115" sha2 = "0.10.9" -tempfile = "3.10.1" -tezos-smart-rollup-constants.path = "../kernel_sdk/constants" -tezos-smart-rollup-encoding.path = "../kernel_sdk/encoding" -tezos-smart-rollup-utils.path = "../kernel_sdk/utils" -thiserror = "1.0.57" -try-blocks = "0.1.4" -vm-fdt = "0.3.0" -goldenfile = "1.7.1" -arbitrary-int = "1.2.7" -range-collections = "0.4.5" - -[workspace.dependencies.tezos-smart-rollup] -path = "../kernel_sdk/sdk" -features = ["utils"] - -[workspace.dependencies.tezos_crypto_rs] -path = "../../sdk/rust/crypto" -default-features = false [workspace.dependencies.strum] version = "0.26.1" features = ["derive"] -[workspace.dependencies.clap] -version = "4.4.6" -features = ["derive"] - -[workspace.dependencies.serde] -version = "1.0.197" -features = ["derive"] - -[workspace.dependencies.hex] -version = "0.4.3" -features = ["serde"] +[workspace.dependencies.octez-riscv] +git = "https://github.com/tezos/riscv-pvm.git" [workspace.dependencies.ocaml] version = "1.1.0" default-features = false -# The dependency alias is used to make it obvious that it should not be used directly. Using it -# directly may have a surprising impact on performance when logging and tracing are disabled. -[workspace.dependencies.__tracing_do_not_use_directly] -package = "tracing" -version = "0.1.41" +[workspace.dependencies.ocaml-sys] +# We don't care about the version. Ideally this gets pinned to what `ocaml` needs. +version = "*" +default-features = false -[workspace.dependencies.tracing-subscriber] -version = "0.3.19" -features = ["json"] +[workspace.dependencies.ocaml-boxroot-sys] +# We don't care about the version. Ideally this gets pinned to what `ocaml` needs. +version = "*" +default-features = false \ No newline at end of file diff --git a/src/riscv/api/Cargo.toml b/src/riscv/api/Cargo.toml index 9b2a605fd51b..6f29dfa27358 100644 --- a/src/riscv/api/Cargo.toml +++ b/src/riscv/api/Cargo.toml @@ -12,19 +12,9 @@ num_enum.workspace = true sha2.workspace = true strum.workspace = true ocaml.workspace = true - -[dependencies.octez-riscv] -git = "https://github.com/tezos/riscv-pvm.git" - -[dependencies.ocaml-sys] -# We don't care about the version. Ideally this gets pinned to what `ocaml` needs. -version = "*" -default-features = false - -[dependencies.ocaml-boxroot-sys] -# We don't care about the version. Ideally this gets pinned to what `ocaml` needs. -version = "*" -default-features = false +octez-riscv.workspace = true +ocaml-sys.workspace = true +ocaml-boxroot-sys.workspace = true [build-dependencies] ocaml-build.workspace = true diff --git a/src/rust_deps/Cargo.toml b/src/rust_deps/Cargo.toml index 9dd479074f25..c4b5a15c0569 100644 --- a/src/rust_deps/Cargo.toml +++ b/src/rust_deps/Cargo.toml @@ -2,6 +2,7 @@ name = "octez-rust-deps" version = "0.0.0" edition = "2021" +resolver = "3" [lib] crate-type = ["staticlib", "cdylib"] -- GitLab From 9d733dcdfc9e92dc302e36c6d9602fffd5b97929 Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Thu, 19 Jun 2025 15:51:18 +0200 Subject: [PATCH 2/3] RISC-V: Makefile: Update mechanism --- src/riscv/Cargo.toml | 1 + src/riscv/Makefile | 29 ++++++++++++++++++++--------- 2 files changed, 21 insertions(+), 9 deletions(-) diff --git a/src/riscv/Cargo.toml b/src/riscv/Cargo.toml index 77ba7acd090c..068855939b08 100644 --- a/src/riscv/Cargo.toml +++ b/src/riscv/Cargo.toml @@ -21,6 +21,7 @@ version = "0.26.1" features = ["derive"] [workspace.dependencies.octez-riscv] +# The locked version can be updated via `make update-riscv-pvm` git = "https://github.com/tezos/riscv-pvm.git" [workspace.dependencies.ocaml] diff --git a/src/riscv/Makefile b/src/riscv/Makefile index 8f0a9518a16f..a4be48b07964 100644 --- a/src/riscv/Makefile +++ b/src/riscv/Makefile @@ -1,4 +1,4 @@ -# SPDX-FileCopyrightText: 2023 Nomadic Labs +# SPDX-FileCopyrightText: 2023-2025 Nomadic Labs # SPDX-FileCopyrightText: 2024-2025 TriliTech # # SPDX-License-Identifier: MIT @@ -25,24 +25,35 @@ SANDBOX_ENABLE_FEATURES ?= # The version of nightly that we use for anything that requires it NIGHTLY_VERSION = nightly-2025-01-30 +# Prefix for downloading assets from the riscv-pvm repo +RISCV_PVM_REPO = https://raw.githubusercontent.com/tezos/riscv-pvm/refs/heads/main + .PHONY: build build: @cargo build --release --workspace $(NATIVE_OPT) $(EXTRA_FLAGS) -# Update checked-in binaries +# Update checked-in binaries and regression files .PHONY: update-assets -update-assets: assets/riscv-dummy.elf assets/jstz +update-assets: assets/riscv-dummy.elf assets/jstz assets/jstz_proof_initial + +# Update to the latest version of `riscv-pvm`. Assets will be updated accordingly. +.PHONY: update-riscv-pvm +update-riscv-pvm: update-assets + @cargo update octez-riscv # Update the compiled dummy kernel used in CI tests assets/riscv-dummy.elf assets/riscv-dummy.elf.checksum:: - @cargo install --config .cargo/config.toml --locked --git https://github.com/tezos/riscv-pvm.git --branch ole/github --target riscv64gc-unknown-linux-musl --root assets riscv-dummy - @mv assets/bin/riscv-dummy $@ - @sha256sum $@ > $@.checksum + @curl -L -o $@ $(RISCV_PVM_REPO)/src/riscv/assets/riscv-dummy.elf + @curl -L -o $@.checksum $(RISCV_PVM_REPO)/src/riscv/assets/riscv-dummy.elf.checksum +# Update the compiled jstz kernel used in CI tests assets/jstz assets/jstz.checksum:: - @cargo install --config .cargo/config.toml --locked --git https://github.com/tezos/riscv-pvm.git --branch ole/github --target riscv64gc-unknown-linux-musl --root assets jstz - @mv assets/bin/jstz $@ - @sha256sum $@ > $@.checksum + @curl -L -o $@ $(RISCV_PVM_REPO)/src/riscv/assets/jstz + @curl -L -o $@.checksum $(RISCV_PVM_REPO)/src/riscv/assets/jstz.checksum + +# Update the serialised proof for the initial tick of jstz used in the CI tests +assets/jstz_proof_initial: + @curl -L -o $@ $(RISCV_PVM_REPO)/src/riscv/lib/tests/expected/jstz/proof_initial .PHONY: build-deps build-deps: -- GitLab From 5cd26d5ceb259957b62f6106cb40da9bd9efd681 Mon Sep 17 00:00:00 2001 From: Victor Dumitrescu Date: Tue, 24 Jun 2025 15:34:20 +0200 Subject: [PATCH 3/3] RISC-V: Run `make update-riscv-pvm` --- src/riscv/Cargo.lock | 103 +++++++++++++++++++++++++++++++++++-------- 1 file changed, 85 insertions(+), 18 deletions(-) diff --git a/src/riscv/Cargo.lock b/src/riscv/Cargo.lock index 27d488a4f8f6..29d4dab4f74d 100644 --- a/src/riscv/Cargo.lock +++ b/src/riscv/Cargo.lock @@ -98,9 +98,9 @@ checksum = "0c4b4d0bd25bd0b74681c0ad21497610ce1b7c91b1022cd21c80c6fbdd9476b0" [[package]] name = "base64" -version = "0.13.1" +version = "0.22.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" +checksum = "72b3254f16251a8381aa12e40e3c4d2f0199f8c6508fbecb9d91f575e0fbb8c6" [[package]] name = "base64ct" @@ -481,6 +481,16 @@ dependencies = [ "typenum", ] +[[package]] +name = "crypto-mac" +version = "0.8.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "b584a330336237c1eecd3e94266efb216c56ed91225d634cb2991c5f3fd1aeab" +dependencies = [ + "generic-array", + "subtle", +] + [[package]] name = "crypto-mac" version = "0.11.1" @@ -595,7 +605,7 @@ checksum = "43ee23aa5b4f68c7a092b5c3beb25f50c406adc75e2363634f242f28ab255372" dependencies = [ "der 0.4.5", "elliptic-curve", - "hmac", + "hmac 0.11.0", "signature 1.3.2", ] @@ -783,14 +793,35 @@ dependencies = [ "serde", ] +[[package]] +name = "hmac" +version = "0.8.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "126888268dcc288495a26bf004b38c5fdbb31682f992c84ceb046a1f0fe38840" +dependencies = [ + "crypto-mac 0.8.0", + "digest 0.9.0", +] + [[package]] name = "hmac" version = "0.11.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "2a2a2320eb7ec0ebe8da8f744d7812d9fc4cb4d09344ac01898dbcb6a20ae69b" dependencies = [ - "crypto-mac", + "crypto-mac 0.11.1", + "digest 0.9.0", +] + +[[package]] +name = "hmac-drbg" +version = "0.3.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "17ea0a1394df5b6574da6e0c1ade9e78868c9fb0a4e5ef4428e32da4676b85b1" +dependencies = [ "digest 0.9.0", + "generic-array", + "hmac 0.8.1", ] [[package]] @@ -851,6 +882,15 @@ dependencies = [ "wasm-bindgen", ] +[[package]] +name = "keccak" +version = "0.1.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "ecc2af9a1119c51f12a14607e783cb977bde58bc069ff0c3da1095e635d70654" +dependencies = [ + "cpufeatures", +] + [[package]] name = "lazy_static" version = "1.4.0" @@ -865,18 +905,21 @@ checksum = "97b3888a4aecf77e811145cadf6eef5901f4782c53886191b2f693f24761847c" [[package]] name = "libsecp256k1" -version = "0.7.1" +version = "0.7.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "95b09eff1b35ed3b33b877ced3a691fc7a481919c7e29c53c906226fcf55e2a1" +checksum = "e79019718125edc905a079a70cfa5f3820bc76139fc91d6f9abc27ea2a887139" dependencies = [ "arrayref", "base64", "digest 0.9.0", + "hmac-drbg", "libsecp256k1-core", "libsecp256k1-gen-ecmult", "libsecp256k1-gen-genmult", "rand 0.8.5", "serde", + "sha2 0.9.9", + "typenum", ] [[package]] @@ -1055,7 +1098,7 @@ dependencies = [ [[package]] name = "octez-riscv" version = "0.0.0" -source = "git+https://github.com/tezos/riscv-pvm.git#48dc9c129dd9bec3269b536a12be4008d3b10589" +source = "git+https://github.com/tezos/riscv-pvm.git#bea5417fd1898ccc506cda11e07f12daddbd1293" dependencies = [ "arbitrary-int", "bincode", @@ -1070,6 +1113,7 @@ dependencies = [ "hex", "ieee-apsqrt", "itertools", + "libsecp256k1", "num_enum", "paste", "range-collections", @@ -1077,6 +1121,7 @@ dependencies = [ "serde", "serde_json", "sha2 0.10.9", + "sha3", "strum 0.26.3", "tezos-smart-rollup-constants", "tezos-smart-rollup-utils", @@ -1232,7 +1277,7 @@ version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a6b1679d49b24bbfe0c803429aa1874472f50d9b363131f0e89fc356b544d03" dependencies = [ - "rand_chacha", + "rand_chacha 0.2.2", "rand_core 0.5.1", "rand_hc", ] @@ -1243,6 +1288,8 @@ version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "34af8d1a0e25924bc5b7c43c079c942339d8f0a8b57c39049bef581b46327404" dependencies = [ + "libc", + "rand_chacha 0.3.1", "rand_core 0.6.4", ] @@ -1256,6 +1303,16 @@ dependencies = [ "rand_core 0.5.1", ] +[[package]] +name = "rand_chacha" +version = "0.3.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "e6c10a63a0fa32252be49d21e7709d4d4baf8d231c2dbce1eaa8141b9b127d88" +dependencies = [ + "ppv-lite86", + "rand_core 0.6.4", +] + [[package]] name = "rand_core" version = "0.5.1" @@ -1480,6 +1537,16 @@ dependencies = [ "digest 0.10.7", ] +[[package]] +name = "sha3" +version = "0.10.8" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "75872d278a8f37ef87fa0ddbda7802605cb18344497949862c0d4dcb291eba60" +dependencies = [ + "digest 0.10.7", + "keccak", +] + [[package]] name = "shlex" version = "1.3.0" @@ -1616,7 +1683,7 @@ checksum = "e502f78cdbb8ba4718f566c418c52bc729126ffd16baee5baa718cf25dd5a69a" [[package]] name = "tezos-smart-rollup-build-utils" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "rustc_version", ] @@ -1624,12 +1691,12 @@ dependencies = [ [[package]] name = "tezos-smart-rollup-constants" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" [[package]] name = "tezos-smart-rollup-core" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "tezos-smart-rollup-build-utils", "tezos-smart-rollup-constants", @@ -1638,7 +1705,7 @@ dependencies = [ [[package]] name = "tezos-smart-rollup-encoding" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "hex", "nom", @@ -1657,7 +1724,7 @@ dependencies = [ [[package]] name = "tezos-smart-rollup-host" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "tezos-smart-rollup-build-utils", "tezos-smart-rollup-core", @@ -1669,7 +1736,7 @@ dependencies = [ [[package]] name = "tezos-smart-rollup-mock" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "hex", "tezos-smart-rollup-core", @@ -1682,7 +1749,7 @@ dependencies = [ [[package]] name = "tezos-smart-rollup-utils" version = "0.2.2" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "clap", "hex", @@ -1699,7 +1766,7 @@ dependencies = [ [[package]] name = "tezos_crypto_rs" version = "0.6.0" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "anyhow", "bs58", @@ -1724,7 +1791,7 @@ dependencies = [ [[package]] name = "tezos_data_encoding" version = "0.6.0" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "bit-vec", "bitvec", @@ -1741,7 +1808,7 @@ dependencies = [ [[package]] name = "tezos_data_encoding_derive" version = "0.6.0" -source = "git+https://gitlab.com/tezos/tezos.git#45b3ad6d3c2741620c566323fd9f93235bb7fc5e" +source = "git+https://gitlab.com/tezos/tezos.git#0bf7deb196e7015c4595b7bce1659796e83cdca5" dependencies = [ "lazy_static", "once_cell", -- GitLab