foundry-rs / foundry-rs/foundry

feat(`cheatcodes`): add `vm.ec{Add, Mul?, AddP256, MulP256?}` (elliptic-curve cryptography)

Open
#10,868 8 comments 0 reactions 0 assignees View on GitHub
A-cheatcodes T-feature
Dominant language
Rust
Stars
10.6k
Forks
2.6k
Avg merge
18h 20m
Merged PRs (30d)
510

Description

### Component

Forge

### Describe the feature you would like

It would be great to have such methods in `vm` since in rollups we could see more complex smart contracts that use secp256k1 / secp256r1 elliptic-curves. Intended use case - multi-signature schemes, ECDH on-chain, etc.

### Additional context
`Mul` is marked with a question mark because we already have `vm.createWallet(uint256 privateKey)` and `vm.publicKeyP256(uint256 privateKey)`, but we don't have any generic method like `add/mul` that returns `struct PublicKey { uint256 x, y; }`.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.