## Description
Follow up of https://github.com/MystenLabs/sui/pull/12465
This PR is:
* Introducing a new `protocol_config` feature flag
`narwhal_new_leader_election_schedule` , so we keep all the new changes
disabled until we decide to enable on a new protocol version
* Introducing the `LeaderSchedule` which from now on will be responsible
for crafting the leader schedule and used to perform the leader
election.
* Is updating the leader schedule with the new scores every `K` commit
rounds
* Is injecting the `LeaderSchedule` to the primary node so it can be
used from the `proposer` module as well since the schedule now can be
updated
Next steps:
- [x] calculate the swap table on every K committed subdags & wire into
the leader election algorithm
- [x] ensure whole feature is gated behind a protocol config feature
flag - and probably a config switch as we might need to have it disabled
for longer than a release cycle.
- [ ] restore correct swap table after crash/recovery
- [ ] modify the commit path so we repeat the leader election when we
commit recursively
- [ ] modify the proposer to support the new leader election
capabilities
- [ ] add testing
## Test Plan
Added unit tests
---
If your changes are not user-facing and not a breaking change, you can
skip the following section. Otherwise, please indicate what changed, and
then add to the Release Notes section as highlighted during the release
process.
### Type of Change (Check all that apply)
- [ ] protocol change
- [ ] user-visible impact
- [ ] breaking change for a client SDKs
- [ ] breaking change for FNs (FN binary must upgrade)
- [ ] breaking change for validators or node operators (must upgrade
binaries)
- [ ] breaking change for on-chain data layout
- [ ] necessitate either a data wipe or data migration
### Release notes