diff --git a/app/submodule/syncer/syncer_api.go b/app/submodule/syncer/syncer_api.go index 2876013ca8..559ea48785 100644 --- a/app/submodule/syncer/syncer_api.go +++ b/app/submodule/syncer/syncer_api.go @@ -8,6 +8,7 @@ import ( "github.com/filecoin-project/go-state-types/big" syncTypes "github.com/filecoin-project/venus/pkg/chainsync/types" + "github.com/filecoin-project/venus/pkg/constants" "github.com/filecoin-project/venus/pkg/fvm" v1api "github.com/filecoin-project/venus/venus-shared/api/chain/v1" "github.com/filecoin-project/venus/venus-shared/types" @@ -101,9 +102,11 @@ func (sa *syncerAPI) SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) e return fmt.Errorf("loading parent block: %v", err) } - if err := sa.syncer.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height); err != nil { - log.Errorf(" SLASH FILTER ERROR: %s", err) - return fmt.Errorf(" SLASH FILTER ERROR: %v", err) + if !constants.NoSlashFilter { + if err := sa.syncer.SlashFilter.MinedBlock(ctx, blk.Header, parent.Height); err != nil { + log.Errorf(" SLASH FILTER ERROR: %s", err) + return fmt.Errorf(" SLASH FILTER ERROR: %v", err) + } } // TODO: should we have some sort of fast path to adding a local block? diff --git a/pkg/constants/env.go b/pkg/constants/env.go index 3c76426116..043f22befb 100644 --- a/pkg/constants/env.go +++ b/pkg/constants/env.go @@ -7,3 +7,6 @@ var FevmEnableEthRPC = os.Getenv("VENUS_FEVM_ENABLEETHRPC") == "1" // InsecurePoStValidation use to attach debug var InsecurePoStValidation = os.Getenv("INSECURE_POST_VALIDATION") == "1" + +// NoSlashFilter will not check whether the miner's block violates the consensus +var NoSlashFilter = os.Getenv("VENUS_NO_SLASHFILTER") == "_yes_i_know_and_i_accept_that_may_loss_my_fil"