Skip to content

Commit

Permalink
doc: update README
Browse files Browse the repository at this point in the history
  • Loading branch information
dcposch committed Sep 10, 2023
1 parent 412ad1e commit 44b6bbc
Showing 1 changed file with 21 additions and 7 deletions.
28 changes: 21 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,12 @@
## EIP-7212 fallback `P256Verifier` contract

This repo implements a gas-efficient P256 signature verifier based on [Renaud Dubois from Ledger's implementation](https://github.com/rdubois-crypto/FreshCryptoLib).

Verifying a signature costs about 200k gas. Pure function, no precomputation.

This implementation is a fallback contract exactly matching the proposed [EIP-7212 precompile](https://eips.ethereum.org/EIPS/eip-7212), letting us ship it as a [progressive precompile](https://ethereum-magicians.org/t/progressive-precompiles-via-create2-shadowing/).
This repo implements a gas-efficient P256 signature verifier inspired by [Renaud Dubois's implementation](https://github.com/rdubois-crypto/FreshCryptoLib). Verifying a signature costs about 200k gas. Pure function, no precomputation.

**The contract exists at a deterministic CREATE2 address. You can use it on any EVM chain. If a chain has implemented EIP-7212, you pay ~3k gas. If not, you pay ~200k gas. Either way, the contract address and results are identical.**

The secp256r1 elliptic curve, aka P256, is interesting because it's a widely implemented standard. P256 is used in hardware keys such as Yubikey, Apple's Secure Element, the Android Keystore, and WebAuthn. P256 verification is especially useful for contract wallets, enabling hardware-based signing keys.
This contract matches the proposed [EIP-7212 precompile](https://eips.ethereum.org/EIPS/eip-7212), letting us ship it as a [progressive precompile](https://ethereum-magicians.org/t/progressive-precompiles-via-create2-shadowing/).

The secp256r1 elliptic curve, aka P256, is interesting because it's supported by high-quality consumer enclaves including Yubikey, Apple's Secure Enclave, the Android Keystore, and WebAuthn. P256 verification is especially useful for contract wallets, enabling hardware-based signing keys.

## Development

Expand All @@ -18,11 +16,25 @@ Run `foundryup` to ensure you have the latest foundry. Then,
git clone --recurse-submodules [email protected]:daimo-eth/eip-7212
cd eip-7212
forge test --via-ir -vv
```

This runs test input and output handling as well as all applicable Wycheproof
test vectors, covering a range of edge cases.

# Coverage. Install the recommended extension to view.
<details>
<summary>Code coverage</summary>
Install the recommended extension to view line-by-line test coverage.
To regenerate coverage:

```
forge coverage --via-ir --ir-minimum --report lcov
```

</details>

<details>
<summary>Test vectors</summary>

To regenerate test vectors:

```
Expand All @@ -43,3 +55,5 @@ forge test --via-ir -vv
# In future, execution spec and clients can test against the same clean vectors
```

</details>

0 comments on commit 44b6bbc

Please sign in to comment.