Skip to content

Commit

Permalink
feat(f3): allow to disable f3 passive testing (#12672)
Browse files Browse the repository at this point in the history
using `LOTUS_DISABLE_F3_PASSIVE_TESTING=1`

Signed-off-by: Jakub Sztandera <oss@kubuxu.com>
  • Loading branch information
Kubuxu authored Nov 6, 2024
1 parent 3a34832 commit be74be0
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 1 deletion.
21 changes: 21 additions & 0 deletions build/params_shared_funcs.go
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,24 @@ func IsF3Enabled() bool {
return false
}
}

func IsF3PassiveTestingEnabled() bool {
if !IsF3Enabled() {
return false
}
const F3DisablePassiveTesting = "LOTUS_DISABLE_F3_PASSIVE_TESTING"

v, disableEnvVarSet := os.LookupEnv(F3DisablePassiveTesting)
if !disableEnvVarSet {
// Environment variable to disable F3 passive testing is not set.
return true
}
switch strings.TrimSpace(strings.ToLower(v)) {
case "", "0", "false", "no":
// Consider these values as "do not disable".
return true
default:
// Consider any other value as disable.
return false
}
}
3 changes: 2 additions & 1 deletion chain/lf3/manifest.go
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ import (
"github.com/filecoin-project/go-f3/ec"
"github.com/filecoin-project/go-f3/manifest"

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

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

0 comments on commit be74be0

Please sign in to comment.