Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
5 changes: 5 additions & 0 deletions .github/workflows/integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -141,6 +141,11 @@ jobs:
RUSTFLAGS: "-C opt-level=3"
run: cargo run --release --package ceno_zkvm --bin e2e -- --platform=ceno examples/target/riscv32im-ceno-zkvm-elf/release/examples/bn254_curve_syscalls

- name: Run k256 ecrecover (release)
env:
RUSTFLAGS: "-C opt-level=3"
run: cargo run --release --package ceno_zkvm --bin e2e -- --platform=ceno examples/target/riscv32im-ceno-zkvm-elf/release/examples/secp256k1_ecrecover

- name: Run uint256_mul_syscall (release)
env:
RUSTFLAGS: "-C opt-level=3"
Expand Down
9 changes: 5 additions & 4 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

7 changes: 7 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,13 @@ opt-level = 3
[profile.release]
lto = "thin"

#[patch."https://github.com/scroll-tech/elliptic-curves"]
#k256 = { path = "../elliptic-curves/k256", default-features = false, features = ["std", "ecdsa"] }
#
#[patch."https://github.com/scroll-tech/ceno-patch.git"]
#ceno_crypto_primitives = { path = "../ceno-patch/crypto-primitives", package = "ceno_crypto_primitives" }
#ceno_syscall = { path = "../ceno-patch/syscall", package = "ceno_syscall" }

# [patch."https://github.com/scroll-tech/ceno-gpu-mock.git"]
# ceno_gpu = { path = "../ceno-gpu/cuda_hal", package = "cuda_hal", default-features = false, features=["bb31"] }

Expand Down
3 changes: 3 additions & 0 deletions examples/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -30,3 +30,6 @@ rkyv = { version = "0.8", default-features = false, features = [
"bytecheck",
] }
substrate-bn.workspace = true

[features]
profiling = ["k256/std", "k256/ecdsa", "k256/profiling"]
2 changes: 1 addition & 1 deletion guest_libs/crypto/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@ alloy-primitives = "1.4"
revm-precompile = "27"

[features]
profiling = []
profiling = ["k256/profiling"]
4 changes: 4 additions & 0 deletions guest_libs/crypto/src/secp256k1.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,12 @@ pub fn secp256k1_ecrecover(
}
let recid = RecoveryId::from_byte(recid).expect("recovery ID is valid");

#[cfg(feature = "profiling")]
syscall_phantom_log_pc_cycle("recover_from_prehash start");
// recover key
let recovered_key = VerifyingKey::recover_from_prehash(&msg[..], &sig, recid)?;
#[cfg(feature = "profiling")]
syscall_phantom_log_pc_cycle("recover_from_prehash end");
// hash it
let mut hasher = Keccak::v256();
let mut hash = [0u8; 32];
Expand Down