-
Notifications
You must be signed in to change notification settings - Fork 380
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
engine: unified list of opaque requests #577
Conversation
ideally the outputs of the "system" contracts would be little-endian so that the outputs are indeed SSZ (I would guess they are big-endian at the moment), but otherwise I think this is a nice simplification! |
The simplification makes sense to me! We can update 7002 contract with the logic converting the It might also make sense to represent type in little endian as then it will be compatible with SSZ Union definition |
Co-authored-by: Mikhail Kalinin <[email protected]>
The type is just one byte, so there is no endianness to consider AFAIK. |
Contract update here: lightclient/sys-asm#20 |
Co-authored-by: Mikhail Kalinin <[email protected]>
Whatever encoding one uses, they still come out of three different system request contracts. It's unclear to me why they should end up in a single list at any point, aside from the encodings used (JSON, RLP, SSZ, or anything else). That is,
doesn't seem related to the stated goals of:
For CLs, sure, of course they're not going to use these interchangeably, but that was already obvious/stipulated. The ELs don't really either, in any intrinsic way. They have to gather them from various logs. Why combine them just for the CLs to immediately to have to disentangle this and create separate lists again? https://eips.ethereum.org/EIPS/eip-7685#ordering even already requires:
So the EL already has to either get them in this more or less sorted order or sort them. Meanwhile, this PR doesn't actually convey this requirement, so the CL has to sort them again, just in case the EL does something pathologically strange with the ordering it provides. |
The main reason for the ELs to group all requests into a single list is to avoid modifying the block body all the time. It is very annoying for us to add stuff in blocks, and I think it's not strictly necessary. From the perspective of the EL, all requests are similar because they are just 'stuff for the CL to process'. So we want them in a single list of opaque objects that we do not have to otherwise care about. It really does simplify it for the EL. I understand you may feel different about it on the CL side, since the requests have a meaning there, and you want to put them into their own dedicated lists in the end. |
@tersec imho the point this change makes is the fact that a "Request" is ultimately a domain entity that the CL cares about. And its existence in the execution block is a mere limitation of our existing design. If we had an easy way to send requests to CL w/o using the execution block as "transport", it would be even better (it was considered but ended up being harder than we were willing to deal with). As mentioned before, deposits are a bit special, but for other requests like consolidations or withdrawals, the EL barely has to do anything to them. They are already pulled from the contracts in the right format and order. So just putting them into the block w/o worrying about their meaning makes sense to simplify the EL logic. Even more so as more and more requests are added in the future. It means less changes in the execution block and the engine API spec as well. So the gist of this from my point of view is:
|
I am not sure if I understand this point. Why would the CL need to reorder the list? The order is defined by the underlying request "origin", I.e. the contract where requests are being pulled from. In my understanding the CL has to do is to process the requests preserving the order within their type. |
Nothing in this PR, in engine API terms, enforced from https://eips.ethereum.org/EIPS/eip-7685#ordering
It only requires that https://eips.ethereum.org/EIPS/eip-7685#request
It does reference EIP-7685 but specifically to pull in this, not in more general terms. Therefore, as stated, it's unclear from the text of the proposed engine API changes that they can correctly assume that an EL has not randomly sorted or shuffled the requests in, yes, some pathological way. |
Yes, "requests" are CL domain entities. However, even if the format from each deposit contract is more or less the same (helped by aligning one of the remaining contracts with SSZ), and the EL is merely conveying the system contract logs with as little further processing as it can imagine, it starts with
One issue here transcends per se parsing or reconstruction issues, but rather having the list of
fed back to the CL via the engine API has false flexibility and opens various edge cases which nothing in the EIP or this PR defines. For example, what if:
A root cause of both of these is the proposed engine API representation is overly flexible. One alternative which retains the properties described as useful for the EL is
Where
|
I have added some more text @tersec PTAL. |
This resolves those particular, specific concerns, yes. |
close as we went with #591 instead |
This is a simplification/alternative to #565.
The purpose of EIP-7685 is creating a generic mechanism for relaying requests from EL to CL.
However, as it is defined, the EL has to have knowledge of the internal encoding of request types.
The current spec also requires us to implement four different encoding formats for each request object
across the stack. Here is an illustration for EIP-7251 consolidation requests:
We parse the raw return value encoding from the contract into a list. In the EL block, we store in them in an intermediate RLP-based format that isn't used anywhere else. For the engine API, we return the requests as a JSON object containing type-specific fields. Within the CL, requests are encoded into SSZ as part of the beacon block.
An important observation is that the EIP-7002 and EIP-7251 contracts already return a valid SSZ representation of their respective request objects. If we could just treat these objects as an opaque bytes container in the EL, our lives would be much simplified. The deposit contract is an outlier here because it returns ABI encoded events, but we can deal with that transformation in the EL as a legacy one-off.
So my proposal is returning the requests as opaque hex bytes, similar to transactions. On the CL side, the request types can be distinguished by the first byte in each encoded object. The remaining bytes are a valid SSZ payload for the request as defined by the CL spec. Less type definitions and format conversions for everyone.