Skip to content

Commit

Permalink
Refactor sign-types to remove libsecp256k1 dep (scroll-tech#969)
Browse files Browse the repository at this point in the history
* chore: recover_pk with k256

* chore: remove libsecp256k1 dep

* chore: cargo lock file
  • Loading branch information
roynalnaruto authored Oct 25, 2023
1 parent 8cc8d83 commit 188396d
Show file tree
Hide file tree
Showing 9 changed files with 86 additions and 200 deletions.
142 changes: 24 additions & 118 deletions Cargo.lock

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

4 changes: 2 additions & 2 deletions bus-mapping/src/evm/opcodes/precompiles/ecrecover.rs
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use eth_types::{
sign_types::{biguint_to_32bytes_le, recover_pk, SignData, SECP256K1_Q},
sign_types::{biguint_to_32bytes_le, recover_pk2, SignData, SECP256K1_Q},
Bytes, ToBigEndian, ToLittleEndian,
};
use halo2_proofs::halo2curves::{
Expand Down Expand Up @@ -35,7 +35,7 @@ pub(crate) fn opt_data(
}

if let Some(sig_v) = aux_data.recovery_id() {
let recovered_pk = recover_pk(
let recovered_pk = recover_pk2(
sig_v,
&aux_data.sig_r,
&aux_data.sig_s,
Expand Down
2 changes: 1 addition & 1 deletion eth-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -17,14 +17,14 @@ serde_json.workspace = true
serde_with = "1.12"
uint = "0.9.1"
itertools.workspace = true
libsecp256k1.workspace = true
subtle.workspace = true
sha3.workspace = true
num.workspace = true
num-bigint.workspace = true
strum_macros.workspace = true
strum.workspace = true
hash-circuit.workspace = true

[features]
default = ["warn-unimplemented"]
warn-unimplemented = []
Expand Down
8 changes: 1 addition & 7 deletions eth-types/src/error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,7 @@ pub enum Error {
/// `MemoryAddress`.
WordToMemAddr,
/// Signature parsing error.
Signature(libsecp256k1::Error),
}

impl From<libsecp256k1::Error> for Error {
fn from(err: libsecp256k1::Error) -> Self {
Error::Signature(err)
}
Signature,
}

impl Display for Error {
Expand Down
Loading

0 comments on commit 188396d

Please sign in to comment.