fix: compute Gloas envelope stateRoot from postState#9256
fix: compute Gloas envelope stateRoot from postState#9256lodekeeper wants to merge 2 commits intoChainSafe:unstablefrom
Conversation
|
Duplicate of #9255 — same false-premise PR re-opened by an autonomous heartbeat. |
There was a problem hiding this comment.
Code Review
This pull request implements the computation and caching of the envelopeStateRoot for self-built blocks during the Gloas fork. It updates the block production logic to calculate the state root by processing the execution payload envelope against the post-state and ensures this value is correctly served through the validator API. Feedback highlights a critical runtime error where processExecutionPayloadEnvelope is incorrectly called as a method on the state object rather than as a standalone function, necessitating the addition of missing imports and a correction of the function call syntax.
| const postEnvelopeState = postState.processExecutionPayloadEnvelope(signedEnvelope, { | ||
| verifySignature: false, | ||
| verifyStateRoot: false, | ||
| dontTransferCache: true, | ||
| }); |
There was a problem hiding this comment.
The processExecutionPayloadEnvelope function is defined as a standalone function in @lodestar/state-transition, but it is being called here as a method on postState. This will result in a runtime error as IBeaconStateView does not have this method. Additionally, the function is not imported in this file.
You should import processExecutionPayloadEnvelope and CachedBeaconStateGloas from @lodestar/state-transition and call the function directly, casting postState to the appropriate type.
| const postEnvelopeState = postState.processExecutionPayloadEnvelope(signedEnvelope, { | |
| verifySignature: false, | |
| verifyStateRoot: false, | |
| dontTransferCache: true, | |
| }); | |
| const postEnvelopeState = processExecutionPayloadEnvelope(postState as CachedBeaconStateGloas, signedEnvelope, { | |
| verifySignature: false, | |
| verifyStateRoot: false, | |
| dontTransferCache: true, | |
| }); |
| BUILDER_INDEX_SELF_BUILD, | ||
| EFFECTIVE_BALANCE_INCREMENT, | ||
| type ForkPostFulu, | ||
| type ForkPostGloas, |
There was a problem hiding this comment.
See local draft.