-
Notifications
You must be signed in to change notification settings - Fork 325
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
base: eips/osaka/eip-7805
Are you sure you want to change the base?
Changes from all commits
3c0f4b0
9ca93fd
4916e4a
ab1bf03
647fcc6
5f188de
78828a7
14ed750
d9f70f9
66a935b
90b1834
6d42547
ed4d89d
3f6a717
3d6fa3c
98c9a47
7fe0097
57b8ad3
5c74ce0
39125dc
6911362
6a2d809
eb8c3a7
0d5af71
0d3aaa8
5f2d661
24de924
d55fca7
efe7bfd
8f8fb21
fd4f4bc
8f89be5
b22a46a
586b03b
ce310e4
408a907
114c063
5108203
8707c28
d9a7ee2
4cf63ec
5f1a9cd
e3d0743
9a6b298
936ec94
b8fd8aa
f78853d
e8b8988
8e0ed34
b1edd6b
001a057
d54528e
4c991a5
5de14b5
ab9058e
32b7326
f524bae
7ee2734
4efe764
e8155d2
c1d9c2f
92c7e87
4a78374
f918332
1d623fb
0550bf3
ab0967b
ecfb525
5e268b0
441801e
5be6965
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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) | ||
|
@@ -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. | ||
|
@@ -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 | ||
------- | ||
|
@@ -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( | ||
block_env, | ||
block_output, | ||
transactions, | ||
inclusion_list, | ||
) | ||
|
||
process_withdrawals(block_env, block_output, withdrawals) | ||
|
||
process_general_purpose_requests( | ||
|
@@ -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) | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe 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 There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. There was a problem hiding this comment. Choose a reason for hiding this commentThe 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? There was a problem hiding this comment. Choose a reason for hiding this commentThe 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. | ||
|
Uh oh!
There was an error while loading. Please reload this page.
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.
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.