transmissions11 / solmate

Modern, opinionated, and gas optimized building blocks for smart contract development.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Yul based wrapper for ECDSA

Vectorized opened this issue · comments

The OpenZeppelin library has a convenient wrapper over the ecrecover function to ensure that the signature is valid and non-malleable.

However, most of the time, users only need check whether the signature is valid, without throwing or getting error codes.

I'd suggest a Yul based wrapper that simply returns an address.
If the address doesn't match the signer, the signature is simply treated as invalid.

The implementation at #247 should save you about 700 gas over OpenZeppelin's version.

Let me know your opinions.