-
Notifications
You must be signed in to change notification settings - Fork 89
Big Ledger Peer Targets for Genesis #4832
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
Conversation
fadac6c
to
44f6265
Compare
It's ready for review, isn't it. I'll mark it as such. |
ouroboros-network/src/Ouroboros/Network/Diffusion/Configuration.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Diffusion/Configuration.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
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.
I think you complicated things for you with this mutex. I get that you want to have different targets depending on a given OG state but the OG only acts upon inputs, it doesn't actually output much for the outside except some public info and debugging info. So having a mutex that is kind of a smell to me.
I think what could simplify things is to move the target decision logic outside of the churn and OG, since it is static anyway (via currentTargets
) and put it at the STM m PeerSelectionTargets
action level. I think that's the right place to put it
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/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.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/Governor.hs
Outdated
Show resolved
Hide resolved
44f6265
to
1d84abb
Compare
1d84abb
to
6b74ed8
Compare
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.
A few suggestions
ouroboros-network/src/Ouroboros/Network/Diffusion/Configuration.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Diffusion/Configuration.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Monitor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
4a0b47c
to
cee3efb
Compare
dd67a38
to
26b4721
Compare
13b33e2
to
7300cf7
Compare
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.
LGTM 🎉
39aa13e
to
943e64b
Compare
Depending on its topology configuration, a node may provide diffusion layer with a snapshot of big ledger peers from some slot. This value is provided as an argument when diffusion is initialized, and is provided to ledgerPeersThread function, which contains the logic when these peers, if any, can be provided to peer selection governor when it requests them. This is especially useful when consensus is ran in Genesis mode and when the node is bootstrapping so it may have opportunity to connect to these trustworthy peers when they may not be yet available on its own ledger.
encoding, as well as checking that ToCBOR and FromCBOR are working together correctly.
Test is modified such that ledger peer pool relays are equal modulo fully qualified domain names to pool relays restored from snapshot. Also, since stake is serialised in floating point format, comparison to original Rational values is approximate.
Improved naming of functions related to calculating big ledger stake distribution which were to moved public ouroboros-network-api component.
This change equips peer selection and churn governor to appropriately respond to change in ledger state judgment when diffusion is running in Genesis consensus mode. A separate targets basis is made available in this mode which uses more hot big ledger peers when a node is syncing up. Additional changes in support of this were made to the configuration module, and some other minor refactorings were applied as well.
Read LedgerStateJudgement(*) to decide whether to use syncTargets from ConsensusModePeerTargets when * is TooOld.
In Genesis sync mode, when we aren't actively churning, the targets basis in the TVar can become stale when ledger state judgement flips. We don't want to use these targets when that happens and so we add a check for this condition, and instead set the targets in the private OG state based on the targets appropriate for the current ledger state judgement. When churn wakes up for the next round, it will use the appropriate targets basis and then we can use the targets that churn modifies and provides us with.
943e64b
to
2244210
Compare
I've looked thru all suggestions and confirmed that your review comments have been addressed. However, github still won't allow it to merge because apparently it still thinks there are some changes that need to be fixed.
Big Ledger Peer Targets for Genesis
Genesis mode support can be determined from node's configuration at startup. If this mode is disabled, the legacy peer selection method will be used, with optional support for bootstrap peers. When Genesis is enabled, peer selection must be provided with two sets of peer targets.
One set is used when it is detected that we are far from the tip of the best chain, and this set is maintained for the duration of the syncing period. Support for churning of this set is included. The other set is the default set when we are caught up, and it is analogous to the set used by the non-Genesis method.
The configuration module has been expanded to include some useful defaults for the new functionality.
Some minor refactoring.
Description
resolves #4813, resolves #3396, resolves #4609
Checklist