refactor: validator state management refactor
Motivation
After the latest refactors regarding Genserver removal, the state management of validators became more complex than it needed, before it made sense because of everyone beign and independen Genserver, but now most of the state could be shared by a ValidatorSet, this PR deals with that.
Description
This PR introduces a new ValidatorSet module that manage Validators and Duties. It process both new_head notifications as well as ticks throughout the slot lifecycle and select just the validators that need to be involved in every step of the process. The logic is maintained as it were previously implemented, this PR aims to reduce complexity, duplication and enhance clarity but it doesn't go in depth in the current logic, it tries to reuse current functions when available and simplify the ones that are intuitive to do so.
- ValidatorSet creation
- Moving the process of new_heads and ticks from Validators to ValidatorSet
- Simplified the Validator state as much as possible
- Move Duties to work on a per-epoch-basis, i.e. every duty is calculated once per epoch
- ValidatorSet selects only the validators with a duty to accomplish in every slot third, and just them do their work.
Note: The long commit history is because this branch started out of validator-manager-genserver-removal (#1224) before merging it to main.
Resolves #1255
NEXT STEPS:
- Subnet Info checks (we are not joining anymore to subnets at the duties calculation but everything continue working, this needs to be investigated further)