-
Notifications
You must be signed in to change notification settings - Fork 89
[WIP] Add ObjectDiffusion miniprotocol for Peras cert and vote diffusion #5181
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: peras-staging
Are you sure you want to change the base?
Conversation
pattern ReflOutboundAgency :: ReflRelativeAgency ClientAgency (r :: RelativeAgency) (r :: RelativeAgency) | ||
pattern ReflOutboundAgency = ReflClientAgency | ||
type ReflOutboundAgency = 'ReflClientAgency | ||
|
||
pattern ReflInboundAgency :: ReflRelativeAgency ServerAgency (r :: RelativeAgency) (r :: RelativeAgency) | ||
pattern ReflInboundAgency = ReflServerAgency | ||
type ReflInboundAgency = 'ReflServerAgency |
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.
One should not need these patterns at all so I wouldn't include them.
data StBlockingStyle where | ||
-- | In this sub-state the reply need not be prompt. There is no timeout. | ||
StBlocking :: StBlockingStyle | ||
-- | In this state the peer must reply. There is a timeout. | ||
StNonBlocking :: StBlockingStyle |
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.
Why not import this type from Ouroboros.Network.Protocol.TxSubmission2.Type
? It can also be exported here.
type SingObjectDiffusion :: | ||
ObjectDiffusion initAgency objectId object -> | ||
Type |
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.
Please check our style guide in ./docs/StyleGuide.md
type SingObjectDiffusion :: | |
ObjectDiffusion initAgency objectId object -> | |
Type | |
type SingObjectDiffusion | |
:: ObjectDiffusion initAgency objectId object | |
-> Type |
type ObjectDiffusion :: Agency -> Type -> Type -> Type | ||
data ObjectDiffusion initAgency objectId object where |
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.
type ObjectDiffusion :: Agency -> Type -> Type -> Type | |
data ObjectDiffusion initAgency objectId object where | |
type ObjectDiffusion :: Type -> Type -> Type | |
data ObjectDiffusion objectId object where |
The initAgency
doesn't seem to be used anywhere in the protocol definitions, can it be dropped?
-- of these constraints is also a protocol error. The constraints are intended | ||
-- to ensure that implementations are able to work in bounded space. | ||
instance Protocol (ObjectDiffusion initAgency objectId object) where | ||
-- \| The messages in the object diffusion protocol. |
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.
-- \| The messages in the object diffusion protocol. | |
-- | The messages in the object diffusion protocol. |
I know haddock doesn't support it yet, but it also doesn't complain about it, doesn't it?
deriving instance Eq (SingBlockingStyle b) | ||
|
||
deriving instance Show (SingBlockingStyle b) |
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.
deriving instance Eq (SingBlockingStyle b) | |
deriving instance Show (SingBlockingStyle b) | |
deriving instance Eq (SingBlockingStyle b) | |
deriving instance Show (SingBlockingStyle b) |
type instance Sing = SingBlockingStyle | ||
|
||
instance SingI StBlocking where sing = SingBlocking | ||
|
||
instance SingI StNonBlocking where sing = SingNonBlocking |
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.
type instance Sing = SingBlockingStyle | |
instance SingI StBlocking where sing = SingBlocking | |
instance SingI StNonBlocking where sing = SingNonBlocking | |
type instance Sing = SingBlockingStyle | |
instance SingI StBlocking where sing = SingBlocking | |
instance SingI StNonBlocking where sing = SingNonBlocking |
deriving instance (Eq a) => Eq (BlockingReplyList blocking a) | ||
|
||
deriving instance (Show a) => Show (BlockingReplyList blocking a) | ||
|
||
deriving instance Foldable (BlockingReplyList blocking) | ||
|
||
instance (NFData a) => NFData (BlockingReplyList blocking a) where |
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.
deriving instance (Eq a) => Eq (BlockingReplyList blocking a) | |
deriving instance (Show a) => Show (BlockingReplyList blocking a) | |
deriving instance Foldable (BlockingReplyList blocking) | |
instance (NFData a) => NFData (BlockingReplyList blocking a) where | |
deriving instance (Eq a) => Eq (BlockingReplyList blocking a) | |
deriving instance (Show a) => Show (BlockingReplyList blocking a) | |
deriving instance Foldable (BlockingReplyList blocking) | |
instance (NFData a) => NFData (BlockingReplyList blocking a) where |
-- object identifiers. | ||
data Message (ObjectDiffusion initAgency objectId object) from to where | ||
MsgInit :: | ||
Message (ObjectDiffusion initAgency objectId object) StInit StIdle |
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.
Or did you mean:
MsgInit :: Message (ObjectDiffusion initAgency objectId object) initAgency StIdle
@coot Thanks for the comments! Note though that this is early stage code (ie this is a draft PR), not yet intended for review by the Network team 😅 |
…either the inbound or outbound peer
5f76136
to
bca44ca
Compare
Closes tweag/cardano-peras#57. IntersectMBO/ouroboros-consensus#1615 depends on this PR.
Defines a new miniprotocol, ObjectDiffusion, highly inspired from TxSubmission.
It supports two modes (
initAgency
type parameter), one where the inbound peer initiates the communication, and the other where the outbound peer does.For that, it relies on the
InboundAgency
andOutboundAgency
types (see ouroboros-network-protocols/src/Ouroboros/Network/Protocol/ObjectDiffusion/Type.hs). So far, they are aliases for hardcodedServerAgency
andClientAgency
. It doesn't bother us too much for now, as client/server roles are purely arbitrary and symmetrical from atyped-protocols
PoV, but apparently for production they carry a particular meaning, so we should find a way to fix that.On a side note, this PR also adds a new miniprotocol parameter (and a corresponding default value) for the number of certs to ack for PerasCert diffusion (based on ObjectDiffusion).