Skip to content

Commit bb5ecde

Browse files
Speed up more
1 parent ef4c4cb commit bb5ecde

2 files changed

Lines changed: 25 additions & 79 deletions

File tree

test/e2e/evm_full_node_e2e_test.go

Lines changed: 20 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -467,19 +467,19 @@ func TestEvmFullNodeBlockPropagationE2E(t *testing.T) {
467467
txBlockNumbers = append(txBlockNumbers, txBlockNumber)
468468
t.Logf("Transaction %d included in sequencer block %d", i+1, txBlockNumber)
469469

470-
// Vary the timing to create different block distributions
470+
// Optimized timing to create different block distributions
471471
if i < 3 {
472-
time.Sleep(100 * time.Millisecond) // Fast submissions
472+
time.Sleep(50 * time.Millisecond) // Fast submissions
473473
} else if i < 6 {
474-
time.Sleep(200 * time.Millisecond) // Medium pace
474+
time.Sleep(100 * time.Millisecond) // Medium pace
475475
} else {
476-
time.Sleep(300 * time.Millisecond) // Slower pace
476+
time.Sleep(150 * time.Millisecond) // Slower pace
477477
}
478478
}
479479

480-
// Wait for all blocks to propagate
480+
// Wait for all blocks to propagate (reduced wait time due to faster block times)
481481
t.Log("Waiting for block propagation to full node...")
482-
time.Sleep(2 * time.Second)
482+
time.Sleep(1 * time.Second)
483483

484484
// === VERIFICATION PHASE ===
485485

@@ -515,7 +515,7 @@ func TestEvmFullNodeBlockPropagationE2E(t *testing.T) {
515515
return false
516516
}
517517
return true
518-
}, 60*time.Second, 2*time.Second, "Full node should catch up to sequencer height %d", currentHeight)
518+
}, 30*time.Second, 1*time.Second, "Full node should catch up to sequencer height %d", currentHeight)
519519

520520
t.Log("Full node is synced! Verifying block propagation...")
521521

