Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
4 changes: 3 additions & 1 deletion docs/roadmaps/roadmap.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
2 changes: 1 addition & 1 deletion tests/network/04-sync-miner-blocks/configs/node1.json
Original file line number Diff line number Diff line change
@@ -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"]
}

2 changes: 1 addition & 1 deletion tests/network/04-sync-miner-blocks/configs/node2.json
Original file line number Diff line number Diff line change
@@ -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"]
}

45 changes: 14 additions & 31 deletions tests/network/04-sync-miner-blocks/test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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 $?
Expand Down
Loading