Skip to content

Commit

Permalink
Merge pull request #153 from danyalprout/add-precompiles
Browse files Browse the repository at this point in the history
Add Precompiles Page
  • Loading branch information
tynes authored May 15, 2024
2 parents 08d3c71 + 7e3b8c4 commit 832e6d7
Show file tree
Hide file tree
Showing 4 changed files with 49 additions and 1 deletion.
1 change: 1 addition & 0 deletions specs/SUMMARY.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
- [Rollup Node P2P](./protocol/rollup-node-p2p.md)
- [Derivation](./protocol/derivation.md)
- [Batch Submitter](./protocol/batcher.md)
- [Precompiles](./protocol/precompiles.md)
- [Predeploys](./protocol/predeploys.md)
- [Preinstalls](./protocol/preinstalls.md)
- [Superchain]()
Expand Down
2 changes: 1 addition & 1 deletion specs/fjord/overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ This document is not finalized and should be considered experimental.

## Execution Layer

- [RIP-7212: Precompile for secp256r1 Curve Support](https://github.com/ethereum/RIPs/blob/master/RIPS/rip-7212.md)
- [RIP-7212: Precompile for secp256r1 Curve Support](../protocol/precompiles.md#P256VERIFY)

## Consensus Layer

Expand Down
11 changes: 11 additions & 0 deletions specs/glossary.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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")

[precompile]: 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
Expand Down
36 changes: 36 additions & 0 deletions specs/protocol/precompiles.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
# Precompiles

<!-- START doctoc generated TOC please keep comment here to allow auto update -->
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
**Table of Contents**

- [Overview](#overview)
- [P256VERIFY](#p256verify)

<!-- END doctoc generated TOC please keep comment here to allow auto update -->

## 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`

0 comments on commit 832e6d7

Please sign in to comment.