-
Notifications
You must be signed in to change notification settings - Fork 329
EIP-7702: Set EOA account code #961
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
Merged
Changes from all commits
Commits
Show all changes
11 commits
Select commit
Hold shift + click to select a range
e1bde4c
Validate EIP-7702 set-code transactions and process authorization list
gumb0 4f013ee
Support code delegation in instructions implementation
gumb0 f20de8a
Allow account with delegated code to be originator of transactions
gumb0 b7d7f80
Support delegation for transaction recipient
gumb0 076c76e
Do not execute precompile when calling account delegated to precompile
gumb0 1d5b653
State transition tests for EIP-7702
gumb0 0f5aa6f
Support set-code transactions in exporting state transition tests
gumb0 bd25b72
Support set-code transaction in RLP encoding
pdobacz b80a752
Support set-code transaction in state test loader
gumb0 ad5307c
Run EEST tests for EIP-7702 on CI
gumb0 4358516
statetest: Don't skip tests with 7702 transactions
chfast File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,29 @@ | ||
| // evmone: Fast Ethereum Virtual Machine implementation | ||
| // Copyright 2025 The evmone Authors. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #include "delegation.hpp" | ||
| #include <cassert> | ||
|
|
||
| namespace evmone | ||
| { | ||
| std::optional<evmc::address> get_delegate_address( | ||
| const evmc::HostInterface& host, const evmc::address& addr) noexcept | ||
| { | ||
| // Load the code prefix up to the delegation designation size. | ||
| // The HostInterface::copy_code() copies up to the addr's code size | ||
| // and returns the number of bytes copied. | ||
| uint8_t designation_buffer[std::size(DELEGATION_MAGIC) + sizeof(evmc::address)]; | ||
| const auto size = host.copy_code(addr, 0, designation_buffer, std::size(designation_buffer)); | ||
| const bytes_view designation{designation_buffer, size}; | ||
|
|
||
| if (!is_code_delegated(designation)) | ||
| return {}; | ||
|
|
||
| // Copy the delegate address from the designation buffer. | ||
| evmc::address delegate_address; | ||
| // Assume the designation with the valid magic has also valid length. | ||
| assert(designation.size() == std::size(designation_buffer)); | ||
| std::ranges::copy(designation.substr(std::size(DELEGATION_MAGIC)), delegate_address.bytes); | ||
| return delegate_address; | ||
| } | ||
| } // namespace evmone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,28 @@ | ||
| // evmone: Fast Ethereum Virtual Machine implementation | ||
| // Copyright 2025 The evmone Authors. | ||
| // SPDX-License-Identifier: Apache-2.0 | ||
| #pragma once | ||
|
|
||
| #include <evmc/bytes.hpp> | ||
| #include <evmc/evmc.hpp> | ||
| #include <evmc/utils.h> | ||
|
|
||
| namespace evmone | ||
| { | ||
| using evmc::bytes_view; | ||
|
|
||
| /// Prefix of code for delegated accounts | ||
| /// defined by [EIP-7702](https://eips.ethereum.org/EIPS/eip-7702) | ||
| constexpr uint8_t DELEGATION_MAGIC_BYTES[] = {0xef, 0x01, 0x00}; | ||
| constexpr bytes_view DELEGATION_MAGIC{DELEGATION_MAGIC_BYTES, std::size(DELEGATION_MAGIC_BYTES)}; | ||
|
|
||
| /// Check if code contains EIP-7702 delegation designator | ||
| constexpr bool is_code_delegated(bytes_view code) noexcept | ||
| { | ||
| return code.starts_with(DELEGATION_MAGIC); | ||
| } | ||
|
|
||
| /// Get EIP-7702 delegate address from the code of addr, if it is delegated. | ||
| EVMC_EXPORT std::optional<evmc::address> get_delegate_address( | ||
| const evmc::HostInterface& host, const evmc::address& addr) noexcept; | ||
| } // namespace evmone |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.