Skip to content

Implement SessionManager Trait for pallet-session Integration - #55

Merged
motoZ-crypto merged 2 commits into
masterfrom
motoz/session-manager-trait
Apr 23, 2026
Merged

Implement SessionManager Trait for pallet-session Integration#55
motoZ-crypto merged 2 commits into
masterfrom
motoz/session-manager-trait

Conversation

@motoZ-crypto

@motoZ-crypto motoZ-crypto commented Apr 23, 2026

Copy link
Copy Markdown
Collaborator

Summary

Replace the placeholder () SessionManager in the runtime with a real implementation provided by pallet-validator, so the active validator set is driven by the validator lock lifecycle (lock / exit / kick / cooldown / lock release) instead of being fixed at genesis.

Changes

  • pallet-validator
    • Add pallet-session as a dependency (std + try-runtime features).
    • Add ActiveValidators<T>: BoundedVec<AccountId, MaxValidators> storage
      that mirrors the set currently in use by the session.
    • Implement pallet_session::SessionManager<T::AccountId>:
      • new_session(_) rebuilds the next set as previous ∩ {status == Active}
        plus accounts drained from PendingValidators whose lock status is
        Active. Returns None when the result equals the previous set,
        matching the pallet-session convention. Persists the new set into
        ActiveValidators.
      • start_session / end_session are no-ops in this iteration.

runtime/configs

  • Import Validator and set pallet_session::Config::SessionManager = Validator.

Tests

  • new_session_promotes_pending_validators
  • new_session_removes_exited_validator
  • new_session_removes_kicked_and_cooldown_validators
  • new_session_returns_none_when_unchanged
  • new_session_drops_validator_with_released_lock

Closes #27

- new_session_promotes_pending_validators
- new_session_removes_exited_validator
- new_session_removes_kicked_and_cooldown_validators
- new_session_returns_none_when_unchanged
- new_session_drops_validator_with_released_lock
@motoZ-crypto motoZ-crypto added this to the Alpha-0.1 milestone Apr 23, 2026
@motoZ-crypto motoZ-crypto self-assigned this Apr 23, 2026
@motoZ-crypto motoZ-crypto added T-enhancement New feature or request A-pallet Runtime pallet A-session Session management A-validator Validator system labels Apr 23, 2026
@motoZ-crypto
motoZ-crypto marked this pull request as ready for review April 23, 2026 12:50
@motoZ-crypto
motoZ-crypto merged commit 219c62c into master Apr 23, 2026
1 check passed
@motoZ-crypto
motoZ-crypto deleted the motoz/session-manager-trait branch July 5, 2026 04:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

A-pallet Runtime pallet A-session Session management A-validator Validator system T-enhancement New feature or request

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Implement SessionManager Trait for pallet-session Integration

1 participant