Skip to content

perf: use global secp256k1 context for signature recovery - #1119

Merged
DaniPopes merged 1 commit into
alloy-rs:mainfrom
decofe:centaur/eip7702-secp-global-context
Jun 4, 2026
Merged

DaniPopes merged 1 commit into
alloy-rs:mainfrom
decofe:centaur/eip7702-secp-global-context

Conversation

@decofe

@decofe decofe commented Jun 4, 2026 •

Copy link
Copy Markdown
Contributor

Switch std builds of Signature::recover_from_prehash_secp256k1 to use the secp256k1 global context instead of constructing a fresh verification-only context for every recovery. no-std builds keep the existing per-call fallback because the global context is gated behind std upstream.

global-context is enabled through alloy-primitives/std, not unconditionally on the workspace dependency.

Validation:

  • cargo test -p alloy-primitives --features 'std secp256k1' signature
  • cargo check -p alloy-primitives --features secp256k1 --no-default-features

Prompted by: @DaniPopes

@decofe
decofe requested review from DaniPopes and mattsse as code owners June 4, 2026 16:12
@DaniPopes DaniPopes changed the title Use global secp256k1 context for signature recovery perf: use global secp256k1 context for signature recovery Jun 4, 2026
@decofe
decofe force-pushed the centaur/eip7702-secp-global-context branch from 8ea0968 to 2f58e75 Compare June 4, 2026 16:22
@github-project-automation github-project-automation Bot moved this to Reviewed in Alloy Jun 4, 2026
@DaniPopes
DaniPopes merged commit 0e3c87d into alloy-rs:main Jun 4, 2026
31 checks passed
@github-project-automation github-project-automation Bot moved this from Reviewed to Done in Alloy Jun 4, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

2 participants