Replies: 3 comments 1 reply
-
Note on deriving the header for a new blockOnly 1 field in the In particular, as we see in Reth's implementation this calculation also uses the intermediate merkle branches to recompute the state root. We need some way of accessing this! |
Beta Was this translation helpful? Give feedback.
-
On calculating the new state rootAs noted by @merklefruit in order to produce a valid We're currently exploring an alternative approach leveraging partial Merkle Patricia Tries as done in this PoC https://github.com/zemse/partial-mpt. It consists in the following steps:
On the implementation side, the following changes will made to the sidecar components:
|
Beta Was this translation helpful? Give feedback.
-
Thanks a lot @zemse for the feedback here and the support you provided in our Telegram chat. We really appreciated it. For reference, I’ll report a more concrete example of this interesting edge case we didn’t know about, along with new possible workarounds. Edge case exampleConsider the following state trie: Assume this is a storage trie of a certain account, since account nodes can't be deleted anymore after the Dencun hard-fork due to the change of the Suppose we made just one pre-confirmation for this block that only resets the storage slot with key The node associated with such storage slot will be deleted to save on space along with its parent branch node (since it has just one children) and the extension node (with shared nibbles Proposed solutionsIn the context of our simulation unfortunately it is not feasible to use brute-force on Keccak due to latency reasons. At the same time forks of EL clients will slow the development significantly, unless they’re really minor changes.
|
Beta Was this translation helpful? Give feedback.
-
Context
Simulation
Some simulation & validation is required to consider a preconfirmation. At minimum, they need to be valid according to the protocol rules:
This is simple enough for a standalone transaction: we just request all necessary values from the execution client over JSON-RPC and match those against the received transaction.
Once we commit to a transaction, we need to keep track of any relevant variable state: the nonce and the balance. This is because essentially we've already executed the transaction, and any subsequent transactions need to be valid given the modified nonce and balance. This means that the sidecar should build some sort of proto-block template that keeps track of nonce and balance per account, and should check each new transaction against the post-state of that proto-block.
Local building
For non-PBS proposers or in the case mev-boost fails, we need a way to fall back to a locally built block that adheres to any commitments given.
We can point our beacon node builder API to the sidecar instead of mev-boost, and the sidecar will act like a proxy for mev-boost (if configured) and a local block builder. Non-mev-boost users can configure the sidecar to not proxy requests to mev-boost.
Minimum viable block (easy)
Since the sidecar always keeps a (valid) block template, we can just use that when a payload is requested in a local block building situation. If there were no commitments made, we just don't return a block which will force the beacon node to get one from the execution client over the engine API.1
What's important here is that we respond in time with a payload so that the beacon node won't fall back to the execution client, which would break commitments. This delay is defined in the specs as
BUILDER_PROPOSAL_DELAY_TOLERANCE=1s
.2Better block (hard)
Another potential option would be to have our sidecar communicate with the execution client through the
engine
API to request a block (this already is hard because it requires access to thepayloadId
which is something that only the beacon node has AFAIK).3Once we have that block, we can modify it to include our commitments with some naive algorithm that takes into consideration the block value and block validity. We then derive the header once more and send it to the beacon node, who will take care of the rest.
The second option would obviously be much better for local builders but is much more complex.
Footnotes
https://github.com/ethereum/builder-specs/blob/main/specs/bellatrix/validator.md#relation-to-local-block-building ↩
https://github.com/ethereum/builder-specs/blob/982af908707113de373e62babee113782e6bb6cd/specs/bellatrix/validator.md#constants ↩
https://github.com/ethereum/execution-apis/blob/main/src/engine/cancun.md#request-2 ↩
Beta Was this translation helpful? Give feedback.
All reactions