Skip to content

Commit 8faf87a

Browse files
committed
op-e2e: Expose methods for asterisc e2e
1 parent c5fc25f commit 8faf87a

File tree

7 files changed

+38
-38
lines changed

7 files changed

+38
-38
lines changed

op-e2e/e2eutils/challenger/helper.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -76,9 +76,9 @@ func WithPollInterval(pollInterval time.Duration) Option {
7676
}
7777
}
7878

79-
// findMonorepoRoot finds the relative path to the monorepo root
79+
// FindMonorepoRoot finds the relative path to the monorepo root
8080
// Different tests might be nested in subdirectories of the op-e2e dir.
81-
func findMonorepoRoot(t *testing.T) string {
81+
func FindMonorepoRoot(t *testing.T) string {
8282
path := "./"
8383
// Only search up 5 directories
8484
// Avoids infinite recursion if the root isn't found for some reason
@@ -104,7 +104,7 @@ func applyCannonConfig(
104104
) {
105105
require := require.New(t)
106106
c.L2Rpc = l2Endpoint
107-
root := findMonorepoRoot(t)
107+
root := FindMonorepoRoot(t)
108108
c.CannonBin = root + "cannon/bin/cannon"
109109
c.CannonServer = root + "op-program/bin/op-program"
110110
c.CannonAbsolutePreState = root + "op-program/bin/prestate.json"

op-e2e/faultproofs/challenge_preimage_test.go

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ import (
1515
func TestChallengeLargePreimages_ChallengeFirst(t *testing.T) {
1616
op_e2e.InitParallel(t)
1717
ctx := context.Background()
18-
sys, _ := startFaultDisputeSystem(t)
18+
sys, _ := StartFaultDisputeSystem(t)
1919
t.Cleanup(sys.Close)
2020

2121
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -34,7 +34,7 @@ func TestChallengeLargePreimages_ChallengeFirst(t *testing.T) {
3434
func TestChallengeLargePreimages_ChallengeMiddle(t *testing.T) {
3535
op_e2e.InitParallel(t)
3636
ctx := context.Background()
37-
sys, _ := startFaultDisputeSystem(t)
37+
sys, _ := StartFaultDisputeSystem(t)
3838
t.Cleanup(sys.Close)
3939
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
4040
disputeGameFactory.StartChallenger(ctx, "Challenger",
@@ -52,7 +52,7 @@ func TestChallengeLargePreimages_ChallengeMiddle(t *testing.T) {
5252
func TestChallengeLargePreimages_ChallengeLast(t *testing.T) {
5353
op_e2e.InitParallel(t)
5454
ctx := context.Background()
55-
sys, _ := startFaultDisputeSystem(t)
55+
sys, _ := StartFaultDisputeSystem(t)
5656
t.Cleanup(sys.Close)
5757
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
5858
disputeGameFactory.StartChallenger(ctx, "Challenger",

op-e2e/faultproofs/multi_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ func TestMultipleGameTypes(t *testing.T) {
1414
op_e2e.InitParallel(t, op_e2e.UsesCannon)
1515

1616
ctx := context.Background()
17-
sys, _ := startFaultDisputeSystem(t)
17+
sys, _ := StartFaultDisputeSystem(t)
1818
t.Cleanup(sys.Close)
1919

2020
gameFactory := disputegame.NewFactoryHelper(t, ctx, sys)

op-e2e/faultproofs/output_alphabet_test.go

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ import (
1818
func TestOutputAlphabetGame_ChallengerWins(t *testing.T) {
1919
op_e2e.InitParallel(t)
2020
ctx := context.Background()
21-
sys, l1Client := startFaultDisputeSystem(t)
21+
sys, l1Client := StartFaultDisputeSystem(t)
2222
t.Cleanup(sys.Close)
2323

2424
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -75,15 +75,15 @@ func TestOutputAlphabetGame_ChallengerWins(t *testing.T) {
7575
func TestOutputAlphabetGame_ReclaimBond(t *testing.T) {
7676
op_e2e.InitParallel(t)
7777
ctx := context.Background()
78-
sys, l1Client := startFaultDisputeSystem(t)
78+
sys, l1Client := StartFaultDisputeSystem(t)
7979
t.Cleanup(sys.Close)
8080

8181
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
8282
game := disputeGameFactory.StartOutputAlphabetGame(ctx, "sequencer", 3, common.Hash{0xff})
8383
game.LogGameData(ctx)
8484

8585
// The dispute game should have a zero balance
86-
balance := game.WethBalance(ctx, game.Addr())
86+
balance := game.WethBalance(ctx, game.Addr)
8787
require.Zero(t, balance.Uint64())
8888

8989
alice := sys.Cfg.Secrets.Addresses().Alice
@@ -105,7 +105,7 @@ func TestOutputAlphabetGame_ReclaimBond(t *testing.T) {
105105
_ = claim.WaitForCounterClaim(ctx)
106106

107107
// Expect posted claims so the game balance is non-zero
108-
balance = game.WethBalance(ctx, game.Addr())
108+
balance = game.WethBalance(ctx, game.Addr)
109109
require.Truef(t, balance.Cmp(big.NewInt(0)) > 0, "Expected game balance to be above zero")
110110

111111
sys.TimeTravelClock.AdvanceTime(game.MaxClockDuration(ctx))
@@ -130,13 +130,13 @@ func TestOutputAlphabetGame_ReclaimBond(t *testing.T) {
130130
game.WaitForNoAvailableCredit(ctx, alice)
131131

132132
// The dispute game delayed weth balance should be zero since it's all claimed
133-
require.True(t, game.WethBalance(ctx, game.Addr()).Cmp(big.NewInt(0)) == 0)
133+
require.True(t, game.WethBalance(ctx, game.Addr).Cmp(big.NewInt(0)) == 0)
134134
}
135135

136136
func TestOutputAlphabetGame_ValidOutputRoot(t *testing.T) {
137137
op_e2e.InitParallel(t)
138138
ctx := context.Background()
139-
sys, l1Client := startFaultDisputeSystem(t)
139+
sys, l1Client := StartFaultDisputeSystem(t)
140140
t.Cleanup(sys.Close)
141141

142142
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -169,7 +169,7 @@ func TestChallengerCompleteExhaustiveDisputeGame(t *testing.T) {
169169

170170
testCase := func(t *testing.T, isRootCorrect bool) {
171171
ctx := context.Background()
172-
sys, l1Client := startFaultDisputeSystem(t)
172+
sys, l1Client := StartFaultDisputeSystem(t)
173173
t.Cleanup(sys.Close)
174174

175175
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -234,7 +234,7 @@ func TestChallengerCompleteExhaustiveDisputeGame(t *testing.T) {
234234
func TestOutputAlphabetGame_FreeloaderEarnsNothing(t *testing.T) {
235235
op_e2e.InitParallel(t)
236236
ctx := context.Background()
237-
sys, l1Client := startFaultDisputeSystem(t)
237+
sys, l1Client := StartFaultDisputeSystem(t)
238238
t.Cleanup(sys.Close)
239239

240240
freeloaderOpts, err := bind.NewKeyedTransactorWithChainID(sys.Cfg.Secrets.Mallory, sys.Cfg.L1ChainIDBig())

op-e2e/faultproofs/output_cannon_test.go

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ import (
2121
func TestOutputCannonGame(t *testing.T) {
2222
op_e2e.InitParallel(t, op_e2e.UsesCannon)
2323
ctx := context.Background()
24-
sys, l1Client := startFaultDisputeSystem(t)
24+
sys, l1Client := StartFaultDisputeSystem(t)
2525
t.Cleanup(sys.Close)
2626

2727
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -77,7 +77,7 @@ func TestOutputCannon_ChallengeAllZeroClaim(t *testing.T) {
7777
// The dishonest actor always posts claims with all zeros.
7878
op_e2e.InitParallel(t, op_e2e.UsesCannon)
7979
ctx := context.Background()
80-
sys, l1Client := startFaultDisputeSystem(t)
80+
sys, l1Client := StartFaultDisputeSystem(t)
8181
t.Cleanup(sys.Close)
8282

8383
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -116,7 +116,7 @@ func TestOutputCannon_PublishCannonRootClaim(t *testing.T) {
116116
op_e2e.InitParallel(t, op_e2e.UsesCannon)
117117

118118
ctx := context.Background()
119-
sys, _ := startFaultDisputeSystem(t)
119+
sys, _ := StartFaultDisputeSystem(t)
120120

121121
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
122122
game := disputeGameFactory.StartOutputCannonGame(ctx, "sequencer", test.disputeL2BlockNumber, common.Hash{0x01})
@@ -147,7 +147,7 @@ func TestOutputCannonDisputeGame(t *testing.T) {
147147
op_e2e.InitParallel(t, op_e2e.UsesCannon)
148148

149149
ctx := context.Background()
150-
sys, l1Client := startFaultDisputeSystem(t)
150+
sys, l1Client := StartFaultDisputeSystem(t)
151151
t.Cleanup(sys.Close)
152152

153153
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -184,7 +184,7 @@ func TestOutputCannonDefendStep(t *testing.T) {
184184
op_e2e.InitParallel(t, op_e2e.UsesCannon)
185185

186186
ctx := context.Background()
187-
sys, l1Client := startFaultDisputeSystem(t)
187+
sys, l1Client := StartFaultDisputeSystem(t)
188188
t.Cleanup(sys.Close)
189189

190190
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -220,7 +220,7 @@ func TestOutputCannonStepWithLargePreimage(t *testing.T) {
220220
op_e2e.InitParallel(t, op_e2e.UsesCannon)
221221

222222
ctx := context.Background()
223-
sys, _ := startFaultDisputeSystem(t, withBatcherStopped())
223+
sys, _ := StartFaultDisputeSystem(t, WithBatcherStopped())
224224
t.Cleanup(sys.Close)
225225

226226
// Manually send a tx from the correct batcher key to the batcher input with very large (invalid) data
@@ -263,7 +263,7 @@ func TestOutputCannonStepWithPreimage(t *testing.T) {
263263
op_e2e.InitParallel(t, op_e2e.UsesCannon)
264264

265265
ctx := context.Background()
266-
sys, _ := startFaultDisputeSystem(t, withBlobBatches())
266+
sys, _ := StartFaultDisputeSystem(t, WithBlobBatches())
267267
t.Cleanup(sys.Close)
268268

269269
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -306,7 +306,7 @@ func TestOutputCannonStepWithKZGPointEvaluation(t *testing.T) {
306306
op_e2e.InitParallel(t, op_e2e.UsesCannon)
307307

308308
ctx := context.Background()
309-
sys, _ := startFaultDisputeSystem(t, withEcotone())
309+
sys, _ := StartFaultDisputeSystem(t, WithEcotone())
310310
t.Cleanup(sys.Close)
311311

312312
// NOTE: Flake prevention
@@ -315,7 +315,7 @@ func TestOutputCannonStepWithKZGPointEvaluation(t *testing.T) {
315315
require.NoError(t, err)
316316
require.NoError(t, wait.ForSafeBlock(ctx, sys.RollupClient("sequencer"), safeBlock.NumberU64()+3))
317317

318-
receipt := sendKZGPointEvaluationTx(t, sys, "sequencer", sys.Cfg.Secrets.Alice)
318+
receipt := SendKZGPointEvaluationTx(t, sys, "sequencer", sys.Cfg.Secrets.Alice)
319319
precompileBlock := receipt.BlockNumber
320320
t.Logf("KZG Point Evaluation block number: %d", precompileBlock)
321321

@@ -406,7 +406,7 @@ func TestOutputCannonProposedOutputRootValid(t *testing.T) {
406406
op_e2e.InitParallel(t, op_e2e.UsesCannon)
407407

408408
ctx := context.Background()
409-
sys, l1Client := startFaultDisputeSystem(t)
409+
sys, l1Client := StartFaultDisputeSystem(t)
410410
t.Cleanup(sys.Close)
411411

412412
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -440,7 +440,7 @@ func TestOutputCannonPoisonedPostState(t *testing.T) {
440440
op_e2e.InitParallel(t, op_e2e.UsesCannon)
441441

442442
ctx := context.Background()
443-
sys, l1Client := startFaultDisputeSystem(t)
443+
sys, l1Client := StartFaultDisputeSystem(t)
444444
t.Cleanup(sys.Close)
445445

446446
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -504,7 +504,7 @@ func TestDisputeOutputRootBeyondProposedBlock_ValidOutputRoot(t *testing.T) {
504504
op_e2e.InitParallel(t, op_e2e.UsesCannon)
505505

506506
ctx := context.Background()
507-
sys, l1Client := startFaultDisputeSystem(t)
507+
sys, l1Client := StartFaultDisputeSystem(t)
508508
t.Cleanup(sys.Close)
509509

510510
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -554,7 +554,7 @@ func TestDisputeOutputRootBeyondProposedBlock_InvalidOutputRoot(t *testing.T) {
554554
op_e2e.InitParallel(t, op_e2e.UsesCannon)
555555

556556
ctx := context.Background()
557-
sys, l1Client := startFaultDisputeSystem(t)
557+
sys, l1Client := StartFaultDisputeSystem(t)
558558
t.Cleanup(sys.Close)
559559

560560
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -605,7 +605,7 @@ func TestDisputeOutputRoot_ChangeClaimedOutputRoot(t *testing.T) {
605605
op_e2e.InitParallel(t, op_e2e.UsesCannon)
606606

607607
ctx := context.Background()
608-
sys, l1Client := startFaultDisputeSystem(t)
608+
sys, l1Client := StartFaultDisputeSystem(t)
609609
t.Cleanup(sys.Close)
610610

611611
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)
@@ -693,7 +693,7 @@ func TestInvalidateUnsafeProposal(t *testing.T) {
693693
test := test
694694
t.Run(test.name, func(t *testing.T) {
695695
op_e2e.InitParallel(t, op_e2e.UsesCannon)
696-
sys, l1Client := startFaultDisputeSystem(t, withSequencerWindowSize(100000), withBatcherStopped())
696+
sys, l1Client := StartFaultDisputeSystem(t, WithSequencerWindowSize(100000), WithBatcherStopped())
697697
t.Cleanup(sys.Close)
698698

699699
blockNum := uint64(1)
@@ -755,7 +755,7 @@ func TestInvalidateProposalForFutureBlock(t *testing.T) {
755755
test := test
756756
t.Run(test.name, func(t *testing.T) {
757757
op_e2e.InitParallel(t, op_e2e.UsesCannon)
758-
sys, l1Client := startFaultDisputeSystem(t, withSequencerWindowSize(100000))
758+
sys, l1Client := StartFaultDisputeSystem(t, WithSequencerWindowSize(100000))
759759
t.Cleanup(sys.Close)
760760

761761
farFutureBlockNum := uint64(10_000_000)

op-e2e/faultproofs/preimages_test.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ func TestLocalPreimages(t *testing.T) {
3232
op_e2e.InitParallel(t, op_e2e.UsesCannon)
3333

3434
ctx := context.Background()
35-
sys, _ := startFaultDisputeSystem(t)
35+
sys, _ := StartFaultDisputeSystem(t)
3636
t.Cleanup(sys.Close)
3737

3838
disputeGameFactory := disputegame.NewFactoryHelper(t, ctx, sys)

op-e2e/faultproofs/util.go

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,13 +15,13 @@ import (
1515

1616
type faultDisputeConfigOpts func(cfg *op_e2e.SystemConfig)
1717

18-
func withBatcherStopped() faultDisputeConfigOpts {
18+
func WithBatcherStopped() faultDisputeConfigOpts {
1919
return func(cfg *op_e2e.SystemConfig) {
2020
cfg.DisableBatcher = true
2121
}
2222
}
2323

24-
func withBlobBatches() faultDisputeConfigOpts {
24+
func WithBlobBatches() faultDisputeConfigOpts {
2525
return func(cfg *op_e2e.SystemConfig) {
2626
cfg.DataAvailabilityType = batcherFlags.BlobsType
2727

@@ -32,7 +32,7 @@ func withBlobBatches() faultDisputeConfigOpts {
3232
}
3333
}
3434

35-
func withEcotone() faultDisputeConfigOpts {
35+
func WithEcotone() faultDisputeConfigOpts {
3636
return func(cfg *op_e2e.SystemConfig) {
3737
genesisActivation := hexutil.Uint64(0)
3838
cfg.DeployConfig.L1CancunTimeOffset = &genesisActivation
@@ -41,13 +41,13 @@ func withEcotone() faultDisputeConfigOpts {
4141
}
4242
}
4343

44-
func withSequencerWindowSize(size uint64) faultDisputeConfigOpts {
44+
func WithSequencerWindowSize(size uint64) faultDisputeConfigOpts {
4545
return func(cfg *op_e2e.SystemConfig) {
4646
cfg.DeployConfig.SequencerWindowSize = size
4747
}
4848
}
4949

50-
func startFaultDisputeSystem(t *testing.T, opts ...faultDisputeConfigOpts) (*op_e2e.System, *ethclient.Client) {
50+
func StartFaultDisputeSystem(t *testing.T, opts ...faultDisputeConfigOpts) (*op_e2e.System, *ethclient.Client) {
5151
cfg := op_e2e.DefaultSystemConfig(t)
5252
delete(cfg.Nodes, "verifier")
5353
for _, opt := range opts {
@@ -64,7 +64,7 @@ func startFaultDisputeSystem(t *testing.T, opts ...faultDisputeConfigOpts) (*op_
6464
return sys, sys.Clients["l1"]
6565
}
6666

67-
func sendKZGPointEvaluationTx(t *testing.T, sys *op_e2e.System, l2Node string, privateKey *ecdsa.PrivateKey) *types.Receipt {
67+
func SendKZGPointEvaluationTx(t *testing.T, sys *op_e2e.System, l2Node string, privateKey *ecdsa.PrivateKey) *types.Receipt {
6868
return op_e2e.SendL2Tx(t, sys.Cfg, sys.Clients[l2Node], privateKey, func(opts *op_e2e.TxOpts) {
6969
precompile := common.BytesToAddress([]byte{0x0a})
7070
opts.Gas = 100_000

0 commit comments

Comments
 (0)