-
Notifications
You must be signed in to change notification settings - Fork 2.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
fix(en): gracefully shutdown en waiting for reorg detector (#270)
This PR changes the shutdown order of the external node to a more graceful one. # Why? Currently sutting down the EN because of reorgs and inconsistency checks may be raceful and a shutting down consistency checker may bring down the reorg detector with it which would prevent the reorg detector from doing it's job in the legitimate cases of reorgs where the node actually needs to be rolled back to some previous state. # What happens currently? The concerns have been focused around the logic of consistency checker that used to panic when an inconsistency was found. That is no longer the case (`anyhow::bail!` used to be `panic`): https://github.com/matter-labs/zksync-era/blob/feb8a6c7053cc5e0202088f6a1f7644316e1ad05/core/lib/zksync_core/src/consistency_checker/mod.rs#L181-L183 however, this error would still unconditionally bring the node down because currently the handler for `ConsistencyChecker` is a part of `wait_tasks` that would resolve if any of the tasks has resolved: https://github.com/matter-labs/zksync-era/blob/feb8a6c7053cc5e0202088f6a1f7644316e1ad05/core/bin/external_node/src/main.rs#L401-L404 The proposed logic works as follows: The handle to reorg detector is fused and on the node shutdown, after all the components are gracefully shutdown we manually check the result of the reorg detector. This logic handles both situations: 1. node is shutting down 2. reorg detector has found a reorg and is performing a rollback and shutdown.
- Loading branch information
Showing
5 changed files
with
72 additions
and
55 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters