-
Notifications
You must be signed in to change notification settings - Fork 304
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
EIP-7702: Set EOA account code [devnet-6 version] #961
Open
gumb0
wants to merge
13
commits into
master
Choose a base branch
from
eip-7702
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
13 commits
Select commit
Hold shift + click to select a range
3b4e6d2
Validate EIP-7702 set code transactions and process authorization list
gumb0 11dee6e
Support code delegation in instructions implementation
gumb0 b9b2bdd
Allow account with delegated code to be originator of transactions
gumb0 f087dfa
Support delegation for transaction recipient
gumb0 11c564e
Do not execute precompile when calling account delegated to precompile
gumb0 45c884b
State transition tests for EIP-7702
gumb0 9d7f9be
Support set code transactions in exporting state transition tests
gumb0 fd1d446
Support set code transaction in RLP encoding
pdobacz dadab11
Support set code transaction in state test loader
gumb0 a24c48b
Run EEST tests for EIP-7702 on CI
gumb0 c19fdd2
statetest: Don't skip tests with 7702 transactions
chfast 38be465
EIP-7702: EXTCODE* work on full delegation designation
gumb0 7d70c0d
Refactor EIP-7702: delegation resolution in EVM instead of host function
gumb0 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 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
Submodule evmc
updated
5 files
+2 −0 | README.md | |
+4 −1 | bindings/go/evmc/evmc.go | |
+1 −1 | bindings/go/evmc/evmc_test.go | |
+2 −2 | bindings/go/evmc/host_test.go | |
+3 −2 | include/evmc/evmc.h |
This file contains 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 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,42 @@ | ||
// 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 <cassert> | ||
|
||
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 | ||
inline 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. | ||
inline std::optional<evmc::address> get_delegate_address( | ||
const evmc::address& addr, const evmc::HostInterface& host) noexcept | ||
{ | ||
uint8_t prefix[std::size(DELEGATION_MAGIC)] = {}; | ||
host.copy_code(addr, 0, prefix, std::size(prefix)); | ||
|
||
if (!is_code_delegated(bytes_view{prefix, std::size(prefix)})) | ||
return {}; | ||
|
||
evmc::address delegate_address; | ||
assert(host.get_code_size(addr) == | ||
std::size(DELEGATION_MAGIC) + std::size(delegate_address.bytes)); | ||
host.copy_code( | ||
addr, std::size(prefix), delegate_address.bytes, std::size(delegate_address.bytes)); | ||
return delegate_address; | ||
} | ||
} // namespace evmone |
This file contains 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 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 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 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 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.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This hack points to that maybe
msg.flags
is not the best way to signal delegation (because it is not propagated unlike static mode).Alternative could be a separate delegation address field in
evmc_message
, or another flag field.