diff --git a/specs/SUMMARY.md b/specs/SUMMARY.md index fea0ff823..203de30c0 100644 --- a/specs/SUMMARY.md +++ b/specs/SUMMARY.md @@ -20,6 +20,7 @@ - [Batch Submitter](./protocol/batcher.md) - [Predeploys](./protocol/predeploys.md) - [Preinstalls](./protocol/preinstalls.md) + - [Precompiles](./protocol/precompiles.md) - [Superchain]() - [Superchain Configuration](./protocol/superchain-configuration.md) - [Superchain Upgrades](./protocol/superchain-upgrades.md) diff --git a/specs/glossary.md b/specs/glossary.md index 7a9ee3cc8..2998b3236 100644 --- a/specs/glossary.md +++ b/specs/glossary.md @@ -13,6 +13,7 @@ - [Chain Re-Organization](#chain-re-organization) - [Predeployed Contract ("Predeploy")](#predeployed-contract-predeploy) - [Preinstalled Contract ("Preinstall")](#preinstalled-contract-preinstall) + - [Precompiled Contract ("Precompile")](#precompiled-contract-precompile) - [Receipt](#receipt) - [Transaction Type](#transaction-type) - [Fork Choice Rule](#fork-choice-rule) @@ -149,6 +150,16 @@ available to improve the L2's UX. All preinstall contracts are specified in the [preinstalls specification](./protocol/preinstalls.md). +## Precompiled Contract ("Precompile") + +[predeploy]: glossary.md#precompiled-contract-precompile + +A contract implemented natively in the EVM that performs a specific operation more efficiently than a bytecode +(e.g. Solidity) implementation. Precompiles exist at predefined addresses. They are created and modified through +network upgrades. + +All precompile contracts are specified in the [precompiles specification](./protocol/precompiles.md). + ## Receipt [receipt]: glossary.md#receipt diff --git a/specs/protocol/precompiles.md b/specs/protocol/precompiles.md new file mode 100644 index 000000000..3549283c7 --- /dev/null +++ b/specs/protocol/precompiles.md @@ -0,0 +1,36 @@ +# Precompiles + + + +**Table of Contents** + +- [Overview](#overview) +- [P256VERIFY](#p256verify) + + + +## Overview + +[Precompiled contracts](../glossary.md#precompiled-contract-precompile) exist on OP-Stack chains at +predefined addresses. They are similar to predeploys but are implemented as native code in the EVM as opposed to +bytecode. Precompiles are used for computationally expensive operations, that would be cost prohibitive to implement +in Solidity. Where possible predeploys are preferred, as precompiles must be implemented in every execution client. + +OP-Stack chains contain the [standard Ethereum precompiles](https://www.evm.codes/precompiled) as well as a small +number of additional precompiles. The following table lists each of the additional precompiles. The system version +indicates when the precompile was introduced. + +| Name | Address | Introduced | +|------------| ------------------------------------------ |------------| +| P256VERIFY | 0x0000000000000000000000000000000000000100 | Fjord | + +## P256VERIFY + +The `P256VERIFY` precompile performs signature verification for the secp256r1 elliptic curve. This curve has widespread +adoption. It's used by Passkeys, Apple Secure Enclave and many other systems. + +It is specified as part of [RIP-7212](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md) and was added to +the OP-Stack protocol in the Fjord release. The op-geth implementation is +[here](https://github.com/ethereum-optimism/op-geth/blob/optimism/core/vm/contracts.go#L1161-L1193). + +Address: `0x0000000000000000000000000000000000000100`