diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 9d87609c0..2d67968ea 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,6 +159,13 @@ jobs: export PATH="$GITHUB_WORKSPACE/rust/target/debug:$PATH" bash ./test.sh + - name: Sync miner blocks between local nodes + working-directory: tests/network/04-sync-miner-blocks + timeout-minutes: 5 + run: | + export PATH="$GITHUB_WORKSPACE/rust/target/debug:$PATH" + bash ./test.sh + - name: Mine and persist a local block working-directory: tests/network/05-mining timeout-minutes: 6 diff --git a/docs/roadmaps/roadmap.md b/docs/roadmaps/roadmap.md index a13b39ec3..a10ceddcd 100644 --- a/docs/roadmaps/roadmap.md +++ b/docs/roadmaps/roadmap.md @@ -38,7 +38,9 @@ For live access, start with [Join the public testnet](../cli/join-testnet.md). and workspace Clippy. These cover network crates as workspace members. CI also builds `modal` and runs the numbered `01-ping-node` and `02-run-devnet1` scenarios: the first boots and pings from a second node, - the second certifies a local static-sequencer round, and `05-mining` mines, + the second certifies a local static-sequencer round, `04-sync-miner-blocks` + syncs 120 fixture blocks between local nodes and checks duplicate syncs are + no-ops, and `05-mining` mines, inspects, persists, and resumes a solo devnet block. The remaining numbered scenarios are not yet CI gates. - [x] A small [hybrid consensus experiment](../../experiments/hybrid-consensus/README.md) diff --git a/tests/network/04-sync-miner-blocks/configs/node1.json b/tests/network/04-sync-miner-blocks/configs/node1.json index 534316bb1..e99a43b36 100644 --- a/tests/network/04-sync-miner-blocks/configs/node1.json +++ b/tests/network/04-sync-miner-blocks/configs/node1.json @@ -1,6 +1,6 @@ { + "config_version": 2, "passfile_path": "../../../../fixtures/passfiles/node1.mod_passfile", "data_dir": "../tmp/storage/node1", "listeners": ["/ip4/0.0.0.0/tcp/10201/ws"] } - diff --git a/tests/network/04-sync-miner-blocks/configs/node2.json b/tests/network/04-sync-miner-blocks/configs/node2.json index a524be95d..564de54b6 100644 --- a/tests/network/04-sync-miner-blocks/configs/node2.json +++ b/tests/network/04-sync-miner-blocks/configs/node2.json @@ -1,6 +1,6 @@ { + "config_version": 2, "passfile_path": "../../../../fixtures/passfiles/node2.mod_passfile", "storage_path": "../tmp/storage/node2", "listeners": ["/ip4/0.0.0.0/tcp/10202/ws"] } - diff --git a/tests/network/04-sync-miner-blocks/test.sh b/tests/network/04-sync-miner-blocks/test.sh index 63455e887..61f0644de 100755 --- a/tests/network/04-sync-miner-blocks/test.sh +++ b/tests/network/04-sync-miner-blocks/test.sh @@ -60,57 +60,40 @@ assert_output_contains \ "Total Blocks" \ "Node2 should have synced blocks" -# Test 7: Test epoch sync +# Test 7: Re-sync the complete chain without clearing node2. It must be a no-op. echo "" -echo "Test 7: Testing epoch sync..." +echo "Test 7: Testing sync idempotency..." +assert_output_contains \ + "./03-sync-all-blocks.sh" \ + "Blocks persisted: 0" \ + "Re-sync should not persist duplicate blocks" + +# Test 8: Test epoch sync +echo "" +echo "Test 8: Testing epoch sync..." rm -rf ./configs/tmp/storage/node2 2>/dev/null || true rm -rf ./tmp/storage/node2 2>/dev/null || true assert_success \ "./04-sync-epoch.sh 0" \ "Sync epoch 0 should succeed" -# Test 8: Test range sync +# Test 9: Test range sync echo "" -echo "Test 8: Testing range sync..." +echo "Test 9: Testing range sync..." rm -rf ./configs/tmp/storage/node2 2>/dev/null || true rm -rf ./tmp/storage/node2 2>/dev/null || true assert_success \ "./05-sync-range.sh 0 10" \ "Sync range 0-10 should succeed" -# Test 9: Test JSON output +# Test 10: Test JSON output echo "" -echo "Test 9: Testing JSON output format..." +echo "Test 10: Testing JSON output format..." assert_output_contains \ "./06-view-blocks-json.sh" \ "blocks" \ "JSON output should contain blocks field" -# Test 10: Test idempotency (re-sync should skip duplicates) -echo "" -echo "Test 10: Testing sync idempotency..." -RESYNC_OUTPUT=$(./03-sync-all-blocks.sh 2>&1 || true) -echo "Re-sync output: $RESYNC_OUTPUT" >> "$CURRENT_LOG" -# Re-syncing should either show "Blocks persisted: 0" (all skipped) or show some skipped blocks -# The format is "Blocks persisted: N" where N should be 0 for fully idempotent sync -if echo "$RESYNC_OUTPUT" | grep -q "Blocks persisted: 0"; then - TESTS_RUN=$((TESTS_RUN + 1)) - TESTS_PASSED=$((TESTS_PASSED + 1)) - echo -e " ${GREEN}✓${NC} Re-sync should skip duplicate blocks" -else - # Check if some blocks were skipped (partial idempotency is acceptable for now) - PERSISTED=$(echo "$RESYNC_OUTPUT" | grep "Blocks persisted:" | sed -E 's/.*Blocks persisted: ([0-9]+).*/\1/' || echo "") - if [ ! -z "$PERSISTED" ] && [ "$PERSISTED" -lt 120 ]; then - TESTS_RUN=$((TESTS_RUN + 1)) - TESTS_PASSED=$((TESTS_PASSED + 1)) - echo -e " ${GREEN}✓${NC} Re-sync partially skipped duplicate blocks ($PERSISTED/120 persisted)" - else - TESTS_RUN=$((TESTS_RUN + 1)) - TESTS_FAILED=$((TESTS_FAILED + 1)) - echo -e " ${RED}✗${NC} Re-sync should skip duplicate blocks" - fi -fi - # Finalize test test_finalize exit $?