Skip to content

Commit

Permalink
test(f3): fix test flakes
Browse files Browse the repository at this point in the history
1. Reduce GPBFT delta to blockdelay/5 to match the expected mainnet
config and avoid timing out tests.
2. Make waiting for rebootstrap work in the presence of null tipsets.
  • Loading branch information
Stebalien committed Sep 27, 2024
1 parent 3a90ce4 commit c6b77be
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 2 deletions.
12 changes: 10 additions & 2 deletions itests/f3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ import (
"github.com/filecoin-project/go-f3/manifest"
"github.com/filecoin-project/go-state-types/abi"

"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/itests/kit"
"github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/modules"
Expand Down Expand Up @@ -107,10 +108,17 @@ func (e *testEnv) waitTillF3Rebootstrap(timeout time.Duration) {
if err != nil || cert == nil {
return false
}
e.t.Log("here")
m, err := n.F3GetManifest(e.testCtx)
require.NoError(e.t, err)
e.t.Log("got manifest", cert.ECChain.Base().Epoch, m.BootstrapEpoch-m.EC.Finality)

// Find the first non-null block at or before the target height, that's the bootstrap block.
targetEpoch := m.BootstrapEpoch - m.EC.Finality
ts, err := n.ChainGetTipSetByHeight(e.testCtx, abi.ChainEpoch(targetEpoch), types.EmptyTSK)
if err != nil {
return false
}

e.t.Log("got manifest", cert.ECChain.Base().Epoch, int64(ts.Height()))
return cert.ECChain.Base().Epoch == m.BootstrapEpoch-m.EC.Finality
}, timeout)
}
Expand Down
1 change: 1 addition & 0 deletions itests/kit/node_opts.go
Original file line number Diff line number Diff line change
Expand Up @@ -220,6 +220,7 @@ func F3Enabled(bootstrapEpoch abi.ChainEpoch, blockDelay time.Duration, finality
c := lf3.NewConfig(manifestProvider, true, cid.Undef)(nn)
c.InitialManifest.Pause = false
c.InitialManifest.EC.Period = blockDelay
c.InitialManifest.Gpbft.Delta = blockDelay / 5
c.InitialManifest.EC.Finality = int64(finality)
c.InitialManifest.BootstrapEpoch = int64(bootstrapEpoch)
c.InitialManifest.EC.HeadLookback = 0
Expand Down

0 comments on commit c6b77be

Please sign in to comment.