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

7702 refactor, remove CodeDelegationAccount abstraction #8408

Draft
wants to merge 4 commits into
base: main
Choose a base branch
from

Conversation

daniellehrner
Copy link
Contributor

PR description

Removes the CodeDelegationAbstraction to avoid calling Account.getCode() every time that we retrieve an account.

Fixed Issue(s)

fixes #8392

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

@daniellehrner daniellehrner requested a review from Copilot March 12, 2025 10:12

Choose a reason for hiding this comment

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

Pull Request Overview

This PR refactors code delegation handling by removing the CodeDelegationAccount abstraction and centralizing delegation logic into helper classes and services. Key changes include:

  • Removal of CodeDelegationAccount, MutableCodeDelegationDelegationAccount, and related files.
  • Introduction of CodeDelegationHelper and a simplified CodeDelegationService.
  • Updates to tests, protocol spec configurations, and transaction processing logic to use the new delegation approach.

Reviewed Changes

Copilot reviewed 14 out of 14 changed files in this pull request and generated no comments.

Show a summary per file
File Description
evm/src/main/java/org/hyperledger/besu/evm/operation/InsufficientGasException.java New exception class for signaling insufficient gas during delegation resolution.
evm/src/main/java/org/hyperledger/besu/evm/worldstate/CodeDelegationHelper.java Introduces helper methods for code delegation resolution.
ethereum/core/src/main/java/org/hyperledger/besu/ethereum/mainnet/CodeDelegationProcessor.java Refactored to use WorldUpdater and a newly instantiated CodeDelegationService.
evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCallOperation.java Updates to delegate code resolution, integrating the new helper methods and exception handling.
Other files Removal of legacy code delegation account abstractions and adjustments in tests and transaction processing.
Comments suppressed due to low confidence (1)

evm/src/main/java/org/hyperledger/besu/evm/operation/AbstractCallOperation.java:264

  • Consider replacing RuntimeException with a more specific exception type to clearly indicate the missing target account condition and improve downstream error handling.
throw new RuntimeException("A delegated code account must have a target account");
@daniellehrner daniellehrner force-pushed the feat/issue-8392/remove_code_delegation_abstraction branch from 59486ff to 5f2eb7a Compare March 14, 2025 10:35
@daniellehrner daniellehrner force-pushed the feat/issue-8392/remove_code_delegation_abstraction branch from f8b0f59 to b7304b2 Compare March 14, 2025 12:40
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.

Remove getCode() from CodeDelegationService.processAccount
1 participant