ouroboros-network icon indicating copy to clipboard operation
ouroboros-network copied to clipboard

Inform Consensus Layer whether a bootstrap peer should be considered remote

Open nfrisby opened this issue 1 year ago • 6 comments

@karknu had raised a concern about the Bootstrap State Machine (ie https://github.com/IntersectMBO/ouroboros-consensus/pull/808) that would be most naturally mitigated by the Diffusion Layer annotating new peers with whether or not that peer should be considered remote.

EG SPOs separately configure the "local trusted" portion of the topology from the "bootstrap peers source" of the topology. If that distinction would be preserved deep enough into the code, then the Bootstrap State Machine would simply refuse to transition from TooOld to YoungEnough while it only has local peers.

nfrisby avatar Feb 26 '24 17:02 nfrisby

To address this we need to extend ExpandedInitiatorContext which is used by node-to-node clients.

coot avatar Feb 26 '24 17:02 coot

simply refuse to transition from TooOld to YoungEnough while it only has local peers

For relays this is exactly what we want. For nodes with some trusted local peers and no bootstrap peers, such as BPs, the transition should happen when only talking to trusted local peers.

karknu avatar Feb 27 '24 07:02 karknu

Am I right understanding that by adding a eicIsLocalRootPeer :: Bool field in ExpandedInitiatorContext is information enough for consensus ?

bolt12 avatar Mar 19 '24 10:03 bolt12

I realised that Consensus might actually be interested in a signal from the outbound governor which summarises all connections. If we just expose IsLocalRoot in ExpandedInitiatorContext then on the consensus side one will need to build such a signal oneself, despite it being available from the outbound-governor.

This would be handy in other areas as well (e.g. churn). So here's another proposal. The outbound-governor should expose ~STM EffectiveTargets~ EffectiveCounters where effective ~targets~ counters is a record containing number of hot & warm: local / ledger / big ledger / bootstrap peers currently used by the outbound governor. This would work for us in churn and summarising it to onlyLocalOutboundConnections :: EffectiveCounters -> Bool.

coot avatar Mar 20 '24 09:03 coot

I don't see how exposing targets would work for consensus, since they have to know which peers are local and which peers are not, right?

bolt12 avatar Mar 20 '24 09:03 bolt12

I used wrong name, it's about counters not targets.

coot avatar Mar 20 '24 09:03 coot