Skip to content
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

Reject create block and attestation requests when chain head is optimistic #4706

Merged
merged 4 commits into from
Nov 26, 2021

Conversation

ajsutton
Copy link
Contributor

PR Description

It is not safe for validators to produce blocks on top of or attest to blocks that have only been optimistically synced. So if the referenced block is not fully validated, return a node syncing response rather than creating the block/attestation. Node syncing is used because the execution engine is still syncing and unable to verify the payload.

Since blocks and attestations use the chain head which is normally not optimistic block production and attestation creation can continue while there are some optimistically sync'd blocks, as long as we still have a fully validated block close enough to use as our chain head and build on. If we've optimistically finalized, we will cease block and attestation production.

We don't prevent creating aggregates because the validator client will only create aggregates for attestations they produced, so if they managed to produce the attestation it must have been validated (though potentially by a different beacon node).

Fixed Issue(s)

#4650 - need to handle sync committee messages separately as they don't have a create call.

Documentation

  • I thought about documentation and added the documentation label to this PR if updates are required.

Changelog

  • I thought about adding a changelog entry, and added one if I deemed necessary.

…istic

It is not safe for validators to produce blocks on top of or attest to blocks that have only been optimistically synced. So if the referenced block is not fully validated, return a node syncing response rather than creating the block/attestation. Node syncing is used because the execution engine is still syncing and unable to verify the payload.

Since blocks and attestations use the chain head which is normally not optimistic block production and attestation creation can continue while there are some optimistically sync'd blocks, as long as we still have a fully validated block close enough to use as our chain head and build on. If we've optimistically finalized, we will cease block and attestation production.
…ad block and has fun corner cases around genesis
Comment on lines +297 to +299
LOG.warn(
"Unable to produce block at slot {} because parent has optimistically validated payload",
slot);
Copy link
Contributor

Choose a reason for hiding this comment

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

are we expecting this to be rare? will warning be annoying?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes that should be rare and I think it's worth knowing if it happens.

@@ -427,6 +436,7 @@ public void onExecutionPayloadResult(
protoArray.markNodeValid(blockRoot);
break;
case INVALID:
LOG.warn("Payload for block root {} was invalid", blockRoot);
Copy link
Contributor

Choose a reason for hiding this comment

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

mean to leave this in? invalid isn't super uncommon i thought...

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Invalid signatures and stuff like that aren't uncommon, but invalid payload are. Geth prints a very big, scary multiline warning if it gets a block that is invalid when executed (as opposed to invalid PoW). I'm a little unsure but I think its worth leaving this in at least until we get some experience on merge testnets to see how annoying it is as I expect it will be very useful during interop testing.

Copy link
Contributor

@rolfyone rolfyone left a comment

Choose a reason for hiding this comment

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

LGTM, a couple of questions re. logs.

@ajsutton
Copy link
Contributor Author

Excellent questions to ask btw.

@ajsutton ajsutton merged commit a9a99a0 into Consensys:master Nov 26, 2021
@ajsutton ajsutton deleted the reject-optimistic-duties branch November 26, 2021 21:22
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.

2 participants