Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a CLI tool for miner proving deadline #6132

Merged
merged 1 commit into from
Apr 29, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions cli/state.go
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,50 @@ var StateCmd = &cli.Command{
StateMarketCmd,
StateExecTraceCmd,
StateNtwkVersionCmd,
StateMinerProvingDeadlineCmd,
},
}

var StateMinerProvingDeadlineCmd = &cli.Command{
Name: "miner-proving-deadline",
Usage: "Retrieve information about a given miner's proving deadline",
ArgsUsage: "[minerAddress]",
Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer closer()

ctx := ReqContext(cctx)

if !cctx.Args().Present() {
return fmt.Errorf("must specify miner to get information for")
}

addr, err := address.NewFromString(cctx.Args().First())
if err != nil {
return err
}

ts, err := LoadTipSet(ctx, cctx, api)
if err != nil {
return err
}

cd, err := api.StateMinerProvingDeadline(ctx, addr, ts.Key())
if err != nil {
return xerrors.Errorf("getting miner info: %w", err)
}

fmt.Printf("Period Start:\t%s\n", cd.PeriodStart)
fmt.Printf("Index:\t\t%d\n", cd.Index)
fmt.Printf("Open:\t\t%s\n", cd.Open)
fmt.Printf("Close:\t\t%s\n", cd.Close)
fmt.Printf("Challenge:\t%s\n", cd.Challenge)
fmt.Printf("FaultCutoff:\t%s\n", cd.FaultCutoff)

return nil
},
}

Expand Down