Repository navigation
feat(eip7702): add secp256k1 feature for ECDSA recovery - #87
Merged
Merged
Conversation
decofe
requested review from
DaniPopes,
gakonst,
mattsse and
onbjerg
as code owners
May 14, 2026 01:31
decofe
force-pushed
the
feat/secp256k1-feature
branch
2 times, most recently
from
May 14, 2026 01:42
8d00419 to
321851d
Compare
Add an optional `secp256k1` feature to `alloy-eip7702` that uses alloy-primitives' secp256k1 backend for ECDSA public key recovery. The feature is disabled by default. When both `secp256k1` and `k256` features are enabled, `secp256k1` is preferred (handled by alloy-primitives internally via `cfg_if!`). This avoids importing k256 or secp256k1 directly for recovery — the backend selection is fully delegated to alloy-primitives' `Signature::recover_address_from_prehash`. Changes: - Add `secp256k1` feature to eip7702 that forwards to `alloy-primitives/secp256k1` - Unify recovery impl under `#[cfg(any(feature = "k256", feature = "secp256k1"))]` instead of separate impl blocks - Patch alloy-primitives to decofe/core#feat/secp256k1-backend (alloy-rs/core#1104) until merged and released Depends on: alloy-rs/core#1104 Amp-Thread-ID: https://ampcode.com/threads/T-019e23bb-1e32-718f-8ec4-5f3b7bef33e2
decofe
force-pushed
the
feat/secp256k1-feature
branch
from
May 14, 2026 01:44
321851d to
744e135
Compare
DaniPopes
approved these changes
May 14, 2026
mattsse
approved these changes
May 14, 2026
added 2 commits
May 14, 2026 17:25
alloy-core 1.6.0 includes native secp256k1 backend support (alloy-rs/core#1104), so the temporary git patch is no longer needed. Amp-Thread-ID: https://ampcode.com/threads/T-019e23bb-1e32-718f-8ec4-5f3b7bef33e2
DaniPopes
approved these changes
May 14, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add an optional
secp256k1feature toalloy-eip7702that uses thesecp256k1C library bindings (via thesecp256k1crate) for ECDSA public key recovery instead of the pure-Rustk256implementation.Details
secp256k1andk256are enabled,secp256k1is preferred for recovery operations (recover_authority,into_recovered, and theFromimpls)k256feature continues to work exactly as before whensecp256k1is not enabledChanges
Cargo.tomlsecp256k1 = { version = "0.31", features = ["recovery", "alloc"] }as workspace depcrates/eip7702/Cargo.tomlsecp256k1dep and feature flagcrates/eip7702/src/auth_list.rssecp256k1-backed recovery impl; gatek256impl withnot(feature = "secp256k1"); updateFromimpls toany(k256, secp256k1)crates/eip7702/src/error.rsSecp256k1(secp256k1::Error)variant behind feature gateUsage
Tested
cargo checkwith each feature combo:secp256k1,k256, both, neither ✅cargo test --all-features✅cargo clippy --all-features -- -Dwarnings✅cargo build --target wasm32-unknown-unknown(default features, no secp256k1) ✅