lp:feat multiaddr, comments
This commit is contained in:
parent
a0867a2a60
commit
425e672ef6
@ -35,7 +35,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/provider"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
"github.com/filecoin-project/lotus/provider/multictladdr"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/ffiwrapper"
|
||||
@ -96,8 +96,8 @@ type Deps struct {
|
||||
Full api.FullNode
|
||||
Verif storiface.Verifier
|
||||
LW *sealer.LocalWorker
|
||||
As *ctladdr.MultiAddressSelector
|
||||
Maddrs []dtypes.MinerAddress
|
||||
As *multictladdr.MultiAddressSelector
|
||||
Maddrs map[dtypes.MinerAddress]bool
|
||||
Stor *paths.Remote
|
||||
Si *paths.DBIndex
|
||||
LocalStore *paths.Local
|
||||
@ -243,7 +243,7 @@ Get it with: jq .PrivateKey ~/.lotus-miner/keystore/MF2XI2BNNJ3XILLQOJUXMYLUMU`,
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
deps.Maddrs = append(deps.Maddrs, dtypes.MinerAddress(addr))
|
||||
deps.Maddrs[dtypes.MinerAddress(addr)] = true
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -189,7 +189,7 @@ It will not send any messages to the chain. Since it can compute any deadline, o
|
||||
|
||||
di := dline.NewInfo(head.Height(), cctx.Uint64("deadline"), 0, 0, 0, 10 /*challenge window*/, 0, 0)
|
||||
|
||||
for _, maddr := range deps.Maddrs {
|
||||
for maddr := range deps.Maddrs {
|
||||
out, err := wdPostTask.DoPartition(ctx, head, address.Address(maddr), di, cctx.Uint64("partition"))
|
||||
if err != nil {
|
||||
fmt.Println("Error computing WindowPoSt for miner", maddr, err)
|
||||
|
7
go.mod
7
go.mod
@ -166,12 +166,6 @@ require (
|
||||
gotest.tools v2.2.0+incompatible
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/bahlo/generic-list-go v0.2.0 // indirect
|
||||
github.com/buger/jsonparser v1.1.1 // indirect
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 // indirect
|
||||
)
|
||||
|
||||
require (
|
||||
github.com/GeertJohan/go.incremental v1.0.0 // indirect
|
||||
github.com/PuerkitoBio/purell v1.1.1 // indirect
|
||||
@ -231,7 +225,6 @@ require (
|
||||
github.com/hashicorp/golang-lru v0.6.0 // indirect
|
||||
github.com/huin/goupnp v1.2.0 // indirect
|
||||
github.com/iancoleman/orderedmap v0.1.0 // indirect
|
||||
github.com/invopop/jsonschema v0.12.0
|
||||
github.com/ipfs/go-bitfield v1.1.0 // indirect
|
||||
github.com/ipfs/go-blockservice v0.5.1 // indirect
|
||||
github.com/ipfs/go-ipfs-blockstore v1.3.0 // indirect
|
||||
|
8
go.sum
8
go.sum
@ -102,8 +102,6 @@ github.com/aryann/difflib v0.0.0-20170710044230-e206f873d14a/go.mod h1:DAHtR1m6l
|
||||
github.com/aws/aws-lambda-go v1.13.3/go.mod h1:4UKl9IzQMoD+QF79YdCuzCwp8VbmG4VAQwij/eHl5CU=
|
||||
github.com/aws/aws-sdk-go v1.27.0/go.mod h1:KmX6BPdI08NWTb3/sm4ZGu5ShLoqVDhKgpiN924inxo=
|
||||
github.com/aws/aws-sdk-go-v2 v0.18.0/go.mod h1:JWVYvqSMppoMJC0x5wdwiImzgXTI9FuZwxzkQq9wy+g=
|
||||
github.com/bahlo/generic-list-go v0.2.0 h1:5sz/EEAK+ls5wF+NeqDpk5+iNdMDXrh3z3nPnH1Wvgk=
|
||||
github.com/bahlo/generic-list-go v0.2.0/go.mod h1:2KvAjgMlE5NNynlg/5iLrrCCZ2+5xWbdbCW3pNTGyYg=
|
||||
github.com/benbjohnson/clock v1.1.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/benbjohnson/clock v1.3.0/go.mod h1:J11/hYXuz8f4ySSvYwY0FKfm+ezbsZBKZxNJlLklBHA=
|
||||
github.com/benbjohnson/clock v1.3.5 h1:VvXlSJBzZpA/zum6Sj74hxwYI2DIxRWuNIoXAzHZz5o=
|
||||
@ -137,8 +135,6 @@ github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46f
|
||||
github.com/buger/goterm v1.0.3 h1:7V/HeAQHrzPk/U4BvyH2g9u+xbUW9nr4yRPyG59W4fM=
|
||||
github.com/buger/goterm v1.0.3/go.mod h1:HiFWV3xnkolgrBV3mY8m0X0Pumt4zg4QhbdOzQtB8tE=
|
||||
github.com/buger/jsonparser v0.0.0-20181115193947-bf1c66bbce23/go.mod h1:bbYlZJ7hK1yFx9hf58LP0zeX7UjIGs20ufpu3evjr+s=
|
||||
github.com/buger/jsonparser v1.1.1 h1:2PnMjfWD7wBILjqQbt530v576A/cAbQvEW9gGIpYMUs=
|
||||
github.com/buger/jsonparser v1.1.1/go.mod h1:6RYKKt7H4d4+iWqouImQ9R2FZql3VbhNgx27UK13J/0=
|
||||
github.com/casbin/casbin/v2 v2.1.2/go.mod h1:YcPU1XXisHhLzuxH9coDNf2FbKpjGlbCg3n9yuLkIJQ=
|
||||
github.com/cenkalti/backoff v2.2.1+incompatible/go.mod h1:90ReRw6GdpyfrHakVjL/QHaoyV4aDUVVkXQJJJ3NXXM=
|
||||
github.com/census-instrumentation/opencensus-proto v0.2.1/go.mod h1:f6KPmirojxKA12rnyqOA5BBL4O983OfeGPqjHWSTneU=
|
||||
@ -634,8 +630,6 @@ github.com/inconshreveable/mousetrap v1.0.0/go.mod h1:PxqpIevigyE2G7u3NXJIT2ANyt
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab h1:HqW4xhhynfjrtEiiSGcQUd6vrK23iMam1FO8rI7mwig=
|
||||
github.com/influxdata/influxdb1-client v0.0.0-20200827194710-b269163b24ab/go.mod h1:qj24IKcXYK6Iy9ceXlo3Tc+vtHo9lIhSX5JddghvEPo=
|
||||
github.com/invopop/jsonschema v0.12.0 h1:6ovsNSuvn9wEQVOyc72aycBMVQFKz7cPdMJn10CvzRI=
|
||||
github.com/invopop/jsonschema v0.12.0/go.mod h1:ffZ5Km5SWWRAIN6wbDXItl95euhFz2uON45H2qjYt+0=
|
||||
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
|
||||
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
|
||||
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
|
||||
@ -1641,8 +1635,6 @@ github.com/whyrusleeping/mdns v0.0.0-20180901202407-ef14215e6b30/go.mod h1:j4l84
|
||||
github.com/whyrusleeping/mdns v0.0.0-20190826153040-b9b60ed33aa9/go.mod h1:j4l84WPFclQPj320J9gp0XwNKBb3U0zt5CBqjPp22G4=
|
||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7 h1:E9S12nwJwEOXe2d6gT6qxdvqMnNq+VnSsKPgm2ZZNds=
|
||||
github.com/whyrusleeping/multiaddr-filter v0.0.0-20160516205228-e903e4adabd7/go.mod h1:X2c0RVCI1eSUFI8eLcY3c0423ykwiUdxLJtkDvruhjI=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8 h1:5h/BUHu93oj4gIdvHHHGsScSTMijfx5PeYkE/fJgbpc=
|
||||
github.com/wk8/go-ordered-map/v2 v2.1.8/go.mod h1:5nJHM5DyteebpVlHnWMV0rPz6Zp7+xBAnxjb1X5vnTw=
|
||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f h1:J9EGpcZtP0E/raorCMxlFGSTBrsSlaDGf3jU/qvAE2c=
|
||||
github.com/xeipuuv/gojsonpointer v0.0.0-20180127040702-4e3ac2762d5f/go.mod h1:N2zxlSyiKSe5eX1tZViRH5QA0qijqEDrYZiPEAiq3wU=
|
||||
|
@ -7,12 +7,12 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/node/config"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
"github.com/filecoin-project/lotus/provider/multictladdr"
|
||||
)
|
||||
|
||||
func AddressSelector(addrConf []config.LotusProviderAddresses) func() (*ctladdr.MultiAddressSelector, error) {
|
||||
return func() (*ctladdr.MultiAddressSelector, error) {
|
||||
as := &ctladdr.MultiAddressSelector{
|
||||
func AddressSelector(addrConf []config.LotusProviderAddresses) func() (*multictladdr.MultiAddressSelector, error) {
|
||||
return func() (*multictladdr.MultiAddressSelector, error) {
|
||||
as := &multictladdr.MultiAddressSelector{
|
||||
MinerMap: make(map[address.Address]api.AddressConfig),
|
||||
}
|
||||
if addrConf == nil {
|
||||
|
@ -11,7 +11,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/provider/chainsched"
|
||||
"github.com/filecoin-project/lotus/provider/lpmessage"
|
||||
"github.com/filecoin-project/lotus/provider/lpwindow"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
"github.com/filecoin-project/lotus/provider/multictladdr"
|
||||
"github.com/filecoin-project/lotus/storage/paths"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/sealer/storiface"
|
||||
@ -21,7 +21,7 @@ import (
|
||||
|
||||
func WindowPostScheduler(ctx context.Context, fc config.LotusProviderFees, pc config.ProvingConfig,
|
||||
api api.FullNode, verif storiface.Verifier, lw *sealer.LocalWorker, sender *lpmessage.Sender,
|
||||
as *ctladdr.MultiAddressSelector, addresses []dtypes.MinerAddress, db *harmonydb.DB,
|
||||
as *multictladdr.MultiAddressSelector, addresses map[dtypes.MinerAddress]bool, db *harmonydb.DB,
|
||||
stor paths.Store, idx paths.SectorIndex, max int) (*lpwindow.WdPostTask, *lpwindow.WdPostSubmitTask, *lpwindow.WdPostRecoverDeclareTask, error) {
|
||||
|
||||
chainSched := chainsched.New(api)
|
||||
|
@ -70,7 +70,7 @@ type WdPostTask struct {
|
||||
|
||||
windowPoStTF promise.Promise[harmonytask.AddTaskFunc]
|
||||
|
||||
actors []dtypes.MinerAddress
|
||||
actors map[dtypes.MinerAddress]bool
|
||||
max int
|
||||
}
|
||||
|
||||
@ -86,9 +86,8 @@ func NewWdPostTask(db *harmonydb.DB,
|
||||
faultTracker sealer.FaultTracker,
|
||||
prover ProverPoSt,
|
||||
verifier storiface.Verifier,
|
||||
|
||||
pcs *chainsched.ProviderChainSched,
|
||||
actors []dtypes.MinerAddress,
|
||||
actors map[dtypes.MinerAddress]bool,
|
||||
max int,
|
||||
) (*WdPostTask, error) {
|
||||
t := &WdPostTask{
|
||||
@ -356,7 +355,7 @@ func (t *WdPostTask) Adder(taskFunc harmonytask.AddTaskFunc) {
|
||||
}
|
||||
|
||||
func (t *WdPostTask) processHeadChange(ctx context.Context, revert, apply *types.TipSet) error {
|
||||
for _, act := range t.actors {
|
||||
for act := range t.actors {
|
||||
maddr := address.Address(act)
|
||||
|
||||
aid, err := address.IDFromAddress(maddr)
|
||||
|
@ -110,7 +110,7 @@ func (m *SimpleFaultTracker) CheckProvable(ctx context.Context, pp abi.Registere
|
||||
|
||||
if !locked {
|
||||
log.Warnw("CheckProvable Sector FAULT: can't acquire read lock", "sector", sector)
|
||||
addBad(sector.ID, fmt.Sprint("can't acquire read lock"))
|
||||
addBad(sector.ID, "can't acquire read lock")
|
||||
return
|
||||
}
|
||||
|
||||
|
@ -22,7 +22,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
"github.com/filecoin-project/lotus/provider/chainsched"
|
||||
"github.com/filecoin-project/lotus/provider/lpmessage"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
"github.com/filecoin-project/lotus/provider/multictladdr"
|
||||
"github.com/filecoin-project/lotus/storage/sealer"
|
||||
"github.com/filecoin-project/lotus/storage/wdpost"
|
||||
)
|
||||
@ -34,8 +34,8 @@ type WdPostRecoverDeclareTask struct {
|
||||
faultTracker sealer.FaultTracker
|
||||
|
||||
maxDeclareRecoveriesGasFee types.FIL
|
||||
as *ctladdr.MultiAddressSelector
|
||||
actors []dtypes.MinerAddress
|
||||
as *multictladdr.MultiAddressSelector
|
||||
actors map[dtypes.MinerAddress]bool
|
||||
|
||||
startCheckTF promise.Promise[harmonytask.AddTaskFunc]
|
||||
}
|
||||
@ -61,11 +61,11 @@ func NewWdPostRecoverDeclareTask(sender *lpmessage.Sender,
|
||||
db *harmonydb.DB,
|
||||
api WdPostRecoverDeclareTaskApi,
|
||||
faultTracker sealer.FaultTracker,
|
||||
as *ctladdr.MultiAddressSelector,
|
||||
as *multictladdr.MultiAddressSelector,
|
||||
pcs *chainsched.ProviderChainSched,
|
||||
|
||||
maxDeclareRecoveriesGasFee types.FIL,
|
||||
actors []dtypes.MinerAddress) (*WdPostRecoverDeclareTask, error) {
|
||||
actors map[dtypes.MinerAddress]bool) (*WdPostRecoverDeclareTask, error) {
|
||||
t := &WdPostRecoverDeclareTask{
|
||||
sender: sender,
|
||||
db: db,
|
||||
@ -235,7 +235,7 @@ func (w *WdPostRecoverDeclareTask) Adder(taskFunc harmonytask.AddTaskFunc) {
|
||||
func (w *WdPostRecoverDeclareTask) processHeadChange(ctx context.Context, revert, apply *types.TipSet) error {
|
||||
tf := w.startCheckTF.Val(ctx)
|
||||
|
||||
for _, act := range w.actors {
|
||||
for act := range w.actors {
|
||||
maddr := address.Address(act)
|
||||
|
||||
aid, err := address.IDFromAddress(maddr)
|
||||
|
@ -21,7 +21,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/lib/promise"
|
||||
"github.com/filecoin-project/lotus/provider/chainsched"
|
||||
"github.com/filecoin-project/lotus/provider/lpmessage"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
"github.com/filecoin-project/lotus/provider/multictladdr"
|
||||
"github.com/filecoin-project/lotus/storage/wdpost"
|
||||
)
|
||||
|
||||
@ -47,12 +47,12 @@ type WdPostSubmitTask struct {
|
||||
api WdPoStSubmitTaskApi
|
||||
|
||||
maxWindowPoStGasFee types.FIL
|
||||
as *ctladdr.MultiAddressSelector
|
||||
as *multictladdr.MultiAddressSelector
|
||||
|
||||
submitPoStTF promise.Promise[harmonytask.AddTaskFunc]
|
||||
}
|
||||
|
||||
func NewWdPostSubmitTask(pcs *chainsched.ProviderChainSched, send *lpmessage.Sender, db *harmonydb.DB, api WdPoStSubmitTaskApi, maxWindowPoStGasFee types.FIL, as *ctladdr.MultiAddressSelector) (*WdPostSubmitTask, error) {
|
||||
func NewWdPostSubmitTask(pcs *chainsched.ProviderChainSched, send *lpmessage.Sender, db *harmonydb.DB, api WdPoStSubmitTaskApi, maxWindowPoStGasFee types.FIL, as *multictladdr.MultiAddressSelector) (*WdPostSubmitTask, error) {
|
||||
res := &WdPostSubmitTask{
|
||||
sender: send,
|
||||
db: db,
|
||||
@ -248,7 +248,7 @@ type MsgPrepAPI interface {
|
||||
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||
}
|
||||
|
||||
func preparePoStMessage(w MsgPrepAPI, as *ctladdr.MultiAddressSelector, maddr address.Address, msg *types.Message, maxFee abi.TokenAmount) (*types.Message, *api.MessageSendSpec, error) {
|
||||
func preparePoStMessage(w MsgPrepAPI, as *multictladdr.MultiAddressSelector, maddr address.Address, msg *types.Message, maxFee abi.TokenAmount) (*types.Message, *api.MessageSendSpec, error) {
|
||||
mi, err := w.StateMinerInfo(context.Background(), maddr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("error getting miner info: %w", err)
|
||||
|
@ -42,7 +42,7 @@ type WinPostTask struct {
|
||||
verifier storiface.Verifier
|
||||
|
||||
api WinPostAPI
|
||||
actors []dtypes.MinerAddress
|
||||
actors map[dtypes.MinerAddress]bool
|
||||
|
||||
mineTF promise.Promise[harmonytask.AddTaskFunc]
|
||||
}
|
||||
@ -70,7 +70,7 @@ type ProverWinningPoSt interface {
|
||||
GenerateWinningPoSt(ctx context.Context, ppt abi.RegisteredPoStProof, minerID abi.ActorID, sectorInfo []storiface.PostSectorChallenge, randomness abi.PoStRandomness) ([]prooftypes.PoStProof, error)
|
||||
}
|
||||
|
||||
func NewWinPostTask(max int, db *harmonydb.DB, prover ProverWinningPoSt, verifier storiface.Verifier, api WinPostAPI, actors []dtypes.MinerAddress) *WinPostTask {
|
||||
func NewWinPostTask(max int, db *harmonydb.DB, prover ProverWinningPoSt, verifier storiface.Verifier, api WinPostAPI, actors map[dtypes.MinerAddress]bool) *WinPostTask {
|
||||
t := &WinPostTask{
|
||||
max: max,
|
||||
db: db,
|
||||
@ -572,7 +572,7 @@ func (t *WinPostTask) mineBasic(ctx context.Context) {
|
||||
|
||||
baseEpoch := workBase.TipSet.Height()
|
||||
|
||||
for _, act := range t.actors {
|
||||
for act := range t.actors {
|
||||
spID, err := address.IDFromAddress(address.Address(act))
|
||||
if err != nil {
|
||||
log.Errorf("failed to get spID from address %s: %s", act, err)
|
||||
|
@ -1,21 +1,26 @@
|
||||
package ctladdr
|
||||
package multictladdr
|
||||
|
||||
import (
|
||||
"context"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
|
||||
"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/types"
|
||||
"github.com/filecoin-project/lotus/storage/ctladdr"
|
||||
)
|
||||
|
||||
var log = logging.Logger("multictladdr")
|
||||
|
||||
type MultiAddressSelector struct {
|
||||
MinerMap map[address.Address]api.AddressConfig
|
||||
}
|
||||
|
||||
func (as *MultiAddressSelector) AddressFor(ctx context.Context, a NodeApi, minerID address.Address, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
|
||||
func (as *MultiAddressSelector) AddressFor(ctx context.Context, a ctladdr.NodeApi, minerID address.Address, mi api.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")
|
||||
@ -72,5 +77,5 @@ func (as *MultiAddressSelector) AddressFor(ctx context.Context, a NodeApi, miner
|
||||
addrs = append(addrs, mi.Owner)
|
||||
}
|
||||
|
||||
return pickAddress(ctx, a, mi, goodFunds, minFunds, addrs)
|
||||
return ctladdr.PickAddress(ctx, a, mi, goodFunds, minFunds, addrs)
|
||||
}
|
@ -82,10 +82,10 @@ func (as *AddressSelector) AddressFor(ctx context.Context, a NodeApi, mi api.Min
|
||||
addrs = append(addrs, mi.Owner)
|
||||
}
|
||||
|
||||
return pickAddress(ctx, a, mi, goodFunds, minFunds, addrs)
|
||||
return PickAddress(ctx, a, mi, goodFunds, minFunds, addrs)
|
||||
}
|
||||
|
||||
func pickAddress(ctx context.Context, a NodeApi, mi api.MinerInfo, goodFunds, minFunds abi.TokenAmount, addrs []address.Address) (address.Address, abi.TokenAmount, error) {
|
||||
func PickAddress(ctx context.Context, a NodeApi, mi api.MinerInfo, goodFunds, minFunds abi.TokenAmount, addrs []address.Address) (address.Address, abi.TokenAmount, error) {
|
||||
leastBad := mi.Worker
|
||||
bestAvail := minFunds
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user