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

Do not call repeated times FCU #12091

Merged
merged 5 commits into from
Mar 8, 2023
Merged

Do not call repeated times FCU #12091

merged 5 commits into from
Mar 8, 2023

Conversation

potuz
Copy link
Contributor

@potuz potuz commented Mar 7, 2023

This PR, with deceptively low line count, addresses a few issues

  • It avoids repeated unnecessary calls to FCU
  • It addresses all edge cases when reorging late blocks
  • It fixes a deadlock and some race cases for not locked head accesses.

It is important to notice that this PR effectively changes the way we deal with the engine API under some circumstances. For example, when inserting an early non-canonical block, we will not send an FCU even if proposing next slot, this is deferred until 4 seconds into the slot.

There are two main issues that are left unattended

  1. Block processing and on_tick will race to process attestations and update head. On the one hand a second call to process attestation is almost a noop. The second call to updateHead is a noop.
  2. In all cases where there is a reorg because of attestations at 12 seconds, and we are proposing during the next slot, we send a call to FCU with the wrong proposing slot (we send the next slot instead of the current slot). This can be addressed in a separate PR if deemed important.

Accompanying doc with all edge cases analysis https://www.notion.so/arbitrum/Late-Block-Reorgs-c35737afbf4b4631b98b666872dd565c

@potuz potuz added Bug Something isn't working Ready For Review A pull request ready for code review labels Mar 7, 2023
@potuz potuz requested a review from a team as a code owner March 7, 2023 15:31
}

return nil
// Only need to prune attestations from pool if the head has changed.
return s.pruneAttsFromPool(headBlock)
Copy link
Contributor

Choose a reason for hiding this comment

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

would it be possible to refactor and return the headblock,isNewHead,isNewProposer instead? this way we can also use it for the postBlockOperations?

Copy link
Member

Choose a reason for hiding this comment

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

I dont think we should alter the signature. Some options are:

  1. call postBlockOperations here
  2. call postBlockOperations downstream but return nil on non-canonical block

Comment on lines 63 to 65
if !isNewHead {
return nil
}
Copy link
Member

Choose a reason for hiding this comment

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

This is the most significant change in this PR

terencechain
terencechain previously approved these changes Mar 7, 2023
@potuz potuz merged commit eb0b5a6 into develop Mar 8, 2023
@potuz potuz deleted the dont-repeat-fcu branch August 16, 2023 11:01
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Something isn't working Ready For Review A pull request ready for code review
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants