Skip to content

feat: add initial EIP-7805 #1214

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

Draft
wants to merge 71 commits into
base: eips/osaka/eip-7805
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
3c0f4b0
prague initial commit
gurukamath Jan 21, 2025
9ca93fd
changes for prague
gurukamath Apr 23, 2024
4916e4a
Implement EIP-7702
gurukamath Jan 23, 2025
ab1bf03
Implement EIP-2537
gurukamath Jan 23, 2025
647fcc6
Implement EIP-6110
gurukamath Jan 23, 2025
5f188de
Implement EIP-7002
gurukamath Jan 23, 2025
78828a7
Implement EIP-7251
gurukamath Jan 23, 2025
14ed750
Implement EIP-2935
gurukamath Jan 23, 2025
d9f70f9
Implement EIP-7623
gurukamath Jan 23, 2025
66a935b
Implement EIP-7691
gurukamath Jan 23, 2025
90b1834
run tests
gurukamath Jan 23, 2025
6d42547
catch invalid signatures
gurukamath Jan 23, 2025
ed4d89d
add state test flag
gurukamath Jan 23, 2025
3f6a717
run only prague tests
gurukamath Jan 23, 2025
3d6fa3c
re-factor validate_transaction
gurukamath Jan 24, 2025
98c9a47
change type of branch node subnodes (#1066) (#1095)
SamWilsn Jan 27, 2025
7fe0097
update storage trie type (#1070 #1071)
SamWilsn Jan 25, 2025
57b8ad3
port #1098 and #1011 to `forks/prague` (#1102)
gurukamath Feb 3, 2025
5c74ce0
update EXTCODE* behavior in 7702 (#1094)
gurukamath Jan 30, 2025
39125dc
Update EIP-2935, EIP-7002, EIP-7251 system contract addresses (#1100)
marioevz Jan 30, 2025
6911362
run [email protected] tests
gurukamath Feb 5, 2025
6a2d809
Backport changes from prague (#1113)
gurukamath Feb 11, 2025
eb8c3a7
Prepare to release
SamWilsn Feb 11, 2025
0d5af71
Remove unused file
SamWilsn Feb 13, 2025
0d3aaa8
Bump ethash to 1.1.0
SamWilsn Feb 13, 2025
5f2d661
fix: check y_parity value (#1107)
SamWilsn Feb 12, 2025
24de924
Refactor Environment (#1131)
gurukamath Mar 5, 2025
d55fca7
add state test flag
gurukamath Mar 10, 2025
efe7bfd
output traces to correct location
gurukamath Mar 10, 2025
8f8fb21
update ethereum tests to latest
gurukamath Mar 11, 2025
fd4f4bc
validate_transaction now raises InvalidTransaction exception (#1138)
Shashwat-Nautiyal Mar 12, 2025
8f89be5
default to empty accesslist when unavailable (#1151)
gurukamath Mar 13, 2025
b22a46a
Simplified validate_header func in post-merge forks (#1163)
Antrikshgwal Mar 27, 2025
586b03b
Update the type for `blob_gas_used` (#1161)
Shashwat-Nautiyal Apr 1, 2025
ce310e4
EELS Update: Update EIP-6110 (#1143)
gurukamath Apr 7, 2025
408a907
added address after checks (#1129)
Shashwat-Nautiyal Apr 7, 2025
114c063
Update codecov
Carsons-Eels Apr 8, 2025
5108203
delete only select files
gurukamath Apr 7, 2025
8707c28
Refactored AccessListTransaction by hoisting complex class member
Carsons-Eels Apr 8, 2025
d9a7ee2
Use py_ecc for alt_bn128 (#1187)
gurukamath Apr 14, 2025
4cf63ec
EOAs that delegate to a precompile (#1191)
gurukamath Apr 19, 2025
5f1a9cd
t8n: Return `InvalidBlock` exception in `result.blockException`
marioevz Apr 15, 2025
e3d0743
fix: Update result on error
marioevz Apr 15, 2025
9a6b298
Split run_blockchain_test in two
SamWilsn Apr 22, 2025
936ec94
Bump version
SamWilsn Apr 22, 2025
b8fd8aa
process deposit requests after txs
gurukamath Apr 17, 2025
f78853d
store receipt keys instead of receipts
gurukamath Apr 22, 2025
e8b8988
backport to older forks
gurukamath Apr 23, 2025
8e0ed34
Add test for changing evm_trace (#994)
SamWilsn Apr 22, 2025
b1edd6b
Fix changing evm_trace after import (closes #994)
SamWilsn Apr 22, 2025
001a057
Use type alias instead of raw type
DistributedDoge Mar 3, 2024
d54528e
More `bytes` -> `Bytes` changes
SamWilsn Apr 25, 2025
4c991a5
compute_header_hash() removed
Shashwat-Nautiyal Apr 23, 2025
5de14b5
remove empty account handling code (#1160)
gurukamath May 1, 2025
ab9058e
Disallow unused arguments (closes #962)
SamWilsn Jun 24, 2024
32b7326
fix docc
SamWilsn May 2, 2025
f524bae
Import Extended type directly instead of using rlp.Extended
ClementWalter Dec 6, 2024
7ee2734
feat: add initial EIP-7805 impl
jacobkaufmann May 5, 2025
4efe764
osaka initial commit
gurukamath Mar 25, 2025
e8155d2
Revert "feat: add initial EIP-7805 impl"
jacobkaufmann May 6, 2025
c1d9c2f
implement EIP-7805
jacobkaufmann May 6, 2025
92c7e87
Revert "implement EIP-7805"
jacobkaufmann May 14, 2025
4a78374
Revert "osaka initial commit"
jacobkaufmann May 14, 2025
f918332
osaka initial commit
gurukamath May 8, 2025
1d623fb
update specific osaka refs
gurukamath May 8, 2025
0550bf3
implement eip7805
jacobkaufmann May 29, 2025
ab0967b
Merge remote-tracking branch 'upstream/eips/osaka/eip-7805' into eips…
jacobkaufmann May 29, 2025
ecfb525
fix: remove leftover merge artifact
jacobkaufmann May 29, 2025
5e268b0
remove debug print statement from t8n
jacobkaufmann May 29, 2025
441801e
add fix from pr 1233
jacobkaufmann May 29, 2025
5be6965
fix: validate IL in blockchain test
jacobkaufmann May 30, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions src/ethereum/osaka/blocks.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,7 @@ class Block:
transactions: Tuple[Union[Bytes, LegacyTransaction], ...]
ommers: Tuple[Header, ...]
withdrawals: Tuple[Withdrawal, ...]
inclusion_list: Tuple[Union[Bytes, LegacyTransaction], ...]


@slotted_freezable
Expand Down
38 changes: 38 additions & 0 deletions src/ethereum/osaka/fork.py
Original file line number Diff line number Diff line change
Expand Up @@ -216,6 +216,7 @@ def state_transition(chain: BlockChain, block: Block) -> None:
block_env=block_env,
transactions=block.transactions,
withdrawals=block.withdrawals,
inclusion_list=block.inclusion_list,
)
block_state_root = state_root(block_env.state)
transactions_root = root(block_output.transactions_trie)
Expand Down Expand Up @@ -663,6 +664,7 @@ def apply_body(
block_env: vm.BlockEnvironment,
transactions: Tuple[Union[LegacyTransaction, Bytes], ...],
withdrawals: Tuple[Withdrawal, ...],
inclusion_list: Tuple[Union[LegacyTransaction, Bytes], ...],
) -> vm.BlockOutput:
"""
Executes a block.
Expand All @@ -682,6 +684,8 @@ def apply_body(
Transactions included in the block.
withdrawals :
Withdrawals to be processed in the current block.
inclusion_list :
Transactions that must be included in the block if possible.

Returns
-------
Expand All @@ -705,6 +709,13 @@ def apply_body(
for i, tx in enumerate(map(decode_transaction, transactions)):
process_transaction(block_env, block_output, tx, Uint(i))

validate_inclusion_list(
Copy link

@jihoonsong jihoonsong May 30, 2025

Choose a reason for hiding this comment

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

I want to share an idea about an edge case testing. It would be nice if we could test such situations that some withdrawal address become available to cover some IL transaction that they couldn't after process_withdrawals. That missing IL transaction should not reorg the block.

block_env,
block_output,
transactions,
inclusion_list,
)

process_withdrawals(block_env, block_output, withdrawals)

process_general_purpose_requests(
Expand Down Expand Up @@ -952,6 +963,33 @@ def increase_recipient_balance(recipient: Account) -> None:
destroy_account(block_env.state, wd.address)


def validate_inclusion_list(
block_env: vm.BlockEnvironment,
block_output: vm.BlockOutput,
transactions: Tuple[Union[Bytes, LegacyTransaction], ...],
inclusion_list: Tuple[Union[Bytes, LegacyTransaction], ...],
) -> None:
"""
Validate the block satisfies the inclusion list.
"""

index = Uint(len(transactions))
for tx in inclusion_list:
# If the transaction is already present in the block, then skip.
if tx in transactions:
continue

try:
tx = decode_transaction(tx)
process_transaction(block_env, block_output, tx, index)

Choose a reason for hiding this comment

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

We don't execute IL transactions. We just need to check its nonce and balance, and see if there is sufficient gas left to include any missing IL transactions.

Current version of EIP is misleading and we have a pending PR that fixes it: https://github.com/ethereum/EIPs/pull/9381/files

Copy link
Author

Choose a reason for hiding this comment

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

ah I see. I forgot about this PR, and so I was just going off what I saw in the EIP.

Copy link
Contributor

@gurukamath gurukamath May 22, 2025

Choose a reason for hiding this comment

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

In addition to checking for nonce and balance, would we need to perform some basic checks to make sure that the transaction is well formed? Including perhaps the checks that are performed in the validate_transaction and check_transaction functions?

Choose a reason for hiding this comment

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

The EL builds an IL with transactions from the mempool and each transaction is validated when added to the mempool. That being said, it makes sense to specify that IL transactions are intrinsically valid.

except Exception as e:
continue

# If the transaction was not in the block and was decoded and
# executed successfully, then mark the block invalid.
raise InvalidBlock("unsatisfied inclusion list")


def compute_header_hash(header: Header) -> Hash32:
"""
Computes the hash of a block header.
Expand Down
5 changes: 5 additions & 0 deletions src/ethereum_spec_tools/evm_tools/loaders/fork_loader.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,11 @@ def process_transaction(self) -> Any:
"""process_transaction function of the fork"""
return self._module("fork").process_transaction

@property
def validate_inclusion_list(self) -> Any:
"""validate_inclusion_list function of the fork"""
return self._module("fork").validate_inclusion_list

@property
def MAX_BLOB_GAS_PER_BLOCK(self) -> Any:
"""MAX_BLOB_GAS_PER_BLOCK parameter of the fork"""
Expand Down
8 changes: 8 additions & 0 deletions src/ethereum_spec_tools/evm_tools/t8n/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,14 @@ def _run_blockchain_test(self, block_env: Any, block_output: Any) -> None:
self.env.ommers,
)

if self.fork.is_after_fork("ethereum.osaka"):
self.fork.validate_inclusion_list(
block_env,
block_output,
self.txs.transactions,
self.env.inclusion_list,
)

if self.fork.is_after_fork("ethereum.shanghai"):
self.fork.process_withdrawals(
block_env, block_output, self.env.withdrawals
Expand Down
16 changes: 16 additions & 0 deletions src/ethereum_spec_tools/evm_tools/t8n/env.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,15 @@ class Env:
parent_blob_gas_used: Optional[U64]
excess_blob_gas: Optional[U64]
requests: Any
inclusion_list: Any

def __init__(self, t8n: "T8N", stdin: Optional[Dict] = None):
inclusion_list = None

if t8n.options.input_env == "stdin":
assert stdin is not None
data = stdin["env"]
inclusion_list = stdin["inclusionList"]
else:
with open(t8n.options.input_env, "r") as f:
data = json.load(f)
Expand All @@ -75,6 +79,8 @@ def __init__(self, t8n: "T8N", stdin: Optional[Dict] = None):
self.read_ommers(data, t8n)
self.read_withdrawals(data, t8n)

self.read_inclusion_list(inclusion_list, t8n)

self.parent_beacon_block_root = None
if t8n.fork.is_after_fork("ethereum.cancun"):
if not t8n.options.state_test:
Expand Down Expand Up @@ -191,6 +197,16 @@ def read_withdrawals(self, data: Any, t8n: "T8N") -> None:
t8n.json_to_withdrawals(wd) for wd in data["withdrawals"]
)

def read_inclusion_list(self, inclusion_list: Any, t8n: "T8N") -> None:
"""
Read the inclusion list from the data.
"""
self.inclusion_list = None
if t8n.fork.is_after_fork("ethereum.osaka"):
self.inclusion_list = tuple(
hex_to_bytes(tx) for tx in inclusion_list
)

def read_block_difficulty(self, data: Any, t8n: "T8N") -> None:
"""
Read the block difficulty from the data.
Expand Down
10 changes: 1 addition & 9 deletions src/ethereum_spec_tools/evm_tools/t8n/t8n_types.py
Original file line number Diff line number Diff line change
Expand Up @@ -339,18 +339,10 @@ def json_encode_receipts(self) -> Any:

receipt_dict["gasUsed"] = hex(receipt.cumulative_gas_used)
receipt_dict["bloom"] = "0x" + receipt.bloom.hex()
receipt_dict["logs"] = [
{
"address": "0x" + log.address.hex(),
"topics": ["0x" + topic.hex() for topic in log.topics],
"data": "0x" + log.data.hex(),
}
for log in receipt.logs
]

receipts_json.append(receipt_dict)

return receipt_dict
return receipts_json

def to_json(self) -> Any:
"""Encode the result to JSON"""
Expand Down
Loading