Commit eb3a9ce
fix: cap channel-owner hints per verification to bound the shared event-id budget
An Ethereum verification for an address owning many channels emitted one
ChannelOwnerChangeHint per owned channel, unbounded. Each hint draws an id from
the block-scoped 14-bit HubEvent sequence (16384 events/block) that the hook
shares with the merge loop and the mandatory BlockConfirmed commit. Verifications
sort to priority 1, so a single verification against an address owning ~16k
channels (accumulated over prior blocks) could exhaust the block's event-id
budget: later message merges then fail via commit_transaction and drop from the
shard root (deterministic censorship), and BlockConfirmed's commit unwrap panics
on the overflow, halting nodes on replay.
Cap the fan-out at MAX_CHANNEL_OWNER_HINTS_PER_VERIFICATION = 256 (~1.5% of the
block budget, far above any plausible single-owner channel count). On exceeding
the cap the scan warns once and stops in ascending key order, so which channels
survive truncation is deterministic across nodes. Truncation is contract-legal:
a shard is already not guaranteed to carry every hint, and consumers reconcile
the full owner set via GetChannelOwner. The public hook becomes a thin wrapper
over a cap-parameterized seam so tests can drive the cap at a small value; the
merge-loop call site and the swallow-all-errors contract are unchanged. The
pre-existing BlockConfirmed unwrap-on-overflow is left as a separate follow-up.
Also folds in review hardening on the same hook: a decode helper dedup in the
tests, a malformed/None/wrong-variant body no-panic test, and doc-comment
accuracy fixes. New tests pin cap truncation, its trie-inertness, and that a cap
above the owned count still emits every hint.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>1 parent 8dbd61e commit eb3a9ce
2 files changed
Lines changed: 256 additions & 32 deletions
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
803 | 803 | | |
804 | 804 | | |
805 | 805 | | |
| 806 | + | |
| 807 | + | |
| 808 | + | |
| 809 | + | |
| 810 | + | |
| 811 | + | |
| 812 | + | |
| 813 | + | |
| 814 | + | |
| 815 | + | |
806 | 816 | | |
807 | 817 | | |
808 | 818 | | |
809 | 819 | | |
810 | 820 | | |
811 | 821 | | |
812 | 822 | | |
813 | | - | |
814 | | - | |
815 | | - | |
816 | | - | |
817 | | - | |
818 | | - | |
819 | | - | |
| 823 | + | |
| 824 | + | |
| 825 | + | |
| 826 | + | |
| 827 | + | |
| 828 | + | |
| 829 | + | |
| 830 | + | |
| 831 | + | |
| 832 | + | |
| 833 | + | |
| 834 | + | |
| 835 | + | |
| 836 | + | |
| 837 | + | |
| 838 | + | |
| 839 | + | |
| 840 | + | |
| 841 | + | |
| 842 | + | |
| 843 | + | |
| 844 | + | |
| 845 | + | |
| 846 | + | |
| 847 | + | |
| 848 | + | |
| 849 | + | |
| 850 | + | |
820 | 851 | | |
821 | 852 | | |
822 | 853 | | |
| |||
837 | 868 | | |
838 | 869 | | |
839 | 870 | | |
| 871 | + | |
| 872 | + | |
| 873 | + | |
| 874 | + | |
| 875 | + | |
| 876 | + | |
| 877 | + | |
| 878 | + | |
| 879 | + | |
| 880 | + | |
| 881 | + | |
| 882 | + | |
| 883 | + | |
| 884 | + | |
| 885 | + | |
| 886 | + | |
| 887 | + | |
| 888 | + | |
| 889 | + | |
| 890 | + | |
| 891 | + | |
840 | 892 | | |
841 | 893 | | |
842 | 894 | | |
| |||
888 | 940 | | |
889 | 941 | | |
890 | 942 | | |
891 | | - | |
892 | | - | |
893 | | - | |
894 | | - | |
895 | | - | |
896 | | - | |
| 943 | + | |
| 944 | + | |
| 945 | + | |
| 946 | + | |
| 947 | + | |
| 948 | + | |
| 949 | + | |
897 | 950 | | |
898 | 951 | | |
899 | | - | |
| 952 | + | |
900 | 953 | | |
901 | 954 | | |
902 | 955 | | |
| |||
919 | 972 | | |
920 | 973 | | |
921 | 974 | | |
| 975 | + | |
| 976 | + | |
| 977 | + | |
| 978 | + | |
| 979 | + | |
| 980 | + | |
| 981 | + | |
| 982 | + | |
| 983 | + | |
| 984 | + | |
| 985 | + | |
| 986 | + | |
| 987 | + | |
| 988 | + | |
| 989 | + | |
| 990 | + | |
922 | 991 | | |
923 | 992 | | |
924 | 993 | | |
| |||
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
| |||
5090 | 5090 | | |
5091 | 5091 | | |
5092 | 5092 | | |
| 5093 | + | |
| 5094 | + | |
| 5095 | + | |
| 5096 | + | |
| 5097 | + | |
| 5098 | + | |
| 5099 | + | |
| 5100 | + | |
| 5101 | + | |
| 5102 | + | |
5093 | 5103 | | |
5094 | 5104 | | |
5095 | 5105 | | |
5096 | 5106 | | |
5097 | 5107 | | |
5098 | | - | |
5099 | | - | |
5100 | | - | |
5101 | | - | |
5102 | | - | |
5103 | | - | |
5104 | | - | |
| 5108 | + | |
| 5109 | + | |
| 5110 | + | |
| 5111 | + | |
5105 | 5112 | | |
5106 | 5113 | | |
5107 | 5114 | | |
| |||
5112 | 5119 | | |
5113 | 5120 | | |
5114 | 5121 | | |
5115 | | - | |
5116 | | - | |
5117 | | - | |
5118 | | - | |
| 5122 | + | |
5119 | 5123 | | |
5120 | 5124 | | |
5121 | 5125 | | |
| |||
5393 | 5397 | | |
5394 | 5398 | | |
5395 | 5399 | | |
| 5400 | + | |
| 5401 | + | |
| 5402 | + | |
| 5403 | + | |
| 5404 | + | |
| 5405 | + | |
| 5406 | + | |
| 5407 | + | |
| 5408 | + | |
| 5409 | + | |
| 5410 | + | |
| 5411 | + | |
| 5412 | + | |
| 5413 | + | |
| 5414 | + | |
| 5415 | + | |
| 5416 | + | |
| 5417 | + | |
| 5418 | + | |
| 5419 | + | |
| 5420 | + | |
| 5421 | + | |
| 5422 | + | |
| 5423 | + | |
| 5424 | + | |
| 5425 | + | |
| 5426 | + | |
| 5427 | + | |
| 5428 | + | |
| 5429 | + | |
| 5430 | + | |
| 5431 | + | |
| 5432 | + | |
| 5433 | + | |
| 5434 | + | |
| 5435 | + | |
| 5436 | + | |
| 5437 | + | |
| 5438 | + | |
| 5439 | + | |
| 5440 | + | |
| 5441 | + | |
| 5442 | + | |
| 5443 | + | |
| 5444 | + | |
| 5445 | + | |
| 5446 | + | |
| 5447 | + | |
| 5448 | + | |
| 5449 | + | |
| 5450 | + | |
| 5451 | + | |
| 5452 | + | |
| 5453 | + | |
| 5454 | + | |
| 5455 | + | |
| 5456 | + | |
| 5457 | + | |
| 5458 | + | |
| 5459 | + | |
| 5460 | + | |
| 5461 | + | |
| 5462 | + | |
| 5463 | + | |
| 5464 | + | |
| 5465 | + | |
| 5466 | + | |
| 5467 | + | |
| 5468 | + | |
| 5469 | + | |
| 5470 | + | |
| 5471 | + | |
| 5472 | + | |
| 5473 | + | |
| 5474 | + | |
| 5475 | + | |
| 5476 | + | |
| 5477 | + | |
| 5478 | + | |
| 5479 | + | |
| 5480 | + | |
| 5481 | + | |
| 5482 | + | |
| 5483 | + | |
| 5484 | + | |
| 5485 | + | |
| 5486 | + | |
| 5487 | + | |
| 5488 | + | |
| 5489 | + | |
| 5490 | + | |
| 5491 | + | |
| 5492 | + | |
| 5493 | + | |
| 5494 | + | |
| 5495 | + | |
| 5496 | + | |
| 5497 | + | |
| 5498 | + | |
| 5499 | + | |
| 5500 | + | |
| 5501 | + | |
| 5502 | + | |
| 5503 | + | |
| 5504 | + | |
| 5505 | + | |
| 5506 | + | |
| 5507 | + | |
| 5508 | + | |
| 5509 | + | |
| 5510 | + | |
| 5511 | + | |
| 5512 | + | |
| 5513 | + | |
| 5514 | + | |
| 5515 | + | |
| 5516 | + | |
| 5517 | + | |
| 5518 | + | |
| 5519 | + | |
| 5520 | + | |
| 5521 | + | |
| 5522 | + | |
| 5523 | + | |
| 5524 | + | |
| 5525 | + | |
| 5526 | + | |
| 5527 | + | |
| 5528 | + | |
| 5529 | + | |
| 5530 | + | |
| 5531 | + | |
| 5532 | + | |
| 5533 | + | |
| 5534 | + | |
| 5535 | + | |
| 5536 | + | |
| 5537 | + | |
| 5538 | + | |
| 5539 | + | |
| 5540 | + | |
| 5541 | + | |
| 5542 | + | |
| 5543 | + | |
| 5544 | + | |
| 5545 | + | |
| 5546 | + | |
| 5547 | + | |
| 5548 | + | |
| 5549 | + | |
| 5550 | + | |
| 5551 | + | |
| 5552 | + | |
| 5553 | + | |
| 5554 | + | |
| 5555 | + | |
| 5556 | + | |
5396 | 5557 | | |
5397 | 5558 | | |
5398 | 5559 | | |
| |||
5444 | 5605 | | |
5445 | 5606 | | |
5446 | 5607 | | |
5447 | | - | |
5448 | | - | |
5449 | | - | |
5450 | | - | |
5451 | | - | |
5452 | | - | |
5453 | | - | |
| 5608 | + | |
5454 | 5609 | | |
5455 | 5610 | | |
5456 | 5611 | | |
| |||
0 commit comments