Merge pull request #4203 from filecoin-project/fix/pond-actorsv2

Fix pond
This commit is contained in:
Łukasz Magiera 2020-10-07 07:55:38 +02:00 committed by GitHub
commit f6eb530cba
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 15 additions and 13 deletions

View File

@ -33,7 +33,7 @@ var runCmd = &cli.Command{
Usage: "Start a lotus miner process", Usage: "Start a lotus miner process",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{
Name: "api", Name: "miner-api",
Usage: "2345", Usage: "2345",
}, },
&cli.BoolFlag{ &cli.BoolFlag{
@ -61,7 +61,7 @@ var runCmd = &cli.Command{
nodeApi, ncloser, err := lcli.GetFullNodeAPI(cctx) nodeApi, ncloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return xerrors.Errorf("getting full node api: %w", err)
} }
defer ncloser() defer ncloser()
ctx := lcli.DaemonContext(cctx) ctx := lcli.DaemonContext(cctx)
@ -112,29 +112,29 @@ var runCmd = &cli.Command{
node.Online(), node.Online(),
node.Repo(r), node.Repo(r),
node.ApplyIf(func(s *node.Settings) bool { return cctx.IsSet("api") }, node.ApplyIf(func(s *node.Settings) bool { return cctx.IsSet("miner-api") },
node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) { node.Override(new(dtypes.APIEndpoint), func() (dtypes.APIEndpoint, error) {
return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("api")) return multiaddr.NewMultiaddr("/ip4/127.0.0.1/tcp/" + cctx.String("miner-api"))
})), })),
node.Override(new(api.FullNode), nodeApi), node.Override(new(api.FullNode), nodeApi),
) )
if err != nil { if err != nil {
return err return xerrors.Errorf("creating node: %w", err)
} }
endpoint, err := r.APIEndpoint() endpoint, err := r.APIEndpoint()
if err != nil { if err != nil {
return err return xerrors.Errorf("getting API endpoint: %w", err)
} }
// Bootstrap with full node // Bootstrap with full node
remoteAddrs, err := nodeApi.NetAddrsListen(ctx) remoteAddrs, err := nodeApi.NetAddrsListen(ctx)
if err != nil { if err != nil {
return err return xerrors.Errorf("getting full node libp2p address: %w", err)
} }
if err := minerapi.NetConnect(ctx, remoteAddrs); err != nil { if err := minerapi.NetConnect(ctx, remoteAddrs); err != nil {
return err return xerrors.Errorf("connecting to full node (libp2p): %w", err)
} }
log.Infof("Remote version %s", v) log.Infof("Remote version %s", v)

View File

@ -11,16 +11,16 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/google/uuid"
"github.com/filecoin-project/lotus/chain/types"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed" "github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
"github.com/filecoin-project/lotus/genesis" "github.com/filecoin-project/lotus/genesis"
) )
@ -69,6 +69,8 @@ func (api *api) Spawn() (nodeInfo, error) {
Meta: (&genesis.AccountMeta{Owner: genm.Owner}).ActorMeta(), Meta: (&genesis.AccountMeta{Owner: genm.Owner}).ActorMeta(),
}) })
template.VerifregRootKey = gen.DefaultVerifregRootkeyActor template.VerifregRootKey = gen.DefaultVerifregRootkeyActor
template.RemainderAccount = gen.DefaultRemainderAccountActor
template.NetworkName = "pond-" + uuid.New().String()
tb, err := json.Marshal(&template) tb, err := json.Marshal(&template)
if err != nil { if err != nil {
@ -188,7 +190,7 @@ func (api *api) SpawnStorage(fullNodeRepo string) (nodeInfo, error) {
mux := newWsMux() mux := newWsMux()
cmd = exec.Command("./lotus-miner", "run", "--api", fmt.Sprintf("%d", 2500+id), "--nosync") cmd = exec.Command("./lotus-miner", "run", "--miner-api", fmt.Sprintf("%d", 2500+id), "--nosync")
cmd.Stderr = io.MultiWriter(os.Stderr, errlogfile, mux.errpw) cmd.Stderr = io.MultiWriter(os.Stderr, errlogfile, mux.errpw)
cmd.Stdout = io.MultiWriter(os.Stdout, logfile, mux.outpw) cmd.Stdout = io.MultiWriter(os.Stdout, logfile, mux.outpw)
cmd.Env = append(os.Environ(), "LOTUS_MINER_PATH="+dir, "LOTUS_PATH="+fullNodeRepo) cmd.Env = append(os.Environ(), "LOTUS_MINER_PATH="+dir, "LOTUS_PATH="+fullNodeRepo)
@ -248,7 +250,7 @@ func (api *api) RestartNode(id int32) (nodeInfo, error) {
var cmd *exec.Cmd var cmd *exec.Cmd
if nd.meta.Storage { if nd.meta.Storage {
cmd = exec.Command("./lotus-miner", "run", "--api", fmt.Sprintf("%d", 2500+id), "--nosync") cmd = exec.Command("./lotus-miner", "run", "--miner-api", fmt.Sprintf("%d", 2500+id), "--nosync")
} else { } else {
cmd = exec.Command("./lotus", "daemon", "--api", fmt.Sprintf("%d", 2500+id)) cmd = exec.Command("./lotus", "daemon", "--api", fmt.Sprintf("%d", 2500+id))
} }