policy.SetPreCommitChallengeDelay to reduce WaitSeed stage time

This commit is contained in:
Anton Evangelatov 2021-06-22 13:08:36 +02:00
parent 5e10d53ca8
commit 00618672f5

View File

@ -13,6 +13,7 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/extern/sector-storage/storiface" "github.com/filecoin-project/lotus/extern/sector-storage/storiface"
"github.com/filecoin-project/lotus/itests/kit" "github.com/filecoin-project/lotus/itests/kit"
@ -30,6 +31,12 @@ func TestDealCyclesConcurrent(t *testing.T) {
kit.QuietMiningLogs() kit.QuietMiningLogs()
oldDelay := policy.GetPreCommitChallengeDelay()
policy.SetPreCommitChallengeDelay(5)
t.Cleanup(func() {
policy.SetPreCommitChallengeDelay(oldDelay)
})
blockTime := 10 * time.Millisecond blockTime := 10 * time.Millisecond
// For these tests where the block time is artificially short, just use // For these tests where the block time is artificially short, just use
@ -107,6 +114,12 @@ func TestDealsWithSealingAndRPC(t *testing.T) {
kit.QuietMiningLogs() kit.QuietMiningLogs()
oldDelay := policy.GetPreCommitChallengeDelay()
policy.SetPreCommitChallengeDelay(5)
t.Cleanup(func() {
policy.SetPreCommitChallengeDelay(oldDelay)
})
var blockTime = 1 * time.Second var blockTime = 1 * time.Second
client, miner, ens := kit.EnsembleMinimal(t, kit.ThroughRPC(), kit.WithAllSubsystems()) // no mock proofs. client, miner, ens := kit.EnsembleMinimal(t, kit.ThroughRPC(), kit.WithAllSubsystems()) // no mock proofs.
@ -224,6 +237,12 @@ func TestPublishDealsBatching(t *testing.T) {
startEpoch = abi.ChainEpoch(2 << 12) startEpoch = abi.ChainEpoch(2 << 12)
) )
oldDelay := policy.GetPreCommitChallengeDelay()
policy.SetPreCommitChallengeDelay(5)
t.Cleanup(func() {
policy.SetPreCommitChallengeDelay(oldDelay)
})
kit.QuietMiningLogs() kit.QuietMiningLogs()
opts := node.Override(new(*storageadapter.DealPublisher), opts := node.Override(new(*storageadapter.DealPublisher),
@ -365,6 +384,12 @@ func TestOfflineDealFlow(t *testing.T) {
// so that the deal starts sealing in time // so that the deal starts sealing in time
startEpoch := abi.ChainEpoch(2 << 12) startEpoch := abi.ChainEpoch(2 << 12)
oldDelay := policy.GetPreCommitChallengeDelay()
policy.SetPreCommitChallengeDelay(5)
t.Cleanup(func() {
policy.SetPreCommitChallengeDelay(oldDelay)
})
runTest := func(t *testing.T, fastRet bool) { runTest := func(t *testing.T, fastRet bool) {
ctx := context.Background() ctx := context.Background()
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs()) client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs())
@ -447,6 +472,12 @@ func TestZeroPricePerByteRetrieval(t *testing.T) {
t.Skip("skipping test in short mode") t.Skip("skipping test in short mode")
} }
oldDelay := policy.GetPreCommitChallengeDelay()
policy.SetPreCommitChallengeDelay(5)
t.Cleanup(func() {
policy.SetPreCommitChallengeDelay(oldDelay)
})
kit.QuietMiningLogs() kit.QuietMiningLogs()
var ( var (