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

block on forkchoiceUpdated EL calls due to doing fewer of them #4609

Merged
merged 1 commit into from Feb 13, 2023

Conversation

tersec
Copy link
Contributor

@tersec tersec commented Feb 10, 2023

In a steady-state synced situation, the CL needs to wait anyway for the EL to finish, so it was not truly asynchronous except during syncing.

@github-actions
Copy link

Unit Test Results

         9 files  ±0    1 062 suites  ±0   30m 3s ⏱️ -58s
  3 552 tests ±0    3 315 ✔️ ±0  237 💤 ±0  0 ±0 
15 401 runs  ±0  15 136 ✔️ ±0  265 💤 ±0  0 ±0 

Results for commit 12d8f11. ± Comparison against base commit 09dd64d.

@@ -543,7 +549,7 @@ proc storeBlock*(
# - "Beacon chain gapped" from DAG head to optimistic head,
# - followed by "Beacon chain reorged" from optimistic head back to DAG.
self.consensusManager[].updateHead(newHead.get.blck)
asyncSpawn eth1Monitor.runForkchoiceUpdatedDiscardResult(
await eth1Monitor.runForkchoiceUpdatedDiscardResult(
Copy link
Member

Choose a reason for hiding this comment

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

refactor to put the discard here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

runForkchoiceUpdatedDiscardResult is one such example of a now-too-fine delineation, yes which was there only to support some cases being asyncSpawn, indeed, for example.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -572,10 +578,10 @@ proc storeBlock*(
# Some attached validator is next proposer, so prepare payload. As
# updateHead() updated the DAG head, runProposalForkchoiceUpdated,
# which needs the state corresponding to that head block, can run.
asyncSpawn self.consensusManager.runProposalForkchoiceUpdated(
await self.consensusManager.runProposalForkchoiceUpdated(
Copy link
Member

Choose a reason for hiding this comment

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

it's kind of weird that we sometimes run fcu through consensusmanager and sometimes through eth1monitor - can't we collect all FCU calls in consensus manager? also, can't we move the proposer-or-not logic there?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

#4465 already does this in elManager.forkchoiceUpdated

Copy link
Member

@arnetheduck arnetheduck left a comment

Choose a reason for hiding this comment

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

soo... this PR looks like it might solve the immediate problem of concurrent / stale head updates, but it also feels like the code could be simplified further with a round of refactoring (which we can leave for another PR) - ie it's starting to get quite hairy, to understand what sets which head where and why

@arnetheduck
Copy link
Member

merging for now since sync is completely broken by the concurrent head updates when spawned tasks get reordered

@arnetheduck arnetheduck merged commit aee19fe into unstable Feb 13, 2023
@arnetheduck arnetheduck deleted the PHn branch February 13, 2023 11:13
@tersec
Copy link
Contributor Author

tersec commented Feb 13, 2023

soo... this PR looks like it might solve the immediate problem of concurrent / stale head updates, but it also feels like the code could be simplified further with a round of refactoring (which we can leave for another PR) - ie it's starting to get quite hairy, to understand what sets which head where and why

There is potentially other cleanup from cases to consolidate -- previously, one distinction was exactly whether to asyncSpawn or await. If it always awaits, there is less reason to delineate cases so finely.

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.

None yet

2 participants