Skip to content

Commit c77bfba

Browse files
committed
Merge branch 'main' into market-migration
2 parents 38f943c + 9bd93aa commit c77bfba

File tree

130 files changed

+4392
-1500
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

130 files changed

+4392
-1500
lines changed

.circleci/config.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -279,6 +279,7 @@ workflows:
279279
name: test-all
280280
requires:
281281
- build
282-
target: "`go list ./... | grep -v curio/itests`"
283282
suite: test-all
283+
target: "`go list ./... | grep -v curio/itests`"
284284
get-params: true
285+
resource_class: 2xlarge

README.md

Lines changed: 15 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -40,12 +40,22 @@ Curio Storage is designed to deliver significant improvements and new features f
4040
- **Scalability**: No single point of stress, allowing for seamless expansion from a single machine to thousands.
4141
- **Multi-Miner-ID Support**: Saves hardware resources by enabling multi-proving.
4242
- **Rich Filtering**: Allows detailed filtering at storage locations by ID, purpose, etc.
43+
- **Better Hardware Efficiency**: Tasks pack tightly onto any machine that has that work layer enabled.
44+
- **Debian/Ubuntu APT Repo**: Automatic updates & no building (for the common case).
45+
- **Simple Migrator**: Switch from Lotus Miner to Curio in minutes.
4346

4447
## Future Developments
4548

46-
Curio Storage is continuously evolving, with future plans including:
49+
Since release, Curio's team has added:
4750

4851
- **New Snap Sectors & Unsealing**: Completing the feature set of lotus-miner.
52+
- **Curio SupraSeal (beta) integration**: 10x more efficient Sealing than through other means (Read docs).
53+
- **Disk Garbage Collection**: Know you're storing only what you need.
54+
- **Binary size reduction**: All this functionality is now in a binary under 100MiB.
55+
56+
57+
Curio Storage is continuously evolving, with future plans including:
58+
4959
- **Built-In Markets (like Boost) with Automation**: Enhancing market capabilities with automation.
5060
- **Staking, Resource Sharing, & Deals 2.0**: Introducing advanced features for resource management.
5161
- **Efficiency Gains**: Achieving significant cost savings for storage providers of all sizes.
@@ -58,7 +68,9 @@ Curio Storage is continuously evolving, with future plans including:
5868

5969
## Getting Started
6070

61-
To get started with Curio Storage, follow these steps:
71+
We recommend reading [docs.CurioStorage.org](https://docs.curiostorage.org/) where you may have a pre-built binary for your system.
72+
73+
One way to get started with Curio Storage, follow these steps:
6274

6375
1. **Clone the Repository**:
6476
```sh
@@ -89,7 +101,7 @@ Dual-licensed under [MIT](https://github.com/filecoin-project/curio/blob/master/
89101

90102
# Contributing
91103

92-
We welcome contributions from the community! Please see our [Contributing Guide](CONTRIBUTING.md) for more details.
104+
We welcome contributions from the community! Feel free to open PRs. Reach out to the team on Slack if you need any help.
93105

94106
---
95107

api/api_curio.go

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,10 +8,11 @@ import (
88
"github.com/filecoin-project/go-address"
99
"github.com/filecoin-project/go-state-types/abi"
1010

11+
storiface "github.com/filecoin-project/curio/lib/storiface"
12+
1113
"github.com/filecoin-project/lotus/api"
1214
lpiece "github.com/filecoin-project/lotus/storage/pipeline/piece"
1315
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
14-
"github.com/filecoin-project/lotus/storage/sealer/storiface"
1516
)
1617

1718
type Curio interface {

api/proxy_gen.go

Lines changed: 2 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/curio/guidedsetup/guidedsetup.go

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -328,7 +328,7 @@ func configToDB(d *MigrationData) {
328328
return i == 1
329329
}
330330

331-
d.MinerID, err = SaveConfigToLayerMigrateSectors(d.MinerConfigPath, chainApiInfo, shouldErrPrompt)
331+
d.MinerID, err = SaveConfigToLayerMigrateSectors(d.DB, d.MinerConfigPath, chainApiInfo, shouldErrPrompt)
332332
if err != nil {
333333
d.say(notice, "Error saving config to layer: %s. Aborting Migration", err.Error())
334334
os.Exit(1)

cmd/curio/guidedsetup/shared.go

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -26,11 +26,11 @@ import (
2626
"github.com/filecoin-project/curio/deps"
2727
"github.com/filecoin-project/curio/deps/config"
2828
"github.com/filecoin-project/curio/harmony/harmonydb"
29+
"github.com/filecoin-project/curio/lib/storiface"
2930
"github.com/filecoin-project/curio/lib/types/sector"
3031

3132
"github.com/filecoin-project/lotus/chain/types"
3233
"github.com/filecoin-project/lotus/node/repo"
33-
"github.com/filecoin-project/lotus/storage/sealer/storiface"
3434
)
3535

3636
//go:generate cbor-gen-for --map-encoding SectorInfo
@@ -68,7 +68,7 @@ func (storageMiner) APIInfoEnvVars() (primary string, fallbacks []string, deprec
6868
return "MINER_API_INFO", nil, []string{"STORAGE_API_INFO"}
6969
}
7070

71-
func SaveConfigToLayerMigrateSectors(minerRepoPath, chainApiInfo string, unmigSectorShouldFail func() bool) (minerAddress address.Address, err error) {
71+
func SaveConfigToLayerMigrateSectors(db *harmonydb.DB, minerRepoPath, chainApiInfo string, unmigSectorShouldFail func() bool) (minerAddress address.Address, err error) {
7272
_, say := SetupLanguage()
7373
ctx := context.Background()
7474

@@ -103,12 +103,6 @@ func SaveConfigToLayerMigrateSectors(minerRepoPath, chainApiInfo string, unmigSe
103103
}
104104
smCfg := cfgNode.(*config.StorageMiner)
105105

106-
db, err := harmonydb.NewFromConfig(smCfg.HarmonyDB)
107-
if err != nil {
108-
return minerAddress, fmt.Errorf("could not reach the database. Ensure the Miner config toml's HarmonyDB entry"+
109-
" is setup to reach Yugabyte correctly: %w", err)
110-
}
111-
112106
var titles []string
113107
err = db.Select(ctx, &titles, `SELECT title FROM harmony_config WHERE LENGTH(config) > 0`)
114108
if err != nil {

cmd/curio/guidedsetup/shared_cbor_gen.go

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

cmd/curio/pipeline.go

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ package main
22

33
import (
44
"fmt"
5+
"time"
56

67
"github.com/ipfs/go-datastore"
8+
"github.com/samber/lo"
79
"github.com/urfave/cli/v2"
810
"golang.org/x/xerrors"
911

@@ -29,6 +31,7 @@ var sealCmd = &cli.Command{
2931
Subcommands: []*cli.Command{
3032
sealStartCmd,
3133
sealMigrateLMSectorsCmd,
34+
sealEventsCmd,
3235
},
3336
}
3437

@@ -253,3 +256,108 @@ var sealMigrateLMSectorsCmd = &cli.Command{
253256
return nil
254257
},
255258
}
259+
260+
var sealEventsCmd = &cli.Command{
261+
Name: "events",
262+
Usage: "List pipeline events",
263+
Flags: []cli.Flag{
264+
&cli.StringFlag{
265+
Name: "actor",
266+
Usage: "Filter events by actor address; lists all if not specified",
267+
},
268+
&cli.IntFlag{
269+
Name: "sector",
270+
Usage: "Filter events by sector number; requires --actor to be specified",
271+
},
272+
&cli.UintFlag{
273+
Name: "last",
274+
Usage: "Limit output to the last N events",
275+
Value: 100,
276+
},
277+
},
278+
Action: func(cctx *cli.Context) error {
279+
280+
var actorID uint64
281+
var sector abi.SectorNumber
282+
if cctx.IsSet("actor") {
283+
act, err := address.NewFromString(cctx.String("actor"))
284+
if err != nil {
285+
return fmt.Errorf("parsing --actor: %w", err)
286+
}
287+
mid, err := address.IDFromAddress(act)
288+
if err != nil {
289+
return fmt.Errorf("getting miner id: %w", err)
290+
}
291+
actorID = mid
292+
}
293+
if cctx.IsSet("sector") {
294+
sector = abi.SectorNumber(cctx.Int("sector"))
295+
if !cctx.IsSet("actor") {
296+
return fmt.Errorf("the --actor flag is required when using --sector")
297+
}
298+
}
299+
300+
ctx := reqcontext.ReqContext(cctx)
301+
dep, err := deps.GetDepsCLI(ctx, cctx)
302+
if err != nil {
303+
return err
304+
}
305+
306+
var events []struct {
307+
ActorID int `db:"sp_id"`
308+
Sector int `db:"sector_number"`
309+
ID int `db:"id"`
310+
TaskID int `db:"task_id"`
311+
Name string `db:"name"`
312+
Posted time.Time `db:"posted"`
313+
WorkStart time.Time `db:"work_start"`
314+
WorkEnd time.Time `db:"work_end"`
315+
Result bool `db:"result"`
316+
Err string `db:"err"`
317+
ByHost string `db:"completed_by_host_and_port"`
318+
}
319+
320+
if !cctx.IsSet("actor") {
321+
// list for all actors
322+
err = dep.DB.Select(ctx, &events, `SELECT s.sp_id, s.sector_number, h.*
323+
FROM harmony_task_history h
324+
JOIN sectors_pipeline_events s ON h.id = s.task_history_id
325+
ORDER BY h.work_end DESC LIMIT $1;`, cctx.Int("last"))
326+
} else if cctx.IsSet("sector") {
327+
// list for specific actor and sector
328+
err = dep.DB.Select(ctx, &events, `SELECT s.sp_id, s.sector_number, h.*
329+
FROM harmony_task_history h
330+
JOIN sectors_pipeline_events s ON h.id = s.task_history_id
331+
WHERE s.sp_id = $1 AND s.sector_number = $2 ORDER BY h.work_end DESC LIMIT $3;`, actorID, sector, cctx.Int("last"))
332+
} else {
333+
fmt.Println(cctx.IsSet("actor"), cctx.IsSet("sector"))
334+
// list for specific actor
335+
err = dep.DB.Select(ctx, &events, `SELECT s.sp_id, s.sector_number, h.*
336+
FROM harmony_task_history h
337+
JOIN sectors_pipeline_events s ON h.id = s.task_history_id
338+
WHERE s.sp_id = $1 ORDER BY h.work_end DESC LIMIT $2;`, actorID, cctx.Int("last"))
339+
}
340+
341+
if err != nil {
342+
return fmt.Errorf("getting events: %w", err)
343+
}
344+
fmt.Printf("Total Events: %d\n", len(events))
345+
346+
fmt.Printf("%-10s %-10s %-18s %-10s %-28s %-28s %-20s %-20s %-10s %-20s \n", "ActorID", "Sector", "Task", "HistoryID", "Posted", "Start", "Took", "Machine", "Status", "Error")
347+
for _, e := range events {
348+
fmt.Printf("%-10d %-10d %-18s %-10d %-28s %-28s %-20s %-20s %-10s %-20s \n",
349+
e.ActorID,
350+
e.Sector,
351+
e.Name,
352+
e.TaskID,
353+
e.Posted.Format(time.RFC3339),
354+
e.WorkStart.Format(time.RFC3339),
355+
e.WorkEnd.Sub(e.WorkStart),
356+
e.ByHost,
357+
lo.Ternary(e.Result, "Success", "Failure"),
358+
e.Err,
359+
)
360+
}
361+
return nil
362+
},
363+
}

cmd/curio/rpc/rpc.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ import (
3333
"github.com/filecoin-project/curio/lib/metrics"
3434
"github.com/filecoin-project/curio/lib/paths"
3535
"github.com/filecoin-project/curio/lib/repo"
36+
storiface "github.com/filecoin-project/curio/lib/storiface"
3637
"github.com/filecoin-project/curio/web"
3738

3839
lapi "github.com/filecoin-project/lotus/api"
@@ -42,7 +43,6 @@ import (
4243
"github.com/filecoin-project/lotus/metrics/proxy"
4344
"github.com/filecoin-project/lotus/storage/pipeline/piece"
4445
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
45-
"github.com/filecoin-project/lotus/storage/sealer/storiface"
4646
)
4747

4848
const metaFile = "sectorstore.json"
@@ -296,7 +296,7 @@ func ListenAndServe(ctx context.Context, dependencies *deps.Deps, shutdownChan c
296296
eg.Go(srv.ListenAndServe)
297297

298298
if dependencies.Cfg.Subsystems.EnableWebGui {
299-
web, err := web.GetSrv(ctx, dependencies)
299+
web, err := web.GetSrv(ctx, dependencies, false)
300300
if err != nil {
301301
return err
302302
}

cmd/curio/storage.go

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,10 +20,10 @@ import (
2020

2121
"github.com/filecoin-project/curio/cmd/curio/rpc"
2222
"github.com/filecoin-project/curio/lib/reqcontext"
23+
storiface "github.com/filecoin-project/curio/lib/storiface"
2324

2425
"github.com/filecoin-project/lotus/chain/types"
2526
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
26-
"github.com/filecoin-project/lotus/storage/sealer/storiface"
2727
)
2828

2929
var storageCmd = &cli.Command{
@@ -438,7 +438,7 @@ var storageFindCmd = &cli.Command{
438438
}
439439

440440
sectorTypes := []storiface.SectorFileType{
441-
storiface.FTUnsealed, storiface.FTSealed, storiface.FTCache, storiface.FTUpdate, storiface.FTUpdateCache,
441+
storiface.FTUnsealed, storiface.FTSealed, storiface.FTCache, storiface.FTUpdate, storiface.FTUpdateCache, storiface.FTPiece,
442442
}
443443

444444
byId := make(map[storiface.ID]*storedSector)

0 commit comments

Comments
 (0)