v1.27.0-a #10

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

View File

@ -120,6 +120,11 @@ var initCmd = &cli.Command{
Name: "from", Name: "from",
Usage: "select which address to send actor creation message from", Usage: "select which address to send actor creation message from",
}, },
&cli.Uint64Flag{
Name: "confidence",
Usage: "number of block confirmations to wait for",
Value: build.MessageConfidence,
},
}, },
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
restoreCmd, restoreCmd,
@ -146,6 +151,8 @@ var initCmd = &cli.Command{
return xerrors.Errorf("failed to parse gas-price flag: %s", err) return xerrors.Errorf("failed to parse gas-price flag: %s", err)
} }
confidence := cctx.Uint64("confidence")
symlink := cctx.Bool("symlink-imported-sectors") symlink := cctx.Bool("symlink-imported-sectors")
if symlink { if symlink {
log.Info("will attempt to symlink to imported sectors") log.Info("will attempt to symlink to imported sectors")
@ -265,7 +272,7 @@ var initCmd = &cli.Command{
} }
} }
if err := storageMinerInit(ctx, cctx, api, r, ssize, gasPrice); err != nil { if err := storageMinerInit(ctx, cctx, api, r, ssize, gasPrice, confidence); err != nil {
log.Errorf("Failed to initialize lotus-miner: %+v", err) log.Errorf("Failed to initialize lotus-miner: %+v", err)
path, err := homedir.Expand(repoPath) path, err := homedir.Expand(repoPath)
if err != nil { if err != nil {
@ -414,7 +421,7 @@ func findMarketDealID(ctx context.Context, api v1api.FullNode, deal markettypes.
return 0, xerrors.New("deal not found") return 0, xerrors.New("deal not found")
} }
func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode, r repo.Repo, ssize abi.SectorSize, gasPrice types.BigInt) error { func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode, r repo.Repo, ssize abi.SectorSize, gasPrice types.BigInt, confidence uint64) error {
lr, err := r.Lock(repo.StorageMiner) lr, err := r.Lock(repo.StorageMiner)
if err != nil { if err != nil {
return err return err
@ -501,7 +508,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode
return xerrors.Errorf("failed to start up genesis miner: %w", err) return xerrors.Errorf("failed to start up genesis miner: %w", err)
} }
cerr := configureStorageMiner(ctx, api, a, peerid, gasPrice) cerr := configureStorageMiner(ctx, api, a, peerid, gasPrice, confidence)
if err := m.Stop(ctx); err != nil { if err := m.Stop(ctx); err != nil {
log.Error("failed to shut down miner: ", err) log.Error("failed to shut down miner: ", err)
@ -541,13 +548,13 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api v1api.FullNode
} }
} }
if err := configureStorageMiner(ctx, api, a, peerid, gasPrice); err != nil { if err := configureStorageMiner(ctx, api, a, peerid, gasPrice, confidence); err != nil {
return xerrors.Errorf("failed to configure miner: %w", err) return xerrors.Errorf("failed to configure miner: %w", err)
} }
addr = a addr = a
} else { } else {
a, err := createStorageMiner(ctx, api, ssize, peerid, gasPrice, cctx) a, err := createStorageMiner(ctx, api, ssize, peerid, gasPrice, confidence, cctx)
if err != nil { if err != nil {
return xerrors.Errorf("creating miner failed: %w", err) return xerrors.Errorf("creating miner failed: %w", err)
} }
@ -589,7 +596,7 @@ func makeHostKey(lr repo.LockedRepo) (crypto.PrivKey, error) {
return pk, nil return pk, nil
} }
func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address.Address, peerid peer.ID, gasPrice types.BigInt) error { func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address.Address, peerid peer.ID, gasPrice types.BigInt, confidence uint64) error {
mi, err := api.StateMinerInfo(ctx, addr, types.EmptyTSK) mi, err := api.StateMinerInfo(ctx, addr, types.EmptyTSK)
if err != nil { if err != nil {
return xerrors.Errorf("getWorkerAddr returned bad address: %w", err) return xerrors.Errorf("getWorkerAddr returned bad address: %w", err)
@ -615,7 +622,7 @@ func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address
} }
log.Info("Waiting for message: ", smsg.Cid()) log.Info("Waiting for message: ", smsg.Cid())
ret, err := api.StateWaitMsg(ctx, smsg.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true) ret, err := api.StateWaitMsg(ctx, smsg.Cid(), confidence, lapi.LookbackNoLimit, true)
if err != nil { if err != nil {
return err return err
} }
@ -627,7 +634,7 @@ func configureStorageMiner(ctx context.Context, api v1api.FullNode, addr address
return nil return nil
} }
func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.SectorSize, peerid peer.ID, gasPrice types.BigInt, cctx *cli.Context) (address.Address, error) { func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.SectorSize, peerid peer.ID, gasPrice types.BigInt, confidence uint64, cctx *cli.Context) (address.Address, error) {
var err error var err error
var owner address.Address var owner address.Address
if cctx.String("owner") != "" { if cctx.String("owner") != "" {
@ -679,7 +686,7 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.Secto
log.Infof("Initializing worker account %s, message: %s", worker, signed.Cid()) log.Infof("Initializing worker account %s, message: %s", worker, signed.Cid())
log.Infof("Waiting for confirmation") log.Infof("Waiting for confirmation")
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true) mw, err := api.StateWaitMsg(ctx, signed.Cid(), confidence, lapi.LookbackNoLimit, true)
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("waiting for worker init: %w", err) return address.Undef, xerrors.Errorf("waiting for worker init: %w", err)
} }
@ -703,7 +710,7 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.Secto
log.Infof("Initializing owner account %s, message: %s", worker, signed.Cid()) log.Infof("Initializing owner account %s, message: %s", worker, signed.Cid())
log.Infof("Waiting for confirmation") log.Infof("Waiting for confirmation")
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true) mw, err := api.StateWaitMsg(ctx, signed.Cid(), confidence, lapi.LookbackNoLimit, true)
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("waiting for owner init: %w", err) return address.Undef, xerrors.Errorf("waiting for owner init: %w", err)
} }
@ -752,7 +759,7 @@ func createStorageMiner(ctx context.Context, api v1api.FullNode, ssize abi.Secto
log.Infof("Pushed CreateMiner message: %s", signed.Cid()) log.Infof("Pushed CreateMiner message: %s", signed.Cid())
log.Infof("Waiting for confirmation") log.Infof("Waiting for confirmation")
mw, err := api.StateWaitMsg(ctx, signed.Cid(), build.MessageConfidence, lapi.LookbackNoLimit, true) mw, err := api.StateWaitMsg(ctx, signed.Cid(), confidence, lapi.LookbackNoLimit, true)
if err != nil { if err != nil {
return address.Undef, xerrors.Errorf("waiting for createMiner message: %w", err) return address.Undef, xerrors.Errorf("waiting for createMiner message: %w", err)
} }

View File

@ -80,8 +80,7 @@ var restoreCmd = &cli.Command{
} }
log.Info("Configuring miner actor") log.Info("Configuring miner actor")
if err := configureStorageMiner(ctx, api, maddr, peerid, big.Zero(), cctx.Uint64("confidence")); err != nil {
if err := configureStorageMiner(ctx, api, maddr, peerid, big.Zero()); err != nil {
return err return err
} }

View File

@ -105,7 +105,7 @@ var serviceCmd = &cli.Command{
if es.Contains(MarketsService) { if es.Contains(MarketsService) {
log.Info("Configuring miner actor") log.Info("Configuring miner actor")
if err := configureStorageMiner(ctx, api, maddr, peerid, big.Zero()); err != nil { if err := configureStorageMiner(ctx, api, maddr, peerid, big.Zero(), cctx.Uint64("confidence")); err != nil {
return err return err
} }
} }

View File

@ -66,6 +66,7 @@ OPTIONS:
--no-local-storage don't use storageminer repo for sector storage (default: false) --no-local-storage don't use storageminer repo for sector storage (default: false)
--gas-premium value set gas premium for initialization messages in AttoFIL (default: "0") --gas-premium value set gas premium for initialization messages in AttoFIL (default: "0")
--from value select which address to send actor creation message from --from value select which address to send actor creation message from
--confidence value number of block confirmations to wait for (default: 5)
--help, -h show help --help, -h show help
``` ```