-
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
Extensible Ouroboros Network Diffusion Stack #5016
base: main
Are you sure you want to change the base?
Conversation
3cdb9a3
to
f00952f
Compare
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Policies.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/MockEnvironment.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/PublicRootPeers.hs
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor/Types.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Cardano/Network/PeerSelection/Governor/Types.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Diffusion/MinimalP2P.hs
Outdated
Show resolved
Hide resolved
c14d5cb
to
3b30f43
Compare
a step toward haskell blockchain sdk? 😄 |
@yihuang as you can see from the PR description this is some interesting step towards a fully polymorphic diffusion that might be used by others to create their own overlay network! Thank you for noticing 😃 |
f922210
to
3cdf98d
Compare
ce99e1d
to
5400a7c
Compare
ouroboros-network/src/Ouroboros/Network/PeerSelection/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PublicRootPeers.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.
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano/Node.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PublicRootPeers.hs
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Cardano/Node/PeerSelection/Governor/PeerSelectionState.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.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.
Reviewed commit: Reorganised and refactored Diffusion modules.
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Minimal/Node.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Cardano/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Diffusion/MinimalP2P.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Diffusion/MinimalP2P.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/Diffusion/MinimalP2P.hs
Outdated
Show resolved
Hide resolved
f4e996b
to
d048514
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.
This is next batch of review comments...
ouroboros-network/src/Ouroboros/Cardano/Network/PeerSelection/PeerChurnArgs.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Cardano/Network/PeerSelection/PeerChurnArgs.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.
Next batch of comments. I am only left with one non-testing module.
ouroboros-network/src/Ouroboros/Cardano/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
ouroboros-network/src/Ouroboros/Network/PeerSelection/State/LocalRootPeers.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/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Cardano/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Cardano/PeerSelection/PeerSelectionActions.hs
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Network/PeerSelection/PeerSelectionActions.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Cardano/Network/PeerSelection/Governor/PeerSelectionActions.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano/Simulation.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/MockEnvironment.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/MockEnvironment.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/MockEnvironment.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Node/MiniProtocols.hs
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/LocalRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/LocalRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/LocalRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/LocalRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/PeerSelection/Cardano/PublicRootPeers.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano/Simulation.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano/Simulation.hs
Outdated
Show resolved
Hide resolved
0935d40
to
9a2980f
Compare
9a2980f
to
e1b0745
Compare
-- | For Genesis, this sets the floor for minimum number of | ||
-- active big ledger peers we must be connected to in order | ||
-- to be able to signal trusted state (OutboundConnectionsState) | ||
, numberOfBigLedgerPeers :: NumberOfBigLedgerPeers |
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 don't think just adding numberOfBigLedgerPeers
is enough. If the target for established peers is insufficient, then we won't have a chance to achieve the target of big ledger peers.
I think in main
we pass all the targets, not just active ones.
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.
Is this somehow related to genesisPeerTargets
from Ouroboros.Cardano.Network.PeerSeledction.Churn.ExtraArguments
?
If it is the same, we should organise the code better. E.g. pass genesisPeerTargets
through AgumentsExtra
here rather than the Churn
ones.
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.
It is the same but this one in ArgumentsExtra
comes from configuration file which is going to be passed to Churn.ExtraArguments
ouroboros-network/src/Ouroboros/Network/PeerSelection/Governor.hs
Outdated
Show resolved
Hide resolved
peerconn | ||
BootstrapPeersCriticalTimeoutError | ||
m | ||
cardanoPeerSelectionGovernorArgs readUseLedgerPeers peerSharing updateOutboundConnectionsState = |
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.
It's something wrong if we need to call it in cardano-node
. It seems the arguments in Cardano
diffusion are too general. Please investigate how to call this function inside of Cardano
diffusion.
@@ -366,6 +367,16 @@ data PeerSelectionActions peeraddr peerconn m = PeerSelectionActions { | |||
-- | |||
peerConnToPeerSharing :: peerconn -> PeerSharing, | |||
|
|||
-- | Public Extra Peers Actions | |||
-- | |||
extraPeersAPI :: PublicExtraPeersAPI extraPeers peeraddr, |
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 I confused PeerSelectionActions
, with PeerStateActions
. It's fine to pass it as part of the former. It's already a mixture of things.
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/Cardano/Simulation.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/MiniProtocols/BlockFetch.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Cardano/Diffusion/Configuration.hs
Outdated
Show resolved
Hide resolved
ouroboros-network/src/Ouroboros/Cardano/Diffusion/Configuration.hs
Outdated
Show resolved
Hide resolved
|
||
-- | Extension point for third party users to be able to add more | ||
-- arguments. | ||
, daExtraArgs :: extraArgs |
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.
Is this used anywhere? I don't see how it is used inside Ouroboros.Network.Diffusion.P2P.run
function. This indicates that it could be removed.
ouroboros-network/sim-tests-lib/Test/Ouroboros/Network/Diffusion/Testnet/P2P/Node.hs
Outdated
Show resolved
Hide resolved
(See CHANGELOG for more details) - Extract Cardano-specific components into separate modules to resolve cyclic dependency issues: - `ConsensusModePeerTargets` and `PeerSelectionTargets` were refactored to avoid circular dependencies. - Introduce extension points in Diffusion data structures: - Split P2P functionality into `P2PCardano` (for Cardano Node specifics) and a more general `P2P` module. - Added `Minimal/Node.hs` as a placeholder for a minimal Node diffusion instantiation example. - Refactor Peer Selection: - Removed redundant `PeerSelectionActionsArgs`. - Reorganized `DNSActions` and `LedgerPeersArgs`. - Improved API for `PeerSelectionActions`. - Rename `Cardano.Node` to `Cardano.Network`. - Generalize and refactor the following components: - `ConsensusModePeerTargets`. - `PeerSelection{Views, Counters}` to allow extensibility for third-party users. - `PublicRootPeers`. - Enhance the Outbound Governor: - Generalize `MinimalP2P` for diffusion initialization. - Update `ArgumentsExtra` with new parameters for a more flexible diffusion setup. - Refactor `PeerSelection.Governor.Monitor` to separate Cardano-specific monitoring actions and support third-party custom actions. - Ensure the `Diffusion` module is fully polymorphic: - Removed `CardanoP2P` dependencies. - Updated the test suite to align with the new structure. - Miscellaneous updates: - Update CHaP and fix build issues. - Remove `daBlockFetchMode`. - Address review feedback. - Fix churn timeout tests and increase `shortDelay` to stabilize tests. - Recover `sigusr1` signal handler. - Make addresses polymorphic. - Refactor `extraDebugState` and introduce `P2PDecisionType`. - Refactor `requestPublicRootPeers` type.
44a505f
to
a84ba63
Compare
a84ba63
to
7e02959
Compare
Description
This PR refactors
ouroboros-network
in order to make diffusion layer general/polymorphic and extensible. This will allow us (or 3rd parties) to have access to a flexible network stack which can be extended/configured to ones needs.For more details about this refactoring, see https://github.com/IntersectMBO/ouroboros-network/wiki/Reusable-Diffusion-Investigation
TODOs:
daBlockFetchMode
For next steps (e,.g. when developing mithril) this will be in the todo list: