Skip to content

Commit

Permalink
Use the correct error
Browse files Browse the repository at this point in the history
When the state provider isn't able to do its job because the chain is lagging
behind head, it's supposed to use a predefined error from the l2stateprovider
package. Instead, the nitro implemention of the provider was using a
redefinition of the error.

While this coding error easily accounts for why there were a bunch of ERROR logs
about the chain's not keeping up with the latest changes, it does not explain
why the test is sometimes flaky. I suspect that the original commits in this PR
were chasing the ERROR logs in the flaky tests, but that those were not the root
cause of the test failures.
  • Loading branch information
eljobe committed Jan 29, 2025
1 parent 78c6223 commit 1db55df
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 22 deletions.
6 changes: 1 addition & 5 deletions staker/bold/bold_state_provider.go
Original file line number Diff line number Diff line change
Expand Up @@ -38,10 +38,6 @@ var (

var executionNodeOfflineGauge = metrics.NewRegisteredGauge("arb/state_provider/execution_node_offline", nil)

var (
ErrChainCatchingUp = errors.New("chain catching up")
)

type BOLDStateProvider struct {
validator *staker.BlockValidator
statelessValidator *staker.StatelessBlockValidator
Expand Down Expand Up @@ -171,7 +167,7 @@ func (s *BOLDStateProvider) isStateValidatedAndMessageCountPastThreshold(
return false, err
}
if lastValidatedGs == nil {
return false, ErrChainCatchingUp
return false, l2stateprovider.ErrChainCatchingUp
}
stateValidated := gs.Batch < lastValidatedGs.GlobalState.Batch || (gs.Batch == lastValidatedGs.GlobalState.Batch && gs.PosInBatch <= lastValidatedGs.GlobalState.PosInBatch)
return stateValidated, nil
Expand Down
19 changes: 2 additions & 17 deletions system_tests/bold_new_challenge_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -157,23 +157,6 @@ func testChallengeProtocolBOLDVirtualBlocks(t *testing.T, wrongAtFirstVirtual bo
builder.L1Info.GenerateAccount("EvilAsserter")
fundBoldStaker(t, ctx, builder, "EvilAsserter")

TransferBalance(t, "Faucet", "Faucet", common.Big0, builder.L2Info, builder.L2.Client, ctx)

// Wait for both nodes' chains to catch up to at least a batch that includes the self-transfer
// from above. This makes sure that nodes have at least caught up to the required rollup chain state
// by reading batches from the parent chain.
nodeAExec := builder.L2.ExecNode
nodeBExec := evilNode.ExecNode
for {
nodeALatest := nodeAExec.Backend.APIBackend().CurrentHeader()
nodeBLatest := nodeBExec.Backend.APIBackend().CurrentHeader()
isCaughtUp := nodeALatest.Number.Uint64() == 2
areEqual := nodeALatest.Number.Uint64() == nodeBLatest.Number.Uint64()
if isCaughtUp && areEqual {
break
}
}

assertionChain, cleanupHonestChallengeManager := startBoldChallengeManager(t, ctx, builder, builder.L2, "HonestAsserter", nil)
defer cleanupHonestChallengeManager()

Expand All @@ -190,6 +173,8 @@ func testChallengeProtocolBOLDVirtualBlocks(t *testing.T, wrongAtFirstVirtual bo
})
defer cleanupEvilChallengeManager()

TransferBalance(t, "Faucet", "Faucet", common.Big0, builder.L2Info, builder.L2.Client, ctx)

// Everything's setup, now just wait for the challenge to complete and ensure the honest party won

chalManager := assertionChain.SpecChallengeManager()
Expand Down

0 comments on commit 1db55df

Please sign in to comment.