Skip to content

Dont touch state for CALLs raising a static exception #8639

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

Conversation

OlivierBBB
Copy link
Contributor

@OlivierBBB OlivierBBB commented May 16, 2025

PR description

This PR does two things:

  • not compute the gas cost of LOGX that raise a static exception
  • not compute the gas cost of CALL that raises a static exception

Note. Computing the cost of a value-bearing CALL requires a state access: one must determine whether the target address exists in the state. In the code this state access was implicitly performed during cost(frame, true). If the CALL raises a static exception this state access is not required; it also pollutes the accumulator. In the fix we therefore remove this cost calculation and replace it with 0. We also remove the cost calculation for LOGX operations that raise a static exception.

Fixed Issue(s)

Thanks for sending a pull request! Have you done the following?

  • Checked out our contribution guidelines?
  • Considered documentation and added the doc-change-required label to this PR if updates are required.
  • Considered the changelog and included an update if required.
  • For database changes (e.g. KeyValueSegmentIdentifier) considered compatibility and performed forwards and backwards compatibility tests

Locally, you can run these tests to catch failures early:

  • spotless: ./gradlew spotlessApply
  • unit tests: ./gradlew build
  • acceptance tests: ./gradlew acceptanceTest
  • integration tests: ./gradlew integrationTest
  • reference tests: ./gradlew ethereum:referenceTests:referenceTests

required to price CALLs

Signed-off-by: Olivier Bégassat <olivier.begassat.cours@gmail.com>
@OlivierBBB OlivierBBB force-pushed the dont-touch-state-for-CALLs-with-staticx-or-mxpx branch from 679d7ce to 227524b Compare May 16, 2025 14:54
Copy link
Contributor

@matkt matkt left a comment

Choose a reason for hiding this comment

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

LGTM

@macfarla macfarla requested a review from lu-pinto May 19, 2025 03:22
@lu-pinto lu-pinto enabled auto-merge (squash) May 19, 2025 09:05
@lu-pinto lu-pinto merged commit 6caf0f7 into hyperledger:main May 19, 2025
48 checks passed
@macfarla macfarla mentioned this pull request May 22, 2025
9 tasks
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.

4 participants