Skip to content

Commit f966157

Browse files
Update ecrecover benchmark to use guest-libs
1 parent 141873b commit f966157

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

benchmarks/guest/ecrecover/Cargo.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ openvm-algebra-guest = { path = "../../../extensions/algebra/guest", default-fea
1212
openvm-ecc-guest = { path = "../../../extensions/ecc/guest", default-features = false, features = [
1313
"k256",
1414
] }
15-
openvm-keccak256-guest = { path = "../../../extensions/keccak256/guest", default-features = false }
15+
openvm-keccak256 = { path = "../../../guest-libs/keccak256/guest", default-features = false }
1616
# We do not patch revm-precompile so that the benchmark only depends on this repo.
1717
revm-precompile = { version = "14.0.0", default-features = false }
1818
alloy-primitives = { version = "0.8.10", default-features = false, features = [

benchmarks/guest/ecrecover/src/main.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
use alloy_primitives::{keccak256, Bytes, B256, B512};
1+
use alloy_primitives::{Bytes, B256, B512};
22
use k256::{
33
ecdsa::{Error, RecoveryId, Signature},
44
Secp256k1,
@@ -9,7 +9,7 @@ use openvm_ecc_guest::{
99
algebra::IntMod, ecdsa::VerifyingKey, k256::Secp256k1Point, weierstrass::WeierstrassPoint,
1010
};
1111
#[allow(unused_imports, clippy::single_component_path_imports)]
12-
use openvm_keccak256_guest;
12+
use openvm_keccak256::keccak256;
1313
// export native keccak
1414
use revm_precompile::{
1515
utilities::right_pad, Error as PrecompileError, PrecompileOutput, PrecompileResult,
@@ -50,7 +50,7 @@ pub fn ecrecover(sig: &B512, mut recid: u8, msg: &B256) -> Result<B256, Error> {
5050
encoded[..32].copy_from_slice(&public_key.x().to_be_bytes());
5151
encoded[32..].copy_from_slice(&public_key.y().to_be_bytes());
5252
// hash it
53-
let mut hash = keccak256(encoded);
53+
let mut hash = keccak256(&encoded);
5454
// truncate to 20 bytes
5555
hash[..12].fill(0);
5656
Ok(B256::from(hash))

0 commit comments

Comments
 (0)