Skip to content

Commit 2cc2578

Browse files
Kubuxurjan90
authored andcommitted
feat(f3): allow to disable f3 passive testing (#12672)
using `LOTUS_DISABLE_F3_PASSIVE_TESTING=1` Signed-off-by: Jakub Sztandera <[email protected]>
1 parent 8646c2f commit 2cc2578

File tree

2 files changed

+23
-1
lines changed

2 files changed

+23
-1
lines changed

build/params_shared_funcs.go

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,3 +55,24 @@ func IsF3Enabled() bool {
5555
return false
5656
}
5757
}
58+
59+
func IsF3PassiveTestingEnabled() bool {
60+
if !IsF3Enabled() {
61+
return false
62+
}
63+
const F3DisablePassiveTesting = "LOTUS_DISABLE_F3_PASSIVE_TESTING"
64+
65+
v, disableEnvVarSet := os.LookupEnv(F3DisablePassiveTesting)
66+
if !disableEnvVarSet {
67+
// Environment variable to disable F3 passive testing is not set.
68+
return true
69+
}
70+
switch strings.TrimSpace(strings.ToLower(v)) {
71+
case "", "0", "false", "no":
72+
// Consider these values as "do not disable".
73+
return true
74+
default:
75+
// Consider any other value as disable.
76+
return false
77+
}
78+
}

chain/lf3/manifest.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ import (
1313
"github.com/filecoin-project/go-f3/ec"
1414
"github.com/filecoin-project/go-f3/manifest"
1515

16+
"github.com/filecoin-project/lotus/build"
1617
"github.com/filecoin-project/lotus/chain/store"
1718
"github.com/filecoin-project/lotus/node/modules/dtypes"
1819
"github.com/filecoin-project/lotus/node/modules/helpers"
@@ -35,7 +36,7 @@ func (hg *headGetter) GetHead(context.Context) (ec.TipSet, error) {
3536
var MaxDynamicManifestChangesAllowed = 1000
3637

3738
func NewManifestProvider(mctx helpers.MetricsCtx, config *Config, cs *store.ChainStore, ps *pubsub.PubSub, mds dtypes.MetadataDS) (prov manifest.ManifestProvider, err error) {
38-
if config.DynamicManifestProvider == "" {
39+
if config.DynamicManifestProvider == "" || !build.IsF3PassiveTestingEnabled() {
3940
if config.StaticManifest == nil {
4041
return manifest.NoopManifestProvider{}, nil
4142
}

0 commit comments

Comments
 (0)