From 32a699d6a35a50eb9fe38af98fa60617ec6d3e27 Mon Sep 17 00:00:00 2001 From: Steven Allen Date: Wed, 23 Sep 2020 12:24:51 -0700 Subject: [PATCH] Add some actors policy setters for testing Addresses: * https://github.com/filecoin-project/lotus/pull/3781/files/a307e4593a005888395db34e5af4691ee50d765d#r491966115 * https://github.com/filecoin-project/lotus/pull/3781/files/a307e4593a005888395db34e5af4691ee50d765d#r491966634 Note: This puts everything into a policy package to avoid a dependency cycle between the build package, the miner package, and the types package. This is also why I introduced a GetPreCommitChallengeDelay function and removed the variable. --- build/params_2k.go | 14 +++--- build/params_testnet.go | 19 ++++---- chain/actors/builtin/miner/miner.go | 1 - chain/actors/policy/policy.go | 56 ++++++++++++++++++++++++ chain/gen/gen.go | 7 ++- chain/gen/gen_test.go | 13 ++---- chain/stmgr/forks_test.go | 13 ++---- chain/store/store_test.go | 13 ++---- chain/sync_test.go | 13 ++---- cli/paych_test.go | 34 ++++++-------- cmd/lotus-bench/main.go | 4 +- extern/storage-sealing/checks.go | 6 +-- extern/storage-sealing/states_sealing.go | 3 +- lotuspond/spawn.go | 6 +-- node/node_test.go | 24 +++++----- 15 files changed, 121 insertions(+), 105 deletions(-) create mode 100644 chain/actors/policy/policy.go diff --git a/build/params_2k.go b/build/params_2k.go index 4a49da22ba..3edd0fb82a 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -4,10 +4,8 @@ package build import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" + + "github.com/filecoin-project/lotus/chain/actors/policy" ) const UpgradeBreezeHeight = -1 @@ -20,11 +18,9 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ } func init() { - power0.ConsensusMinerMinPower = big.NewInt(2048) - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) BuildType |= Build2k } diff --git a/build/params_testnet.go b/build/params_testnet.go index 108aba20c1..13d2ff62e1 100644 --- a/build/params_testnet.go +++ b/build/params_testnet.go @@ -6,10 +6,9 @@ package build import ( "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" - "github.com/filecoin-project/specs-actors/actors/builtin" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" + "github.com/filecoin-project/lotus/chain/actors/policy" + + builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" ) var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ @@ -23,13 +22,13 @@ const BreezeGasTampingDuration = 120 const UpgradeSmokeHeight = 51000 func init() { - power0.ConsensusMinerMinPower = big.NewInt(10 << 40) - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg32GiBV1: {}, - abi.RegisteredSealProof_StackedDrg64GiBV1: {}, - } + policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40)) + policy.SetSupportedProofTypes( + abi.RegisteredSealProof_StackedDrg32GiBV1, + abi.RegisteredSealProof_StackedDrg64GiBV1, + ) } -const BlockDelaySecs = uint64(builtin.EpochDurationSeconds) +const BlockDelaySecs = uint64(builtin0.EpochDurationSeconds) const PropagationDelaySecs = uint64(6) diff --git a/chain/actors/builtin/miner/miner.go b/chain/actors/builtin/miner/miner.go index 50a0fc5ca9..1a4c466b90 100644 --- a/chain/actors/builtin/miner/miner.go +++ b/chain/actors/builtin/miner/miner.go @@ -19,7 +19,6 @@ import ( ) // Unchanged between v0 and v1 actors -var PreCommitChallengeDelay = miner0.PreCommitChallengeDelay var WPoStProvingPeriod = miner0.WPoStProvingPeriod const MinSectorExpiration = miner0.MinSectorExpiration diff --git a/chain/actors/policy/policy.go b/chain/actors/policy/policy.go new file mode 100644 index 0000000000..eec52e8553 --- /dev/null +++ b/chain/actors/policy/policy.go @@ -0,0 +1,56 @@ +package policy + +import ( + "github.com/filecoin-project/go-state-types/abi" + + miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" + power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" + verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" +) + +// SetSupportedProofTypes sets supported proof types, across all actor versions. +// This should only be used for testing. +func SetSupportedProofTypes(types ...abi.RegisteredSealProof) { + newTypes := make(map[abi.RegisteredSealProof]struct{}, len(types)) + for _, t := range types { + newTypes[t] = struct{}{} + } + // Set for all miner versions. + miner0.SupportedProofTypes = newTypes +} + +// AddSupportedProofTypes sets supported proof types, across all actor versions. +// This should only be used for testing. +func AddSupportedProofTypes(types ...abi.RegisteredSealProof) { + newTypes := make(map[abi.RegisteredSealProof]struct{}, len(types)) + for _, t := range types { + newTypes[t] = struct{}{} + } + // Set for all miner versions. + miner0.SupportedProofTypes = newTypes +} + +// SetPreCommitChallengeDelay sets the pre-commit challenge delay across all +// actors versions. Use for testing. +func SetPreCommitChallengeDelay(delay abi.ChainEpoch) { + // Set for all miner versions. + miner0.PreCommitChallengeDelay = delay +} + +// TODO: this function shouldn't really exist. Instead, the API should expose the precommit delay. +func GetPreCommitChallengeDelay() abi.ChainEpoch { + return miner0.PreCommitChallengeDelay +} + +// SetConsensusMinerMinPower sets the minimum power of an individual miner must +// meet for leader election, across all actor versions. This should only be used +// for testing. +func SetConsensusMinerMinPower(p abi.StoragePower) { + power0.ConsensusMinerMinPower = p +} + +// SetMinVerifiedDealSize sets the minimum size of a verified deal. This should +// only be used for testing. +func SetMinVerifiedDealSize(size abi.StoragePower) { + verifreg0.MinVerifiedDealSize = size +} diff --git a/chain/gen/gen.go b/chain/gen/gen.go index c4ecf1d41d..d05165ab12 100644 --- a/chain/gen/gen.go +++ b/chain/gen/gen.go @@ -14,7 +14,6 @@ import ( "github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" block "github.com/ipfs/go-block-format" "github.com/ipfs/go-blockservice" "github.com/ipfs/go-cid" @@ -28,6 +27,7 @@ import ( "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/beacon" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" "github.com/filecoin-project/lotus/chain/stmgr" @@ -121,9 +121,8 @@ var DefaultRemainderAccountActor = genesis.Actor{ } func NewGeneratorWithSectors(numSectors int) (*ChainGen, error) { - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } + // TODO: we really shouldn't modify a global variable here. + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) mr := repo.NewMemory(nil) lr, err := mr.Lock(repo.StorageMiner) diff --git a/chain/gen/gen_test.go b/chain/gen/gen_test.go index be913f5f2f..8c38328d07 100644 --- a/chain/gen/gen_test.go +++ b/chain/gen/gen_test.go @@ -4,21 +4,16 @@ import ( "testing" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" + "github.com/filecoin-project/lotus/chain/actors/policy" _ "github.com/filecoin-project/lotus/lib/sigs/bls" _ "github.com/filecoin-project/lotus/lib/sigs/secp" ) func init() { - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - power0.ConsensusMinerMinPower = big.NewInt(2048) - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) } func testGeneration(t testing.TB, n int, msgs int, sectors int) { diff --git a/chain/stmgr/forks_test.go b/chain/stmgr/forks_test.go index 8c6d2ce40c..516058a81b 100644 --- a/chain/stmgr/forks_test.go +++ b/chain/stmgr/forks_test.go @@ -8,18 +8,15 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/specs-actors/actors/builtin" init_ "github.com/filecoin-project/specs-actors/actors/builtin/init" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/specs-actors/actors/runtime" "golang.org/x/xerrors" "github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors/aerrors" lotusinit "github.com/filecoin-project/lotus/chain/actors/builtin/init" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/stmgr" . "github.com/filecoin-project/lotus/chain/stmgr" @@ -34,11 +31,9 @@ import ( ) func init() { - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - power0.ConsensusMinerMinPower = big.NewInt(2048) - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) } const testForkHeight = 40 diff --git a/chain/store/store_test.go b/chain/store/store_test.go index d5e0925590..b7adfb5950 100644 --- a/chain/store/store_test.go +++ b/chain/store/store_test.go @@ -8,12 +8,9 @@ import ( datastore "github.com/ipfs/go-datastore" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/crypto" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/types" @@ -22,11 +19,9 @@ import ( ) func init() { - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - power0.ConsensusMinerMinPower = big.NewInt(2048) - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) } func BenchmarkGetRandomness(b *testing.B) { diff --git a/chain/sync_test.go b/chain/sync_test.go index 53001caf82..7a839be2bf 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -19,13 +19,10 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/store" @@ -43,11 +40,9 @@ func init() { if err != nil { panic(err) } - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - power0.ConsensusMinerMinPower = big.NewInt(2048) - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) } const source = 0 diff --git a/cli/paych_test.go b/cli/paych_test.go index 47a84fe5e3..35f56d90e4 100644 --- a/cli/paych_test.go +++ b/cli/paych_test.go @@ -12,39 +12,31 @@ import ( "testing" "time" - "github.com/filecoin-project/lotus/build" - - "github.com/filecoin-project/go-state-types/big" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" + "github.com/stretchr/testify/require" + "github.com/urfave/cli/v2" + "github.com/filecoin-project/go-address" + "github.com/filecoin-project/go-state-types/abi" + cbor "github.com/ipfs/go-ipld-cbor" "github.com/multiformats/go-multiaddr" - "github.com/filecoin-project/lotus/chain/events" - - "github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/builtin/paych" - cbor "github.com/ipfs/go-ipld-cbor" + "github.com/filecoin-project/lotus/chain/actors/policy" - "github.com/filecoin-project/go-address" - "github.com/filecoin-project/lotus/chain/types" - - "github.com/filecoin-project/go-state-types/abi" + "github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/test" + "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/events" + "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/wallet" builder "github.com/filecoin-project/lotus/node/test" - "github.com/stretchr/testify/require" - "github.com/urfave/cli/v2" ) func init() { - power0.ConsensusMinerMinPower = big.NewInt(2048) - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) } // TestPaymentChannels does a basic test to exercise the payment channel CLI diff --git a/cmd/lotus-bench/main.go b/cmd/lotus-bench/main.go index 7da7544151..2516bfd260 100644 --- a/cmd/lotus-bench/main.go +++ b/cmd/lotus-bench/main.go @@ -27,11 +27,11 @@ import ( "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs" "github.com/filecoin-project/lotus/extern/sector-storage/stores" - "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/specs-storage/storage" lapi "github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/build" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/genesis" ) @@ -76,7 +76,7 @@ func main() { log.Info("Starting lotus-bench") - miner.SupportedProofTypes[abi.RegisteredSealProof_StackedDrg2KiBV1] = struct{}{} + policy.AddSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) app := &cli.App{ Name: "lotus-bench", diff --git a/extern/storage-sealing/checks.go b/extern/storage-sealing/checks.go index 3d9aedeb40..49994024f9 100644 --- a/extern/storage-sealing/checks.go +++ b/extern/storage-sealing/checks.go @@ -4,7 +4,7 @@ import ( "bytes" "context" - "github.com/filecoin-project/lotus/chain/actors/builtin/miner" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/build" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" @@ -156,8 +156,8 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte, return &ErrNoPrecommit{xerrors.Errorf("precommit info not found on-chain")} } - if pci.PreCommitEpoch+miner.PreCommitChallengeDelay != si.SeedEpoch { - return &ErrBadSeed{xerrors.Errorf("seed epoch doesn't match on chain info: %d != %d", pci.PreCommitEpoch+miner.PreCommitChallengeDelay, si.SeedEpoch)} + if pci.PreCommitEpoch+policy.GetPreCommitChallengeDelay() != si.SeedEpoch { + return &ErrBadSeed{xerrors.Errorf("seed epoch doesn't match on chain info: %d != %d", pci.PreCommitEpoch+policy.GetPreCommitChallengeDelay(), si.SeedEpoch)} } buf := new(bytes.Buffer) diff --git a/extern/storage-sealing/states_sealing.go b/extern/storage-sealing/states_sealing.go index 4433651600..a4e8524542 100644 --- a/extern/storage-sealing/states_sealing.go +++ b/extern/storage-sealing/states_sealing.go @@ -6,6 +6,7 @@ import ( "github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/chain/actors/builtin/miner" + "github.com/filecoin-project/lotus/chain/actors/policy" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" "golang.org/x/xerrors" @@ -281,7 +282,7 @@ func (m *Sealing) handleWaitSeed(ctx statemachine.Context, sector SectorInfo) er return ctx.Send(SectorChainPreCommitFailed{error: xerrors.Errorf("precommit info not found on chain")}) } - randHeight := pci.PreCommitEpoch + miner.PreCommitChallengeDelay + randHeight := pci.PreCommitEpoch + policy.GetPreCommitChallengeDelay() err = m.events.ChainAt(func(ectx context.Context, _ TipSetToken, curH abi.ChainEpoch) error { // in case of null blocks the randomness can land after the tipset we diff --git a/lotuspond/spawn.go b/lotuspond/spawn.go index 5fa82a8653..8b2e8661db 100644 --- a/lotuspond/spawn.go +++ b/lotuspond/spawn.go @@ -11,6 +11,7 @@ import ( "sync/atomic" "time" + "github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/types" "golang.org/x/xerrors" @@ -18,7 +19,6 @@ import ( "github.com/filecoin-project/go-address" "github.com/filecoin-project/go-state-types/abi" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" - "github.com/filecoin-project/specs-actors/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed" @@ -26,9 +26,7 @@ import ( ) func init() { - miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) } func (api *api) Spawn() (nodeInfo, error) { diff --git a/node/node_test.go b/node/node_test.go index 54498eec33..001b99c04d 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -5,29 +5,22 @@ import ( "testing" "time" - "github.com/filecoin-project/lotus/chain/actors/builtin/miner" - builder "github.com/filecoin-project/lotus/node/test" "github.com/filecoin-project/go-state-types/abi" - "github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/lotus/lib/lotuslog" - miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" - power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" - verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" logging "github.com/ipfs/go-log/v2" "github.com/filecoin-project/lotus/api/test" + "github.com/filecoin-project/lotus/chain/actors/policy" ) func init() { _ = logging.SetLogLevel("*", "INFO") - power0.ConsensusMinerMinPower = big.NewInt(2048) - miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ - abi.RegisteredSealProof_StackedDrg2KiBV1: {}, - } - verifreg0.MinVerifiedDealSize = big.NewInt(256) + policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048)) + policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1) + policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) } func TestAPI(t *testing.T) { @@ -70,9 +63,12 @@ func TestAPIDealFlowReal(t *testing.T) { logging.SetLogLevel("sub", "ERROR") logging.SetLogLevel("storageminer", "ERROR") - // TODO: Do this better. - miner.PreCommitChallengeDelay = 5 - miner0.PreCommitChallengeDelay = 5 + // TODO: just set this globally? + oldDelay := policy.GetPreCommitChallengeDelay() + policy.SetPreCommitChallengeDelay(5) + t.Cleanup(func() { + policy.SetPreCommitChallengeDelay(oldDelay) + }) t.Run("basic", func(t *testing.T) { test.TestDealFlow(t, builder.Builder, time.Second, false, false)