Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds support for the risc0 backend by introducing related syscall enums, host functions, build scripts, and CLI integration. Key changes include new risc0 syscall and assembly files, updated host FFI and Cargo configuration for risc0, and adjustments to the build pipeline for post-processing the risc0 executable.
Reviewed Changes
Copilot reviewed 14 out of 14 changed files in this pull request and generated 3 comments.
Show a summary per file
| File | Description |
|---|---|
| pkgs/state-transition-runtime/src/risc0/syscalls.zig | Added syscall, halt_reason, and keccak_mode enums for risc0. |
| pkgs/state-transition-runtime/src/risc0/start.s | Introduced a new startup assembly file for risc0. |
| pkgs/state-transition-runtime/src/risc0/risc0.ld | Provides the linker script for risc0. |
| pkgs/state-transition-runtime/src/risc0/lib.zig | Added host functions using inline assembly to trigger risc0 syscalls. |
| pkgs/state-transition-runtime/src/risc0/io.zig | Introduced IO syscall wrappers corresponding to risc0. |
| pkgs/state-transition-runtime/src/risc0/host/src/lib.rs | New risc0 host functions to perform prove and verify operations. |
| pkgs/state-transition-runtime/src/risc0/host/Cargo.toml | Updated Cargo configuration for risc0 host integration. |
| pkgs/state-transition-runtime/src/main.zig | Adjusted memory allocation and configuration for risc0 runtime. |
| pkgs/state-proving-manager/src/manager.zig | Extended the state transition opts union to support risc0. |
| pkgs/cli/src/main.zig | Updated CLI to select risc0 instead of powdr backend. |
| build/risc0.zig | Added a build script to postprocess the risc0 executable. |
| build.zig | Adjusted build logic to incorporate risc0 target and postbuild steps. |
| pub fn halt(status: u32) noreturn { | ||
| sys_halt(&empty_digest, status); | ||
| } | ||
|
|
||
| const empty_digest = [_]u32{ 0x5c176f83, 0x53f3c062, 0x42651683, 0x340b8b7e, 0x19d2d1f6, 0xae4d7602, 0xb8c606b4, 0xb075b53d }; | ||
|
|
There was a problem hiding this comment.
Consider moving the declaration of 'empty_digest' before its usage in the 'halt' function to improve readability and avoid potential confusion.
| pub fn halt(status: u32) noreturn { | |
| sys_halt(&empty_digest, status); | |
| } | |
| const empty_digest = [_]u32{ 0x5c176f83, 0x53f3c062, 0x42651683, 0x340b8b7e, 0x19d2d1f6, 0xae4d7602, 0xb8c606b4, 0xb075b53d }; | |
| const empty_digest = [_]u32{ 0x5c176f83, 0x53f3c062, 0x42651683, 0x340b8b7e, 0x19d2d1f6, 0xae4d7602, 0xb8c606b4, 0xb075b53d }; | |
| pub fn halt(status: u32) noreturn { | |
| sys_halt(&empty_digest, status); | |
| } |
d864b67 to
d7f1656
Compare
|
Housekeeping tasks:
Some of these will be done in subsequent PRs. |
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Runtime is probably still borked, but messages + panics are working Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
Signed-off-by: Guillaume Ballet <3272758+gballet@users.noreply.github.com>
|
|
||
| pub fn verify_transition(stf_proof: types.BeamSTFProof, state_root: types.Bytes32, block_root: types.Bytes32, opts: StateTransitionOpts) !void { | ||
| _ = stf_proof; | ||
| _ = state_root; |
There was a problem hiding this comment.
(pre) stateroot and blockroot are stil unused to verify transition it seems
| try sftFactory.apply_transition(allocator, &beam_state, block); | ||
|
|
||
| // verify the block | ||
| try stateProvingManager.verify_transition(proof, [_]u8{0} ** 32, [_]u8{0} ** 32, options); |
There was a problem hiding this comment.
conceptually proof needs to be validated against pre state root and block root, since those are still being ignored in verify transition i can do a followup PR to change mock chain to add prestateroots (block roots are already there) so that it becomes handy over here
g11tech
left a comment
There was a problem hiding this comment.
lgtm, further verification changes can followup on another PR
Adds support for proving on risc0.