Skip to content
Open
Show file tree
Hide file tree
Changes from 6 commits
Commits
Show all changes
165 commits
Select commit Hold shift + click to select a range
e1e783a
fixed hints-circuit
Schaeff Sep 16, 2025
2cfe4e3
wip
Schaeff Sep 16, 2025
21ad1e7
first commit but chip inventory doesn't seem to work
qwang98 Sep 17, 2025
26e31c4
add exeutor complex, but seems that we can get airs from chip complex…
qwang98 Sep 17, 2025
04508d5
managed to get airs via executor inventory -> air inventory -> air re…
qwang98 Sep 17, 2025
33efc8e
fix sdk calls
Schaeff Sep 17, 2025
a36b3a2
Merge pull request #3292 from powdr-labs/ovm-1.4-get-original-airs
Schaeff Sep 17, 2025
dcb0293
Merge branch 'ovm-1.4' of github.com:powdr-labs/powdr into ovm-1.4
Schaeff Sep 17, 2025
0c3dd22
add flag
Schaeff Sep 17, 2025
9596cc7
patch bus map
qwang98 Sep 17, 2025
c0da8f8
Merge pull request #3294 from powdr-labs/ovm-1.4-extraction-utils
Schaeff Sep 17, 2025
14229da
make compile
Schaeff Sep 17, 2025
3269e55
pull main, make compile
Schaeff Sep 17, 2025
d1e2a22
export_pil wip
Schaeff Sep 17, 2025
aab0dfd
pull main
Schaeff Sep 17, 2025
85f35d0
make pil export test pass
Schaeff Sep 17, 2025
3724813
implement VmExecutionExtension and VmExecutionConfig for some types
qwang98 Sep 18, 2025
e276b89
add some vmcircuit implementations
qwang98 Sep 18, 2025
3f37dc2
solve AnyRap trait bounds
qwang98 Sep 18, 2025
7c3d7aa
add asref<systemconfig> and asmut<systemconfig> impls
qwang98 Sep 18, 2025
ad65a11
remove executor_inventory() function in place of create_executors()
qwang98 Sep 18, 2025
78752fd
give PowdrExtension access to ChipComplex via OriginalVmConfig
qwang98 Sep 18, 2025
d2571c8
Merge pull request #3298 from powdr-labs/ovm-1.4-extend-executor
Schaeff Sep 18, 2025
2ff7ce1
create sdk with the correct config
Schaeff Sep 18, 2025
4b3d8f9
simplify executor
Schaeff Sep 18, 2025
189d9de
switch to SdkVmConfig for the dummy inventory, implement it
Schaeff Sep 18, 2025
3d0ff0c
implement prover extension
Schaeff Sep 18, 2025
4bf21e6
create_chip_complex
qwang98 Sep 19, 2025
7d1c5f9
fixed executor::new() error via injecting dummy airs and now panic ag…
qwang98 Sep 22, 2025
47d1bb0
remove prints
qwang98 Sep 22, 2025
864e93c
remove more comments
qwang98 Sep 22, 2025
e9a80e9
Merge pull request #3300 from powdr-labs/ovm-1.4-memory-2
Schaeff Sep 22, 2025
a1a8d40
only add TODO after studying the code; not implemented yet
qwang98 Sep 22, 2025
08c894c
keep only executor impls for PowdrExecutor
Schaeff Sep 22, 2025
5834bf7
clippy, fmt
Schaeff Sep 22, 2025
287f34e
PhantomExecutor
Schaeff Sep 22, 2025
57cd49d
import, remove unimplemented
Schaeff Sep 22, 2025
72b4171
remove mutex
Schaeff Sep 22, 2025
7aea878
merge ovm-1.4
qwang98 Sep 23, 2025
b8720e2
precompute size
qwang98 Sep 23, 2025
c6b6c17
fmt
qwang98 Sep 23, 2025
ed27104
added some notes for meteredexecutor and executor. they don't seem to…
qwang98 Sep 23, 2025
6077b02
execute implementation (for Preflight and need to move over next)
qwang98 Sep 23, 2025
1236462
clean up comments
qwang98 Sep 23, 2025
e64ed22
add a small comment for Preflight
qwang98 Sep 23, 2025
0445fb2
Merge pull request #3302 from powdr-labs/ovm-1.4-tracegen
Schaeff Sep 23, 2025
fe7d918
make test pass because apcs are not run
Schaeff Sep 23, 2025
8f3a49a
add apc to the program
Schaeff Sep 23, 2025
04a260f
first commit with full impl for execution and metered execution
qwang98 Sep 24, 2025
191aef2
added preflight implementation, but blocked by a few TODOs
qwang98 Sep 24, 2025
462ccbc
bug fix: use curr_pc instead of pc
qwang98 Sep 24, 2025
a837b8c
fix some comments
qwang98 Sep 24, 2025
172409d
implement e1 and e2 with a derived AlignedBytesBorrow
Schaeff Sep 24, 2025
1e3e47a
clean up
Schaeff Sep 24, 2025
491b632
clean
Schaeff Sep 24, 2025
a18f82b
comment fixes
qwang98 Sep 25, 2025
d1f1c7c
Merge pull request #3310 from powdr-labs/ovm-1.4-execution-with-deriv…
qwang98 Sep 25, 2025
815dd47
use refcells for mutable fields of PowdrExecutor (dummy recod arena a…
qwang98 Sep 25, 2025
7827f09
complete trace gen but not debugged at all
qwang98 Sep 25, 2025
4f8edcc
bug fix: not all record arenas have dummy traces
qwang98 Sep 25, 2025
16461c9
modify program when adding apcs
Schaeff Sep 25, 2025
0617a00
Merge pull request #3311 from powdr-labs/modify-program-fix
Schaeff Sep 25, 2025
5b5db0a
Merge branch 'ovm-1.4' of github.com:powdr-labs/powdr into ovm-1.4-al…
Schaeff Sep 25, 2025
440c271
Merge pull request #3309 from powdr-labs/ovm-1.4-all-execution-modes
Schaeff Sep 25, 2025
4ccec33
first commit but test still fails at proving
qwang98 Sep 26, 2025
ab10057
first commit with mock prover, test prints debug message on bus
qwang98 Sep 26, 2025
f2f7425
clean up
qwang98 Sep 26, 2025
ae0e785
Merge pull request #3317 from powdr-labs/ovm-1.4-mock-prover
Schaeff Sep 26, 2025
57180c2
clean hints-circuit executors
Schaeff Sep 26, 2025
ff27118
Merge branch 'main' of github.com:powdr-labs/powdr into ovm-1.4
Schaeff Sep 26, 2025
675176d
fix some of the comments
qwang98 Sep 26, 2025
00601e8
made RA dimension a struct
qwang98 Sep 26, 2025
eda50b5
clean up
Schaeff Sep 26, 2025
b0ac0d9
pull target
Schaeff Sep 26, 2025
ad0f4b5
more cleaning
Schaeff Sep 26, 2025
9ecf44c
decouple chip and executor
Schaeff Sep 29, 2025
6f91298
Merge pull request #3321 from powdr-labs/ovm-1.4-decouple
Schaeff Sep 30, 2025
ac5b415
first commit
qwang98 Sep 30, 2025
bfe1d86
remove some comments/prints
qwang98 Sep 30, 2025
f791df2
implemented single Vec<RA> at initialization; trace gen now works
qwang98 Sep 30, 2025
f9addcd
removed cached original instruction count and fixed comments
qwang98 Sep 30, 2025
283f080
Merge pull request #3325 from powdr-labs/ovm-1.4-decouple-3
Schaeff Sep 30, 2025
7df1ce1
Merge branch 'ovm-1.4' into ovm-1.4-fix-dummy-trace
Schaeff Sep 30, 2025
54d39f0
Merge pull request #3316 from powdr-labs/ovm-1.4-fix-dummy-trace
Schaeff Sep 30, 2025
f49c4bd
pull target
Schaeff Sep 30, 2025
7496c8e
simplify
Schaeff Sep 30, 2025
8fddb45
introduce trace_generator, re-introduce plonk, clean up
Schaeff Sep 30, 2025
69cefba
use number_of_calls() in plonk chip
qwang98 Oct 1, 2025
716b797
Merge pull request #3318 from powdr-labs/ovm-1.4-cleanup
qwang98 Oct 1, 2025
41b6aa3
fixed simple fibo test, which panic'ed with original not found becaus…
qwang98 Oct 1, 2025
e13688f
fix second bug on plonk air
qwang98 Oct 1, 2025
4afaede
fixed third bug: air_metrics shouldn't use chip complex without any p…
qwang98 Oct 1, 2025
8dbcfd2
fixed fourth bug on all tests with more than 1 apc
qwang98 Oct 1, 2025
1902bf3
remove prits
qwang98 Oct 1, 2025
42ed94b
fixed comments
qwang98 Oct 1, 2025
81091cc
fix comments
qwang98 Oct 1, 2025
bdda298
Merge pull request #3326 from powdr-labs/ovm-1.4-test-bug-fix
Schaeff Oct 1, 2025
be9ca33
put back logup col count
Schaeff Oct 1, 2025
096b9bc
fix log up and update expected
qwang98 Oct 2, 2025
e8e0c0d
also fix max columns
qwang98 Oct 2, 2025
7708fd3
remove some commetns
qwang98 Oct 2, 2025
a6453d2
fix instret, fix multisegment
Schaeff Oct 2, 2025
91d6736
pull target
Schaeff Oct 2, 2025
eaa8283
fmt
Schaeff Oct 2, 2025
452481f
fmt
Schaeff Oct 2, 2025
7eef8b6
fmt
Schaeff Oct 2, 2025
c47561a
columnsair fix
qwang98 Oct 3, 2025
ad2d461
update k256 openvm dependency to 1.4.0-wip
qwang98 Oct 3, 2025
4234175
first commit with attempt to use sdk for extendedVMConfig, but encoun…
qwang98 Oct 3, 2025
9b12547
added a bunch of print statements to aid testing
qwang98 Oct 6, 2025
75d25e0
udpate k256 dependency for ecc-powdr-affine-hint
qwang98 Oct 6, 2025
e2dc162
Merge pull request #3329 from powdr-labs/ovm-1.4-test-fix-bug-2
Schaeff Oct 6, 2025
907a0bf
memory AS is now stored as u8 instead of F
pacheco Oct 6, 2025
4c5f4eb
Merge pull request #3332 from powdr-labs/ovm-1.4-hints-memory-fix
qwang98 Oct 7, 2025
058f2ef
remove some prints and panics
qwang98 Oct 7, 2025
8ad34a4
remove more prints
qwang98 Oct 7, 2025
7a09cb4
Merge pull request #3331 from powdr-labs/ovm-1.4-fix-execution-profil…
Schaeff Oct 7, 2025
94dc325
ignore keccak plonk test due to debug assertion bug
qwang98 Oct 7, 2025
5dcbb34
Merge branch 'main' of github.com:powdr-labs/powdr into ovm-1.4
Schaeff Oct 7, 2025
a8d8fbf
clean
Schaeff Oct 7, 2025
0b35edf
clean
Schaeff Oct 7, 2025
ddc1309
pull target
Schaeff Oct 7, 2025
3260408
lock stark backend and ovm
Schaeff Oct 8, 2025
fa84893
use reth compatible serde version for powdr-openvm-hints-circuit
qwang98 Oct 9, 2025
5d34a76
add support for tco and metrics by adding features
Schaeff Oct 9, 2025
c800f49
update ovm to log pc in tco mode
Schaeff Oct 9, 2025
c6a13e6
update nightly
Schaeff Oct 10, 2025
8ab376d
update rust toolchain more
Schaeff Oct 10, 2025
c37f3f9
clippy
Schaeff Oct 10, 2025
f72f8e5
fmt
Schaeff Oct 10, 2025
6d4b3b7
try fix reth test
Schaeff Oct 10, 2025
180027f
typo
Schaeff Oct 10, 2025
e88c853
fix ref
Schaeff Oct 10, 2025
274c73b
add log
Schaeff Oct 10, 2025
d32a136
expose HintsExtension
Schaeff Oct 10, 2025
6a147f4
update reth
Schaeff Oct 10, 2025
ad00797
fmt
Schaeff Oct 10, 2025
a4f438f
update reth
Schaeff Oct 10, 2025
63191ff
update k256
Schaeff Oct 10, 2025
9de513b
update dep
Schaeff Oct 10, 2025
e854c9f
run only one test
Schaeff Oct 11, 2025
5885b92
run cargo test
Schaeff Oct 11, 2025
70169b3
enable logs and debug, run only one test
Schaeff Oct 11, 2025
26fe978
run more tests, use pr-test profile
Schaeff Oct 11, 2025
ffa9419
revert, single job matrix
Schaeff Oct 11, 2025
2ee1142
remove all-features
Schaeff Oct 11, 2025
21bd511
remove tco
Schaeff Oct 11, 2025
ca3ff63
point to reth without tco
Schaeff Oct 13, 2025
055b6fb
revert ci
Schaeff Oct 13, 2025
e5d9993
enable tco
Schaeff Oct 13, 2025
3a1dacd
update reth
Schaeff Oct 13, 2025
2139f4e
update k256
Schaeff Oct 13, 2025
6b3e266
address review comment about record_arena_dimension_by_air_name_per_a…
Schaeff Oct 14, 2025
5b1f359
typo
Schaeff Oct 14, 2025
f69b675
address review comments
Schaeff Oct 14, 2025
7d2d9a0
remove ignore as test passes
Schaeff Oct 14, 2025
9975ee6
refine plonk error, add test, fix height change
Schaeff Oct 14, 2025
e4730ef
Merge branch 'main' of github.com:powdr-labs/powdr into ovm-1.4
Schaeff Oct 14, 2025
a1a84d9
ignore tests, add reason
Schaeff Oct 14, 2025
d3da73c
pull main
Schaeff Oct 15, 2025
d0e6c3c
fix review comments
Schaeff Oct 15, 2025
99651ba
pull main
Schaeff Oct 15, 2025
cbef8b2
fix cargo.toml
Schaeff Oct 15, 2025
6ab6e42
fix metrics collection in cli
Schaeff Oct 15, 2025
0546cfa
make metrics default in openvm-cli
Schaeff Oct 16, 2025
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
70 changes: 33 additions & 37 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -38,59 +38,55 @@ powdr-riscv-types = { path = "./riscv-types", version = "0.1.4" }
powdr-syscalls = { path = "./syscalls", version = "0.1.4" }
powdr-autoprecompiles = { path = "./autoprecompiles", version = "0.1.4" }
powdr-openvm = { path = "./openvm", version = "0.1.4" }
powdr-cli-openvm = { path = "./cli-openvm", version = "0.1.4" }

powdr-openvm-hints-guest = { path = "./openvm/extensions/hints-guest", version = "0.1.4" }
powdr-openvm-hints-transpiler = { path = "./openvm/extensions/hints-transpiler", version = "0.1.4" }
powdr-openvm-hints-circuit = { path = "./openvm/extensions/hints-circuit", version = "0.1.4" }

# openvm
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-build = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-rv32im-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-rv32im-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-rv32im-guest = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26", default-features = false }
openvm-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-circuit-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-circuit-primitives = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-circuit-primitives-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-instructions = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-instructions-derive = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-sdk = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26", default-features = false, features = [
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-build = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-rv32im-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-rv32im-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-rv32im-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", default-features = false }
openvm-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-circuit-derive = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-circuit-primitives = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-circuit-primitives-derive = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-instructions = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-instructions-derive = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-sdk = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", default-features = false, features = [
"parallel",
"jemalloc",
"nightly-features",
"bench-metrics",
] }
openvm-ecc-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-ecc-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-keccak256-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-keccak256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-sha256-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-sha256-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-algebra-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-algebra-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-bigint-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-bigint-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-pairing-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-pairing-transpiler = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-native-circuit = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26", default-features = false }
openvm-native-recursion = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26", default-features = false }
openvm-platform = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-custom-insn = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm-ecc-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-ecc-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-keccak256-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-keccak256-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-sha256-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-sha256-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-algebra-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-algebra-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-bigint-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-bigint-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-pairing-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-pairing-transpiler = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-native-circuit = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", default-features = false }
openvm-native-recursion = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", default-features = false }
openvm-platform = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-custom-insn = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }

