From 9182146021bfbfd58716e80465d1a589c8ee52b2 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Vella Date: Mon, 29 Jun 2026 19:31:10 -0300 Subject: [PATCH 1/4] FP is part of the execution state, alongside PC. --- openvm-riscv/extensions/hints-circuit/src/executors.rs | 4 ++++ openvm/src/powdr_extension/executor/mod.rs | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/openvm-riscv/extensions/hints-circuit/src/executors.rs b/openvm-riscv/extensions/hints-circuit/src/executors.rs index 7dfcbc9384..71bd7b929b 100644 --- a/openvm-riscv/extensions/hints-circuit/src/executors.rs +++ b/openvm-riscv/extensions/hints-circuit/src/executors.rs @@ -18,6 +18,7 @@ impl PhantomSubExecutor for ReverseBytesSubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, + _fp: u32, _: PhantomDiscriminant, a: u32, _: u32, @@ -58,6 +59,7 @@ impl PhantomSubExecutor for K256InverseFieldSubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, + _fp: u32, _: PhantomDiscriminant, a: u32, _: u32, @@ -103,6 +105,7 @@ impl PhantomSubExecutor for K256InverseField10x26SubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, + _fp: u32, _: PhantomDiscriminant, a: u32, _: u32, @@ -150,6 +153,7 @@ impl PhantomSubExecutor for K256SqrtField10x26SubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, + _fp: u32, _: PhantomDiscriminant, a: u32, _: u32, diff --git a/openvm/src/powdr_extension/executor/mod.rs b/openvm/src/powdr_extension/executor/mod.rs index 9c097d73af..90ff81aca8 100644 --- a/openvm/src/powdr_extension/executor/mod.rs +++ b/openvm/src/powdr_extension/executor/mod.rs @@ -465,6 +465,7 @@ impl PreflightExecutor> // Extract the state components, since `execute` consumes the state but we need to pass it to each instruction execution let VmStateMut { pc, + fp, memory, streams, rng, @@ -503,6 +504,7 @@ impl PreflightExecutor> let state = VmStateMut { pc, + fp, memory, streams, rng, @@ -537,6 +539,7 @@ impl PreflightExecutor for PowdrExec // Extract the state components, since `execute` consumes the state but we need to pass it to each instruction execution let VmStateMut { pc, + fp, memory, streams, rng, @@ -575,6 +578,7 @@ impl PreflightExecutor for PowdrExec let state = VmStateMut { pc, + fp, memory, streams, rng, From 4d3eae4ccec57734df7d946d11c0fa50e2cccec0 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Vella Date: Mon, 29 Jun 2026 19:44:06 -0300 Subject: [PATCH 2/4] Point openvm deps at the first-class-fp branch. powdr-openvm relies on the forked openvm where `fp` is a first-class ExecutionState field (VmStateMut/PhantomSubExecutor carry `fp`). Move the openvm git dependencies from tag v2.0.0-beta.2-powdr.1 to branch first-class-fp so the patched powdr sources compile against the fork and consumers don't pull two conflicting copies of openvm-circuit-primitives. Co-Authored-By: Claude Opus 4.8 --- Cargo.toml | 64 +++++++++++++++++++++++++++--------------------------- 1 file changed, 32 insertions(+), 32 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index cd7d28e440..dd36fb4910 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -49,41 +49,41 @@ powdr-openvm-riscv-hints-transpiler = { path = "./openvm-riscv/extensions/hints- powdr-openvm-riscv-hints-circuit = { path = "./openvm-riscv/extensions/hints-circuit", version = "0.1.4" } # openvm -openvm = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-build = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-rv32im-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-rv32im-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-rv32im-guest = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1", default-features = false } -openvm-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-circuit-derive = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-circuit-primitives = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-circuit-primitives-derive = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-instructions = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-instructions-derive = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-sdk = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1", default-features = false, features = [ +openvm = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-build = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-rv32im-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-rv32im-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-rv32im-guest = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp", default-features = false } +openvm-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-circuit-derive = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-circuit-primitives = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-circuit-primitives-derive = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-instructions = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-instructions-derive = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-sdk = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp", default-features = false, features = [ "parallel", "jemalloc", ] } -openvm-sdk-config = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-ecc-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-ecc-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-keccak256-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-keccak256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-sha2-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-sha2-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-algebra-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-algebra-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-bigint-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-bigint-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-pairing-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-pairing-transpiler = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-native-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1", default-features = false } -openvm-native-recursion = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1", default-features = false } -openvm-platform = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-custom-insn = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-poseidon2-air = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } -openvm-deferral-circuit = { git = "https://github.com/powdr-labs/openvm.git", tag = "v2.0.0-beta.2-powdr.1" } +openvm-sdk-config = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-ecc-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-ecc-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-keccak256-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-keccak256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-sha2-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-sha2-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-algebra-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-algebra-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-bigint-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-bigint-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-pairing-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-pairing-transpiler = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-native-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp", default-features = false } +openvm-native-recursion = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp", default-features = false } +openvm-platform = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-custom-insn = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-poseidon2-air = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } +openvm-deferral-circuit = { git = "https://github.com/powdr-labs/openvm.git", branch = "first-class-fp" } # stark-backend openvm-stark-sdk = { git = "https://github.com/powdr-labs/stark-backend.git", tag = "v2.0.0-beta.2-powdr", default-features = false, features = [ From 06c76cb9af4dce4e61245fdc0d32c284636d9014 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Vella Date: Thu, 2 Jul 2026 13:22:33 -0300 Subject: [PATCH 3/4] Updating openvm-eth --- .github/actions/patch-openvm-eth/action.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/actions/patch-openvm-eth/action.yml b/.github/actions/patch-openvm-eth/action.yml index ac9cb60629..739bfd25c7 100644 --- a/.github/actions/patch-openvm-eth/action.yml +++ b/.github/actions/patch-openvm-eth/action.yml @@ -9,7 +9,7 @@ runs: with: repository: powdr-labs/openvm-eth # Set once here — no inputs required elsewhere. - ref: b4204ea4e28298744088492b24062bf247cec122 + ref: 8746acfbd251368cdbefc014079f7267c4524865 path: openvm-eth - name: Patch openvm-eth to use local powdr From e1d141d2def45dbfb003c1e066e436e53875a5a1 Mon Sep 17 00:00:00 2001 From: Lucas Clemente Vella Date: Thu, 2 Jul 2026 19:10:04 -0300 Subject: [PATCH 4/4] Migrate powdr openvm extension from fp to extra_regs OpenVM's execution state no longer has a dedicated `fp` field; the frame pointer is carried in `extra_regs[0]` (see openvm `EXTRA_EXEC_REGS`). - powdr_extension executor: destructure/reconstruct `VmStateMut` with `extra_regs` instead of `fp`. - hints-circuit phantom sub-executors: `phantom_execute` takes `extra_regs: [u32; EXTRA_EXEC_REGS]` instead of `fp: u32`. Co-Authored-By: Claude Opus 4.8 --- openvm-riscv/extensions/hints-circuit/src/executors.rs | 10 +++++----- openvm/src/powdr_extension/executor/mod.rs | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/openvm-riscv/extensions/hints-circuit/src/executors.rs b/openvm-riscv/extensions/hints-circuit/src/executors.rs index 71bd7b929b..466d2fc512 100644 --- a/openvm-riscv/extensions/hints-circuit/src/executors.rs +++ b/openvm-riscv/extensions/hints-circuit/src/executors.rs @@ -1,4 +1,4 @@ -use openvm_circuit::arch::{PhantomSubExecutor, Streams}; +use openvm_circuit::arch::{PhantomSubExecutor, Streams, EXTRA_EXEC_REGS}; use openvm_circuit::system::memory::online::GuestMemory; use openvm_instructions::riscv::RV32_MEMORY_AS; use openvm_instructions::PhantomDiscriminant; @@ -18,7 +18,7 @@ impl PhantomSubExecutor for ReverseBytesSubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, - _fp: u32, + _extra_regs: [u32; EXTRA_EXEC_REGS], _: PhantomDiscriminant, a: u32, _: u32, @@ -59,7 +59,7 @@ impl PhantomSubExecutor for K256InverseFieldSubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, - _fp: u32, + _extra_regs: [u32; EXTRA_EXEC_REGS], _: PhantomDiscriminant, a: u32, _: u32, @@ -105,7 +105,7 @@ impl PhantomSubExecutor for K256InverseField10x26SubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, - _fp: u32, + _extra_regs: [u32; EXTRA_EXEC_REGS], _: PhantomDiscriminant, a: u32, _: u32, @@ -153,7 +153,7 @@ impl PhantomSubExecutor for K256SqrtField10x26SubEx { memory: &GuestMemory, streams: &mut Streams, _: &mut StdRng, - _fp: u32, + _extra_regs: [u32; EXTRA_EXEC_REGS], _: PhantomDiscriminant, a: u32, _: u32, diff --git a/openvm/src/powdr_extension/executor/mod.rs b/openvm/src/powdr_extension/executor/mod.rs index 90ff81aca8..9aade6082f 100644 --- a/openvm/src/powdr_extension/executor/mod.rs +++ b/openvm/src/powdr_extension/executor/mod.rs @@ -465,7 +465,7 @@ impl PreflightExecutor> // Extract the state components, since `execute` consumes the state but we need to pass it to each instruction execution let VmStateMut { pc, - fp, + extra_regs, memory, streams, rng, @@ -504,7 +504,7 @@ impl PreflightExecutor> let state = VmStateMut { pc, - fp, + extra_regs, memory, streams, rng, @@ -539,7 +539,7 @@ impl PreflightExecutor for PowdrExec // Extract the state components, since `execute` consumes the state but we need to pass it to each instruction execution let VmStateMut { pc, - fp, + extra_regs, memory, streams, rng, @@ -578,7 +578,7 @@ impl PreflightExecutor for PowdrExec let state = VmStateMut { pc, - fp, + extra_regs, memory, streams, rng,