-
Notifications
You must be signed in to change notification settings - Fork 87
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Bootstrap Peers Implementation #4555
Conversation
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/test/Test/Ouroboros/Network/Testnet/Simulation/Node.hs
Outdated
Show resolved
Hide resolved
@bolt12 I think we can merge it as soon as |
I think it might make sense to repurpose this PR to include bootstrap peers as well. |
Also see my comment here: IntersectMBO/ouroboros-consensus#200 |
ouroboros-network/src/Ouroboros/Network/PeerSelection/LedgerPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Types.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Types.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
7410ddc
to
dc9a829
Compare
`LedgerConsensusInterface` now has to fill 3 STM actions: - `lpGetLatestSlot :: STM m SlotNo` - `lpGetLedgerStateJudgment :: STM m LedgerStateJudgement` - `lpGetLedgerPeers :: STM m [(PoolStake, NonEmpty RelayAccessPoint)]` This allows to create a new interface function similar to the old one: `getLedgerPeersFromSlotNo :: MonadSTM m => LedgerPeersConsensusInterface m -> SlotNo -> STM m LedgerPeers` That abides buy the following invariants: * 'BeforeSlot' is returned iff the latest slot is before the 'slotNo' * 'LedgerPeers lsj peers' is returned iff the latest slot is after the 'slotNo'; Adds a test that checks this invariants
This is fruit of the following discussion: #4658 Renamed `UseLedgerAfter` to `AfterSlot` Move `UseLedgerPeers` and `AfterSlot` to *-api
Adds `readLedgerStateJudgement` to `PeerSelectionActions` Adds `currentLedgerStateJudgement` to `PeerSelectionState` Adjusts `PeerSelectionActions` `requestPublicRootPeers` function to provide either only ledger peers or bootstrap peers according to the current ledger state. The same for `requestBigLedgerPeers`. Adds LedgerStateJudgement to tests Moves BigLedgerPeers to PublicRootPeers Refactor `PeerSelectionActions` `requestPublicRootPeers` function
1. **ledgerStateJudgement**: - Triggered by `LedgerPeersConsensusInterface` API's STM action. - If ledger state shifts to 'TooOld', the governor: - Sets all targets to 0. - Ignores other monitoring jobs, preventing new peer learning or alterations to the peer sets. - The intent is to ensure complete state purge, transitioning the governor to a secure fallback state. 2. **waitForOnlyBootstrapPeers**: - Activates once the governor is in a clean state. - Resets targets to original values, allowing normal operations. - An invariant is introduced: the governor only knows about trustable (bootstrap) peers. - Protective measures added in the code to maintain this invariant. This safeguard is essential only during the fallback state. When the ledger state transitions to 'YoungEnough', the governor will accept non-trustable peers into its known set.
Reduce memory and time efficiency of test
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks @bolt12 for the good work.
The Genesis SoW will deliver a proper GSM. In the interim, this PR defines a GSM that is suitable for use with the bootstrap-peers intermediate solution (see IntersectMBO/ouroboros-network#4555). The relevant high-level specification is rendered here https://ouroboros-consensus.cardano.intersectmbo.org/docs/for-developers/BootstrapPeersIER
Description
This PR implements the Bootstrap Peers IER by changing the
LedgerConsensusInterface
API and creating mechanisms in the networking outbound governor to promptly react to ledger state changes.