Skip to content

test(p2p): handler-level check of HF16 slot_scale thresholds - #196

Merged
On1x merged 1 commit into
masterfrom
test/hf16-p2p-handler-scale
Oct 27, 2026
Merged

On1x merged 1 commit into
masterfrom
test/hf16-p2p-handler-scale

Conversation

@chiliec

@chiliec chiliec commented Oct 27, 2026

Copy link
Copy Markdown
Member

Follow-up to #183 (deferred item from the HF16 audit). tests/p2p/test_slot_interval.py pins the slot_scale arithmetic; this drives the real handlers.

tests/consensus_sim/scenarios/test_p2p_slot_scale.cpp runs a dlt_p2p_node with a mock delegate at block_interval 3 and 1:

handler 3 s 1 s
check_forward_behind SYNC above 2 blocks behind SYNC above 6
check_sync_catchup stays SYNC above 2 unlinked ahead above 6
track_fork_state resolves at 42 blocks at 126

No sockets: send_message is a no-op without a connection, exchange_enabled=false keeps block requests out. Not BUILD_TESTNET-gated, so the default consensus_sim ctest in CI runs it.

Production change: one friend struct dlt_p2p_node_test_access; in dlt_p2p_node.hpp.

Verified locally (amd64 Docker, testnet build): passes; removing * slot_scale() from check_forward_behind or track_fork_state fails the matching case.

Not covered: on_dlt_hello_reply and request_blocks_from_peer sites (need a connected peer).

check_forward_behind, check_sync_catchup and track_fork_state run on a real
dlt_p2p_node at 3 s and 1 s slots and must keep the 6 s / 126 s wall-clock
thresholds. No sockets. Production change: one friend declaration.
@On1x
On1x merged commit 1fb62b2 into master Oct 27, 2026
6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants