Skip to content

Immediately check for static exceptions for SELFDESTRUCT #8468

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

PR description

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


// checking for static violations first means fewer account accesses
if (frame.isStatic()) {
return new OperationResult(0, ExceptionalHaltReason.ILLEGAL_STATE_CHANGE);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Put 0 gas parameter in OperationResult.

Copy link
Contributor

@garyschulte garyschulte Apr 2, 2025

Choose a reason for hiding this comment

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

It seems like we can disregard the cold vs warm gas cost if we are halting. It would be good to have a second opinion from @shemnon and/or @lu-pinto.

AFAICT the only place the difference might matter is in trace post-execution

Copy link
Member

Choose a reason for hiding this comment

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

IMO since we are halting I can only it being useful for debugging reasons.
But even for debugging I actually don't see the point because the context failed due to an illegal state, not due to OOG. Maybe you might want to see the overall picture but what guarantees you that the developer puts in the right value, or what right value is it actually? I'll let @shemnon add to that but LGTM

Copy link
Member

Choose a reason for hiding this comment

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

BTW CALL already does this: https://github.com/hyperledger/besu/blob/main/evm/src/main/java/org/hyperledger/besu/evm/operation/CallOperation.java#L90-L96

It just puts an arbitrary cost considering accountWarm = true.

Signed-off-by: Olivier Bégassat <olivier.begassat.cours@gmail.com>
Signed-off-by: Olivier Bégassat <olivier.begassat.cours@gmail.com>
@OlivierBBB OlivierBBB force-pushed the immediately-check-for-static-exceptions-for-SELFDESTRUCT branch from 8b796f7 to 3e26abe Compare March 26, 2025 18:20
@lu-pinto lu-pinto enabled auto-merge (squash) April 8, 2025 08:17
@lu-pinto lu-pinto merged commit 6af6cab into hyperledger:main Apr 8, 2025
43 checks passed
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