Inject LambdaVM crypto into the ethrex guest#702
Open
jotabulacios wants to merge 2 commits into
Open
Conversation
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.
This PR builds on #666 by adding ECSM-accelerated
secp256k1_ecrecoverand moving the crypto implementation into this repo.Accelerates
secp256k1_ecrecovervia the ECSM precompile. The ECDSA recovery's linear combinationpk = u1·G + u2·Ris evaluated through four x-onlyecsm_mulqueries and full-point reconstruction via the chord law, with all three inversions batched. Falls back to pure-RustProjectivePoint::lincombfor degenerate cases (zero scalars, identity points, cancelling terms). Uses the existing x-only ABI — no executor or prover changes required.keccak256continues routing to thekeccak_permuteprecompile as before.Moves the crypto implementation into this repo as a new crate
crypto/ethrex-crypto(lambda-vm-ethrex-crypto). Previously theLambdaVmCryptoimpl lived inside the ethrex repo (crates/guest-program/src/crypto/lambdavm.rs). The guest now constructsLambdaVmEcsmCryptofrom this crate and injects it viaArc<dyn Crypto>— crypto changes no longer require an ethrex PR.Validation
crypto/ethrex-cryptohost tests: 5/5 —lincomb2correctness on fixed inputs and recovery shape, plus three degenerate fallback guards (edge scalars, identity points, cancelling terms).vm-benchmarks-1— each ETH transfer triggers onesecp256k1_ecrecover: