Skip to content

Refactor(consensus): split oversized process function and eliminate panic risks in main loop#4963

Open
raushan728 wants to merge 1 commit intomassalabs:mainfrom
raushan728:refactor/consensus-cleanup-and-stability
Open

Refactor(consensus): split oversized process function and eliminate panic risks in main loop#4963
raushan728 wants to merge 1 commit intomassalabs:mainfrom
raushan728:refactor/consensus-cleanup-and-stability

Conversation

@raushan728
Copy link
Copy Markdown

Description

Refactored massa-consensus-worker to improve maintainability and reliability:

  • Refactoring: Split the oversized ConsensusState::process function into modular helper methods to comply with the 50-line limit (CONTRIBUTING.md).
  • Stability: Replaced .expect() and .unwrap() calls in process.rs and main_loop.rs with proper Result propagation and error logging to prevent worker panics.
  • Testing: Added unit and integration tests in src/tests/process_refactor.rs to verify state transitions in the refactored logic.

Checklist

  • document all added functions
  • try in sandbox /simulation/labnet
  • if part of node-launch, checked using the resync_check flag
  • unit tests on the added/changed features
  • make tests compile
  • make tests pass
  • add logs allowing easy debugging in case the changes caused problems
  • if the API has changed, update the API specification

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.

1 participant