Skip to content

Bring more clarity to notify_forkchoice_updated calls#2745

Merged
djrtwo merged 4 commits intoethereum:devfrom
mkalinin:clarify-forkchoice-updated
Nov 26, 2021
Merged

Bring more clarity to notify_forkchoice_updated calls#2745
djrtwo merged 4 commits intoethereum:devfrom
mkalinin:clarify-forkchoice-updated

Conversation

@mkalinin
Copy link
Contributor

This PR clarifies two things:

  • notify_forkchoice_updated must not be called if a block with empty payload becomes the head of the chain
  • notify_forkchoice_updated must be called with head_block_hash = terminal_pow_block.block_hash if it attempts to initiate build process of the payload for the merge transition block; this case is also specified in the validator.md in a form of python code hence isn't that obvious

@mkalinin mkalinin requested a review from djrtwo November 24, 2021 14:36
*Note*: The call of the `notify_forkchoice_updated` function maps on the `POS_FORKCHOICE_UPDATED` event defined in the [EIP-3675](https://eips.ethereum.org/EIPS/eip-3675#definitions).
As per EIP-3675, before a post-transition block is finalized, `notify_forkchoice_updated` must be called with `finalized_block_hash = Hash32()`.

*Note*: Client software must not call this function as long as the paylod of the head of the chain is empty, i.e. `get_head(store).body.payload == ExecutionPayload()`.
Copy link
Contributor

Choose a reason for hiding this comment

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

This statement is too strong. The validator that builds the merge transition block will call notify_forkchoice_updated when their store has an empty payload to kick off the build process

Copy link
Contributor

Choose a reason for hiding this comment

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

Instead, it might be. "must not call this function as long as the transition conditions are not met on the PoW chain. i.e. there exists a block for which is_valid_terminal_pow_block returns true"

Copy link
Contributor

Choose a reason for hiding this comment

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

btw maybe use capital "MUST NOT".

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Should be fixed now.

Copy link
Contributor

@djrtwo djrtwo left a comment

Choose a reason for hiding this comment

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

looks good! just a minor typo that i'll patch

@djrtwo djrtwo merged commit e1356ae into ethereum:dev Nov 26, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants