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

feat: curio: sectors UI #11869

Merged
merged 74 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from 71 commits
Commits
Show all changes
74 commits
Select commit Hold shift + click to select a range
d36245c
cfg edit 1
snadrus Jan 30, 2024
fb86554
jsonschema deps
snadrus Feb 1, 2024
f6f4d0e
feat: lp mig - first few steps
snadrus Feb 12, 2024
229645b
lp mig: default tasks
snadrus Feb 13, 2024
5a61b87
code comments
snadrus Feb 13, 2024
17ffd12
docs
snadrus Feb 13, 2024
0c8969d
lp-mig-progress
snadrus Feb 20, 2024
aa049ba
Merge branch 'master' into easyMigration
snadrus Feb 20, 2024
6765ac1
shared
snadrus Feb 20, 2024
d47b2f7
comments and todos
snadrus Feb 26, 2024
443b05c
fix: curio: rename lotus-provider to curio (#11645)
LexLuthr Feb 29, 2024
b686823
lp: channels doc
snadrus Feb 29, 2024
86f8624
Merge branch 'easyMigration' of https://github.com/filecoin-project/l…
snadrus Feb 29, 2024
5c2a86b
finish easy-migration TODOs
snadrus Mar 2, 2024
345dd9c
out generate
snadrus Mar 2, 2024
94e2a37
Merge branch 'master' into easyMigration
snadrus Mar 2, 2024
ef9e3f2
merging and more renames
snadrus Mar 2, 2024
af19d34
avoid make-all
snadrus Mar 3, 2024
590537e
minor doc stuff
snadrus Mar 5, 2024
3ff1e4d
cu: make gen
snadrus Mar 6, 2024
ea1dd33
make gen fix
snadrus Mar 6, 2024
0c3d0ce
conflict-resolve
snadrus Mar 6, 2024
dedad07
Merge branch 'master' into easyMigration
snadrus Mar 6, 2024
5470aec
make gen
snadrus Mar 7, 2024
6505b90
tryfix
snadrus Mar 7, 2024
9fa63fb
go mod tidy
snadrus Mar 7, 2024
4c7130e
minor ez migration fixes
snadrus Mar 7, 2024
5086714
ez setup - ui cleanups
snadrus Mar 8, 2024
11f21a0
better error message
snadrus Mar 8, 2024
9d4ed63
guided setup colors
snadrus Mar 8, 2024
ea0b09e
better path to saveconfigtolayer
snadrus Mar 8, 2024
b94a75c
loadconfigwithupgrades fix
snadrus Mar 8, 2024
795bc6d
readMiner oops
snadrus Mar 8, 2024
01886bc
guided - homedir
snadrus Mar 8, 2024
97cb2d0
err if miner is running
snadrus Mar 8, 2024
d520d5c
prompt error should exit
snadrus Mar 8, 2024
1e27ea7
process already running, miner_id sectors in migration
snadrus Mar 8, 2024
ded8122
dont prompt for language a second time
snadrus Mar 8, 2024
500c92b
check miner stopped
Mar 8, 2024
aab78c6
unlock repo
Mar 8, 2024
f03c7d3
render and sql oops
snadrus Mar 8, 2024
0daa23d
Merge branch 'easyMigration' of https://github.com/filecoin-project/l…
snadrus Mar 8, 2024
2e4711e
curio easyMig - some fixes
snadrus Mar 12, 2024
01eae29
easyMigration runs successfully
snadrus Mar 12, 2024
daa2df3
lint
snadrus Mar 12, 2024
445c4d2
Merge branch 'master' into feat/config-edit for easy merge later
snadrus Mar 13, 2024
d075e09
Merge branch 'easyMigration' into feat/config-edit for later simplifi…
snadrus Mar 13, 2024
7dedf18
part 2 of last
snadrus Mar 13, 2024
8de43ee
message
snadrus Apr 1, 2024
763bbfe
Merge branch 'master' into feat/config-edit
snadrus Apr 3, 2024
6634520
merge addtl
snadrus Apr 3, 2024
e2a9f2e
fixing guided setup for myself
snadrus Apr 3, 2024
cd78a66
warn-on-no-post
snadrus Apr 4, 2024
e934222
EditorLoads
snadrus Apr 5, 2024
a8da71b
cleanups and styles
snadrus Apr 6, 2024
1ce78fe
Merge branch 'master' into feat/config-edit
snadrus Apr 6, 2024
a69fb0c
create info
LexLuthr Apr 9, 2024
76fc81d
fix tests
LexLuthr Apr 9, 2024
7f822e6
make gen
snadrus Apr 9, 2024
3d6894f
Merge branch 'feat/config-edit' of https://github.com/filecoin-projec…
snadrus Apr 9, 2024
c009921
sector early bird
snadrus Apr 12, 2024
1d49deb
sectors v2
snadrus Apr 13, 2024
af07c48
sector termination v1
snadrus Apr 13, 2024
a3455de
terminate2
snadrus Apr 13, 2024
1dd8546
mjs
snadrus Apr 16, 2024
7454069
minor things
snadrus Apr 16, 2024
5a856c1
flag bad sectors
LexLuthr Apr 16, 2024
e777bed
Merge branch 'master' into feat/sector-ui
LexLuthr Apr 16, 2024
f8c6252
fix errors
LexLuthr Apr 16, 2024
0f294bf
Merge branch 'master' into feat/sector-ui
LexLuthr Apr 16, 2024
cc2429b
add dealweight and deals
LexLuthr Apr 16, 2024
d03b15d
change column width
LexLuthr Apr 17, 2024
700600f
refactor sql, handle sealing sectors
LexLuthr Apr 17, 2024
dddf2e4
fix estimates
LexLuthr Apr 18, 2024
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
122 changes: 74 additions & 48 deletions cli/spcli/sectors.go
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ package spcli

import (
"bufio"
"context"
"encoding/csv"
"encoding/json"
"errors"
Expand All @@ -16,6 +17,7 @@ import (

"github.com/fatih/color"
cbor "github.com/ipfs/go-ipld-cbor"
"github.com/samber/lo"
"github.com/urfave/cli/v2"
"golang.org/x/xerrors"

Expand Down Expand Up @@ -1353,44 +1355,20 @@ func TerminateSectorCmd(getActorAddress ActorAddressGetter) *cli.Command {
}
}

mi, err := nodeApi.StateMinerInfo(ctx, maddr, types.EmptyTSK)
if err != nil {
return err
}

terminationDeclarationParams := []miner2.TerminationDeclaration{}

for _, sn := range cctx.Args().Slice() {
sectorNum, err := strconv.ParseUint(sn, 10, 64)
var outerErr error
sectorNumbers := lo.Map(cctx.Args().Slice(), func(sn string, _ int) int {
sectorNum, err := strconv.Atoi(sn)
if err != nil {
return fmt.Errorf("could not parse sector number: %w", err)
outerErr = fmt.Errorf("could not parse sector number: %w", err)
return 0
}

sectorbit := bitfield.New()
sectorbit.Set(sectorNum)

loca, err := nodeApi.StateSectorPartition(ctx, maddr, abi.SectorNumber(sectorNum), types.EmptyTSK)
if err != nil {
return fmt.Errorf("get state sector partition %s", err)
}

para := miner2.TerminationDeclaration{
Deadline: loca.Deadline,
Partition: loca.Partition,
Sectors: sectorbit,
}

terminationDeclarationParams = append(terminationDeclarationParams, para)
}

terminateSectorParams := &miner2.TerminateSectorsParams{
Terminations: terminationDeclarationParams,
return sectorNum
})
if outerErr != nil {
return outerErr
}

sp, err := actors.SerializeParams(terminateSectorParams)
if err != nil {
return xerrors.Errorf("serializing params: %w", err)
}
confidence := uint64(cctx.Int("confidence"))

var fromAddr address.Address
if from := cctx.String("from"); from != "" {
Expand All @@ -1400,33 +1378,81 @@ func TerminateSectorCmd(getActorAddress ActorAddressGetter) *cli.Command {
return fmt.Errorf("parsing address %s: %w", from, err)
}
} else {
mi, err := nodeApi.StateMinerInfo(ctx, maddr, types.EmptyTSK)
if err != nil {
return err
}

fromAddr = mi.Worker
}

smsg, err := nodeApi.MpoolPushMessage(ctx, &types.Message{
From: fromAddr,
To: maddr,
Method: builtin.MethodsMiner.TerminateSectors,

Value: big.Zero(),
Params: sp,
}, nil)
smsg, err := TerminateSectors(ctx, nodeApi, maddr, sectorNumbers, fromAddr)
if err != nil {
return xerrors.Errorf("mpool push message: %w", err)
return err
}

fmt.Println("sent termination message:", smsg.Cid())

wait, err := nodeApi.StateWaitMsg(ctx, smsg.Cid(), uint64(cctx.Int("confidence")))
wait, err := nodeApi.StateWaitMsg(ctx, smsg.Cid(), confidence)
if err != nil {
return err
}

if wait.Receipt.ExitCode.IsError() {
return fmt.Errorf("terminate sectors message returned exit %d", wait.Receipt.ExitCode)
}

return nil
},
}
}

type TerminatorNode interface {
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error)
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error)
}

func TerminateSectors(ctx context.Context, full TerminatorNode, maddr address.Address, sectorNumbers []int, fromAddr address.Address) (*types.SignedMessage, error) {

terminationDeclarationParams := []miner2.TerminationDeclaration{}

for _, sectorNum := range sectorNumbers {

sectorbit := bitfield.New()
sectorbit.Set(uint64(sectorNum))

loca, err := full.StateSectorPartition(ctx, maddr, abi.SectorNumber(sectorNum), types.EmptyTSK)
if err != nil {
return nil, fmt.Errorf("get state sector partition %s", err)
}

para := miner2.TerminationDeclaration{
Deadline: loca.Deadline,
Partition: loca.Partition,
Sectors: sectorbit,
}

terminationDeclarationParams = append(terminationDeclarationParams, para)
}

terminateSectorParams := &miner2.TerminateSectorsParams{
Terminations: terminationDeclarationParams,
}

sp, errA := actors.SerializeParams(terminateSectorParams)
if errA != nil {
return nil, xerrors.Errorf("serializing params: %w", errA)
}

smsg, err := full.MpoolPushMessage(ctx, &types.Message{
From: fromAddr,
To: maddr,
Method: builtin.MethodsMiner.TerminateSectors,

Value: big.Zero(),
Params: sp,
}, nil)
if err != nil {
return nil, xerrors.Errorf("mpool push message: %w", err)
}

fmt.Println("sent termination message:", smsg.Cid())

return smsg, nil
}
1 change: 0 additions & 1 deletion curiosrc/web/api/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ func getSch(w http.ResponseWriter, r *http.Request) {
},
}
sch := ref.Reflect(config.CurioConfig{})
//sch := jsonschema.Reflect(config.CurioConfig{})
// add comments
for k, doc := range config.Doc {
item, ok := sch.Definitions[k]
Expand Down
2 changes: 2 additions & 0 deletions curiosrc/web/api/routes.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,11 @@ import (
"github.com/filecoin-project/lotus/cmd/curio/deps"
"github.com/filecoin-project/lotus/curiosrc/web/api/config"
"github.com/filecoin-project/lotus/curiosrc/web/api/debug"
"github.com/filecoin-project/lotus/curiosrc/web/api/sector"
)

func Routes(r *mux.Router, deps *deps.Deps) {
debug.Routes(r.PathPrefix("/debug").Subrouter(), deps)
config.Routes(r.PathPrefix("/config").Subrouter(), deps)
sector.Routes(r.PathPrefix("/sector").Subrouter(), deps)
}
Loading
Loading