主页EIPs
EIPsEIP-7666
EIP-7666

EVM-ify the identity precompile

Remove the identity precompile, and put into place a piece of EVM code that has equivalent functionality
DraftStandards Track: Core
创建时间: 2024-03-31
Vitalik Buterin (@vbuterin)
社区讨论原文链接编辑
1 分钟了解
欢迎补充好内容
去提交
相关视频
欢迎补充好内容
去提交
正文

Abstract

Remove the identity precompile at 0x04. At the start of executing the block in which this change activates, put into that contract a short piece of EVM code that has the same functionality.

Motivation

Ethereum today has a large number of precompiles. Nearly half of these precompiles are not seeing significant use, and are contributing to ongoing maintenance cost and risk of consensus bugs, as well as increased development effort for new Ethereum client implementations, including ZK-EVMs and implementations in formal-verification-friendly languages.

This EIP proposes a path for the Ethereum ecosystem to gracefully abandon these precompiles, and takes a first step by applying this procedure to the simplest precompile of all: the identity precompile (which outputs returndata equal to the input calldata). The identity precompile was originally introduced because memory copying is a common operation, and there was no opcode available to do it directly. Since then, norms around what is acceptable for an opcode have changed, and we have introduced the MCOPY opcode with EIP-5656. And so we can remove the identity precompile, and replace it with an ultra-minimal piece of EVM code that replicates its functionality.

In the future, this technique can be applied to other more complex precompiles, such as little-used hash functions and MODEXP.

Specification

ParameterValue
IDENTITY_PRECOMPILE_ADDRESS0x0000....0004
EVM_CODE0x365f5f37365ff3

At the start of the block in which this fork activates, set the code of IDENTITY_PRECOMPILE_ADDRESS to EVM_CODE. Starting from and including that block, IDENTITY_PRECOMPILE_ADDRESS should no longer be treated as a precompile.

Rationale

The given EVM_CODE corresponds to

CALLDATASIZE PUSH0 PUSH0 CALLDATACOPY CALLDATASIZE PUSH0 RETURN

Which copies calldata into memory, and then returns the same memory slice. This is thus a minimally disruptive change to Ethereum that preserves functionality, and accomplishes the goal of reducing the number of precompiles by 1.

Backwards Compatibility

The functionality of the given EVM_CODE is the same as the identity precompile. Gas costs are slightly different, though gas repricings have been done in the Ethereum ecosystem several times before and their effects are well understood.

Security Considerations

As no new functionality is introduced or made cheaper, no security concerns are raised.

Copyright and related rights waived via CC0.

扩展阅读
欢迎补充好内容
去提交
相关项目
欢迎补充好内容
去提交

不想错过最新的 EIP 动态?

订阅 EIPs Fun 周刊以跟进相关更新,建⽴你与 EIP 之间的连接 ,更好地建设以太坊。

详情
支持以太坊贡献者,推动生态建设
资源
GitHub
支持社区