Skip to content
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

Support EIP-3860 (Limit and meter initcode) for Shanghai #507

Merged
merged 2 commits into from
May 18, 2023

Conversation

silathdiir
Copy link

@silathdiir silathdiir commented May 17, 2023

Geth related code

  1. state_transition 1 and state_transition 2 are related with this EIP. But both cause return nil (not an ExecutionResult) from TransitionDb.

Seems no need to fix BeginTx.

  1. New dynamic gas function gasCreateEip3860 and gasCreate2Eip3860 are set for CREATE and CREATE2 when this EIP is enabled.

Need to fix Create and OOG Create.

Fix summary

  1. Add constants for shanghai feature and not-shanghai to eth-types.
MAX_INIT_CODE_SIZE // 49152 for shanghai, and 0x1FFFFFFFE0 for not-shanghai.
CREATE_GAS_PER_CODE_WORD // 2 for shanghai, and 0 for not-shanghai.
CREATE2_GAS_PER_CODE_WORD // (2 + 6) for shanghai, and 6 for not-shanghai.
  1. Move OOG Create from DynamicMemoryExpansion to OOG Create2. Since both CREATE and CREATE2 need to check with maximum init code size.

  2. In CreateGadget and ErrorOOGCreateGadget, check with MAX_INIT_CODE_SIZE, and use CREATE_GAS_PER_CODE_WORD and CREATE2_GAS_PER_CODE_WORD to calculate gas cost.

Issue Link

#504

Upstream issue privacy-scaling-explorations#1368

Type of change

  • New feature (non-breaking change which adds functionality)

Test

Add a new test case test_oog_create_max_init_code_size to OOG Create.
And Test cases of CreateGadget and ErrorOOGCreateGadget could pass for shanghai feature and not-shanghai.

cargo test -- --nocapture test_create test_oog_create
cargo test --features shanghai -- --nocapture test_create test_oog_create

@silathdiir silathdiir mentioned this pull request May 17, 2023
7 tasks
@silathdiir silathdiir requested a review from lispc May 17, 2023 06:57
@lispc lispc merged commit 74c1d20 into develop May 18, 2023
@lispc lispc deleted the shanghai/eip-3860-limit-and-meter-initcode branch May 18, 2023 06:17
github-merge-queue bot pushed a commit to privacy-scaling-explorations/zkevm-circuits that referenced this pull request Jun 2, 2023
…es (#1424)

### Description

1. Add Shanghai related fields to chain config in geth-utils.

2. EIP-3651 (Warm COINBASE): add a new access-list write for coinbase to
Begin TX.

3. Part of EIP-3860 (Limit and meter initcode): only add gas cost of
init code to Begin TX (missing gas cost changes in Create and OOG
Create).

### Issue Link

Issue
#1362

Local related PRs:
scroll-tech#497
scroll-tech#500
scroll-tech#507

Reference previous PR:
#1361

### Type of change

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

### How Has This Been Tested?

Unit test cases of CI could pass with Shanghai geth traces.

---------

Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
johntaiko pushed a commit to johntaiko/zkevm-circuits that referenced this pull request Aug 20, 2023
…es (privacy-scaling-explorations#1424)

1. Add Shanghai related fields to chain config in geth-utils.

2. EIP-3651 (Warm COINBASE): add a new access-list write for coinbase to
Begin TX.

3. Part of EIP-3860 (Limit and meter initcode): only add gas cost of
init code to Begin TX (missing gas cost changes in Create and OOG
Create).

Issue
privacy-scaling-explorations#1362

Local related PRs:
scroll-tech#497
scroll-tech#500
scroll-tech#507

Reference previous PR:
privacy-scaling-explorations#1361

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

Unit test cases of CI could pass with Shanghai geth traces.

---------

Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
johntaiko pushed a commit to johntaiko/zkevm-circuits that referenced this pull request Aug 20, 2023
…es (privacy-scaling-explorations#1424)

1. Add Shanghai related fields to chain config in geth-utils.

2. EIP-3651 (Warm COINBASE): add a new access-list write for coinbase to
Begin TX.

3. Part of EIP-3860 (Limit and meter initcode): only add gas cost of
init code to Begin TX (missing gas cost changes in Create and OOG
Create).

Issue
privacy-scaling-explorations#1362

Local related PRs:
scroll-tech#497
scroll-tech#500
scroll-tech#507

Reference previous PR:
privacy-scaling-explorations#1361

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

Unit test cases of CI could pass with Shanghai geth traces.

---------

Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
johntaiko pushed a commit to johntaiko/zkevm-circuits that referenced this pull request Aug 20, 2023
…es (privacy-scaling-explorations#1424)

1. Add Shanghai related fields to chain config in geth-utils.

2. EIP-3651 (Warm COINBASE): add a new access-list write for coinbase to
Begin TX.

3. Part of EIP-3860 (Limit and meter initcode): only add gas cost of
init code to Begin TX (missing gas cost changes in Create and OOG
Create).

Issue
privacy-scaling-explorations#1362

Local related PRs:
scroll-tech#497
scroll-tech#500
scroll-tech#507

Reference previous PR:
privacy-scaling-explorations#1361

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

Unit test cases of CI could pass with Shanghai geth traces.

---------

Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
johntaiko pushed a commit to johntaiko/zkevm-circuits that referenced this pull request Aug 20, 2023
…es (privacy-scaling-explorations#1424)

1. Add Shanghai related fields to chain config in geth-utils.

2. EIP-3651 (Warm COINBASE): add a new access-list write for coinbase to
Begin TX.

3. Part of EIP-3860 (Limit and meter initcode): only add gas cost of
init code to Begin TX (missing gas cost changes in Create and OOG
Create).

Issue
privacy-scaling-explorations#1362

Local related PRs:
scroll-tech#497
scroll-tech#500
scroll-tech#507

Reference previous PR:
privacy-scaling-explorations#1361

- [x] Breaking change (fix or feature that would cause existing
functionality to not work as expected)

Unit test cases of CI could pass with Shanghai geth traces.

---------

Co-authored-by: Zhang Zhuo <mycinbrin@gmail.com>
chokobole added a commit to kroma-network/zkevm-circuits that referenced this pull request Apr 18, 2024
chokobole added a commit to kroma-network/zkevm-circuits that referenced this pull request Apr 19, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants