Skip to content

eip7685: Pass execution_requests_hash to is_valid_block_hash#3950

Closed
mkalinin wants to merge 10 commits into
ethereum:devfrom
mkalinin:el-requests
Closed

eip7685: Pass execution_requests_hash to is_valid_block_hash#3950
mkalinin wants to merge 10 commits into
ethereum:devfrom
mkalinin:el-requests

Conversation

@mkalinin

@mkalinin mkalinin commented Sep 30, 2024

Copy link
Copy Markdown
Contributor

Replaces execution_requests with the execution_requests_hash in the call to is_valid_block_hash. The hash is computed as it is defined by EIP-7685.

This changes is the part of EL triggered requests redesign, the corresponding Engine API change is in ethereum/execution-apis#591

Comment thread specs/electra/beacon-chain.md
Comment thread specs/electra/beacon-chain.md Outdated

@ralexstokes ralexstokes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I'm wondering what value this brings the CL?

instead we could simply not apply this PR and leave the CL as-is

the CL then sends over the full ExecutionRequests over the Engine API and the EL can do whatever it wants from there, i.e. check conformance with the execution_requests_hash -- which it will have to do anyway AFAICT.

it seems like this PR is just an optimization to save some bytes across the Engine API and I'd rather prioritize keeping the spec code simple

Comment thread specs/electra/beacon-chain.md Outdated
Co-authored-by: Alex Stokes <r.alex.stokes@gmail.com>
@mkalinin

mkalinin commented Oct 1, 2024

Copy link
Copy Markdown
Contributor Author

the CL then sends over the full ExecutionRequests over the Engine API and the EL can do whatever it wants from there, i.e. check conformance with the execution_requests_hash -- which it will have to do anyway AFAICT.

According to the new design EL’s responsibility is get requests byte sequences from system smart contracts, order them by the first byte ascending and then concatenated in order to compute requestsHash. So, the CL needs to at least encode requests and then send them encoded to the EL, i.e. send [deposit_bytes, withdrawal_bytes, consolidation_bytes] — from that concatenating and computing the hash is an optimisation which is quite straightforward to do. Then EL would just need to incorporate the hash into the blockHash validation process.

@mkalinin

mkalinin commented Oct 1, 2024

Copy link
Copy Markdown
Contributor Author

Updated the PR to modify is_valid_block_hash and revert changes made to notify_new_payload

@haxxpop

haxxpop commented Oct 2, 2024

Copy link
Copy Markdown
Member

I quite agree with @ralexstokes that the benefit is very minimal.

Comment thread specs/electra/beacon-chain.md Outdated
execution_payload,
parent_beacon_block_root,
execution_requests_hash):
execution_requests_list):

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I would still prefer to pass execution_requests here, and if anything handle the serialization step in the engine API, rather than the consensus specs

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

It’s not about serialization, the exact encoding is currently a part of the protocol and would have to be done even if there was other communication channel than engine API. Serialization of this array to JSON is happening in the engine API client

@lucassaldanha lucassaldanha left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

LGTM

@mkalinin mkalinin changed the title eip7685: Pass execution_requests_hash to notify_new_payload eip7685: Pass execution_requests to notify_new_payload Oct 4, 2024

@g11tech g11tech left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

lgtm

@potuz

potuz commented Oct 7, 2024

Copy link
Copy Markdown
Contributor

Please change the description of the PR as it's not passing the hash (which is what we should do given that the theoretical limit, disregarding block gas limit, is over 1.5 MB of data)

@jtraglia jtraglia changed the title eip7685: Pass execution_requests to notify_new_payload eip7685: Pass execution_requests_hash to notify_new_payload Oct 7, 2024
@jtraglia

jtraglia commented Oct 7, 2024

Copy link
Copy Markdown
Member

@mkalinin I've reverted the commit which changed this to a list of bytes. During the testing call, we decided to pass the hash. This is originally how you had it.

Comment thread specs/electra/beacon-chain.md Outdated

@ralexstokes ralexstokes left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I still stand by what I said above that I think this unnecessarily complicates the CL side of things for not much gain

That being said, assuming we fix the hash computation to reflect the latest EIP specification then I'm fine merging to unblock devnet-4

Comment thread specs/electra/beacon-chain.md Outdated
@jtraglia jtraglia changed the title eip7685: Pass execution_requests_hash to notify_new_payload eip7685: Pass execution_requests_hash to is_valid_block_hash Oct 8, 2024
@jtraglia jtraglia mentioned this pull request Oct 8, 2024
5 tasks
The computation algorithm is defined by [EIP-7685](https://eips.ethereum.org/EIPS/eip-7685).

```python
def compute_execution_requests_hash(execution_requests: ExecutionRequests) -> Hash32:

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Alternatively we can do:

def compute_execution_requests_hash(execution_requests: ExecutionRequests) -> Hash32:
    request_list = [execution_requests.deposits, execution_requests.withdrawals, execution_requests.consolidations]
    hash_list = []
    for index, requests in enumerate(requests_list):
        request_type = uint_to_bytes(uint8(index))
        hash_list.append(hash(request_type + serialize(requests)))

    return hash(b''.join(hash_list))

This allows to get rid of explicit type bytes in the spec and easy to extend in the future by adding requests to the flat list used for commitment computation

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I thought we wanted to get rid of these custom one-off hashing schemes that are just a mess to maintain over time?

@jtraglia

jtraglia commented Oct 8, 2024

Copy link
Copy Markdown
Member

Closing. We have reached a consensus to send the full requests.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

9 participants