# stark-backend
openvm-stark-sdk = { git = "https://github.com/powdr-labs/stark-backend.git", rev = "ee4e22b", default-features = false, features = [
openvm-stark-sdk = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.0", default-features = false, features = [
"parallel",
"jemalloc",
"nightly-features",
"bench-metrics",
] }
openvm-stark-backend = { git = "https://github.com/powdr-labs/stark-backend.git", rev = "ee4e22b", default-features = false, features = [
openvm-stark-backend = { git = "https://github.com/openvm-org/stark-backend.git", tag = "v1.2.0", default-features = false, features = [
"parallel",
"jemalloc",
"bench-metrics",
] }

[profile.pr-tests]
Expand All @@ -114,11 +110,11 @@ iter_over_hash_type = "deny"

# Uncomment both patches below for local stark-backend and openvm.
# The local openvm also needs to have stark-backend patched so all types match.
# [patch."https://github.com/powdr-labs/stark-backend.git"]
# [patch."https://github.com/openvm-org/stark-backend.git"]
# openvm-stark-sdk = { path = "../stark-backend/crates/stark-sdk", default-features = false }
# openvm-stark-backend = { path = "../stark-backend/crates/stark-backend", default-features = false }

# [patch."https://github.com/powdr-labs/openvm.git"]
# [patch."https://github.com/openvm-org/openvm.git"]
# openvm = { path = "../openvm/crates/toolchain/openvm" }
# openvm-build = { path = "../openvm/crates/toolchain/build" }
# openvm-rv32im-circuit = { path = "../openvm/extensions/rv32im/circuit/" }
Expand Down
2 changes: 2 additions & 0 deletions openvm/extensions/hints-circuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,5 @@ powdr-openvm-hints-transpiler = { workspace = true }
eyre = "0.6.12"
crypto-bigint = "0.6.1"
elliptic-curve = "0.13.8"
rand = { version = "0.8.5", default-features = false }

95 changes: 43 additions & 52 deletions openvm/extensions/hints-circuit/src/executors.rs
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
use openvm_circuit::arch::{PhantomSubExecutor, Streams};
use openvm_circuit::system::memory::MemoryController;
use openvm_instructions::riscv::RV32_MEMORY_AS;
use openvm_instructions::PhantomDiscriminant;
use openvm_rv32im_circuit::adapters::unsafe_read_rv32_register;
use openvm_rv32im_circuit::adapters::read_rv32_register;
use openvm_stark_backend::p3_field::PrimeField32;
use rand::rngs::StdRng;

use crate::field10x26_k256;

Expand All @@ -13,22 +13,20 @@ pub struct ReverseBytesSubEx;

impl<F: PrimeField32> PhantomSubExecutor<F> for ReverseBytesSubEx {
fn phantom_execute(
&mut self,
memory: &MemoryController<F>,
&self,
memory: &openvm_circuit::system::memory::online::GuestMemory,
streams: &mut Streams<F>,
_discriminant: PhantomDiscriminant,
a: F,
_b: F,
_: &mut StdRng,
_: PhantomDiscriminant,
a: u32,
_: u32,
c_upper: u16,
) -> eyre::Result<()> {
assert_eq!(c_upper, 0);
// read register
let rs1 = unsafe_read_rv32_register(memory, a);
let rs1 = read_rv32_register(memory, a);
// read memory
let bytes = memory.unsafe_read::<4>(
F::from_canonical_u32(RV32_MEMORY_AS),
F::from_canonical_u32(rs1),
);
let bytes = unsafe { memory.read::<F, 4>(RV32_MEMORY_AS, rs1) };
// write hint as bytes in reverse
let hint_bytes = bytes.into_iter().rev().collect();
streams.hint_stream = hint_bytes;
Expand All @@ -55,23 +53,20 @@ impl_modulus!(

impl<F: PrimeField32> PhantomSubExecutor<F> for K256InverseFieldSubEx {
fn phantom_execute(
&mut self,
memory: &MemoryController<F>,
&self,
memory: &openvm_circuit::system::memory::online::GuestMemory,
streams: &mut Streams<F>,
_: &mut StdRng,
_: PhantomDiscriminant,
a: F,
_b: F,
a: u32,
_: u32,
c_upper: u16,
) -> eyre::Result<()> {
assert_eq!(c_upper, 0);
// read register
let rs1 = unsafe_read_rv32_register(memory, a);
let rs1 = read_rv32_register(memory, a);
// read the field element
let bytes: [u8; 32] = memory
.unsafe_read::<32>(
F::from_canonical_u32(RV32_MEMORY_AS),
F::from_canonical_u32(rs1),
)
let bytes: [u8; 32] = unsafe { memory.read::<F, 32>(RV32_MEMORY_AS, rs1) }
.into_iter()
.map(|f| u8::try_from(f.as_canonical_u32()).expect("value not a byte"))
.collect::<Vec<_>>()
Expand Down Expand Up @@ -108,28 +103,26 @@ pub struct K256InverseField10x26SubEx;

impl<F: PrimeField32> PhantomSubExecutor<F> for K256InverseField10x26SubEx {
fn phantom_execute(
&mut self,
memory: &MemoryController<F>,
&self,
memory: &openvm_circuit::system::memory::online::GuestMemory,
streams: &mut Streams<F>,
_: &mut StdRng,
_: PhantomDiscriminant,
a: F,
_b: F,
a: u32,
_: u32,
c_upper: u16,
) -> eyre::Result<()> {
assert_eq!(c_upper, 0);
// read register
let rs1 = unsafe_read_rv32_register(memory, a);
let rs1 = read_rv32_register(memory, a);
// read the k256 field_10x26 as raw bytes
let bytes: [u8; FIELD10X26_BYTES] = memory
.unsafe_read::<{ FIELD10X26_BYTES }>(
F::from_canonical_u32(RV32_MEMORY_AS),
F::from_canonical_u32(rs1),
)
.into_iter()
.map(|f| u8::try_from(f.as_canonical_u32()).expect("value not a byte"))
.collect::<Vec<_>>()
.try_into()
.unwrap();
let bytes: [u8; FIELD10X26_BYTES] =
unsafe { memory.read::<F, { FIELD10X26_BYTES }>(RV32_MEMORY_AS, rs1) }
.into_iter()
.map(|f| u8::try_from(f.as_canonical_u32()).expect("value not a byte"))
.collect::<Vec<_>>()
.try_into()
.unwrap();
// we just reinterpret the bytes as a k256 field element. We don't use mem::transmute to avoid alignment issues
let mut elem = [0u32; 10];
unsafe {
Expand Down Expand Up @@ -164,28 +157,26 @@ pub struct K256SqrtField10x26SubEx;

impl<F: PrimeField32> PhantomSubExecutor<F> for K256SqrtField10x26SubEx {
fn phantom_execute(
&mut self,
memory: &MemoryController<F>,
&self,
memory: &openvm_circuit::system::memory::online::GuestMemory,
streams: &mut Streams<F>,
_: &mut StdRng,
_: PhantomDiscriminant,
a: F,
_b: F,
a: u32,
_: u32,
c_upper: u16,
) -> eyre::Result<()> {
assert_eq!(c_upper, 0);
// read register
let rs1 = unsafe_read_rv32_register(memory, a);
let rs1 = read_rv32_register(memory, a);
// read the k256 field_10x26 as raw bytes
let bytes: [u8; FIELD10X26_BYTES] = memory
.unsafe_read::<{ FIELD10X26_BYTES }>(
F::from_canonical_u32(RV32_MEMORY_AS),
F::from_canonical_u32(rs1),
)
.into_iter()
.map(|f| u8::try_from(f.as_canonical_u32()).expect("value not a byte"))
.collect::<Vec<_>>()
.try_into()
.unwrap();
let bytes: [u8; FIELD10X26_BYTES] =
unsafe { memory.read::<F, { FIELD10X26_BYTES }>(RV32_MEMORY_AS, rs1) }
.into_iter()
.map(|f| u8::try_from(f.as_canonical_u32()).expect("value not a byte"))
.collect::<Vec<_>>()
.try_into()
.unwrap();
// we just reinterpret the bytes as a k256 field element. Can't use mem::transmute due to alighment requirements
let mut elem = [0u32; 10];
unsafe {
Expand Down
35 changes: 12 additions & 23 deletions openvm/extensions/hints-circuit/src/lib.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
use openvm_circuit::arch::{VmExtension, VmInventory};
use openvm_circuit::circuit_derive::{Chip, ChipUsageGetter};
use openvm_circuit::derive::{AnyEnum, InstructionExecutor};
use openvm_circuit::arch::VmExecutionExtension;
use openvm_circuit::derive::{AnyEnum, PreflightExecutor};
use openvm_circuit::system::phantom::PhantomChip;
use openvm_instructions::PhantomDiscriminant;
use openvm_stark_backend::p3_field::PrimeField32;
Expand All @@ -13,44 +12,34 @@ mod field10x26_k256;
/// OpenVM extension with miscellaneous hint implementations.
pub struct HintsExtension;

#[derive(ChipUsageGetter, Chip, InstructionExecutor, AnyEnum)]
#[derive(AnyEnum, PreflightExecutor)]
pub enum HintsExecutor<F: PrimeField32> {
Phantom(PhantomChip<F>),
}

#[derive(ChipUsageGetter, Chip, AnyEnum)]
pub enum HintsPeriphery<F: PrimeField32> {
Phantom(PhantomChip<F>),
}

impl<F: PrimeField32> VmExtension<F> for HintsExtension {
impl<F: PrimeField32> VmExecutionExtension<F> for HintsExtension {
type Executor = HintsExecutor<F>;
type Periphery = HintsPeriphery<F>;

fn build(
fn extend_execution(
&self,
builder: &mut openvm_circuit::arch::VmInventoryBuilder<F>,
) -> Result<
openvm_circuit::arch::VmInventory<Self::Executor, Self::Periphery>,
openvm_circuit::arch::VmInventoryError,
> {
let inventory = VmInventory::new();
builder.add_phantom_sub_executor(
inventory: &mut openvm_circuit::arch::ExecutorInventoryBuilder<F, Self::Executor>,
) -> Result<(), openvm_circuit::arch::ExecutorInventoryError> {
inventory.add_phantom_sub_executor(
executors::ReverseBytesSubEx,
PhantomDiscriminant(HintsPhantom::HintReverseBytes as u16),
)?;
builder.add_phantom_sub_executor(
inventory.add_phantom_sub_executor(
executors::K256InverseFieldSubEx,
PhantomDiscriminant(HintsPhantom::HintK256InverseField as u16),
)?;
builder.add_phantom_sub_executor(
inventory.add_phantom_sub_executor(
executors::K256InverseField10x26SubEx,
PhantomDiscriminant(HintsPhantom::HintK256InverseField10x26 as u16),
)?;
builder.add_phantom_sub_executor(
inventory.add_phantom_sub_executor(
executors::K256SqrtField10x26SubEx,
PhantomDiscriminant(HintsPhantom::HintK256SqrtField10x26 as u16),
)?;
Ok(inventory)
Ok(())
}
}
8 changes: 4 additions & 4 deletions openvm/guest-ecc-manual/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ version = "0.0.0"
edition = "2021"

[dependencies]
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm-ecc-guest = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26", subdirectory = "extensions/ecc/guest", default-features = false }
openvm-algebra-guest = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26", subdirectory = "extensions/algebra/guest", default-features = false }
openvm-k256 = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26", subdirectory = "guest-libs/k256", package = "k256", features = [
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-ecc-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", subdirectory = "extensions/ecc/guest", default-features = false }
openvm-algebra-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", subdirectory = "extensions/algebra/guest", default-features = false }
openvm-k256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", subdirectory = "guest-libs/k256", package = "k256", features = [
"ecdsa",
]}

Expand Down
2 changes: 1 addition & 1 deletion openvm/guest-ecc-powdr-affine-hint/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version = "0.0.0"
edition = "2021"

[dependencies]
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
k256 = { git = "https://github.com/powdr-labs/elliptic-curves-k256", tag = "k256/powdr/v0.13.4-2025.09.10", default-features = false, features = [
"expose-field",
"arithmetic",
Expand Down
2 changes: 1 addition & 1 deletion openvm/guest-ecc-projective/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,6 @@ version = "0.0.0"
edition = "2021"

[dependencies]
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
k256 = { version = "0.13", default-features = false, features = ["arithmetic"] }
hex-literal = "1.0.0"
12 changes: 6 additions & 6 deletions openvm/guest-ecrecover-manual/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ version = "0.0.0"
edition = "2021"

[dependencies]
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm-algebra-guest = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm-algebra-moduli-macros = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm-ecc-guest = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm-ecc-sw-macros = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26" }
openvm-k256 = { git = "https://github.com/powdr-labs/openvm.git", rev="62c5d26", package = "k256" }
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-algebra-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-algebra-moduli-macros = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-ecc-guest = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-ecc-sw-macros = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
openvm-k256 = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0", package = "k256" }

elliptic-curve = { version = "0.13.8" }
ecdsa = { version = "0.16.9" }
Expand Down
2 changes: 1 addition & 1 deletion openvm/guest-ecrecover/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ version = "0.0.0"
edition = "2021"

[dependencies]
openvm = { git = "https://github.com/powdr-labs/openvm.git", rev = "62c5d26" }
openvm = { git = "https://github.com/openvm-org/openvm.git", tag = "v1.4.0" }
k256 = { git = "https://github.com/powdr-labs/elliptic-curves-k256", tag = "k256/powdr/v0.13.4-2025.09.10", default-features = false, features = [
"expose-field",
"arithmetic",
Expand Down
Loading