Skip to content

refactor(test): rename gas cost constant#1870

Closed
LouisTsai-Csie wants to merge 43 commits intoethereum:forks/amsterdamfrom
LouisTsai-Csie:rename-gas-constant
Closed

refactor(test): rename gas cost constant#1870
LouisTsai-Csie wants to merge 43 commits intoethereum:forks/amsterdamfrom
LouisTsai-Csie:rename-gas-constant

Conversation

@LouisTsai-Csie
Copy link
Collaborator

@LouisTsai-Csie LouisTsai-Csie commented Dec 9, 2025

🗒️ Description

EELS EEST Value Description
GAS_JUMPDEST G_JUMPDEST 1 Jump destination opcode
GAS_BASE G_BASE 2 Base operation cost
GAS_VERY_LOW G_VERY_LOW 3 Very low cost operations
GAS_MEMORY G_MEMORY 3 Memory allocation cost
GAS_COPY G_COPY 3 Copy operation cost
GAS_LOW G_LOW 5 Low cost operations
GAS_MID G_MID 8 Medium cost operations
GAS_HIGH G_HIGH 10 High cost operations
GAS_WARM_ACCESS G_WARM_SLOAD 100 Warm storage load
GAS_COLD_SLOAD G_COLD_SLOAD 2100 Cold storage load
GAS_STORAGE_UPDATE G_STORAGE_RESET 5000 Storage slot update cost
GAS_STORAGE_CLEAR_REFUND R_STORAGE_CLEAR 4800 Storage clear refund
GAS_STORAGE_SET G_STORAGE_SET 20000 Storage slot set cost
GAS_WARM_ACCESS G_WARM_ACCOUNT_ACCESS 100 Warm account access
GAS_COLD_ACCOUNT_ACCESS G_COLD_ACCOUNT_ACCESS 2600 Cold account access
GAS_INIT_CODE_WORD_COST G_INITCODE_WORD 2 Init code cost per word
GAS_CODE_DEPOSIT G_CODE_DEPOSIT_BYTE 200 Code deposit per byte
GAS_CREATE G_CREATE 32000 Contract creation cost
GAS_CALL_STIPEND G_CALL_STIPEND 2300 Call stipend
GAS_SELF_DESTRUCT G_SELF_DESTRUCT 5000 Self-destruct base cost
GAS_CALL_VALUE G_CALL_VALUE 9000 Value transfer cost
GAS_NEW_ACCOUNT G_NEW_ACCOUNT 25000 New account creation
GAS_EXPONENTIATION G_EXP 10 Exponentiation base cost
GAS_EXPONENTIATION_PER_BYTE G_EXP_BYTE 50 Exponentiation per byte
GAS_KECCAK256 G_KECCAK_256 30 Keccak256 base cost
GAS_KECCAK256_WORD G_KECCAK_256_WORD 6 Keccak256 per word
GAS_BLOCK_HASH G_BLOCKHASH 20 Block hash cost
GAS_LOG_DATA G_LOG_DATA 8 Log data cost per byte
GAS_LOG G_LOG 375 Log operation cost
GAS_LOG_TOPIC G_LOG_TOPIC 375 Log topic cost
TX_BASE_COST G_TRANSACTION 21000 Base tx cost
TX_CREATE_COST G_TRANSACTION_CREATE 21000 Contract creation tx cost
TX_ACCESS_LIST_ADDRESS_COST G_ACCESS_LIST_ADDRESS 2400 Access list address cost (EIP-2930)
TX_ACCESS_LIST_STORAGE_KEY_COST G_ACCESS_LIST_STORAGE 1900 Access list storage key cost (EIP-2930)
FLOOR_CALLDATA_COST G_TX_DATA_FLOOR_TOKEN_COST 10 Floor calldata token cost
STANDARD_CALLDATA_TOKEN_COST G_TX_DATA_STANDARD_TOKEN_COST 4 Standard calldata token cost
PER_EMPTY_ACCOUNT_COST G_AUTHORIZATION 25000 Cost per empty account authorization
PER_AUTH_BASE_COST R_AUTHORIZATION_EXISTING_AUTHORITY 12500 Cost per empty account authorization
TX_DATA_COST_PER_ZERO G_TX_DATA_ZERO 4 Gas cost per zero byte in the transaction data.
TX_DATA_COST_PER_NON_ZERO G_TX_DATA_NON_ZERO 16 Gas cost per non-zero byte in the transaction data.
N/A G_PRECOMPILE_ECADD 150 Gas cost for ECADD operations
N/A G_PRECOMPILE_ECMUL 6000 Gas cost for ECMUL operations
N/A G_PRECOMPILE_ECPAIRING_BASE 45_000 Gas cost for ecpairing base operations
N/A G_PRECOMPILE_ECPAIRING_PER_POINT 34_000 Gas cost for ecpairing point cost

🔗 Related Issues or PRs

Issue #1879

✅ Checklist

  • All: Ran fast tox checks to avoid unnecessary CI fails, see also Code Standards and Enabling Pre-commit Checks:
    uvx tox -e static
  • All: PR title adheres to the repo standard - it will be used as the squash commit message and should start type(scope):.
  • All: Considered adding an entry to CHANGELOG.md.
  • All: Considered updating the online docs in the ./docs/ directory.
  • All: Set appropriate labels for the changes (only maintainers can apply labels).
  • Tests: Ran mkdocs serve locally and verified the auto-generated docs for new tests in the Test Case Reference are correctly formatted.
  • Tests: For PRs implementing a missed test case, update the post-mortem document to add an entry the list.
  • Ported Tests: All converted JSON/YML tests from ethereum/tests or tests/static have been assigned @ported_from marker.

Cute Animal Picture

I like Junji Ito.

Gemini_Generated_Image_7lb0d7lb0d7lb0d7

@LouisTsai-Csie LouisTsai-Csie self-assigned this Dec 9, 2025
@LouisTsai-Csie LouisTsai-Csie marked this pull request as ready for review December 9, 2025 13:46
@codecov
Copy link

codecov bot commented Dec 9, 2025

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 86.33%. Comparing base (a64f269) to head (921cabf).
⚠️ Report is 1 commits behind head on forks/amsterdam.

Additional details and impacted files
@@               Coverage Diff                @@
##           forks/amsterdam    #1870   +/-   ##
================================================
  Coverage            86.33%   86.33%           
================================================
  Files                  538      538           
  Lines                34557    34557           
  Branches              3222     3222           
================================================
  Hits                 29835    29835           
  Misses                4148     4148           
  Partials               574      574           
Flag Coverage Δ
unittests 86.33% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

SamWilsn pushed a commit that referenced this pull request Dec 9, 2025
* fix(ci): Speed up slow unit tests by reusing t8n server

* refactor(fill): add flag to more tests

* fix(filler): flag
@Carsons-Eels Carsons-Eels self-requested a review January 7, 2026 15:20
Copy link
Contributor

@Carsons-Eels Carsons-Eels left a comment

Choose a reason for hiding this comment

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

Overall I think it looks good, only two small things to address

Comment on lines 74 to 77
TARGET_BLOB_GAS_PER_BLOCK = GAS_PER_BLOB * BLOB_SCHEDULE_TARGET
BLOB_BASE_COST = Uint(2**13)
BLOB_SCHEDULE_MAX = U64(21)
BLOB_SCHEDULE_MAX = U64(9)
MIN_BLOB_GASPRICE = Uint(1)
Copy link
Contributor

Choose a reason for hiding this comment

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

Suggested change
TARGET_BLOB_GAS_PER_BLOCK = GAS_PER_BLOB * BLOB_SCHEDULE_TARGET
BLOB_BASE_COST = Uint(2**13)
BLOB_SCHEDULE_MAX = U64(21)
BLOB_SCHEDULE_MAX = U64(9)
MIN_BLOB_GASPRICE = Uint(1)
BLOB_TARGET_GAS_PER_BLOCK = GAS_PER_BLOB * BLOB_SCHEDULE_TARGET
BLOB_BASE_COST = Uint(2**13)
BLOB_SCHEDULE_MAX = U64(9)
BLOB_MIN_GASPRICE = Uint(1)

I think it makes more sense to name them this way, so that when you're programming the autocomplete suggestions pop up the same way for everything that is BLOB*.

Copy link
Collaborator Author

@LouisTsai-Csie LouisTsai-Csie Jan 8, 2026

Choose a reason for hiding this comment

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

I do the following change in the last 2 commits:

  • TARGET_BLOB_GAS_PER_BLOCK -> BLOB_TARGET_GAS_PER_BLOCK 5b8bf95
  • MIN_BLOB_GASPRICE -> BLOB_MIN_GASPRICE e62a45b

@Carsons-Eels Carsons-Eels added E-medium Experience: of moderate difficulty P-urgent C-refactor Category: refactor labels Jan 8, 2026
@LouisTsai-Csie
Copy link
Collaborator Author

LouisTsai-Csie commented Jan 8, 2026

I accidentally change some variable name, which is not part of the gas cost constant, i hope it would not break anything. Resolve some issue by 921cabf

Other notes: I found there is G_WARM_SLOAD and G_WARM_ACCOUNT_ACCESS, and i convert them all to GAS_WARM_ACCESS, could you help check if this is correct? Thanks

@Carsons-Eels
Copy link
Contributor

I accidentally change some variable name, which is not part of the gas cost constant, i hope it would not break anything. Resolve some issue by 921cabf

Other notes: I found there is G_WARM_SLOAD and G_WARM_ACCOUNT_ACCESS, and i convert them all to GAS_WARM_ACCESS, could you help check if this is correct? Thanks

Yeah, no problem, I'll check it

@fselmo
Copy link
Contributor

fselmo commented Feb 6, 2026

This PR needs a rebase 😱. Any blockers here?

@Carsons-Eels
Copy link
Contributor

Rebased, updated, and passed two reviews at github.com//pull/2094

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

C-refactor Category: refactor E-medium Experience: of moderate difficulty P-urgent

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants