@@ -103,6 +103,7 @@ import Ouroboros.Network.Snocket
103
103
import Ouroboros.Network.Socket
104
104
import Ouroboros.Network.Util.ShowProxy (ShowProxy , showProxy )
105
105
import Ouroboros.Network.Protocol.ObjectDiffusion.Type (NumObjectIdsToAck )
106
+ import Ouroboros.Network.Protocol.ObjectDiffusion.Type (NumObjectsInFifo )
106
107
107
108
108
109
-- The Handshake tracer types are simply terrible.
@@ -162,16 +163,35 @@ data MiniProtocolParameters = MiniProtocolParameters {
162
163
-- ^ maximal number of unacked tx (pipelining is bounded by twice this
163
164
-- number)
164
165
165
- certDiffusionMaxUnacked :: ! NumObjectIdsToAck
166
+ perasCertDiffusionMaxFifoLength :: ! NumObjectsInFifo
167
+ -- ^ Maximum number of PerasCerts in the outbound peer's outstanding FIFO.
168
+ --
169
+ -- This indirectly limits the number of pipelined requests from the inbound peer:
170
+ -- the inbound peer can only request @n@ new IDs if the execution of preceding
171
+ -- requests would result in at least @n@ empty seats in the FIFO.
172
+ --
173
+ -- In the worst case:
174
+ --
175
+ -- * The inbound peer requests IDs and objects one by one.
176
+ -- * The inbound peer is aware of @perasCertDiffusionMaxFifoLength@ IDs for objects
177
+ -- it hasn't requested yet (i.e., the FIFO is full).
178
+ --
179
+ -- Then, the inbound peer can pipeline at most @perasCertDiffusionMaxFifoLength@
180
+ -- requests for one object each (with a known ID), and up to
181
+ -- @perasCertDiffusionMaxFifoLength@ requests for one new ID each.
182
+ --
183
+ -- So, the theoretical maximum pipeline size is
184
+ -- @2 * perasCertDiffusionMaxFifoLength@, but in practice the pipeline size will
185
+ -- be much smaller, as the inbound peer typically batches requests.
166
186
}
167
187
168
188
defaultMiniProtocolParameters :: MiniProtocolParameters
169
189
defaultMiniProtocolParameters = MiniProtocolParameters {
170
- chainSyncPipeliningLowMark = 200
171
- , chainSyncPipeliningHighMark = 300
172
- , blockFetchPipeliningMax = 100
173
- , txSubmissionMaxUnacked = 10
174
- , certDiffusionMaxUnacked = 10
190
+ chainSyncPipeliningLowMark = 200
191
+ , chainSyncPipeliningHighMark = 300
192
+ , blockFetchPipeliningMax = 100
193
+ , txSubmissionMaxUnacked = 10
194
+ , perasCertDiffusionMaxFifoLength = 10
175
195
}
176
196
177
197
-- | Make an 'OuroborosApplication' for the bundle of mini-protocols that
0 commit comments