v1.27.0-a #10

Closed
jonathanface wants to merge 473 commits from v1.27.0-a into master
7 changed files with 14 additions and 12 deletions
Showing only changes of commit a0867a2a60 - Show all commits

View File

@ -291,7 +291,6 @@ type ExportRef struct {
}
type MinerInfo struct {
MinerID address.Address
Owner address.Address // Must be an ID-address.
Worker address.Address // Must be an ID-address.
NewWorker address.Address // Must be an ID-address.

View File

@ -9,7 +9,6 @@ import (
"path"
"strings"
"github.com/BurntSushi/toml"
"github.com/urfave/cli/v2"
"golang.org/x/xerrors"
@ -103,7 +102,7 @@ var configSetCmd = &cli.Command{
}
lp := config.DefaultLotusProvider() // ensure it's toml
_, err = toml.Decode(string(bytes), lp)
_, err = deps.LoadConfigWithUpgrades(string(bytes), lp)
if err != nil {
return fmt.Errorf("cannot decode file: %w", err)
}

View File

@ -253,6 +253,12 @@ Get it with: jq .PrivateKey ~/.lotus-miner/keystore/MF2XI2BNNJ3XILLQOJUXMYLUMU`,
var oldAddresses = regexp.MustCompile("(?i)^[addresses]$")
func LoadConfigWithUpgrades(text string, lp *config.LotusProviderConfig) (toml.MetaData, error) {
// allow migration from old config format that was limited to 1 wallet setup.
newText := oldAddresses.ReplaceAllString(text, "[[addresses]]")
meta, err := toml.Decode(newText, &lp)
return meta, err
}
func GetConfig(cctx *cli.Context, db *harmonydb.DB) (*config.LotusProviderConfig, error) {
lp := config.DefaultLotusProvider()
have := []string{}
@ -271,11 +277,9 @@ func GetConfig(cctx *cli.Context, db *harmonydb.DB) (*config.LotusProviderConfig
return nil, fmt.Errorf("could not read layer '%s': %w", layer, err)
}
// allow migration from old config format that was limited to 1 wallet setup.
newText := oldAddresses.ReplaceAllString(text, "[[addresses]]")
meta, err := toml.Decode(newText, &lp)
meta, err := LoadConfigWithUpgrades(text, lp)
if err != nil {
return nil, fmt.Errorf("could not read layer, bad toml %s: %w", layer, err)
return lp, fmt.Errorf("could not read layer, bad toml %s: %w", layer, err)
}
for _, k := range meta.Keys() {
have = append(have, strings.Join(k, " "))

View File

@ -20,6 +20,7 @@ import (
"github.com/filecoin-project/go-address"
cliutil "github.com/filecoin-project/lotus/cli/util"
"github.com/filecoin-project/lotus/cmd/lotus-provider/deps"
"github.com/filecoin-project/lotus/lib/harmony/harmonydb"
"github.com/filecoin-project/lotus/node/config"
"github.com/filecoin-project/lotus/node/modules"
@ -124,7 +125,7 @@ func fromMiner(cctx *cli.Context) (err error) {
return fmt.Errorf("could not read config.toml: %w", err)
}
var lpCfg config.LotusProviderConfig
_, err = toml.Decode(string(buf), &lpCfg)
_, err = deps.LoadConfigWithUpgrades(string(buf), &lpCfg)
if err != nil {
return fmt.Errorf("could not decode toml: %w", err)
}

View File

@ -169,7 +169,6 @@ func (m *StateModule) StateMinerInfo(ctx context.Context, actor address.Address,
}
ret := api.MinerInfo{
MinerID: actor,
Owner: info.Owner,
Worker: info.Worker,
ControlAddresses: info.ControlAddresses,

View File

@ -292,7 +292,7 @@ func preparePoStMessage(w MsgPrepAPI, as *ctladdr.MultiAddressSelector, maddr ad
goodFunds := big.Add(minGasFeeMsg.RequiredFunds(), minGasFeeMsg.Value)
minFunds := big.Min(big.Add(minGasFeeMsg.RequiredFunds(), minGasFeeMsg.Value), goodFunds)
from, _, err := as.AddressFor(context.Background(), w, mi, api.PoStAddr, goodFunds, minFunds)
from, _, err := as.AddressFor(context.Background(), w, maddr, mi, api.PoStAddr, goodFunds, minFunds)
if err != nil {
return nil, nil, xerrors.Errorf("error getting address: %w", err)
}

View File

@ -15,14 +15,14 @@ type MultiAddressSelector struct {
MinerMap map[address.Address]api.AddressConfig
}
func (as *MultiAddressSelector) AddressFor(ctx context.Context, a NodeApi, mi api.MinerInfo, use api.AddrUse, goodFunds, minFunds abi.TokenAmount) (address.Address, abi.TokenAmount, error) {
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) {
if as == nil {
// should only happen in some tests
log.Warnw("smart address selection disabled, using worker address")
return mi.Worker, big.Zero(), nil
}
tmp := as.MinerMap[mi.MinerID]
tmp := as.MinerMap[minerID]
var addrs []address.Address
switch use {