-
Notifications
You must be signed in to change notification settings - Fork 33
[Peras 4] Add ObjectDiffusion and PerasCert diffusion (instance of ObjectDiffusion)
#1679
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
base: main
Are you sure you want to change the base?
Conversation
PerasCert diffusion (instace of ObjectDiffusion)PerasCert diffusion (instance of ObjectDiffusion)
PerasCert diffusion (instance of ObjectDiffusion)PerasCert diffusion (instance of ObjectDiffusion)
80d3c69 to
f88b3ae
Compare
dca0315 to
d7c3c64
Compare
37a9f85 to
222f4be
Compare
d7c3c64 to
f1158c0
Compare
222f4be to
d47c331
Compare
PerasCert diffusion (instance of ObjectDiffusion)PerasCert diffusion (instance of ObjectDiffusion)
d47c331 to
918307c
Compare
f1158c0 to
90131b2
Compare
8aba6fc to
8b987f6
Compare
328b50a to
1018f6e
Compare
f8083cc to
8a88eb7
Compare
...onsensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ObjectDiffusion/Inbound.hs
Outdated
Show resolved
Hide resolved
...onsensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ObjectDiffusion/Inbound.hs
Outdated
Show resolved
Hide resolved
...onsensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ObjectDiffusion/Inbound.hs
Show resolved
Hide resolved
agustinmista
left a comment
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, minor comments only.
...sensus-diffusion/src/ouroboros-consensus-diffusion/Ouroboros/Consensus/Network/NodeToNode.hs
Show resolved
Hide resolved
|
@amesgen TX-submission V1 had initially hidden a "ensure no thunk" logic in the
|
8a88eb7 to
d9c165b
Compare
|
I think I have adressed all comments from @agustinmista and @amesgen,I guess we are ready for a client review now? |
...onsensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ObjectDiffusion/Inbound.hs
Outdated
Show resolved
Hide resolved
...onsensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ObjectDiffusion/Inbound.hs
Outdated
Show resolved
Hide resolved
...onsensus/src/ouroboros-consensus/Ouroboros/Consensus/MiniProtocol/ObjectDiffusion/Inbound.hs
Outdated
Show resolved
Hide resolved
d9c165b to
bef68f5
Compare
bef68f5 to
0c3b30f
Compare
0c3b30f to
2e7a690
Compare
Also use defaultMiniProtocolParameters instead of hardcoded value in unstable-diffusion-testlib to account for newly defined parameters in the new `ouroboros-network` version. Also integrate `NodeToNodeV_16`. Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
…eader,Writer}` API Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
…fusion Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
Co-authored-by: Agustin Mista <[email protected]> Co-authored-by: Alexander Esgen <[email protected]> Co-authored-by: Georgy Lukyanov <[email protected]> Co-authored-by: Thomas BAGREL <[email protected]> Co-authored-by: Nicolas BACQUEY <[email protected]> Co-authored-by: Nicolas "Niols" Jeannerod <[email protected]>
2e7a690 to
09669d1
Compare
|
Hello everyone, |
| (decodePoint (decodeRawHash p)) | ||
| (encodeTip (encodeRawHash p)) | ||
| (decodeTip (decodeRawHash p)) | ||
| enc |
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.
Maybe these should be renamed after the thing they encode/decode, as it used to be (eg encPoint)
| --> | ||
|
|
||
| ### Breaking |
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.
We should use the same verb tense.
| -- ^ Get the list of objects available in the pool with a ticketNo greater | ||
| -- than the specified one. The number of returned objects is capped by the | ||
| -- given Word64. Only the IDs and ticketNos of the objects are directly | ||
| -- accessible; each actual object must be loaded through a monadic action. |
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.
Would it make sense to explain why does the object has to be retrieved via a monadic action? And also, does the interface guarantees the object to always be available?
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 guess this is why we also have opwHasObject, but in any case it might be worth clarifying this.
| -- ^ Get the list of objects available in the pool with a ticketNo greater | ||
| -- than the specified one. The number of returned objects is capped by the | ||
| -- given Word64. Only the IDs and ticketNos of the objects are directly | ||
| -- accessible; each actual object must be loaded through a monadic action. |
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.
| -- accessible; each actual object must be loaded through a monadic action. | |
| -- accessible; each actual object must be retrieved through a monadic action. |
| take (fromIntegral limit) $ | ||
| [ (ticketNo, getPerasCertRound cert, pure (getPerasCert cert)) | ||
| | (ticketNo, cert) <- | ||
| Map.toAscList $ |
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.
Aren't we worried about the performance of this map to list conversion? How often do we expect it to be performed?
| frequency | ||
| [ (1, pure $ Point Origin) | ||
| , | ||
| ( 4 |
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.
Do we expect the Genesis point to be picked in 20% of the cases in practice?
| ( (\(ticketNo, smokeObject) -> (ticketNo, getSmokeObjectId smokeObject, pure smokeObject)) | ||
| <$> zip [(0 :: Int) ..] poolContent | ||
| ) | ||
| , oprZeroTicketNo = -1 -- objectPoolObjectIdsAfter uses strict comparison, and first ticketNo is 0. |
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 a bit confusing. Probably users won't see this -1, but still. I wonder if it's possible to either start numbering tickets at 1, or use a different name for oprZeroTicketNo. Also it's probably not a big thing, but we're losing half of the space by using -1 as the number before the first ticket number.
| threadDelay 1000 -- give a head start to the other threads | ||
| atomically $ writeTVar controlMessage Terminate | ||
| threadDelay 1000 -- wait for the other threads to finish | ||
| waitAnyThread [outboundThread, inboundThread, controlMessageThread] |
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.
Will this waiting condition give time to all the threads to send/receive all the objects?
| controlMessageThread <- forkLinkedThread reg "ObjectDiffusion Control thread" $ do | ||
| threadDelay 1000 -- give a head start to the other threads | ||
| atomically $ writeTVar controlMessage Terminate | ||
| threadDelay 1000 -- wait for the other threads to finish |
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.
Any rationale on why we choose 1k here?
| action -> | ||
| model.open && case action of | ||
| CloseDB -> True | ||
| -- Do not add equivocating certificates. |
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.
Don't we actually want to test the addition of equivocated certificates?
This pull request introduces support for the ObjectDiffusion mini-protocol, required for Peras (for certificates and votes diffusion). It also plugs the PerasCertDiffusion (instance of ObjectDiffusion) mini-protocol in the networking layer.
This PR depends on an updated version of
ouroboros-network, see IntersectMBO/ouroboros-network#5202 and https://github.com/IntersectMBO/ouroboros-network/tree/peras-staging/pr-5202-v2Peras ObjectDiffusion Mini-protocol:
Ouroboros.Consensus.MiniProtocol.ObjectDiffusion{.Inbound,.Outbound}with implementations of the ObjectDiffusion protocol (quite similar/inspired from TX-submission, except that client = inbound, server = outbound)Ouroboros.Consensus.MiniProtocol.ObjectDiffusion.ObjectPool.APIdefiningObjectPool{Reader,Writer}interfaces, through which ObjectDiffusion accesses/stores the objects to send/that have been received.Ouroboros.Consensus.MiniProtocol.ObjectDiffusion.PerasCertandOuroboros.Consensus.MiniProtocol.ObjectDiffusion.ObjectPool.PerasCertcontaining definitions specific toPerasCertdiffusion through the ObjectDiffusion mini-protocolOuroboros.Consensus.Node.Serialisationto add CBOR serialisation (SerialiseNodeToNode) forPoint blk,Tip blk, andPerasCert blkOuroboros.Consensus{.Node,.Node.Tracer,.Network.NodeToNode}to wire-in PerasCertDiffusion similarly to other mini-protocols (e.g. TX-submission)Tests and benchmarks
Added module
Test.Consensus.MiniProtocol.ObjectDiffusion.Smokewith smoke test for the general ObjectDiffusion mini-protocol (using mock objects)Added module
Test.Consensus.MiniProtocol.ObjectDiffusion.PerasCert.Smokewith smoke test specific toPerasCertdiffusion through ObjectDiffusionUpdates
Test.ThreadNet.Networkinunstable-diffusion-testlibaccordingly to the changes made inOuroboros.Consensus.Network.NodeToNodeNetwork Protocol Version Updates:
ouroboros-networkrev https://github.com/IntersectMBO/ouroboros-network/tree/peras-staging/pr-5202-v2 through source-repository-package directiveouroboros-consensusforNodeToNodeV_16