Commit 55c16cf
Leios N: BearerBytes class replaces dataSize on ProtocolSizeLimits
Replace the `dataSize :: bytes -> Word` field of `ProtocolSizeLimits`
with a `BearerBytes` class:
class BearerBytes bytes where
bearerBytesSize :: bytes -> Word
Default instances cover `BS.ByteString`, `BL.ByteString`, `[Char]` and
`AnyMessage msg` (for tests). Driver/Limits gains a `BearerBytes bytes`
constraint on the public entry points (`runPeerWithLimits` and friends).
The seven `byteLimits*` codec helpers no longer take a
`(bytes -> Word)` argument — call sites drop the `(fromIntegral .
LBS.length)` boilerplate. Two test predicates that previously used
`dataSize` now call `bearerBytesSize` directly.
Co-Authored-By: Claude Opus 4.7 <noreply@anthropic.com>1 parent ebc8eac commit 55c16cf
19 files changed
Lines changed: 84 additions & 52 deletions
File tree
- cardano-diffusion/tests/lib/Test/Cardano/Network/Diffusion/Testnet
- ouroboros-network
- api/lib/Ouroboros/Network/Protocol
- demo/tx-submission
- framework
- io-tests/Test/Ouroboros/Network
- lib/Ouroboros/Network
- Driver
- Protocol/Handshake
- tests-lib/Test/Ouroboros/Network/ConnectionManager
- protocols
- lib/Ouroboros/Network/Protocol
- BlockFetch
- ChainSync
- KeepAlive
- ObjectDiffusion
- PeerSharing
- TxSubmission2
- tests-lib/Ouroboros/Network/Protocol
- KeepAlive
- PeerSharing
- tests/lib
- Ouroboros/Network/BlockFetch
- Test/Ouroboros/Network
- TxSubmission
Lines changed: 6 additions & 7 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1222 | 1222 | | |
1223 | 1223 | | |
1224 | 1224 | | |
1225 | | - | |
| 1225 | + | |
1226 | 1226 | | |
1227 | 1227 | | |
1228 | | - | |
| 1228 | + | |
1229 | 1229 | | |
1230 | 1230 | | |
1231 | | - | |
| 1231 | + | |
1232 | 1232 | | |
1233 | 1233 | | |
1234 | 1234 | | |
| |||
1238 | 1238 | | |
1239 | 1239 | | |
1240 | 1240 | | |
1241 | | - | |
1242 | 1241 | | |
1243 | 1242 | | |
1244 | 1243 | | |
1245 | 1244 | | |
1246 | | - | |
| 1245 | + | |
1247 | 1246 | | |
1248 | 1247 | | |
1249 | | - | |
| 1248 | + | |
1250 | 1249 | | |
1251 | 1250 | | |
1252 | 1251 | | |
| |||
1574 | 1573 | | |
1575 | 1574 | | |
1576 | 1575 | | |
1577 | | - | |
| 1576 | + | |
1578 | 1577 | | |
1579 | 1578 | | |
1580 | 1579 | | |
| |||
Lines changed: 26 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
1 | 1 | | |
2 | 2 | | |
3 | 3 | | |
| 4 | + | |
4 | 5 | | |
5 | 6 | | |
6 | 7 | | |
| |||
15 | 16 | | |
16 | 17 | | |
17 | 18 | | |
| 19 | + | |
| 20 | + | |
18 | 21 | | |
19 | 22 | | |
| 23 | + | |
20 | 24 | | |
21 | 25 | | |
22 | 26 | | |
23 | 27 | | |
24 | 28 | | |
25 | 29 | | |
26 | 30 | | |
27 | | - | |
28 | | - | |
29 | | - | |
| 31 | + | |
30 | 32 | | |
31 | 33 | | |
| 34 | + | |
| 35 | + | |
| 36 | + | |
| 37 | + | |
| 38 | + | |
| 39 | + | |
| 40 | + | |
| 41 | + | |
| 42 | + | |
| 43 | + | |
| 44 | + | |
| 45 | + | |
| 46 | + | |
| 47 | + | |
| 48 | + | |
| 49 | + | |
| 50 | + | |
| 51 | + | |
| 52 | + | |
| 53 | + | |
| 54 | + | |
32 | 55 | | |
33 | 56 | | |
34 | 57 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
357 | 357 | | |
358 | 358 | | |
359 | 359 | | |
360 | | - | |
| 360 | + | |
361 | 361 | | |
362 | 362 | | |
363 | 363 | | |
| |||
Lines changed: 2 additions & 3 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
99 | 99 | | |
100 | 100 | | |
101 | 101 | | |
102 | | - | |
| 102 | + | |
103 | 103 | | |
104 | 104 | | |
105 | 105 | | |
| |||
535 | 535 | | |
536 | 536 | | |
537 | 537 | | |
538 | | - | |
539 | | - | |
| 538 | + | |
540 | 539 | | |
541 | 540 | | |
542 | 541 | | |
| |||
Lines changed: 27 additions & 12 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
82 | 81 | | |
83 | 82 | | |
84 | 83 | | |
| |||
101 | 100 | | |
102 | 101 | | |
103 | 102 | | |
104 | | - | |
| 103 | + | |
105 | 104 | | |
106 | 105 | | |
107 | 106 | | |
| |||
129 | 128 | | |
130 | 129 | | |
131 | 130 | | |
132 | | - | |
| 131 | + | |
133 | 132 | | |
134 | 133 | | |
135 | 134 | | |
| |||
149 | 148 | | |
150 | 149 | | |
151 | 150 | | |
| 151 | + | |
152 | 152 | | |
153 | 153 | | |
154 | 154 | | |
| |||
169 | 169 | | |
170 | 170 | | |
171 | 171 | | |
| 172 | + | |
172 | 173 | | |
173 | 174 | | |
174 | 175 | | |
| |||
191 | 192 | | |
192 | 193 | | |
193 | 194 | | |
194 | | - | |
195 | 195 | | |
196 | 196 | | |
197 | 197 | | |
| |||
214 | 214 | | |
215 | 215 | | |
216 | 216 | | |
217 | | - | |
| 217 | + | |
218 | 218 | | |
219 | 219 | | |
220 | 220 | | |
| |||
243 | 243 | | |
244 | 244 | | |
245 | 245 | | |
246 | | - | |
| 246 | + | |
247 | 247 | | |
248 | 248 | | |
249 | 249 | | |
| |||
266 | 266 | | |
267 | 267 | | |
268 | 268 | | |
| 269 | + | |
269 | 270 | | |
270 | 271 | | |
271 | 272 | | |
| |||
283 | 284 | | |
284 | 285 | | |
285 | 286 | | |
| 287 | + | |
286 | 288 | | |
287 | 289 | | |
288 | 290 | | |
289 | | - | |
290 | | - | |
291 | 291 | | |
292 | 292 | | |
293 | 293 | | |
294 | 294 | | |
295 | | - | |
| 295 | + | |
296 | 296 | | |
297 | 297 | | |
| 298 | + | |
| 299 | + | |
| 300 | + | |
298 | 301 | | |
299 | 302 | | |
300 | 303 | | |
| |||
337 | 340 | | |
338 | 341 | | |
339 | 342 | | |
| 343 | + | |
340 | 344 | | |
341 | 345 | | |
342 | 346 | | |
343 | | - | |
344 | | - | |
345 | 347 | | |
346 | 348 | | |
347 | 349 | | |
348 | 350 | | |
349 | | - | |
| 351 | + | |
350 | 352 | | |
351 | 353 | | |
| 354 | + | |
| 355 | + | |
| 356 | + | |
352 | 357 | | |
353 | 358 | | |
354 | 359 | | |
| |||
410 | 415 | | |
411 | 416 | | |
412 | 417 | | |
| 418 | + | |
413 | 419 | | |
414 | 420 | | |
415 | 421 | | |
| |||
440 | 446 | | |
441 | 447 | | |
442 | 448 | | |
| 449 | + | |
443 | 450 | | |
444 | 451 | | |
445 | 452 | | |
| |||
471 | 478 | | |
472 | 479 | | |
473 | 480 | | |
| 481 | + | |
474 | 482 | | |
475 | 483 | | |
476 | 484 | | |
| |||
507 | 515 | | |
508 | 516 | | |
509 | 517 | | |
| 518 | + | |
510 | 519 | | |
511 | 520 | | |
512 | 521 | | |
| |||
535 | 544 | | |
536 | 545 | | |
537 | 546 | | |
| 547 | + | |
538 | 548 | | |
539 | 549 | | |
540 | 550 | | |
| |||
565 | 575 | | |
566 | 576 | | |
567 | 577 | | |
| 578 | + | |
568 | 579 | | |
569 | 580 | | |
570 | 581 | | |
| |||
603 | 614 | | |
604 | 615 | | |
605 | 616 | | |
| 617 | + | |
606 | 618 | | |
607 | 619 | | |
608 | 620 | | |
| |||
642 | 654 | | |
643 | 655 | | |
644 | 656 | | |
| 657 | + | |
645 | 658 | | |
646 | 659 | | |
647 | 660 | | |
| |||
689 | 702 | | |
690 | 703 | | |
691 | 704 | | |
| 705 | + | |
692 | 706 | | |
693 | 707 | | |
694 | 708 | | |
| |||
725 | 739 | | |
726 | 740 | | |
727 | 741 | | |
| 742 | + | |
728 | 743 | | |
729 | 744 | | |
730 | 745 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
78 | 78 | | |
79 | 79 | | |
80 | 80 | | |
81 | | - | |
| 81 | + | |
82 | 82 | | |
83 | 83 | | |
84 | 84 | | |
| |||
Lines changed: 0 additions & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
635 | 635 | | |
636 | 636 | | |
637 | 637 | | |
638 | | - | |
639 | 638 | | |
640 | 639 | | |
641 | 640 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
31 | 31 | | |
32 | 32 | | |
33 | 33 | | |
34 | | - | |
35 | | - | |
| 34 | + | |
36 | 35 | | |
37 | 36 | | |
38 | 37 | | |
| |||
Lines changed: 1 addition & 2 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
36 | 36 | | |
37 | 37 | | |
38 | 38 | | |
39 | | - | |
40 | | - | |
| 39 | + | |
41 | 40 | | |
42 | 41 | | |
43 | 42 | | |
| |||
Lines changed: 1 addition & 1 deletion
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
75 | 75 | | |
76 | 76 | | |
77 | 77 | | |
78 | | - | |
| 78 | + | |
79 | 79 | | |
80 | 80 | | |
81 | 81 | | |
| |||
0 commit comments