Skip to content

Pectra devnet 5: 7702 changes#8118

Merged
siladu merged 10 commits intobesu-eth:mainfrom
daniellehrner:feat/issue-7948/7702-devnet-5
Jan 16, 2025
Merged

Pectra devnet 5: 7702 changes#8118
siladu merged 10 commits intobesu-eth:mainfrom
daniellehrner:feat/issue-7948/7702-devnet-5

Conversation

@daniellehrner
Copy link
Copy Markdown
Contributor

PR description

EIP-7702 changes required for Pectra devnet-5

Fixed Issue(s)

fixes #7948

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:

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

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
…tx processing

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
… not exist

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
@siladu siladu mentioned this pull request Jan 16, 2025
8 tasks
Copy link
Copy Markdown
Contributor

@siladu siladu left a comment

Choose a reason for hiding this comment

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

Approved with some minor comments which can be picked up in the next PR.

General point: throughout the code and specs we appear to use "delegated" vs "authorized" interchangeable (and "delegation" vs "authorization").

One point where this is obvious is in EVMWorldUpdater:
public DelegatedCodeService authorizedCodeService() { return delegatedCodeService; }

Think we should pick one or is there a semantic difference depending on usage?
Related, could there be confusion with the existing "DELEGATECALL"?

}

return getDelegatedAccount().map(Account::getUnprocessedCode).orElse(Bytes.EMPTY);
return Optional.of(maybeDelegatedAccount.get().getCode());
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
return Optional.of(maybeDelegatedAccount.get().getCode());
return maybeDelegatedAccount.map(AccountState::getCode);

Comment on lines +45 to +48
public static boolean hasDelegatedCode(final Bytes code) {
return code != null
&& code.size() == DELEGATED_CODE_SIZE
&& code.slice(0, DELEGATED_CODE_PREFIX.size()).equals(DELEGATED_CODE_PREFIX);
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Might be good to have a unit test for this.

}
}

private static Bytes getCode(final Account account) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
private static Bytes getCode(final Account account) {
private Bytes getCode(final Account account) {

}
}

private static Bytes getCode(final Account account) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
private static Bytes getCode(final Account account) {
private Bytes getCode(final Account account) {

return new OperationResult(cost, null);
}

private static Bytes getCode(final Account account) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
private static Bytes getCode(final Account account) {
private Bytes getCode(final Account account) {

* @param account the account which needs to be retrieved
* @return the code
*/
protected static Code getCode(final EVM evm, final Account account) {
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Suggested change
protected static Code getCode(final EVM evm, final Account account) {
protected Code getCode(final EVM evm, final Account account) {

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I'm surprised to see ExtCall in here since the EIP doesn't mention it is impacted?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks like it's a future EIP https://github.com/ethereum/EIPs/blob/master/EIPS/eip-7069.md
Has there been any discussion about how this EIP should interact with 7702?

@siladu siladu enabled auto-merge (squash) January 16, 2025 06:05
@siladu siladu merged commit b5fdcc0 into besu-eth:main Jan 16, 2025
@daniellehrner daniellehrner deleted the feat/issue-7948/7702-devnet-5 branch January 21, 2025 15:03
pullurib pushed a commit to pullurib/besu that referenced this pull request Feb 6, 2025
* first draft for 7702 changes for pectra-devnet5

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

* spotless, javadoc

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

* fixed get code in call operations

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

* allow code delegation chain id to be up to 2^256-1

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

* set code for delegated accounts correctly in the initialFrame of the tx processing

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

* delegated accounts return empty bytes for the code if the target does not exist

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>

---------

Signed-off-by: Daniel Lehrner <daniel.lehrner@consensys.net>
Co-authored-by: Simon Dudley <simon.dudley@consensys.net>
Signed-off-by: Bhanu Pulluri <bhanu.pulluri@kaleido.io>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Pectra-Devnet-5: 7702: Remove delegation behavior of EXTCODE*

3 participants