Skip to content

Commit

Permalink
Shorten GPBFT settings for a more responsive timing
Browse files Browse the repository at this point in the history
Defaults are based on epoch of 30s and real RTT. Shorten Delta and
rebroadcast times.
  • Loading branch information
masih committed Oct 16, 2024
1 parent 4192741 commit 0a15c68
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion itests/f3_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -230,6 +230,12 @@ func (e *testEnv) waitFor(f func(n *kit.TestFullNode) bool, timeout time.Duratio
// a miner. The last return value is the manifest sender for the network.
func setup(t *testing.T, blocktime time.Duration) *testEnv {
manif := lf3.NewManifest(BaseNetworkName+"/1", DefaultFinality, DefaultBootstrapEpoch, blocktime, cid.Undef)
manif.Gpbft.Delta = 250 * time.Millisecond
manif.Gpbft.DeltaBackOffExponent = 1.3
manif.Gpbft.RebroadcastBackoffBase = manif.Gpbft.Delta * 2
manif.Gpbft.RebroadcastBackoffMax = manif.Gpbft.RebroadcastBackoffBase * 2
manif.Gpbft.RebroadcastBackoffExponent = manif.Gpbft.DeltaBackOffExponent

return setupWithStaticManifest(t, manif, false)
}

Expand Down Expand Up @@ -295,14 +301,23 @@ func setupWithStaticManifest(t *testing.T, manif *manifest.Manifest, testBootstr
err = n.NetConnect(ctx, e.ms.PeerInfo())
require.NoError(t, err)
}

errgrp.Go(func() error {
defer func() {
require.NoError(t, manifestServerHost.Close())
}()
return e.ms.Run(ctx)
})

// Update initial manifest params to shorten the timeouts and backoff for
// testing.
m.Gpbft.Delta = 250 * time.Millisecond
m.Gpbft.DeltaBackOffExponent = 1.3
m.Gpbft.RebroadcastBackoffBase = manif.Gpbft.Delta * 2
m.Gpbft.RebroadcastBackoffMax = manif.Gpbft.RebroadcastBackoffBase * 2
m.Gpbft.RebroadcastBackoffExponent = manif.Gpbft.DeltaBackOffExponent
e.ms.UpdateManifest(m)
e.waitTillManifestChange(m, 20*time.Second)

return e
}

Expand Down

0 comments on commit 0a15c68

Please sign in to comment.