Skip to content

Update EIP-7907: clarify code warming #9877

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 2 commits into
base: master
Choose a base branch
from

Conversation

lightclient
Copy link
Member

Trying to make the new code warming state clearer.

@lightclient lightclient requested a review from eth-bot as a code owner June 9, 2025 10:08
@github-actions github-actions bot added c-update Modifies an existing proposal s-draft This EIP is a Draft t-core labels Jun 9, 2025
@eth-bot
Copy link
Collaborator

eth-bot commented Jun 9, 2025

File EIPS/eip-7907.md

Requires 1 more reviewers from @charles-cooper, @qizhou

@eth-bot eth-bot added the a-review Waiting on author to review label Jun 9, 2025
@eth-bot eth-bot changed the title 7907: clarify code warming Update EIP-7907: clarify code warming Jun 9, 2025
Copy link
Contributor

@gakonst gakonst left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

ACK


### Code warming

The concept of warm and cold accounts which was previously defined in [EIP-2929](./eip-2929.md) is extended in this EIP to include the concept of warm and cold code. This allows for four possible states an account can be in during execution, with respect to gas pricing: cold-cold, cold-warm, warm-cold, and warm-warm. See the table below with examples.
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it possible to have warm-cold variant? Should the account code be defined by its hash or by its account address?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Right, warm-cold isn't possible if we define code by account, but if it is by hash it will be.

I think either option is acceptable.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It feels more aligned if we use the account address. Not sure if we have notion of bytecode hash anywhere

2. Change the gas schedule for opcodes which load code. Specifically, the opcodes `CALL`, `STATICCALL`, `DELEGATECALL`, `CALLCODE` and `EXTCODECOPY` are modified so that `largeContractCost = ceil32(excess_contract_size) * GAS_INIT_CODE_WORD_COST // 32` gas is added to the access cost if the code is cold, where `excess_contract_size = max(0, contract_size - 0x6000)`, and `GAS_INIT_CODE_WORD_COST = 2`. (Cf. initcode metering: [EELS](https://github.com/ethereum/execution-specs/blob/1a587803e3e698407d204888b02342393f8b4fe5/src/ethereum/cancun/vm/gas.py#L269)). This introduces a new warm state for contract code - warm if the code has been loaded, cold if not.
2. Change the gas schedule for opcodes which load code. Specifically, the opcodes `CALL`, `STATICCALL`, `DELEGATECALL`, `CALLCODE` and `EXTCODECOPY` are modified so that `largeContractCost = ceil32(excess_contract_size) * GAS_INIT_CODE_WORD_COST // 32` gas is added to the access cost if the code is cold, where `excess_contract_size = max(0, contract_size - 0x6000)`, and `GAS_INIT_CODE_WORD_COST = 2`. (Cf. initcode metering: [EELS](https://github.com/ethereum/execution-specs/blob/1a587803e3e698407d204888b02342393f8b4fe5/src/ethereum/cancun/vm/gas.py#L269)). This introduces a [new warm state](#code-warming) for contract code - warm if the code has been loaded, cold if not.
3. Update the [EIP-3860](./eip-3860.md) contract initcode size limit of 48KB (`0xc000` bytes) to 512KB (`0x80000` bytes).
4. Increase the base cost of `EXTCODESIZE` to `5000`
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

so EXTCODESIZE will always cost at least 5000?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
a-review Waiting on author to review c-update Modifies an existing proposal s-draft This EIP is a Draft t-core
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants