resolve conflicts
This commit is contained in:
commit
d89ddb9315
@ -286,15 +286,17 @@ type AddrUse int
|
||||
const (
|
||||
PreCommitAddr AddrUse = iota
|
||||
CommitAddr
|
||||
DealPublishAddr
|
||||
PoStAddr
|
||||
|
||||
TerminateSectorsAddr
|
||||
)
|
||||
|
||||
type AddressConfig struct {
|
||||
PreCommitControl []address.Address
|
||||
CommitControl []address.Address
|
||||
TerminateControl []address.Address
|
||||
PreCommitControl []address.Address
|
||||
CommitControl []address.Address
|
||||
TerminateControl []address.Address
|
||||
DealPublishControl []address.Address
|
||||
|
||||
DisableOwnerFallback bool
|
||||
DisableWorkerFallback bool
|
||||
|
@ -1,2 +1,2 @@
|
||||
/dns4/bootstrap-0.interop.fildev.network/tcp/1347/p2p/12D3KooWN86wA54r3v9M8bBYbc1vK9W1ehHDxVGPRaoeUYuXF8R7
|
||||
/dns4/bootstrap-1.interop.fildev.network/tcp/1347/p2p/12D3KooWNZ41kev8mtBZgWe43qam1VX9pJyf87jnaisQP2urZZ2M
|
||||
/dns4/bootstrap-0.interop.fildev.network/tcp/1347/p2p/12D3KooWLGPq9JL1xwL6gHok7HSNxtK1Q5kyfg4Hk69ifRPghn4i
|
||||
/dns4/bootstrap-1.interop.fildev.network/tcp/1347/p2p/12D3KooWFYS1f31zafv8mqqYu8U3hEqYvaZ6avWzYU3BmZdpyH3h
|
||||
|
Binary file not shown.
Binary file not shown.
@ -196,6 +196,33 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab
|
||||
}
|
||||
}
|
||||
|
||||
// SetProviderCollateralSupplyTarget sets the percentage of normalized circulating
|
||||
// supply that must be covered by provider collateral in a deal. This should
|
||||
// only be used for testing.
|
||||
func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
||||
|
||||
market2.ProviderCollateralSupplyTarget = builtin2.BigFrac{
|
||||
Numerator: num,
|
||||
Denominator: denom,
|
||||
}
|
||||
|
||||
market3.ProviderCollateralSupplyTarget = builtin3.BigFrac{
|
||||
Numerator: num,
|
||||
Denominator: denom,
|
||||
}
|
||||
|
||||
market4.ProviderCollateralSupplyTarget = builtin4.BigFrac{
|
||||
Numerator: num,
|
||||
Denominator: denom,
|
||||
}
|
||||
|
||||
market5.ProviderCollateralSupplyTarget = builtin5.BigFrac{
|
||||
Numerator: num,
|
||||
Denominator: denom,
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
func DealProviderCollateralBounds(
|
||||
size abi.PaddedPieceSize, verified bool,
|
||||
rawBytePower, qaPower, baselinePower abi.StoragePower,
|
||||
|
@ -132,6 +132,20 @@ func GetMaxProveCommitDuration(ver actors.Version, t abi.RegisteredSealProof) ab
|
||||
}
|
||||
}
|
||||
|
||||
// SetProviderCollateralSupplyTarget sets the percentage of normalized circulating
|
||||
// supply that must be covered by provider collateral in a deal. This should
|
||||
// only be used for testing.
|
||||
func SetProviderCollateralSupplyTarget(num, denom big.Int) {
|
||||
{{range .versions}}
|
||||
{{if (ge . 2)}}
|
||||
market{{.}}.ProviderCollateralSupplyTarget = builtin{{.}}.BigFrac{
|
||||
Numerator: num,
|
||||
Denominator: denom,
|
||||
}
|
||||
{{end}}
|
||||
{{end}}
|
||||
}
|
||||
|
||||
func DealProviderCollateralBounds(
|
||||
size abi.PaddedPieceSize, verified bool,
|
||||
rawBytePower, qaPower, baselinePower abi.StoragePower,
|
||||
|
@ -45,6 +45,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/lib/tablewriter"
|
||||
)
|
||||
|
||||
@ -1231,9 +1232,10 @@ var clientListRetrievalsCmd = &cli.Command{
|
||||
Usage: "print verbose deal details",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "show-failed",
|
||||
@ -1804,9 +1806,10 @@ var clientListDeals = &cli.Command{
|
||||
Usage: "print verbose deal details",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "show-failed",
|
||||
@ -2334,9 +2337,10 @@ var clientListTransfers = &cli.Command{
|
||||
Usage: "print verbose transfer details",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "completed",
|
||||
|
@ -695,7 +695,7 @@ var StateListActorsCmd = &cli.Command{
|
||||
var StateGetActorCmd = &cli.Command{
|
||||
Name: "get-actor",
|
||||
Usage: "Print actor information",
|
||||
ArgsUsage: "[actorrAddress]",
|
||||
ArgsUsage: "[actorAddress]",
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
|
14
cli/util/color.go
Normal file
14
cli/util/color.go
Normal file
@ -0,0 +1,14 @@
|
||||
package cliutil
|
||||
|
||||
import (
|
||||
"os"
|
||||
|
||||
"github.com/mattn/go-isatty"
|
||||
)
|
||||
|
||||
// DefaultColorUse is the globally referenced variable for all Lotus CLI tools
|
||||
// It sets to `true` if STDOUT is a TTY or if the variable GOLOG_LOG_FMT is set
|
||||
// to color (as recognizd by github.com/ipfs/go-log/v2)
|
||||
var DefaultColorUse = os.Getenv("GOLOG_LOG_FMT") == "color" ||
|
||||
isatty.IsTerminal(os.Stdout.Fd()) ||
|
||||
isatty.IsCygwinTerminal(os.Stdout.Fd())
|
@ -572,7 +572,7 @@ var genesisCarCmd = &cli.Command{
|
||||
}
|
||||
ofile := c.String("out")
|
||||
jrnl := journal.NilJournal()
|
||||
bstor := blockstore.NewMemorySync()
|
||||
bstor := blockstore.WrapIDStore(blockstore.NewMemorySync())
|
||||
sbldr := vm.Syscalls(ffiwrapper.ProofVerifier)
|
||||
_, err := testing.MakeGenesis(ofile, c.Args().First())(bstor, sbldr, jrnl)()
|
||||
return err
|
||||
|
@ -20,6 +20,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/lib/tablewriter"
|
||||
)
|
||||
|
||||
@ -265,8 +266,9 @@ var actorControlList = &cli.Command{
|
||||
Name: "verbose",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
|
@ -1,10 +1,16 @@
|
||||
package main
|
||||
|
||||
import (
|
||||
"context"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"math/rand"
|
||||
|
||||
"github.com/filecoin-project/lotus/api/v0api"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||
@ -18,6 +24,7 @@ var electionCmd = &cli.Command{
|
||||
Subcommands: []*cli.Command{
|
||||
electionRunDummy,
|
||||
electionEstimate,
|
||||
electionBacktest,
|
||||
},
|
||||
}
|
||||
|
||||
@ -124,3 +131,97 @@ var electionEstimate = &cli.Command{
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
var electionBacktest = &cli.Command{
|
||||
Name: "backtest",
|
||||
Usage: "Backtest elections with given miner",
|
||||
ArgsUsage: "[minerAddress]",
|
||||
Flags: []cli.Flag{
|
||||
&cli.Uint64Flag{
|
||||
Name: "height",
|
||||
Usage: "blockchain head height",
|
||||
},
|
||||
&cli.IntFlag{
|
||||
Name: "count",
|
||||
Usage: "number of won elections to look for",
|
||||
Value: 120,
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := lcli.GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("GetFullNodeAPI: %w", err)
|
||||
}
|
||||
|
||||
defer closer()
|
||||
ctx := lcli.ReqContext(cctx)
|
||||
|
||||
var head *types.TipSet
|
||||
if cctx.IsSet("height") {
|
||||
head, err = api.ChainGetTipSetByHeight(ctx, abi.ChainEpoch(cctx.Uint64("height")), types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("ChainGetTipSetByHeight: %w", err)
|
||||
}
|
||||
} else {
|
||||
head, err = api.ChainHead(ctx)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("ChainHead: %w", err)
|
||||
}
|
||||
}
|
||||
|
||||
miner, err := address.NewFromString(cctx.Args().First())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("miner address: %w", err)
|
||||
}
|
||||
|
||||
count := cctx.Int("count")
|
||||
if count < 1 {
|
||||
return xerrors.Errorf("count: %d", count)
|
||||
}
|
||||
|
||||
fmt.Println("height, winCount")
|
||||
roundEnd := head.Height() + abi.ChainEpoch(1)
|
||||
for i := 0; i < count; {
|
||||
for round := head.Height() + abi.ChainEpoch(1); round <= roundEnd; round++ {
|
||||
i++
|
||||
win, err := backTestWinner(ctx, miner, round, head, api)
|
||||
if err == nil && win != nil {
|
||||
fmt.Printf("%d, %d\n", round, win.WinCount)
|
||||
}
|
||||
}
|
||||
|
||||
roundEnd = head.Height()
|
||||
head, err = api.ChainGetTipSet(ctx, head.Parents())
|
||||
if err != nil {
|
||||
break
|
||||
}
|
||||
}
|
||||
return nil
|
||||
},
|
||||
}
|
||||
|
||||
func backTestWinner(ctx context.Context, miner address.Address, round abi.ChainEpoch, ts *types.TipSet, api v0api.FullNode) (*types.ElectionProof, error) {
|
||||
mbi, err := api.MinerGetBaseInfo(ctx, miner, round, ts.Key())
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to get mining base info: %w", err)
|
||||
}
|
||||
if mbi == nil {
|
||||
return nil, nil
|
||||
}
|
||||
if !mbi.EligibleForMining {
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
brand := mbi.PrevBeaconEntry
|
||||
bvals := mbi.BeaconEntries
|
||||
if len(bvals) > 0 {
|
||||
brand = bvals[len(bvals)-1]
|
||||
}
|
||||
|
||||
winner, err := gen.IsRoundWinner(ctx, ts, round, miner, brand, mbi, api)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to check if we win next round: %w", err)
|
||||
}
|
||||
|
||||
return winner, nil
|
||||
}
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/lib/tablewriter"
|
||||
)
|
||||
|
||||
@ -388,8 +389,9 @@ var actorControlList = &cli.Command{
|
||||
Name: "verbose",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
@ -435,6 +437,7 @@ var actorControlList = &cli.Command{
|
||||
commit := map[address.Address]struct{}{}
|
||||
precommit := map[address.Address]struct{}{}
|
||||
terminate := map[address.Address]struct{}{}
|
||||
dealPublish := map[address.Address]struct{}{}
|
||||
post := map[address.Address]struct{}{}
|
||||
|
||||
for _, ca := range mi.ControlAddresses {
|
||||
@ -471,6 +474,16 @@ var actorControlList = &cli.Command{
|
||||
terminate[ca] = struct{}{}
|
||||
}
|
||||
|
||||
for _, ca := range ac.DealPublishControl {
|
||||
ca, err := api.StateLookupID(ctx, ca, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
delete(post, ca)
|
||||
dealPublish[ca] = struct{}{}
|
||||
}
|
||||
|
||||
printKey := func(name string, a address.Address) {
|
||||
b, err := api.WalletBalance(ctx, a)
|
||||
if err != nil {
|
||||
@ -515,6 +528,9 @@ var actorControlList = &cli.Command{
|
||||
if _, ok := terminate[a]; ok {
|
||||
uses = append(uses, color.YellowString("terminate"))
|
||||
}
|
||||
if _, ok := dealPublish[a]; ok {
|
||||
uses = append(uses, color.MagentaString("deals"))
|
||||
}
|
||||
|
||||
tw.Write(map[string]interface{}{
|
||||
"name": name,
|
||||
|
@ -13,6 +13,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||
"github.com/filecoin-project/lotus/lib/tracing"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
@ -81,7 +82,9 @@ func main() {
|
||||
Aliases: []string{"a"},
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.StringFlag{
|
||||
Name: "repo",
|
||||
|
@ -30,6 +30,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
)
|
||||
|
||||
var CidBaseFlag = cli.StringFlag{
|
||||
@ -752,9 +753,10 @@ var transfersListCmd = &cli.Command{
|
||||
Usage: "print verbose transfer details",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Usage: "use color in display output",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "completed",
|
||||
|
@ -19,6 +19,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
)
|
||||
|
||||
var sealingCmd = &cli.Command{
|
||||
@ -36,7 +37,11 @@ var sealingWorkersCmd = &cli.Command{
|
||||
Name: "workers",
|
||||
Usage: "list workers",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{Name: "color"},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
color.NoColor = !cctx.Bool("color")
|
||||
@ -127,7 +132,11 @@ var sealingJobsCmd = &cli.Command{
|
||||
Name: "jobs",
|
||||
Usage: "list running jobs",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{Name: "color"},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "show-ret-done",
|
||||
Usage: "show returned but not consumed calls",
|
||||
|
@ -26,6 +26,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/lib/tablewriter"
|
||||
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||
)
|
||||
|
||||
@ -161,9 +162,10 @@ var sectorsListCmd = &cli.Command{
|
||||
Usage: "show removed sectors",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Aliases: []string{"c"},
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Aliases: []string{"c"},
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
&cli.BoolFlag{
|
||||
Name: "fast",
|
||||
@ -436,6 +438,12 @@ var sectorsExtendCmd = &cli.Command{
|
||||
Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs",
|
||||
Required: false,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "expiration-ignore",
|
||||
Value: 120,
|
||||
Usage: "when extending v1 sectors, skip sectors whose current expiration is less than <ignore> epochs from now",
|
||||
Required: false,
|
||||
},
|
||||
&cli.Int64Flag{
|
||||
Name: "expiration-cutoff",
|
||||
Usage: "when extending v1 sectors, skip sectors whose current expiration is more than <cutoff> epochs from now (infinity if unspecified)",
|
||||
@ -494,6 +502,10 @@ var sectorsExtendCmd = &cli.Command{
|
||||
continue
|
||||
}
|
||||
|
||||
if si.Expiration < (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-ignore"))) {
|
||||
continue
|
||||
}
|
||||
|
||||
if cctx.IsSet("expiration-cutoff") {
|
||||
if si.Expiration > (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-cutoff"))) {
|
||||
continue
|
||||
@ -508,6 +520,10 @@ var sectorsExtendCmd = &cli.Command{
|
||||
|
||||
// Set the new expiration to 48 hours less than the theoretical maximum lifetime
|
||||
newExp := ml - (miner3.WPoStProvingPeriod * 2) + si.Activation
|
||||
if withinTolerance(si.Expiration, newExp) || si.Expiration >= newExp {
|
||||
continue
|
||||
}
|
||||
|
||||
p, err := api.StateSectorPartition(ctx, maddr, si.SectorNumber, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting sector location for sector %d: %w", si.SectorNumber, err)
|
||||
@ -525,7 +541,7 @@ var sectorsExtendCmd = &cli.Command{
|
||||
} else {
|
||||
added := false
|
||||
for exp := range es {
|
||||
if withinTolerance(exp, newExp) {
|
||||
if withinTolerance(exp, newExp) && newExp >= exp && exp > si.Expiration {
|
||||
es[exp] = append(es[exp], uint64(si.SectorNumber))
|
||||
added = true
|
||||
break
|
||||
|
@ -27,6 +27,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
lcli "github.com/filecoin-project/lotus/cli"
|
||||
cliutil "github.com/filecoin-project/lotus/cli/util"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||
@ -166,7 +167,11 @@ var storageListCmd = &cli.Command{
|
||||
Name: "list",
|
||||
Usage: "list local storage paths",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{Name: "color"},
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Subcommands: []*cli.Command{
|
||||
storageListSectorsCmd,
|
||||
@ -478,8 +483,9 @@ var storageListSectorsCmd = &cli.Command{
|
||||
Usage: "get list of all sector files",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "color",
|
||||
Value: true,
|
||||
Name: "color",
|
||||
Value: cliutil.DefaultColorUse,
|
||||
DefaultText: "depends on output being a TTY",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
|
@ -229,6 +229,7 @@ Response:
|
||||
"PreCommitControl": null,
|
||||
"CommitControl": null,
|
||||
"TerminateControl": null,
|
||||
"DealPublishControl": null,
|
||||
"DisableOwnerFallback": true,
|
||||
"DisableWorkerFallback": true
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ COMMANDS:
|
||||
|
||||
GLOBAL OPTIONS:
|
||||
--actor value, -a value specify other actor to check state for (read only)
|
||||
--color (default: false)
|
||||
--color (default: depends on output being a TTY)
|
||||
--miner-repo value, --storagerepo value Specify miner repo path. flag(storagerepo) and env(LOTUS_STORAGE_PATH) are DEPRECATION, will REMOVE SOON (default: "~/.lotusminer") [$LOTUS_MINER_PATH, $LOTUS_STORAGE_PATH]
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
@ -315,7 +315,7 @@ USAGE:
|
||||
|
||||
OPTIONS:
|
||||
--verbose (default: false)
|
||||
--color (default: true)
|
||||
--color (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
@ -908,7 +908,7 @@ USAGE:
|
||||
|
||||
OPTIONS:
|
||||
--verbose, -v print verbose transfer details (default: false)
|
||||
--color use color in display output (default: true)
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--completed show completed data transfers (default: false)
|
||||
--watch watch deal updates in real-time, rather than a one time list (default: false)
|
||||
--show-failed show failed/cancelled transfers (default: false)
|
||||
@ -1364,7 +1364,7 @@ USAGE:
|
||||
|
||||
OPTIONS:
|
||||
--show-removed show removed sectors (default: false)
|
||||
--color, -c (default: true)
|
||||
--color, -c (default: depends on output being a TTY)
|
||||
--fast don't show on-chain info for better performance (default: false)
|
||||
--events display number of events the sector has received (default: false)
|
||||
--seal-time display how long it took for the sector to be sealed (default: false)
|
||||
@ -1425,6 +1425,7 @@ OPTIONS:
|
||||
--new-expiration value new expiration epoch (default: 0)
|
||||
--v1-sectors renews all v1 sectors up to the maximum possible lifetime (default: false)
|
||||
--tolerance value when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs (default: 20160)
|
||||
--expiration-ignore value when extending v1 sectors, skip sectors whose current expiration is less than <ignore> epochs from now (default: 120)
|
||||
--expiration-cutoff value when extending v1 sectors, skip sectors whose current expiration is more than <cutoff> epochs from now (infinity if unspecified) (default: 0)
|
||||
|
||||
--help, -h show help (default: false)
|
||||
@ -1759,7 +1760,7 @@ COMMANDS:
|
||||
help, h Shows a list of commands or help for one command
|
||||
|
||||
OPTIONS:
|
||||
--color (default: false)
|
||||
--color (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
--version, -v print the version (default: false)
|
||||
|
||||
@ -1774,7 +1775,7 @@ USAGE:
|
||||
lotus-miner storage list sectors [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--color (default: true)
|
||||
--color (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
@ -1836,7 +1837,7 @@ USAGE:
|
||||
lotus-miner sealing jobs [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--color (default: false)
|
||||
--color (default: depends on output being a TTY)
|
||||
--show-ret-done show returned but not consumed calls (default: false)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
@ -1851,7 +1852,7 @@ USAGE:
|
||||
lotus-miner sealing workers [command options] [arguments...]
|
||||
|
||||
OPTIONS:
|
||||
--color (default: false)
|
||||
--color (default: depends on output being a TTY)
|
||||
--help, -h show help (default: false)
|
||||
|
||||
```
|
||||
|
@ -535,7 +535,7 @@ CATEGORY:
|
||||
|
||||
OPTIONS:
|
||||
--verbose, -v print verbose deal details (default: false)
|
||||
--color use color in display output (default: true)
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--show-failed show failed/failing deals (default: true)
|
||||
--completed show completed retrievals (default: false)
|
||||
--watch watch deal updates in real-time, rather than a one time list (default: false)
|
||||
@ -609,7 +609,7 @@ CATEGORY:
|
||||
|
||||
OPTIONS:
|
||||
--verbose, -v print verbose deal details (default: false)
|
||||
--color use color in display output (default: true)
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--show-failed show failed/failing deals (default: false)
|
||||
--watch watch deal updates in real-time, rather than a one time list (default: false)
|
||||
--help, -h show help (default: false)
|
||||
@ -747,7 +747,7 @@ CATEGORY:
|
||||
|
||||
OPTIONS:
|
||||
--verbose, -v print verbose transfer details (default: false)
|
||||
--color use color in display output (default: true)
|
||||
--color use color in display output (default: depends on output being a TTY)
|
||||
--completed show completed data transfers (default: false)
|
||||
--watch watch deal updates in real-time, rather than a one time list (default: false)
|
||||
--show-failed show failed/cancelled transfers (default: false)
|
||||
@ -1673,7 +1673,7 @@ NAME:
|
||||
lotus state get-actor - Print actor information
|
||||
|
||||
USAGE:
|
||||
lotus state get-actor [command options] [actorrAddress]
|
||||
lotus state get-actor [command options] [actorAddress]
|
||||
|
||||
OPTIONS:
|
||||
--help, -h show help (default: false)
|
||||
|
@ -43,13 +43,8 @@ Testing an RC:
|
||||
- [ ] **Stage 1 - Internal Testing**
|
||||
- Binaries
|
||||
- [ ] Ensure the RC release has downloadable binaries
|
||||
- [ ] Validate the binary is able to run on at least one platform
|
||||
- Upgrade our testnet infra
|
||||
- [ ] 1 bootstrap node
|
||||
- [ ] 1 miner
|
||||
- [ ] Scratch nodes
|
||||
- [ ] Wait 24 hours, confirm nodes stay in sync
|
||||
- [ ] Remaining testnet infra
|
||||
- Upgrade our mainnet infra
|
||||
- [ ] Subset of development full archival nodes
|
||||
- [ ] Subset of bootstrappers (1 per region)
|
||||
|
4
go.mod
4
go.mod
@ -89,7 +89,7 @@ require (
|
||||
github.com/ipfs/go-ipfs-util v0.0.2
|
||||
github.com/ipfs/go-ipld-cbor v0.0.5
|
||||
github.com/ipfs/go-ipld-format v0.2.0
|
||||
github.com/ipfs/go-log/v2 v2.1.3
|
||||
github.com/ipfs/go-log/v2 v2.3.0
|
||||
github.com/ipfs/go-merkledag v0.3.2
|
||||
github.com/ipfs/go-metrics-interface v0.0.1
|
||||
github.com/ipfs/go-metrics-prometheus v0.0.2
|
||||
@ -119,7 +119,7 @@ require (
|
||||
github.com/libp2p/go-libp2p-yamux v0.5.4
|
||||
github.com/libp2p/go-maddr-filter v0.1.0
|
||||
github.com/mattn/go-colorable v0.1.6 // indirect
|
||||
github.com/mattn/go-isatty v0.0.12
|
||||
github.com/mattn/go-isatty v0.0.13
|
||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1
|
||||
github.com/mitchellh/go-homedir v1.1.0
|
||||
github.com/multiformats/go-base32 v0.0.3
|
||||
|
7
go.sum
7
go.sum
@ -703,10 +703,10 @@ github.com/ipfs/go-log/v2 v2.0.8/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscw
|
||||
github.com/ipfs/go-log/v2 v2.1.1/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
|
||||
github.com/ipfs/go-log/v2 v2.1.2-0.20200626104915-0016c0b4b3e4/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
|
||||
github.com/ipfs/go-log/v2 v2.1.2/go.mod h1:2v2nsGfZsvvAJz13SyFzf9ObaqwHiHxsPLEHntrv9KM=
|
||||
github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk=
|
||||
github.com/ipfs/go-log/v2 v2.1.3 h1:1iS3IU7aXRlbgUpN8yTTpJ53NXYjAe37vcI5+5nYrzk=
|
||||
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
|
||||
github.com/ipfs/go-log/v2 v2.1.3/go.mod h1:/8d0SH3Su5Ooc31QlL1WysJhvyOTDCjcCZ9Axpmri6g=
|
||||
github.com/ipfs/go-log/v2 v2.3.0 h1:31Re/cPqFHpsRHgyVwjWADPoF0otB1WrjTy8ZFYwEZU=
|
||||
github.com/ipfs/go-log/v2 v2.3.0/go.mod h1:QqGoj30OTpnKaG/LKTGTxoP2mmQtjVMEnK72gynbe/g=
|
||||
github.com/ipfs/go-merkledag v0.0.3/go.mod h1:Oc5kIXLHokkE1hWGMBHw+oxehkAaTOqtEb7Zbh6BhLA=
|
||||
github.com/ipfs/go-merkledag v0.0.6/go.mod h1:QYPdnlvkOg7GnQRofu9XZimC5ZW5Wi3bKys/4GQQfto=
|
||||
github.com/ipfs/go-merkledag v0.2.3/go.mod h1:SQiXrtSts3KGNmgOzMICy5c0POOpUNQLvB3ClKnBAlk=
|
||||
@ -1182,8 +1182,9 @@ github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNx
|
||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
||||
github.com/mattn/go-isatty v0.0.11/go.mod h1:PhnuNfih5lzO57/f3n+odYbM4JtupLOxQOAqxQCu2WE=
|
||||
github.com/mattn/go-isatty v0.0.12 h1:wuysRhFDzyxgEmMf5xjvJ2M9dZoWAXNNr5LSBS7uHXY=
|
||||
github.com/mattn/go-isatty v0.0.12/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-isatty v0.0.13 h1:qdl+GuBjcsKKDco5BsxPJlId98mSWNKqYA+Co0SC1yA=
|
||||
github.com/mattn/go-isatty v0.0.13/go.mod h1:cbi8OIDigv2wuxKPP5vlRcQ1OAZbq2CE4Kysco4FUpU=
|
||||
github.com/mattn/go-runewidth v0.0.2/go.mod h1:LwmH8dsx7+W8Uxz3IHJYH5QSwggIsqBzpuz5H//U1FU=
|
||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
||||
github.com/mattn/go-runewidth v0.0.10 h1:CoZ3S2P7pvtP45xOtBw+/mDL2z0RKI576gSkzRRpdGg=
|
||||
|
@ -73,9 +73,13 @@ func runTestCCUpgrade(t *testing.T, upgradeHeight abi.ChainEpoch) {
|
||||
|
||||
{
|
||||
exp, err := client.StateSectorExpiration(ctx, maddr, CC, types.EmptyTSK)
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, exp)
|
||||
require.Greater(t, 50000, int(exp.OnTime))
|
||||
if err != nil {
|
||||
require.Contains(t, err.Error(), "failed to find sector 3") // already cleaned up
|
||||
} else {
|
||||
require.NoError(t, err)
|
||||
require.NotNil(t, exp)
|
||||
require.Greater(t, 50000, int(exp.OnTime))
|
||||
}
|
||||
}
|
||||
{
|
||||
exp, err := client.StateSectorExpiration(ctx, maddr, Upgraded, types.EmptyTSK)
|
||||
|
@ -11,9 +11,13 @@ import (
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
"github.com/filecoin-project/lotus/itests/kit"
|
||||
"github.com/filecoin-project/lotus/markets/storageadapter"
|
||||
"github.com/filecoin-project/lotus/node"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/node/modules"
|
||||
"github.com/filecoin-project/lotus/storage"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
"github.com/stretchr/testify/require"
|
||||
)
|
||||
@ -28,16 +32,34 @@ func TestPublishDealsBatching(t *testing.T) {
|
||||
|
||||
kit.QuietMiningLogs()
|
||||
|
||||
opts := node.Override(new(*storageadapter.DealPublisher),
|
||||
storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{
|
||||
Period: publishPeriod,
|
||||
MaxDealsPerMsg: maxDealsPerMsg,
|
||||
}),
|
||||
publisherKey, err := wallet.GenerateKey(types.KTSecp256k1)
|
||||
require.NoError(t, err)
|
||||
|
||||
opts := node.Options(
|
||||
node.Override(new(*storageadapter.DealPublisher),
|
||||
storageadapter.NewDealPublisher(nil, storageadapter.PublishMsgConfig{
|
||||
Period: publishPeriod,
|
||||
MaxDealsPerMsg: maxDealsPerMsg,
|
||||
}),
|
||||
),
|
||||
node.Override(new(*storage.AddressSelector), modules.AddressSelector(&config.MinerAddressConfig{
|
||||
DealPublishControl: []string{
|
||||
publisherKey.Address.String(),
|
||||
},
|
||||
DisableOwnerFallback: true,
|
||||
DisableWorkerFallback: true,
|
||||
})),
|
||||
kit.LatestActorsAt(-1),
|
||||
)
|
||||
|
||||
client, miner, ens := kit.EnsembleMinimal(t, kit.MockProofs(), kit.ConstructorOpts(opts))
|
||||
client, miner, ens := kit.EnsembleMinimal(t, kit.Account(publisherKey, types.FromFil(10)), kit.MockProofs(), kit.ConstructorOpts(opts))
|
||||
ens.InterconnectAll().BeginMining(10 * time.Millisecond)
|
||||
|
||||
_, err = client.WalletImport(ctx, &publisherKey.KeyInfo)
|
||||
require.NoError(t, err)
|
||||
|
||||
miner.SetControlAddresses(publisherKey.Address)
|
||||
|
||||
dh := kit.NewDealHarness(t, client, miner, miner)
|
||||
|
||||
// Starts a deal and waits until it's published
|
||||
@ -92,6 +114,7 @@ func TestPublishDealsBatching(t *testing.T) {
|
||||
err = pubDealsParams.UnmarshalCBOR(bytes.NewReader(msg.Params))
|
||||
require.NoError(t, err)
|
||||
require.Len(t, pubDealsParams.Deals, int(maxDealsPerMsg))
|
||||
require.Equal(t, publisherKey.Address.String(), msg.From.String())
|
||||
}
|
||||
}
|
||||
require.Equal(t, 1, count)
|
||||
|
42
itests/kit/control.go
Normal file
42
itests/kit/control.go
Normal file
@ -0,0 +1,42 @@
|
||||
package kit
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
addr "github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
func (tm *TestMiner) SetControlAddresses(addrs ...addr.Address) {
|
||||
ctx := context.TODO()
|
||||
|
||||
mi, err := tm.FullNode.StateMinerInfo(ctx, tm.ActorAddr, types.EmptyTSK)
|
||||
require.NoError(tm.t, err)
|
||||
|
||||
cwp := &miner2.ChangeWorkerAddressParams{
|
||||
NewWorker: mi.Worker,
|
||||
NewControlAddrs: addrs,
|
||||
}
|
||||
|
||||
sp, err := actors.SerializeParams(cwp)
|
||||
require.NoError(tm.t, err)
|
||||
|
||||
smsg, err := tm.FullNode.MpoolPushMessage(ctx, &types.Message{
|
||||
From: mi.Owner,
|
||||
To: tm.ActorAddr,
|
||||
Method: miner.Methods.ChangeWorkerAddress,
|
||||
|
||||
Value: big.Zero(),
|
||||
Params: sp,
|
||||
}, nil)
|
||||
require.NoError(tm.t, err)
|
||||
|
||||
tm.FullNode.WaitMsg(ctx, smsg.Cid())
|
||||
}
|
@ -4,9 +4,11 @@ import (
|
||||
"context"
|
||||
"testing"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/stretchr/testify/require"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/ipfs/go-cid"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -27,8 +29,12 @@ func SendFunds(ctx context.Context, t *testing.T, sender *TestFullNode, recipien
|
||||
sm, err := sender.MpoolPushMessage(ctx, msg, nil)
|
||||
require.NoError(t, err)
|
||||
|
||||
res, err := sender.StateWaitMsg(ctx, sm.Cid(), 3, api.LookbackNoLimit, true)
|
||||
require.NoError(t, err)
|
||||
|
||||
require.EqualValues(t, 0, res.Receipt.ExitCode, "did not successfully send funds")
|
||||
sender.WaitMsg(ctx, sm.Cid())
|
||||
}
|
||||
|
||||
func (f *TestFullNode) WaitMsg(ctx context.Context, msg cid.Cid) {
|
||||
res, err := f.StateWaitMsg(ctx, msg, 3, api.LookbackNoLimit, true)
|
||||
require.NoError(f.t, err)
|
||||
|
||||
require.EqualValues(f.t, 0, res.Receipt.ExitCode, "message did not successfully execute")
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ import (
|
||||
"os"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/policy"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
@ -13,6 +14,8 @@ import (
|
||||
func init() {
|
||||
_ = logging.SetLogLevel("*", "INFO")
|
||||
|
||||
policy.SetProviderCollateralSupplyTarget(big.Zero(), big.NewInt(1))
|
||||
|
||||
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2048))
|
||||
policy.SetSupportedProofTypes(abi.RegisteredSealProof_StackedDrg2KiBV1)
|
||||
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
|
||||
|
@ -160,8 +160,16 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
|
||||
return 0, xerrors.Errorf("failed to resolve from msg ID addr: %w", err)
|
||||
}
|
||||
|
||||
if fromid != mi.Worker {
|
||||
return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s", pubmsg.From, deal.Proposal.Provider)
|
||||
var pubOk bool
|
||||
pubAddrs := append([]address.Address{mi.Worker, mi.Owner}, mi.ControlAddresses...)
|
||||
for _, a := range pubAddrs {
|
||||
if fromid == a {
|
||||
pubOk = true
|
||||
break
|
||||
}
|
||||
}
|
||||
if !pubOk {
|
||||
return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s,%+v", pubmsg.From, deal.Proposal.Provider, pubAddrs)
|
||||
}
|
||||
|
||||
if pubmsg.To != miner2.StorageMarketActorAddr {
|
||||
|
@ -7,27 +7,33 @@ import (
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
"github.com/ipfs/go-cid"
|
||||
"go.uber.org/fx"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
|
||||
"github.com/ipfs/go-cid"
|
||||
"golang.org/x/xerrors"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage"
|
||||
)
|
||||
|
||||
type dealPublisherAPI interface {
|
||||
ChainHead(context.Context) (*types.TipSet, error)
|
||||
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error)
|
||||
|
||||
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
||||
WalletHas(context.Context, address.Address) (bool, error)
|
||||
StateAccountKey(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
}
|
||||
|
||||
// DealPublisher batches deal publishing so that many deals can be included in
|
||||
@ -40,6 +46,7 @@ type dealPublisherAPI interface {
|
||||
// publish message with all deals in the queue.
|
||||
type DealPublisher struct {
|
||||
api dealPublisherAPI
|
||||
as *storage.AddressSelector
|
||||
|
||||
ctx context.Context
|
||||
Shutdown context.CancelFunc
|
||||
@ -87,14 +94,14 @@ type PublishMsgConfig struct {
|
||||
func NewDealPublisher(
|
||||
feeConfig *config.MinerFeeConfig,
|
||||
publishMsgCfg PublishMsgConfig,
|
||||
) func(lc fx.Lifecycle, full api.FullNode) *DealPublisher {
|
||||
return func(lc fx.Lifecycle, full api.FullNode) *DealPublisher {
|
||||
) func(lc fx.Lifecycle, full api.FullNode, as *storage.AddressSelector) *DealPublisher {
|
||||
return func(lc fx.Lifecycle, full api.FullNode, as *storage.AddressSelector) *DealPublisher {
|
||||
maxFee := abi.NewTokenAmount(0)
|
||||
if feeConfig != nil {
|
||||
maxFee = abi.TokenAmount(feeConfig.MaxPublishDealsFee)
|
||||
}
|
||||
publishSpec := &api.MessageSendSpec{MaxFee: maxFee}
|
||||
dp := newDealPublisher(full, publishMsgCfg, publishSpec)
|
||||
dp := newDealPublisher(full, as, publishMsgCfg, publishSpec)
|
||||
lc.Append(fx.Hook{
|
||||
OnStop: func(ctx context.Context) error {
|
||||
dp.Shutdown()
|
||||
@ -107,12 +114,14 @@ func NewDealPublisher(
|
||||
|
||||
func newDealPublisher(
|
||||
dpapi dealPublisherAPI,
|
||||
as *storage.AddressSelector,
|
||||
publishMsgCfg PublishMsgConfig,
|
||||
publishSpec *api.MessageSendSpec,
|
||||
) *DealPublisher {
|
||||
ctx, cancel := context.WithCancel(context.Background())
|
||||
return &DealPublisher{
|
||||
api: dpapi,
|
||||
as: as,
|
||||
ctx: ctx,
|
||||
Shutdown: cancel,
|
||||
maxDealsPerPublishMsg: publishMsgCfg.MaxDealsPerMsg,
|
||||
@ -345,9 +354,14 @@ func (p *DealPublisher) publishDealProposals(deals []market2.ClientDealProposal)
|
||||
return cid.Undef, xerrors.Errorf("serializing PublishStorageDeals params failed: %w", err)
|
||||
}
|
||||
|
||||
addr, _, err := p.as.AddressFor(p.ctx, p.api, mi, api.DealPublishAddr, big.Zero(), big.Zero())
|
||||
if err != nil {
|
||||
return cid.Undef, xerrors.Errorf("selecting address for publishing deals: %w", err)
|
||||
}
|
||||
|
||||
smsg, err := p.api.MpoolPushMessage(p.ctx, &types.Message{
|
||||
To: market.Address,
|
||||
From: mi.Worker,
|
||||
From: addr,
|
||||
Value: types.NewInt(0),
|
||||
Method: market.Methods.PublishStorageDeals,
|
||||
Params: params,
|
||||
|
@ -94,7 +94,7 @@ func TestDealPublisher(t *testing.T) {
|
||||
dpapi := newDPAPI(t)
|
||||
|
||||
// Create a deal publisher
|
||||
dp := newDealPublisher(dpapi, PublishMsgConfig{
|
||||
dp := newDealPublisher(dpapi, nil, PublishMsgConfig{
|
||||
Period: tc.publishPeriod,
|
||||
MaxDealsPerMsg: tc.maxDealsPerMsg,
|
||||
}, &api.MessageSendSpec{MaxFee: abi.NewTokenAmount(1)})
|
||||
@ -134,7 +134,7 @@ func TestForcePublish(t *testing.T) {
|
||||
// Create a deal publisher
|
||||
start := time.Now()
|
||||
publishPeriod := time.Hour
|
||||
dp := newDealPublisher(dpapi, PublishMsgConfig{
|
||||
dp := newDealPublisher(dpapi, nil, PublishMsgConfig{
|
||||
Period: publishPeriod,
|
||||
MaxDealsPerMsg: 10,
|
||||
}, &api.MessageSendSpec{MaxFee: abi.NewTokenAmount(1)})
|
||||
@ -320,6 +320,22 @@ func (d *dpAPI) MpoolPushMessage(ctx context.Context, msg *types.Message, spec *
|
||||
return &types.SignedMessage{Message: *msg}, nil
|
||||
}
|
||||
|
||||
func (d *dpAPI) WalletBalance(ctx context.Context, a address.Address) (types.BigInt, error) {
|
||||
panic("don't call me")
|
||||
}
|
||||
|
||||
func (d *dpAPI) WalletHas(ctx context.Context, a address.Address) (bool, error) {
|
||||
panic("don't call me")
|
||||
}
|
||||
|
||||
func (d *dpAPI) StateAccountKey(ctx context.Context, a address.Address, key types.TipSetKey) (address.Address, error) {
|
||||
panic("don't call me")
|
||||
}
|
||||
|
||||
func (d *dpAPI) StateLookupID(ctx context.Context, a address.Address, key types.TipSetKey) (address.Address, error) {
|
||||
panic("don't call me")
|
||||
}
|
||||
|
||||
func getClientActor(t *testing.T) address.Address {
|
||||
return tutils.NewActorAddr(t, "client")
|
||||
}
|
||||
|
@ -6,6 +6,7 @@ import (
|
||||
"crypto/rand"
|
||||
"encoding/binary"
|
||||
"fmt"
|
||||
"os"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -325,7 +326,9 @@ minerLoop:
|
||||
|
||||
if err := m.sf.MinedBlock(b.Header, base.TipSet.Height()+base.NullRounds); err != nil {
|
||||
log.Errorf("<!!> SLASH FILTER ERROR: %s", err)
|
||||
continue
|
||||
if os.Getenv("LOTUS_MINER_NO_SLASHFILTER") != "_yes_i_know_i_can_and_probably_will_lose_all_my_fil_and_power_" {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
blkKey := fmt.Sprintf("%d", b.Header.Height)
|
||||
|
@ -193,9 +193,10 @@ type MinerFeeConfig struct {
|
||||
}
|
||||
|
||||
type MinerAddressConfig struct {
|
||||
PreCommitControl []string
|
||||
CommitControl []string
|
||||
TerminateControl []string
|
||||
PreCommitControl []string
|
||||
CommitControl []string
|
||||
TerminateControl []string
|
||||
DealPublishControl []string
|
||||
|
||||
// DisableOwnerFallback disables usage of the owner address for messages
|
||||
// sent automatically
|
||||
@ -422,8 +423,10 @@ func DefaultStorageMiner() *StorageMiner {
|
||||
},
|
||||
|
||||
Addresses: MinerAddressConfig{
|
||||
PreCommitControl: []string{},
|
||||
CommitControl: []string{},
|
||||
PreCommitControl: []string{},
|
||||
CommitControl: []string{},
|
||||
TerminateControl: []string{},
|
||||
DealPublishControl: []string{},
|
||||
},
|
||||
}
|
||||
cfg.Common.API.ListenAddress = "/ip4/127.0.0.1/tcp/2345/http"
|
||||
|
@ -188,6 +188,15 @@ func AddressSelector(addrConf *config.MinerAddressConfig) func() (*storage.Addre
|
||||
as.TerminateControl = append(as.TerminateControl, addr)
|
||||
}
|
||||
|
||||
for _, s := range addrConf.DealPublishControl {
|
||||
addr, err := address.NewFromString(s)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("parsing deal publishing control address: %w", err)
|
||||
}
|
||||
|
||||
as.DealPublishControl = append(as.DealPublishControl, addr)
|
||||
}
|
||||
|
||||
return as, nil
|
||||
}
|
||||
}
|
||||
|
@ -5,6 +5,7 @@ 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/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -24,6 +25,12 @@ type AddressSelector struct {
|
||||
}
|
||||
|
||||
func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi miner.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
|
||||
if as == nil {
|
||||
// should only happen in some tests
|
||||
log.Warnw("smart address selection disabled, using worker address")
|
||||
return mi.Worker, big.Zero(), nil
|
||||
}
|
||||
|
||||
var addrs []address.Address
|
||||
switch use {
|
||||
case api.PreCommitAddr:
|
||||
@ -32,6 +39,8 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi m
|
||||
addrs = append(addrs, as.CommitControl...)
|
||||
case api.TerminateSectorsAddr:
|
||||
addrs = append(addrs, as.TerminateControl...)
|
||||
case api.DealPublishAddr:
|
||||
addrs = append(addrs, as.DealPublishControl...)
|
||||
default:
|
||||
defaultCtl := map[address.Address]struct{}{}
|
||||
for _, a := range mi.ControlAddresses {
|
||||
@ -43,6 +52,7 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a addrSelectApi, mi m
|
||||
configCtl := append([]address.Address{}, as.PreCommitControl...)
|
||||
configCtl = append(configCtl, as.CommitControl...)
|
||||
configCtl = append(configCtl, as.TerminateControl...)
|
||||
configCtl = append(configCtl, as.DealPublishControl...)
|
||||
|
||||
for _, addr := range configCtl {
|
||||
if addr.Protocol() != address.ID {
|
||||
|
@ -6,7 +6,7 @@
|
||||
GATE="$LOTUS_PATH"/date_initialized
|
||||
|
||||
# Don't init if already initialized.
|
||||
if [ -f "GATE" ]; then
|
||||
if [ -f "$GATE" ]; then
|
||||
echo lotus already initialized.
|
||||
exit 0
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@
|
||||
GATE="$LOTUS_PATH"/date_initialized
|
||||
|
||||
# Don't init if already initialized.
|
||||
if [ -f "GATE" ]; then
|
||||
if [ -f "$GATE" ]; then
|
||||
echo lotus already initialized.
|
||||
exit 0
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@
|
||||
GATE="$LOTUS_PATH"/date_initialized
|
||||
|
||||
# Don't init if already initialized.
|
||||
if [ -f "GATE" ]; then
|
||||
if [ -f "$GATE" ]; then
|
||||
echo lotus already initialized.
|
||||
exit 0
|
||||
fi
|
||||
|
@ -6,7 +6,7 @@
|
||||
GATE="$LOTUS_PATH"/date_initialized
|
||||
|
||||
# Don't init if already initialized.
|
||||
if [ -f "GATE" ]; then
|
||||
if [ -f "$GATE" ]; then
|
||||
echo lotus already initialized.
|
||||
exit 0
|
||||
fi
|
||||
|
Loading…
Reference in New Issue
Block a user