dymint icon indicating copy to clipboard operation
dymint copied to clipboard

feat: sequencer rotation

Open mtsitrin opened this issue 6 months ago • 1 comments

This PR refactors the sequencers management on dymint. Closes #941

  • based on ADR: https://www.notion.so/dymension/ADR-x-Sequencer-Rotation-014f9f8c781543b5b99f4f2571969c3d?pvs=4
  • depends on dymension version: https://github.com/dymensionxyz/dymension/pull/1006

Main changes:

  • refactored SequencerSet kept in state (custom struct instead of tendermint.ValidatorSet)
  • Proposer is managed from the state, instead of SL
  • blocks are validated against the expected proposer from the state
  • proposer is changed according to the nextSequencerHash field in block header
  • sequencer logic:
    • listen to rotation started signal from the hub
    • produce lastBlock and submit lastStateUpdate

Bug fix

  • fix event handling with dymension based on cosmos v0.47.x
    • https://github.com/dymensionxyz/cosmosclient/pull/35
    • https://github.com/dymensionxyz/cometbft/pull/4

WIP:

  • [x] migration checks
  • [ ] get rotation mark on state update response (depends on https://github.com/dymensionxyz/dymension/issues/1025)
  • [ ] more tests

will be added in separate PRs:

  • https://github.com/dymensionxyz/dymint/issues/1008
  • https://github.com/dymensionxyz/dymint/issues/1015

Summary by CodeRabbit

  • New Features

    • Introduced a new interface, GetProposerI, to enhance proposer management.
    • Implemented comprehensive functionalities for managing sequencer rotations.
    • Added a message structure for updating rollapp states, enhancing state management.
  • Bug Fixes

    • Enhanced error handling within the block application logic, preventing nil pointer dereferences.
  • Improvements

    • Renamed functions for clarity and readability, reflecting their updated roles.
    • Streamlined initialization and update logic for state management, improving clarity and reducing potential errors.
    • Established a robust parameter management system for rollapps.
    • Improved block production process with enhanced error handling and flexibility.
  • Tests

    • Refactored test cases for block management to align with new functionality and improve maintainability.

mtsitrin avatar Aug 01 '24 07:08 mtsitrin