Skip to content

Commit 8be940c

Browse files
committed
Fix make lint
1 parent ca5a362 commit 8be940c

File tree

2 files changed

+110
-111
lines changed

2 files changed

+110
-111
lines changed

Diff for: arbos/parse_l2_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ func TestEspressoParsing(t *testing.T) {
2121
}
2222
var mockProof = json.RawMessage(`{"NonExistence":{"ns_id":0}}`)
2323
var mockChainConfig = &espressoTypes.ResolvableChainConfig{
24-
espressoTypes.EitherChainConfig{
24+
ChainConfig: espressoTypes.EitherChainConfig{
2525
Left: &espressoTypes.ChainConfig{ChainId: *espressoTypes.NewU256().SetUint64(0x8a19), MaxBlockSize: 10240, BaseFee: *espressoTypes.NewU256().SetUint64(0)},
2626
},
2727
}

Diff for: system_tests/espresso_e2e_test.go

+109-110
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import (
55
"encoding/json"
66
"fmt"
77
"math/big"
8+
"os"
89
"os/exec"
910
"strings"
1011
"testing"
@@ -20,6 +21,7 @@ import (
2021
"github.com/offchainlabs/nitro/arbnode"
2122
"github.com/offchainlabs/nitro/arbnode/dataposter/storage"
2223
"github.com/offchainlabs/nitro/arbutil"
24+
"github.com/offchainlabs/nitro/solgen/go/ospgen"
2325
"github.com/offchainlabs/nitro/solgen/go/rollupgen"
2426
"github.com/offchainlabs/nitro/solgen/go/upgrade_executorgen"
2527
"github.com/offchainlabs/nitro/staker"
@@ -31,7 +33,7 @@ import (
3133
var workingDir = "./espresso-e2e"
3234
var lightClientAddress = "0xb075b82c7a23e0994df4793422a1f03dbcf9136f"
3335

34-
// var hostIoAddress = "0xF34C2fac45527E55ED122f80a969e79A40547e6D"
36+
var hostIoAddress = "0xF34C2fac45527E55ED122f80a969e79A40547e6D"
3537
var hotShotUrl = "http://127.0.0.1:50000"
3638

3739
var (
@@ -452,113 +454,110 @@ func TestEspressoE2E(t *testing.T) {
452454
})
453455
Require(t, err)
454456

455-
// TOOD: uncomment once we fix fraud proofs
456-
// https://github.com/EspressoSystems/nitro-espresso-integration/issues/117
457-
458-
// hostIo, err := ospgen.NewOneStepProverHostIo(common.HexToAddress(hostIoAddress), builder.L1.Client)
459-
// Require(t, err)
460-
// actualCommitment, err := hostIo.GetHotShotCommitment(&bind.CallOpts{}, big.NewInt(1))
461-
// Require(t, err)
462-
// commitmentBytes := actualCommitment.Bytes()
463-
// if len(commitmentBytes) != 32 {
464-
// t.Fatal("failed to read hotshot via hostio contract, length is not 32")
465-
// }
466-
// empty := actualCommitment.Cmp(big.NewInt(0)) == 0
467-
// if empty {
468-
// t.Fatal("failed to read hotshot via hostio contract, empty")
469-
// }
470-
// log.Info("Read hotshot commitment via hostio contract successfully", "height", 1, "commitment", commitmentBytes)
471-
472-
// incorrectHeight := uint64(10)
473-
474-
// goodStaker, blockValidatorA, cleanA := createStaker(ctx, t, builder, 0)
475-
// defer cleanA()
476-
// badStaker, blockValidatorB, cleanB := createStaker(ctx, t, builder, incorrectHeight)
477-
// defer cleanB()
478-
479-
// err = waitForWith(t, ctx, 60*time.Second, 1*time.Second, func() bool {
480-
// validatedA := blockValidatorA.Validated(t)
481-
// validatedB := blockValidatorB.Validated(t)
482-
// shouldValidated := arbutil.MessageIndex(incorrectHeight - 1)
483-
// condition := validatedA >= shouldValidated && validatedB >= shouldValidated
484-
// if !condition {
485-
// log.Info("waiting for stakers to catch up the incorrect hotshot height", "stakerA", validatedA, "stakerB", validatedB, "target", shouldValidated)
486-
// }
487-
// return condition
488-
// })
489-
// Require(t, err)
490-
// validatorUtils, err := rollupgen.NewValidatorUtils(builder.L2.ConsensusNode.DeployInfo.ValidatorUtils, builder.L1.Client)
491-
// Require(t, err)
492-
// goodOpts := builder.L1Info.GetDefaultCallOpts("Staker1", ctx)
493-
// badOpts := builder.L1Info.GetDefaultCallOpts("Staker2", ctx)
494-
// i := 0
495-
// err = waitFor(t, ctx, func() bool {
496-
// log.Info("good staker acts", "step", i)
497-
// txA, err := goodStaker.Act(ctx)
498-
// Require(t, err)
499-
// if txA != nil {
500-
// _, err = builder.L1.EnsureTxSucceeded(txA)
501-
// Require(t, err)
502-
// }
503-
504-
// log.Info("bad staker acts", "step", i)
505-
// txB, err := badStaker.Act(ctx)
506-
// Require(t, err)
507-
// if txB != nil {
508-
// _, err = builder.L1.EnsureTxSucceeded(txB)
509-
// Require(t, err)
510-
// }
511-
// i += 1
512-
// conflict, err := validatorUtils.FindStakerConflict(&bind.CallOpts{}, builder.L2.ConsensusNode.DeployInfo.Rollup, goodOpts.From, badOpts.From, big.NewInt(1024))
513-
// Require(t, err)
514-
// condition := staker.ConflictType(conflict.Ty) == staker.CONFLICT_TYPE_FOUND
515-
// if !condition {
516-
// log.Info("waiting for the conflict")
517-
// }
518-
// return condition
519-
// })
520-
// Require(t, err)
521-
522-
// // The following tests are very time-consuming and, given that the related code
523-
// // does not change often, it's not necessary to run them every time.
524-
// // Note: If you are modifying the smart contracts, staker-related code or doing overhaul.
525-
// // Set the E2E_CHECK_STAKER env variable to any non-empty string to run the check.
526-
527-
// checkStaker := os.Getenv("E2E_CHECK_STAKER")
528-
// if checkStaker == "" {
529-
// return
530-
// }
531-
// err = waitForWith(
532-
// t,
533-
// ctx,
534-
// time.Minute*20,
535-
// time.Second*5,
536-
// func() bool {
537-
// log.Info("good staker acts", "step", i)
538-
// txA, err := goodStaker.Act(ctx)
539-
// Require(t, err)
540-
// if txA != nil {
541-
// _, err = builder.L1.EnsureTxSucceeded(txA)
542-
// Require(t, err)
543-
// }
544-
545-
// log.Info("bad staker acts", "step", i)
546-
// txB, err := badStaker.Act(ctx)
547-
// if txB != nil {
548-
// _, err = builder.L1.EnsureTxSucceeded(txB)
549-
// Require(t, err)
550-
// }
551-
// if err != nil {
552-
// ok := strings.Contains(err.Error(), "ERROR_HOTSHOT_COMMITMENT")
553-
// if ok {
554-
// return true
555-
// } else {
556-
// t.Fatal("unexpected err")
557-
// }
558-
// }
559-
// i += 1
560-
// return false
561-
562-
// })
563-
// Require(t, err)
457+
hostIo, err := ospgen.NewOneStepProverHostIo(common.HexToAddress(hostIoAddress), builder.L1.Client)
458+
Require(t, err)
459+
actualCommitment, err := hostIo.GetHotShotCommitment(&bind.CallOpts{}, big.NewInt(1))
460+
Require(t, err)
461+
commitmentBytes := actualCommitment.Bytes()
462+
if len(commitmentBytes) != 32 {
463+
t.Fatal("failed to read hotshot via hostio contract, length is not 32")
464+
}
465+
empty := actualCommitment.Cmp(big.NewInt(0)) == 0
466+
if empty {
467+
t.Fatal("failed to read hotshot via hostio contract, empty")
468+
}
469+
log.Info("Read hotshot commitment via hostio contract successfully", "height", 1, "commitment", commitmentBytes)
470+
471+
incorrectHeight := uint64(10)
472+
473+
goodStaker, blockValidatorA, cleanA := createStaker(ctx, t, builder, 0)
474+
defer cleanA()
475+
badStaker, blockValidatorB, cleanB := createStaker(ctx, t, builder, incorrectHeight)
476+
defer cleanB()
477+
478+
err = waitForWith(t, ctx, 60*time.Second, 1*time.Second, func() bool {
479+
validatedA := blockValidatorA.Validated(t)
480+
validatedB := blockValidatorB.Validated(t)
481+
shouldValidated := arbutil.MessageIndex(incorrectHeight - 1)
482+
condition := validatedA >= shouldValidated && validatedB >= shouldValidated
483+
if !condition {
484+
log.Info("waiting for stakers to catch up the incorrect hotshot height", "stakerA", validatedA, "stakerB", validatedB, "target", shouldValidated)
485+
}
486+
return condition
487+
})
488+
Require(t, err)
489+
validatorUtils, err := rollupgen.NewValidatorUtils(builder.L2.ConsensusNode.DeployInfo.ValidatorUtils, builder.L1.Client)
490+
Require(t, err)
491+
goodOpts := builder.L1Info.GetDefaultCallOpts("Staker1", ctx)
492+
badOpts := builder.L1Info.GetDefaultCallOpts("Staker2", ctx)
493+
i := 0
494+
err = waitFor(t, ctx, func() bool {
495+
log.Info("good staker acts", "step", i)
496+
txA, err := goodStaker.Act(ctx)
497+
Require(t, err)
498+
if txA != nil {
499+
_, err = builder.L1.EnsureTxSucceeded(txA)
500+
Require(t, err)
501+
}
502+
503+
log.Info("bad staker acts", "step", i)
504+
txB, err := badStaker.Act(ctx)
505+
Require(t, err)
506+
if txB != nil {
507+
_, err = builder.L1.EnsureTxSucceeded(txB)
508+
Require(t, err)
509+
}
510+
i += 1
511+
conflict, err := validatorUtils.FindStakerConflict(&bind.CallOpts{}, builder.L2.ConsensusNode.DeployInfo.Rollup, goodOpts.From, badOpts.From, big.NewInt(1024))
512+
Require(t, err)
513+
condition := staker.ConflictType(conflict.Ty) == staker.CONFLICT_TYPE_FOUND
514+
if !condition {
515+
log.Info("waiting for the conflict")
516+
}
517+
return condition
518+
})
519+
Require(t, err)
520+
521+
// The following tests are very time-consuming and, given that the related code
522+
// does not change often, it's not necessary to run them every time.
523+
// Note: If you are modifying the smart contracts, staker-related code or doing overhaul.
524+
// Set the E2E_CHECK_STAKER env variable to any non-empty string to run the check.
525+
526+
checkStaker := os.Getenv("E2E_CHECK_STAKER")
527+
if checkStaker == "" {
528+
return
529+
}
530+
err = waitForWith(
531+
t,
532+
ctx,
533+
time.Minute*20,
534+
time.Second*5,
535+
func() bool {
536+
log.Info("good staker acts", "step", i)
537+
txA, err := goodStaker.Act(ctx)
538+
Require(t, err)
539+
if txA != nil {
540+
_, err = builder.L1.EnsureTxSucceeded(txA)
541+
Require(t, err)
542+
}
543+
544+
log.Info("bad staker acts", "step", i)
545+
txB, err := badStaker.Act(ctx)
546+
if txB != nil {
547+
_, err = builder.L1.EnsureTxSucceeded(txB)
548+
Require(t, err)
549+
}
550+
if err != nil {
551+
ok := strings.Contains(err.Error(), "ERROR_HOTSHOT_COMMITMENT")
552+
if ok {
553+
return true
554+
} else {
555+
t.Fatal("unexpected err")
556+
}
557+
}
558+
i += 1
559+
return false
560+
561+
})
562+
Require(t, err)
564563
}

0 commit comments

Comments
 (0)