Skip to content

Handle validator register/unregister race with ordering guard #18

@GabrielePicco

Description

@GabrielePicco

Tracking item from magicblock-validator PR #1314 review thread:
magicblock-labs/magicblock-validator#1314 (comment)

Problem:
During shutdown shortly after startup, startup registration may still be in flight while the validator starts unregistering. The unregister path can observe no registered validator yet and skip/return, then the earlier registration transaction can still confirm before exit. Since shutdown no longer performs a later unregister, the validator can remain registered on chain.

This should be guarded in the domain program so stale or out-of-order register/unregister transactions cannot leave stale validator state.

Possible direction:

  • Add an ordering guard such as a nonce, epoch, or timestamp to validator registration state.
  • Make unregister apply only to the intended current registration.
  • Ensure an older in-flight registration cannot win after a newer unregister or superseding registration.

Acceptance criteria:

  • Program logic prevents this stale registration outcome.
  • Tests cover register-in-flight followed by shutdown/unregister ordering.
  • Any required validator/client-side field changes are documented.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions