|
|
@ -359,7 +359,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
assert.Equal(t, false, stats.Synced()) |
|
|
|
|
|
|
|
// Test Sync for rollup genesis block
|
|
|
|
syncBlock, discards, err := s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err := s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
require.NotNil(t, syncBlock) |
|
|
@ -382,7 +382,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
assert.Equal(t, int64(1), dbBlocks[1].Num) |
|
|
|
|
|
|
|
// Sync again and expect no new blocks
|
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
require.Nil(t, syncBlock) |
|
|
@ -479,7 +479,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
|
|
|
|
// Block 2
|
|
|
|
|
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
require.NotNil(t, syncBlock) |
|
|
@ -496,7 +496,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
|
|
|
|
// Block 3
|
|
|
|
|
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
assert.NoError(t, err) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
@ -520,7 +520,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
require.NoError(t, err) |
|
|
|
client.CtlMineBlock() |
|
|
|
|
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
require.NotNil(t, syncBlock) |
|
|
@ -571,7 +571,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
|
|
|
|
client.CtlMineBlock() |
|
|
|
|
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
require.NotNil(t, syncBlock) |
|
|
@ -656,7 +656,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
// First sync detects the reorg and discards 4 blocks
|
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
expetedDiscards := int64(4) |
|
|
|
require.Equal(t, &expetedDiscards, discards) |
|
|
@ -684,7 +684,7 @@ func TestSyncGeneral(t *testing.T) { |
|
|
|
|
|
|
|
// Sync blocks 2-6
|
|
|
|
for i := 0; i < 5; i++ { |
|
|
|
syncBlock, discards, err = s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err = s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
require.NotNil(t, syncBlock) |
|
|
@ -807,7 +807,7 @@ func TestSyncForgerCommitment(t *testing.T) { |
|
|
|
|
|
|
|
// be in sync
|
|
|
|
for { |
|
|
|
syncBlock, discards, err := s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err := s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
if syncBlock == nil { |
|
|
@ -826,7 +826,7 @@ func TestSyncForgerCommitment(t *testing.T) { |
|
|
|
err = client.CtlAddBlocks([]common.BlockData{block}) |
|
|
|
require.NoError(t, err) |
|
|
|
|
|
|
|
syncBlock, discards, err := s.Sync2(ctx, nil) |
|
|
|
syncBlock, discards, err := s.Sync(ctx, nil) |
|
|
|
require.NoError(t, err) |
|
|
|
require.Nil(t, discards) |
|
|
|
if syncBlock == nil { |
|
|
|