Skip to content

Commit e129aeb

Browse files
committed
fix(test): simplify withdrawal test after respectedGameType fix
- Remove WaitForGameOfType workaround (no longer needed) - Use WaitForGameCount(1) since respectedGameType is now correctly set to 42 in the submodule The root cause (respectedGameType mismatch) is fixed in the optimism submodule: succinctlabs/optimism#330
1 parent e456b89 commit e129aeb

File tree

2 files changed

+5
-38
lines changed

2 files changed

+5
-38
lines changed

tests/e2e/faultproof/withdrawal/withdrawal_finalized_test.go

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,7 @@ func TestFaultProofProposer_WithdrawalFinalized(gt *testing.T) {
3636
l2User.VerifyBalanceExact(depositAmount)
3737

3838
// Log respected game type for debugging
39-
respectedGameType := bridge.RespectedGameType()
40-
logger.Info("Using respected game type", "gameType", respectedGameType)
39+
logger.Info("Using respected game type", "gameType", bridge.RespectedGameType())
4140

4241
// Phase 1: Initiate withdrawal on L2
4342
logger.Info("Phase 1: Initiating withdrawal on L2")
@@ -48,14 +47,13 @@ func TestFaultProofProposer_WithdrawalFinalized(gt *testing.T) {
4847
expectedL2UserBalance := depositAmount.Sub(withdrawAmount).Sub(withdrawal.InitiateGasCost())
4948
l2User.VerifyBalanceExact(expectedL2UserBalance)
5049

51-
// Wait for a game of the required type to be created before proving.
52-
// The system may have games of other types (e.g., permissioned type 0),
53-
// but the FP proposer creates games of the respected type.
50+
// Wait for at least one game to be created before proving.
51+
// The FP proposer needs time to batch L2 blocks and create games.
5452
dgf := sys.DgfClient(t)
5553
ctx, cancel := context.WithTimeout(t.Ctx(), utils.ShortTimeout())
5654
defer cancel()
57-
logger.Info("Waiting for game of required type")
58-
utils.WaitForGameOfType(ctx, t, dgf, respectedGameType)
55+
logger.Info("Waiting for dispute game creation")
56+
utils.WaitForGameCount(ctx, t, dgf, 1)
5957

6058
// Phase 2: Prove withdrawal on L1
6159
logger.Info("Phase 2: Proving withdrawal on L1")

tests/utils/adapters.go

Lines changed: 0 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -185,37 +185,6 @@ func WaitForGameCount(ctx context.Context, t devtest.T, dgf *DgfClient, min uint
185185
}
186186
}
187187

188-
// WaitForGameOfType waits until a dispute game of the specified type exists.
189-
// This is needed because the system may have games of other types (e.g., permissioned type 0)
190-
// while the FP proposer creates games of type 1.
191-
func WaitForGameOfType(ctx context.Context, t devtest.T, dgf *DgfClient, gameType uint32) {
192-
for {
193-
gameCount, err := dgf.GameCount(ctx)
194-
require.NoError(t, err, "failed to get game count from factory")
195-
196-
// Check all games (newest first) for matching type
197-
for i := int64(gameCount) - 1; i >= 0; i-- {
198-
game, err := dgf.GameAtIndex(ctx, uint64(i))
199-
if err != nil {
200-
continue
201-
}
202-
if game.GameType == gameType {
203-
t.Logger().Info("Found game of required type", "index", i, "gameType", gameType)
204-
return
205-
}
206-
}
207-
208-
t.Logger().Info("Waiting for game of required type...", "gameType", gameType, "totalGames", gameCount)
209-
210-
select {
211-
case <-ctx.Done():
212-
t.Errorf("timeout waiting for game of type %d", gameType)
213-
t.FailNow()
214-
case <-time.After(time.Second):
215-
}
216-
}
217-
}
218-
219188
// -------------------------------------------------------------
220189
// Fault Dispute Game Client
221190
// -------------------------------------------------------------

0 commit comments

Comments
 (0)