From 1260836110ab80382dd2de01c501961ac65f4cb4 Mon Sep 17 00:00:00 2001 From: Aayush Rajasekaran Date: Thu, 3 Sep 2020 22:56:46 -0400 Subject: [PATCH] Make things build --- build/params_2k.go | 2 -- build/params_testnet.go | 3 --- chain/gen/gen_test.go | 2 -- chain/gen/genesis/miners.go | 10 ++++++++++ chain/stmgr/forks_test.go | 2 -- chain/stmgr/utils.go | 13 +++++++------ chain/sync_test.go | 2 -- chain/vectors/gen/main.go | 2 -- cli/paych_test.go | 2 -- cmd/lotus-storage-miner/info.go | 8 ++++++-- node/node_test.go | 2 -- 11 files changed, 23 insertions(+), 25 deletions(-) diff --git a/build/params_2k.go b/build/params_2k.go index 12005f005..7f088e2dd 100644 --- a/build/params_2k.go +++ b/build/params_2k.go @@ -6,12 +6,10 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" ) func init() { - power.ConsensusMinerMinPower = big.NewInt(2048) miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg2KiBV1: {}, } diff --git a/build/params_testnet.go b/build/params_testnet.go index f422b3861..c4d853395 100644 --- a/build/params_testnet.go +++ b/build/params_testnet.go @@ -6,14 +6,11 @@ package build import ( "github.com/filecoin-project/specs-actors/actors/abi" - "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" ) func init() { - power.ConsensusMinerMinPower = big.NewInt(10 << 40) miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg32GiBV1: {}, abi.RegisteredSealProof_StackedDrg64GiBV1: {}, diff --git a/chain/gen/gen_test.go b/chain/gen/gen_test.go index 52766af7a..e7184f4e7 100644 --- a/chain/gen/gen_test.go +++ b/chain/gen/gen_test.go @@ -6,7 +6,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" _ "github.com/filecoin-project/lotus/lib/sigs/bls" @@ -17,7 +16,6 @@ func init() { miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg2KiBV1: {}, } - power.ConsensusMinerMinPower = big.NewInt(2048) verifreg.MinVerifiedDealSize = big.NewInt(256) } diff --git a/chain/gen/genesis/miners.go b/chain/gen/genesis/miners.go index 187a9a2bf..6096cbd68 100644 --- a/chain/gen/genesis/miners.go +++ b/chain/gen/genesis/miners.go @@ -295,6 +295,16 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid if err != nil { return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err) } + + updatePowParams := &power.UpdateClaimedPowerParams{ + RawByteDelta: abi.NewStoragePower(int64(m.SectorSize)), + QualityAdjustedDelta: sectorWeight, + } + + _, err = doExecValue(ctx, vm, builtin.StoragePowerActorAddr, minerInfos[i].maddr, big.Zero(), builtin.MethodsPower.UpdateClaimedPower, mustEnc(updatePowParams)) + if err != nil { + return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err) + } } } } diff --git a/chain/stmgr/forks_test.go b/chain/stmgr/forks_test.go index caa63c879..25ff26813 100644 --- a/chain/stmgr/forks_test.go +++ b/chain/stmgr/forks_test.go @@ -12,7 +12,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/builtin" init_ "github.com/filecoin-project/specs-actors/actors/builtin/init" "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/specs-actors/actors/runtime" "github.com/filecoin-project/specs-actors/actors/util/adt" @@ -37,7 +36,6 @@ func init() { miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg2KiBV1: {}, } - power.ConsensusMinerMinPower = big.NewInt(2048) verifreg.MinVerifiedDealSize = big.NewInt(256) } diff --git a/chain/stmgr/utils.go b/chain/stmgr/utils.go index 0b0ddd2ac..5b64cc045 100644 --- a/chain/stmgr/utils.go +++ b/chain/stmgr/utils.go @@ -624,12 +624,13 @@ func init() { exports := m[1].(abi.Invokee).Exports() for i := 0; i < nf; i++ { export := reflect.TypeOf(exports[i+1]) - - MethodsMap[c] = append(MethodsMap[c], methodMeta{ - Name: rt.Field(i).Name, - Params: export.In(1), - Ret: export.Out(0), - }) + if export != nil { + MethodsMap[c] = append(MethodsMap[c], methodMeta{ + Name: rt.Field(i).Name, + Params: export.In(1), + Ret: export.Out(0), + }) + } } } } diff --git a/chain/sync_test.go b/chain/sync_test.go index cf1385baa..5525c3cf2 100644 --- a/chain/sync_test.go +++ b/chain/sync_test.go @@ -19,7 +19,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/lotus/api" @@ -44,7 +43,6 @@ func init() { miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg2KiBV1: {}, } - power.ConsensusMinerMinPower = big.NewInt(2048) verifreg.MinVerifiedDealSize = big.NewInt(256) } diff --git a/chain/vectors/gen/main.go b/chain/vectors/gen/main.go index ce8d137e8..2c7b36529 100644 --- a/chain/vectors/gen/main.go +++ b/chain/vectors/gen/main.go @@ -16,7 +16,6 @@ import ( "github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/filecoin-project/specs-actors/actors/crypto" @@ -26,7 +25,6 @@ import ( func init() { verifreg.MinVerifiedDealSize = big.NewInt(2048) - power.ConsensusMinerMinPower = big.NewInt(2048) } func MakeHeaderVectors() []vectors.HeaderVector { diff --git a/cli/paych_test.go b/cli/paych_test.go index d4089c4ab..f79300230 100644 --- a/cli/paych_test.go +++ b/cli/paych_test.go @@ -16,7 +16,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi/big" saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" "github.com/multiformats/go-multiaddr" @@ -39,7 +38,6 @@ import ( ) func init() { - power.ConsensusMinerMinPower = big.NewInt(2048) saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg2KiBV1: {}, } diff --git a/cmd/lotus-storage-miner/info.go b/cmd/lotus-storage-miner/info.go index d504a86a9..f5902620d 100644 --- a/cmd/lotus-storage-miner/info.go +++ b/cmd/lotus-storage-miner/info.go @@ -17,7 +17,6 @@ import ( sealing "github.com/filecoin-project/lotus/extern/storage-sealing" "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/util/adt" "github.com/filecoin-project/lotus/api" @@ -136,7 +135,12 @@ func infoCmdAct(cctx *cli.Context) error { faultyPercentage) } - if pow.MinerPower.RawBytePower.LessThan(power.ConsensusMinerMinPower) { + minPow, err := abi.ConsensusMinerMinPower(mi.SealProofType) + if err != nil { + return err + } + + if pow.MinerPower.RawBytePower.LessThan(minPow) { fmt.Print("Below minimum power threshold, no blocks will be won") } else { expWinChance := float64(types.BigMul(qpercI, types.NewInt(build.BlocksPerEpoch)).Int64()) / 1000000 diff --git a/node/node_test.go b/node/node_test.go index 31a14bc20..0e50b9572 100644 --- a/node/node_test.go +++ b/node/node_test.go @@ -11,7 +11,6 @@ import ( "github.com/filecoin-project/specs-actors/actors/abi" "github.com/filecoin-project/specs-actors/actors/abi/big" saminer "github.com/filecoin-project/specs-actors/actors/builtin/miner" - "github.com/filecoin-project/specs-actors/actors/builtin/power" "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" logging "github.com/ipfs/go-log/v2" @@ -21,7 +20,6 @@ import ( func init() { _ = logging.SetLogLevel("*", "INFO") - power.ConsensusMinerMinPower = big.NewInt(2048) saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{ abi.RegisteredSealProof_StackedDrg2KiBV1: {}, }