Skip to content

Commit 05dddf8

Browse files
committed
fix test
1 parent f631efd commit 05dddf8

File tree

1 file changed

+14
-9
lines changed

1 file changed

+14
-9
lines changed

node/full_node_integration_test.go

Lines changed: 14 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -134,12 +134,12 @@ func TestTxGossipingMultipleNodesDAIncluded(t *testing.T) {
134134
func TestFastDASync(t *testing.T) {
135135
require := require.New(t)
136136

137-
// Set up two nodes with different block and DA block times
137+
// Set up two nodes where DA is faster than block production
138138
config := getTestConfig(t, 1)
139-
// Set the block time to 2 seconds and the DA block time to 1 second
140-
// Note: these are large values to avoid test failures due to slow CI machines
141-
config.Node.BlockTime = evconfig.DurationWrapper{Duration: 2 * time.Second}
142-
config.DA.BlockTime = evconfig.DurationWrapper{Duration: 1 * time.Second}
139+
// Slow block production (sequencer takes 1s per block)
140+
config.Node.BlockTime = evconfig.DurationWrapper{Duration: 1 * time.Second}
141+
// Fast DA availability (DA makes blocks available every 200ms)
142+
config.DA.BlockTime = evconfig.DurationWrapper{Duration: 200 * time.Millisecond}
143143

144144
nodes, cleanups := createNodesWithCleanup(t, 2, config)
145145
for _, cleanup := range cleanups {
@@ -165,10 +165,15 @@ func TestFastDASync(t *testing.T) {
165165
// Wait for the second node to catch up to the first node
166166
require.NoError(waitForAtLeastNBlocks(nodes[1], blocksToWaitFor, Store))
167167
syncDuration := time.Since(start)
168-
169-
// Ensure node syncs within a small delta of DA block time
170-
delta := 250 * time.Millisecond
171-
require.Less(syncDuration, config.DA.BlockTime.Duration+delta, "Block sync should be faster than DA block time")
168+
// The key test: sync should be much faster than sequential block production time
169+
// Since DA provides blocks faster than sequencer block time, sync should complete
170+
// in significantly less time than it took the sequencer to produce them sequentially
171+
expectedSequentialTime := time.Duration(blocksToWaitFor) * config.Node.BlockTime.Duration
172+
maxReasonableSyncTime := expectedSequentialTime / 3 // Should be at least 3x faster than sequential
173+
174+
require.Less(syncDuration, maxReasonableSyncTime,
175+
"DA fast sync took %v, should be much faster than sequential block time %v (max reasonable: %v). ",
176+
syncDuration, expectedSequentialTime, maxReasonableSyncTime)
172177

173178
// Verify both nodes are synced and that the synced block is DA-included
174179
assertAllNodesSynced(t, nodes, blocksToWaitFor)

0 commit comments

Comments
 (0)