Repository navigation
p2p: scale block-count thresholds by the live slot length for HF16 - #183
Conversation
FORWARD_FALLBEHIND_THRESHOLD (2), FORK_RESOLUTION_BLOCK_THRESHOLD (42) and WEDGE_BEHIND_THRESHOLD (200) were written for 3 s slots. After HF16 the same block counts cover one third of the time: a node 3 blocks (3 s) behind a peer dropped into SYNC and stopped producing via is_syncing(). The delegate now exposes database::block_interval(); dlt_p2p_node multiplies the three thresholds by CHAIN_BLOCK_INTERVAL / interval (1 before HF16, 3 after). is_wedged() takes the threshold as a defaulted parameter so the truth-table test keeps its symbolic boundaries and gains the scaled case. Docs: snapshot.md notes that block-count options cover 1/3 of the time after HF16 and that dlt-block-log-max-blocks 100000 serves peer sync for ~28 h (300000 keeps 3.5 days); hf16.md gets the operator paragraph. Stale "21 blocks = 63s" comment in validator.cpp fixed.
|
Compatibility follow-up with #182, rechecked at The updated branch includes merged #182. The threshold scaling complements the finality, production and vote-cache fixes; I found no conflicting change in the reviewed paths. The previously noted unguarded hardfork-state read is addressed: One remaining test improvement: the SYNC/fork boundary assertions in the fixture embed This is a scoped source/fixture recheck, not a concurrent remap or whole-node recovery stress test. Please use the complete native CI results for the updated, #182-inclusive head as the merge gate. |
On1x
left a comment
There was a problem hiding this comment.
Reviewed the complete change against master, including PR #182. The live-slot scaling preserves the intended wall-clock P2P thresholds across HF16. The delegate now reads the interval under the database read guard and retains the last valid atomic cached value during transient database unavailability. Added regression coverage exercises the actual delegate and threshold methods across 3s/1s transitions, failed reads, invalid values, and boundary conditions.
Own isolated Docker regressions passed. GitHub Tests run 40170943020 and Docker run 40170942979 passed for exact head c36d642, including the full single-validator simulator, targeted two-validator suites, and PM unit tests. This review does not claim a production rollout or a full 21-validator adversarial campaign.
|
Pushed 607ca80 on top of c36d642, two unrelated-to-P2P HF16 items from the same audit:
Snapshot TU syntax-checked locally with the recorded flags. Nothing changed in the P2P paths. |
What
HF16 switches slots from 3 s to 1 s. Three P2P thresholds are block counts written for 3 s slots and were not rescaled:
FORWARD_FALLBEHIND_THRESHOLDFORK_RESOLUTION_BLOCK_THRESHOLDWEDGE_BEHIND_THRESHOLDA node 3 blocks behind a peer enters SYNC mode and stops producing through
is_syncing(). At 1 s slots that is a 3 s lag.Change
dlt_p2p_delegate::block_interval()(defaultCHAIN_BLOCK_INTERVAL), implemented inp2p_plugin.cppwith a guarded chain read and an atomic last-known interval. Temporary lock/resize/recovery failures retain the cache and retry on the next call, without unwinding P2P.dlt_p2p_node::slot_scale()=CHAIN_BLOCK_INTERVAL / interval(1 before HF16, 3 after). The three thresholds are multiplied at their use sites. Constants and log output unchanged otherwise.is_wedged()takesbehind_thresholdas a defaulted parameter;test_wedge_predicate.cppgains the scaled boundary.snapshot.md(en/ru/zh-CN) notes that block-count options cover one third of the time after HF16 and thatdlt-block-log-max-blocks = 100000serves peer sync for ~28 h (300000 keeps 3.5 days).hf16.md(en/ru) gets the operator paragraph.validator.cpp:344stale comment "21 blocks = 63s" fixed. Defaultfork-collision-timeout-blocksstays 21 (one round).Verification
dlt_p2p_node.cppandp2p_plugin.cppsyntax-checked with the recorded compile flags (arm64 host, no link).test_wedge_predicateruns in CI (consensus_sim).Not changed
dlt-block-log-max-blocksdefault stays 100000; raising it triples disk use for existing operators. Documented instead.Maintainer acceptance follow-up
Merged current master (including #182) into this branch. Removed the unguarded hardfork-state read from the delegate. Added
tests/p2p/test_slot_interval.pyto CI: it compiles the actual delegate/scale/predicate methods against a guarded DB fixture and verifies 3→1→3, initial/read failure fallback, invalid interval and all three threshold boundaries. Independently repeated this and vote-ingress, signing-cache, snapshot-restore, production-safety and archive-merge regressions inside Docker; all passed. Full native CI on the updated head is required before merge.