@@ -560,8 +560,8 @@ func TestEvmFullNodeBlockPropagationE2E(t *testing.T) {
560560
// Additional test: Simulate multiple full node behavior by running verification multiple times
561561
t.Log("Simulating multiple full node verification by running additional checks...")
562562

563-
// Verify state consistency multiple times to simulate different full nodes
564-
for round := 1; round <= 3; round++ {
563+
// Verify state consistency multiple times to simulate different full nodes (reduced rounds)
564+
for round := 1; round <= 2; round++ {
565565
t.Logf("Verification round %d - simulating full node %d", round, round)
566566

567567
// Check a sample of blocks each round
@@ -573,7 +573,7 @@ func TestEvmFullNodeBlockPropagationE2E(t *testing.T) {
573573
}
574574

575575
// Small delay between rounds
576-
time.Sleep(500 * time.Millisecond)
576+
time.Sleep(200 * time.Millisecond)
577577
}
578578

579579
t.Logf("✅ Test PASSED: Block propagation working correctly!")
@@ -665,7 +665,7 @@ func setupSequencerNodeLazy(t *testing.T, sut *SystemUnderTest, sequencerHome, j
665665
"--rollkit.node.block_time", DefaultBlockTime,
666666
"--rollkit.node.aggregator=true",
667667
"--rollkit.node.lazy_mode=true", // Enable lazy mode
668-
"--rollkit.node.lazy_block_interval=30s", // Set lazy block interval to 30 seconds
668+
"--rollkit.node.lazy_block_interval=10s", // Set lazy block interval to 10 seconds
669669
"--rollkit.signer.passphrase", TestPassphrase,
670670
"--home", sequencerHome,
671671
"--rollkit.da.address", DAAddress,
@@ -701,7 +701,7 @@ func verifyNoBlockProduction(t *testing.T, client *ethclient.Client, duration ti
701701
"%s should not produce new blocks during idle period (started at %d, now at %d)",
702702
nodeName, initialHeight, currentHeight)
703703

704-
time.Sleep(500 * time.Millisecond)
704+
time.Sleep(200 * time.Millisecond)
705705
}
706706

707707
t.Logf("✅ %s maintained height %d for %v (no new blocks produced)", nodeName, initialHeight, duration)
@@ -769,10 +769,10 @@ func TestEvmLazyModeSequencerE2E(t *testing.T) {
769769

770770
// === TEST LAZY MODE BEHAVIOR ===
771771

772-
// Monitor for no block production during idle period
772+
// Monitor for no block production during idle period (reduced time)
773773
t.Log("Monitoring nodes for idle block production (should be none in lazy mode)...")
774-
verifyNoBlockProduction(t, sequencerClient, 5*time.Second, "sequencer")
775-
verifyNoBlockProduction(t, fullNodeClient, 5*time.Second, "full node")
774+
verifyNoBlockProduction(t, sequencerClient, 2*time.Second, "sequencer")
775+
verifyNoBlockProduction(t, fullNodeClient, 2*time.Second, "full node")
776776

777777
// Track transactions and their blocks
778778
var txHashes []common.Hash
@@ -795,8 +795,8 @@ func TestEvmLazyModeSequencerE2E(t *testing.T) {
795795

796796
// Verify no additional blocks are produced after transaction
797797
t.Log("Monitoring for idle period after transaction 1...")
798-
verifyNoBlockProduction(t, sequencerClient, 3*time.Second, "sequencer")
799-
verifyNoBlockProduction(t, fullNodeClient, 3*time.Second, "full node")
798+
verifyNoBlockProduction(t, sequencerClient, 2*time.Second, "sequencer")
799+
verifyNoBlockProduction(t, fullNodeClient, 2*time.Second, "full node")
800800

801801
// === ROUND 2: Burst transactions ===
802802

@@ -810,7 +810,7 @@ func TestEvmLazyModeSequencerE2E(t *testing.T) {
810810
t.Logf("Transaction %d included in sequencer block %d", i+2, txBlockNumber)
811811

812812
// Small delay between transactions
813-
time.Sleep(200 * time.Millisecond)
813+
time.Sleep(20 * time.Millisecond)
814814
}
815815

816816
// Verify all transactions sync to full node
@@ -821,8 +821,8 @@ func TestEvmLazyModeSequencerE2E(t *testing.T) {
821821

822822
// Verify no additional blocks after burst
823823
t.Log("Monitoring for idle period after burst transactions...")
824-
verifyNoBlockProduction(t, sequencerClient, 4*time.Second, "sequencer")
825-
verifyNoBlockProduction(t, fullNodeClient, 4*time.Second, "full node")
824+
verifyNoBlockProduction(t, sequencerClient, 2*time.Second, "sequencer")
825+
verifyNoBlockProduction(t, fullNodeClient, 2*time.Second, "full node")
826826

827827
// === ROUND 3: Delayed transaction ===
828828

test/e2e/evm_sequencer_e2e_test.go

Lines changed: 5 additions & 59 deletions
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,6 @@ import (
3434
"context"
3535
"flag"
3636
"fmt"
37-
"os"
3837
"os/exec"
3938
"path/filepath"
4039
"testing"
@@ -159,10 +158,11 @@ func TestEvmMultipleTransactionInclusionE2E(t *testing.T) {
159158
defer client.Close()
160159

161160
// Submit multiple transactions in quick succession
162-
const numTxs = 500
161+
const numTxs = 200
163162
var txHashes []common.Hash
164163
var expectedNonces []uint64
165164
lastNonce := uint64(0)
165+
ctx := context.Background()
166166

167167
t.Logf("Submitting %d transactions in quick succession...", numTxs)
168168
for i := 0; i < numTxs; i++ {
@@ -179,11 +179,10 @@ func TestEvmMultipleTransactionInclusionE2E(t *testing.T) {
179179
}
180180

181181
// Optimized delay for faster test execution while maintaining reliability
182-
time.Sleep(10 * time.Millisecond)
182+
time.Sleep(50 * time.Millisecond)
183183
}
184184

185185
// Wait for all transactions to be included and verify order
186-
ctx := context.Background()
187186
var receipts []*common.Hash
188187

189188
t.Log("Waiting for all transactions to be included...")
@@ -206,7 +205,7 @@ func TestEvmMultipleTransactionInclusionE2E(t *testing.T) {
206205
}
207206

208207
return len(receipts) == numTxs
209-
}, 120*time.Second, 2*time.Second, "All transactions should be included")
208+
}, 60*time.Second, 1*time.Second, "All transactions should be included")
210209

211210
t.Logf("✅ All %d transactions were successfully included", numTxs)
212211

@@ -781,31 +780,7 @@ func TestEvmSequencerRestartRecoveryE2E(t *testing.T) {
781780

782781
// Wait for graceful shutdown to allow state to be saved
783782
t.Log("Waiting for graceful shutdown and state persistence...")
784-
time.Sleep(3 * time.Second)
785-
786-
// Debug: Check if data was written to disk
787-
t.Logf("Checking node home directory: %s", nodeHome)
788-
if files, err := os.ReadDir(nodeHome); err == nil {
789-
t.Logf("Files in node home after shutdown:")
790-
for _, file := range files {
791-
t.Logf(" - %s (dir: %v)", file.Name(), file.IsDir())
792-
793-
// If it's the data directory, check its contents
794-
if file.Name() == "data" && file.IsDir() {
795-
dataDir := filepath.Join(nodeHome, "data")
796-
if dataFiles, err := os.ReadDir(dataDir); err == nil {
797-
t.Logf(" Files in data directory:")
798-
for _, dataFile := range dataFiles {
799-
t.Logf(" - %s (dir: %v)", dataFile.Name(), dataFile.IsDir())
800-
}
801-
} else {
802-
t.Logf(" Error reading data directory: %v", err)
803-
}
804-
}
805-
}
806-
} else {
807-
t.Logf("Error reading node home directory: %v", err)
808-
}
783+
time.Sleep(2 * time.Second)
809784

810785
// Check if process is still running and force kill if needed
811786
checkCmd := exec.Command("pgrep", "-f", "evm-single")
@@ -834,32 +809,7 @@ func TestEvmSequencerRestartRecoveryE2E(t *testing.T) {
834809

835810
t.Log("Phase 3: Restarting sequencer node (testing state synchronization)...")
836811

837-
// Debug: Check if data is still there before restart
838-
t.Logf("Checking node home directory before restart: %s", nodeHome)
839-
if files, err := os.ReadDir(nodeHome); err == nil {
840-
t.Logf("Files in node home before restart:")
841-
for _, file := range files {
842-
t.Logf(" - %s (dir: %v)", file.Name(), file.IsDir())
843-
844-
// If it's the data directory, check its contents
845-
if file.Name() == "data" && file.IsDir() {
846-
dataDir := filepath.Join(nodeHome, "data")
847-
if dataFiles, err := os.ReadDir(dataDir); err == nil {
848-
t.Logf(" Files in data directory before restart:")
849-
for _, dataFile := range dataFiles {
850-
t.Logf(" - %s (dir: %v)", dataFile.Name(), dataFile.IsDir())
851-
}
852-
} else {
853-
t.Logf(" Error reading data directory before restart: %v", err)
854-
}
855-
}
856-
}
857-
} else {
858-
t.Logf("Error reading node home directory before restart: %v", err)
859-
}
860-
861812
// Restart the sequencer node with the same configuration
862-
// This is where the state synchronization fix is tested
863813
restartSequencerNode(t, sut, nodeHome, jwtSecret, genesisHash)
864814

865815
t.Log("Sequencer node restarted successfully")
@@ -993,9 +943,5 @@ func restartSequencerNode(t *testing.T, sut *SystemUnderTest, sequencerHome, jwt
993943
// Give the node a moment to start before checking
994944
time.Sleep(2 * time.Second)
995945

996-
// Print logs for debugging
997-
t.Log("Restart logs:")
998-
sut.PrintBuffer()
999-
1000946
sut.AwaitNodeUp(t, RollkitRPCAddress, 10*time.Second)
1001947
}

0 commit comments

Comments
 (0)