Description
anchor/validator_store/src/lib.rs is currently very large and mixes multiple concerns.
Current snapshot (from unstable @ a27f6def2):
- ~2,980 lines
- ~78 function definitions
- responsibility mix: assignment caching/watch channels, QBFT/signature orchestration, proposer/attester/sync flows, slashing-protection lifecycle, and local helper types/tests
This makes the file hard to read, review, and safely modify.
Goal: split lib.rs into cohesive internal modules with no behavior change and no external API break.
Version
- Anchor branch/commit:
unstable @ a27f6def2
- Rust:
rustc 1.93.1 (01f6ddf75 2026-02-11)
Present Behaviour
Most validator-store logic lives in one monolithic file, making it difficult to:
- identify ownership boundaries
- reason about side-effects
- review refactors in small, safe increments
Expected Behaviour
Validator-store internals are organized into focused modules, for example:
- context/assignments cache and watch-channel flow
- proposer/block signing + builder-related flow
- attestation/aggregate flow
- sync committee flow
- slashing-protection helpers and shared utilities
AnchorValidatorStore remains the crate entry point and public behavior remains unchanged.
Steps to resolve
- Create internal modules under
anchor/validator_store/src/ and move logic by responsibility.
- Keep public API stable (
AnchorValidatorStore + existing trait behavior).
- Move/adjust tests from
lib.rs into per-module tests or mod tests files as appropriate.
- Keep
lib.rs as a thin composition layer (exports, wiring, constructor, module imports).
- Validate no regressions:
cargo test -p anchor_validator_store
- targeted integration tests that cover proposer/attester/sync signing paths
Acceptance criteria
- No functional behavior change
- No public API breakage for downstream crates
lib.rs is significantly reduced and acts primarily as composition
- Existing tests pass; any moved tests continue to cover equivalent behavior
Description
anchor/validator_store/src/lib.rsis currently very large and mixes multiple concerns.Current snapshot (from
unstable@a27f6def2):This makes the file hard to read, review, and safely modify.
Goal: split
lib.rsinto cohesive internal modules with no behavior change and no external API break.Version
unstable@a27f6def2rustc 1.93.1 (01f6ddf75 2026-02-11)Present Behaviour
Most validator-store logic lives in one monolithic file, making it difficult to:
Expected Behaviour
Validator-store internals are organized into focused modules, for example:
AnchorValidatorStoreremains the crate entry point and public behavior remains unchanged.Steps to resolve
anchor/validator_store/src/and move logic by responsibility.AnchorValidatorStore+ existing trait behavior).lib.rsinto per-module tests ormod testsfiles as appropriate.lib.rsas a thin composition layer (exports, wiring, constructor, module imports).cargo test -p anchor_validator_storeAcceptance criteria
lib.rsis significantly reduced and acts primarily as composition