Skip to content

feat: introduce gas_floor_base_cost for EIP-7623 compliance#101

Merged
mrLSD merged 3 commits intofeat/gasometr-refactoringfrom
feat/gasometr-refactoring-2
Jan 23, 2026
Merged

feat: introduce gas_floor_base_cost for EIP-7623 compliance#101
mrLSD merged 3 commits intofeat/gasometr-refactoringfrom
feat/gasometr-refactoring-2

Conversation

@aleksuss
Copy link
Copy Markdown
Member

@aleksuss aleksuss commented Jan 22, 2026

Summary by CodeRabbit

  • New Features

    • Added gas floor calculation support with configurable base cost, enabling more precise gas accounting across network upgrades. Gas floor base cost is set to 21,000 for Prague and 0 for other forks.
  • Refactor

    • Optimized gas computation logic by consolidating floor gas calculation into a dedicated helper function.

✏️ Tip: You can customize this high-level summary in your review settings.

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 22, 2026

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

The changes introduce a new gas_floor_base_cost configuration field to the runtime's Config struct and propagate it across hard-fork initializers. A helper function is extracted in the gasometer module to consolidate floor gas computation logic, with a clippy lint suppression added.

Changes

Cohort / File(s) Summary
Configuration infrastructure
evm/src/runtime/mod.rs
Added public field gas_floor_base_cost: u64 to both Config and DerivedConfigInputs structs. Propagated through all hard-fork initializers (frontier, istanbul, berlin, london, merge, shanghai, cancun, prague), with prague() setting the value to 21000 and others defaulting to 0.
Gas calculation refactoring
evm/src/gasometer/mod.rs
Extracted local helper function floor_gas_calc inside intrinsic_gas_and_gas_floor to consolidate repeated floor gas calculation logic. Applied clippy lint suppression #[allow(clippy::as_conversions)] to the public function.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~10 minutes

Poem

🐰 The gasometer hops with glee,
Floor calculations merged so clean,
Config spreads from fork to fork,
A rabbit's refactoring work! ✨

🚥 Pre-merge checks | ✅ 2 | ❌ 1
❌ Failed checks (1 warning)
Check name Status Explanation Resolution
Docstring Coverage ⚠️ Warning Docstring coverage is 40.00% which is insufficient. The required threshold is 80.00%. Write docstrings for the functions missing them to satisfy the coverage threshold.
✅ Passed checks (2 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title clearly summarizes the main change: introducing gas_floor_base_cost parameter for EIP-7623 compliance, which aligns with the PR objectives and the changes across two files.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.


Comment @coderabbitai help to get the list of available commands and usage tips.

@aleksuss aleksuss requested a review from mrLSD January 22, 2026 16:55
@aleksuss
Copy link
Copy Markdown
Member Author

@CodeRabbit full review

@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jan 22, 2026

✅ Actions performed

Full review triggered.

@aleksuss aleksuss requested a review from birchmd January 22, 2026 16:58
Comment thread evm/src/gasometer/mod.rs Outdated
if config.has_floor_gas {
// According to EIP-2028: non-zero byte = 16, zero-byte = 4
// According to EIP-7623: tokens_in_calldata = zero_bytes_in_calldata + nonzero_bytes_in_calldata * 4
let tokens_in_calldata = (zero_data_len + non_zero_data_len * 4) as u64;
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Maybe we should use saturating arithmetic operations here just to be safe.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

Good idea 👍🏻

@aleksuss aleksuss force-pushed the feat/gasometr-refactoring-2 branch from 3f57395 to 4810147 Compare January 22, 2026 17:22
@mrLSD mrLSD merged commit 924c452 into feat/gasometr-refactoring Jan 23, 2026
7 checks passed
@mrLSD mrLSD deleted the feat/gasometr-refactoring-2 branch January 23, 2026 10:17
mrLSD added a commit that referenced this pull request Jan 23, 2026
* Gasometr: refactoring and improvements

* Bump version to: v2.2.1

* Extend doc comment for calculate_intrinsic_gas_and_gas_floor

* feat: introduce gas_floor_base_cost for EIP-7623 compliance (#101)

* feat: introduce gas_floor_base_cost for EIP-7623 compliance

* fix: replace simple arithmetic operations with saturating_* analogs for gas calculations

* chore: remove gas_floor_base_cost constant

---------

Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
mrLSD added a commit that referenced this pull request Feb 3, 2026
* Feat: gasometr refactoring and improvements (#100)

* Gasometr: refactoring and improvements

* Bump from version: v2.2.1

* Extend doc comment for calculate_intrinsic_gas_and_gas_floor

* feat: introduce gas_floor_base_cost for EIP-7623 compliance (#101)

* feat: introduce gas_floor_base_cost for EIP-7623 compliance

* fix: replace simple arithmetic operations with saturating_* analogs for gas calculations

* chore: remove gas_floor_base_cost constant

---------

Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>

* Fix typo

---------

Co-authored-by: Oleksandr Anyshchenko <oleksandr.anyshchenko@aurora.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants