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

node: Implement a FSM for stalled_chain states #2216

Merged
merged 13 commits into from
Sep 10, 2024
Merged

node: Implement a FSM for stalled_chain states #2216

merged 13 commits into from
Sep 10, 2024

Conversation

goshawk-3
Copy link
Contributor

@goshawk-3 goshawk-3 commented Aug 27, 2024

fixes #2245

Basically, the concept is the following:

If a node is continuously receiving future blocks but the local tip does not change for more than 60sec we assume that it's stalled (State::Stalled). If so, it asks the network for missing blocks.

Once the node receives all blocks from local_final until local_tip, it tries to detect at what height/block is the fork and eventually it verifies the new block.

If the verification passes, the node is in State::StalledOnFork state. If so, it reverts to the previous state_root and tries to accept the new block.

@goshawk-3 goshawk-3 marked this pull request as ready for review September 5, 2024 09:26
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/acceptor.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Outdated Show resolved Hide resolved
node/src/chain/fsm.rs Outdated Show resolved Hide resolved
- Revert to prev_state_hash commit.
- Blacklist the blk from non-main branch
- Read final block from DB
@goshawk-3 goshawk-3 requested a review from fed-franz September 10, 2024 12:05
Copy link
Contributor

@fed-franz fed-franz left a comment

Choose a reason for hiding this comment

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

LGTM, just a couple of remarks

node/src/chain/stall_chain_fsm.rs Show resolved Hide resolved
node/src/chain/stall_chain_fsm.rs Show resolved Hide resolved
node/src/chain/fsm.rs Show resolved Hide resolved
@goshawk-3 goshawk-3 merged commit 75293b2 into master Sep 10, 2024
15 checks passed
@goshawk-3 goshawk-3 deleted the fix-1904 branch September 10, 2024 15:25
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.

Nodes can get stuck on a fork
3 participants