Skip to content
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-7547 #1

Open
wants to merge 17 commits into
base: master
Choose a base branch
from
Open

eip-7547 #1

wants to merge 17 commits into from

Conversation

michaelneuder
Copy link
Owner

@michaelneuder michaelneuder commented Jan 30, 2024

Overview: Update state_transition and apply_body to make IL checks part of block validation.

Note some pulled from ethereum/execution-specs@master...fradamt:execution-specs:eip-7547.

Itemized:

  • fork_types.py
    • Create InclusionListSummaryEntry and InclusionListSummary
    • Add inclusion list fields to both the Header (ExecutionPayloadHeader in the CL spec) and Block (ExecutionPayload in the CL spec) types.
  • Update state_transition to pass the IL summary to apply_body.
  • Update apply_body (called from state_transition) to calculate the added gas from the inclusion list and assert that the inclusion list entries are satisfied.

Comment on lines +221 to +230
nonce: U64

@dataclass
class InclusionListSummary:
"""
Full inclusion list summary.
"""
slot: U64
proposer_index: U64
parent_hash: Hash32

Choose a reason for hiding this comment

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

Do we need to have nonce or only address list should suffice as inclusion entries?
I don't see any use on EL side for slot, proposer_index nor parent_hash, why are they supplied?

Copy link
Owner Author

Choose a reason for hiding this comment

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

nonce is used to avoid having to fetch which entries were satisfied by the parent block. danny prefers to not have cross block dependencies (e.g., need to fetch n-1 block to validate block n).

the slot and proposer will be checked by the CL but to make the type the same i just pass them in. for parent_hash, we need to make sure the parent hash matches. let me try to add that somewhere

Copy link
Owner Author

Choose a reason for hiding this comment

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

Choose a reason for hiding this comment

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

I probably don't understand something, but this seems overly complicated to me.
Currently IL requires:

  • That a block is built on specified parent block
  • That a block has transactions for address X up to at leas nonce N.

Why can't it be simplified to only be:

  • Block has transactions for address X?

Copy link

@LukaszRozmej LukaszRozmej left a comment

Choose a reason for hiding this comment

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

This shouldn't be under shanghai, we should add NewPayloadV4 spec especially if inclusion lists are mandatory.

@michaelneuder
Copy link
Owner Author

as for shanghai, since this is just the PoC spec, it felt ok to directly modify. can migrate once it stabilizes on the CL end more if that's ok? that is where most of the complexity is IMO. see ethereum/consensus-specs#3617

Copy link

@jochem-brouwer jochem-brouwer left a comment

Choose a reason for hiding this comment

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

Some early comments

@@ -66,6 +67,7 @@
ELASTICITY_MULTIPLIER = 2
GAS_LIMIT_ADJUSTMENT_FACTOR = 1024
GAS_LIMIT_MINIMUM = 5000
INCLUSION_LIST_GAS = 4194304 # 2^22 gas for the IL (to start)

Choose a reason for hiding this comment

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

I don't think we should make this a constant, this should be dynamic.

Copy link
Owner Author

Choose a reason for hiding this comment

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

this is the maximum. there needs to be a max!

# If any inclusion list addresses are not satisfied, the block is invalid.
for addr in inclusion_list_nonces:
sender_account = get_account(env.state, addr)
if inclusion_list_nonces[addr] < sender_account.nonce:

Choose a reason for hiding this comment

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

It seems to me that two txs from the same sender in an IL is invalid, is this correct?

Copy link
Owner Author

Choose a reason for hiding this comment

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

should be fine! b/c the IL commits to the nonce and the address, so they can both be included. we just check that the nonce of the account is higher than what was specified in the IL

@@ -411,7 +413,8 @@ def apply_body(
transactions: Tuple[Union[LegacyTransaction, Bytes], ...],
chain_id: U64,
withdrawals: Tuple[Withdrawal, ...],
) -> Tuple[Uint, Root, Root, Bloom, State, Root]:
inclusion_list_summary: InclusionListSummary,
) -> Tuple[Uint, Root, Root, Bloom, State, Root, Root, Root]:
Copy link

Choose a reason for hiding this comment

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

I see two extra Root fields appended to the retval here, but no update to the Returns section of the comment below, nor to the return at the end of the function.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
7 participants