v1.27.0-a #10
@ -142,7 +142,7 @@ func (deps *Deps) PopulateRemainingDeps(ctx context.Context, cctx *cli.Context,
|
|||||||
// The config feeds into task runners & their helpers
|
// The config feeds into task runners & their helpers
|
||||||
deps.Cfg, err = GetConfig(cctx, deps.DB)
|
deps.Cfg, err = GetConfig(cctx, deps.DB)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return xerrors.Errorf("populate config: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,15 +251,19 @@ Get it with: jq .PrivateKey ~/.lotus-miner/keystore/MF2XI2BNNJ3XILLQOJUXMYLUMU`,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
fmt.Println("last line of populate")
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var oldAddresses = regexp.MustCompile("(?i)^[addresses]$")
|
var oldAddresses = regexp.MustCompile("(?i)^\\[addresses\\]$")
|
||||||
|
|
||||||
func LoadConfigWithUpgrades(text string, lp *config.LotusProviderConfig) (toml.MetaData, error) {
|
func LoadConfigWithUpgrades(text string, lp *config.LotusProviderConfig) (toml.MetaData, error) {
|
||||||
// allow migration from old config format that was limited to 1 wallet setup.
|
// allow migration from old config format that was limited to 1 wallet setup.
|
||||||
newText := oldAddresses.ReplaceAllString(text, "[[addresses]]")
|
newText := oldAddresses.ReplaceAllString(text, "[[addresses]]")
|
||||||
|
|
||||||
|
if text != newText {
|
||||||
|
log.Warnw("Upgraded config!", "old", text, "new", newText)
|
||||||
|
}
|
||||||
|
|
||||||
meta, err := toml.Decode(newText, &lp)
|
meta, err := toml.Decode(newText, &lp)
|
||||||
return meta, err
|
return meta, err
|
||||||
}
|
}
|
||||||
|
@ -54,18 +54,13 @@ var wdPostTaskCmd = &cli.Command{
|
|||||||
Usage: "deadline to compute WindowPoSt for ",
|
Usage: "deadline to compute WindowPoSt for ",
|
||||||
Value: 0,
|
Value: 0,
|
||||||
},
|
},
|
||||||
&cli.StringSliceFlag{
|
|
||||||
Name: "layers",
|
|
||||||
Usage: "list of layers to be interpreted (atop defaults). Default: base",
|
|
||||||
Value: cli.NewStringSlice("base"),
|
|
||||||
},
|
|
||||||
},
|
},
|
||||||
Action: func(cctx *cli.Context) error {
|
Action: func(cctx *cli.Context) error {
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
|
|
||||||
deps, err := deps.GetDeps(ctx, cctx)
|
deps, err := deps.GetDeps(ctx, cctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return xerrors.Errorf("get config: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ts, err := deps.Full.ChainHead(ctx)
|
ts, err := deps.Full.ChainHead(ctx)
|
||||||
@ -83,24 +78,24 @@ var wdPostTaskCmd = &cli.Command{
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("cannot get miner id %w", err)
|
return xerrors.Errorf("cannot get miner id %w", err)
|
||||||
}
|
}
|
||||||
var id int64
|
var taskId int64
|
||||||
|
|
||||||
retryDelay := time.Millisecond * 10
|
retryDelay := time.Millisecond * 10
|
||||||
retryAddTask:
|
retryAddTask:
|
||||||
_, err = deps.DB.BeginTransaction(ctx, func(tx *harmonydb.Tx) (commit bool, err error) {
|
_, err = deps.DB.BeginTransaction(ctx, func(tx *harmonydb.Tx) (commit bool, err error) {
|
||||||
err = tx.QueryRow(`INSERT INTO harmony_task (name, posted_time, added_by) VALUES ('WdPost', CURRENT_TIMESTAMP, 123) RETURNING id`).Scan(&id)
|
err = tx.QueryRow(`INSERT INTO harmony_task (name, posted_time, added_by) VALUES ('WdPost', CURRENT_TIMESTAMP, 123) RETURNING id`).Scan(&taskId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("inserting harmony_task: ", err)
|
log.Error("inserting harmony_task: ", err)
|
||||||
return false, xerrors.Errorf("inserting harmony_task: %w", err)
|
return false, xerrors.Errorf("inserting harmony_task: %w", err)
|
||||||
}
|
}
|
||||||
_, err = tx.Exec(`INSERT INTO wdpost_partition_tasks
|
_, err = tx.Exec(`INSERT INTO wdpost_partition_tasks
|
||||||
(task_id, sp_id, proving_period_start, deadline_index, partition_index) VALUES ($1, $2, $3, $4, $5)`,
|
(task_id, sp_id, proving_period_start, deadline_index, partition_index) VALUES ($1, $2, $3, $4, $5)`,
|
||||||
id, maddr, ht, cctx.Uint64("deadline"), 0)
|
taskId, maddr, ht, cctx.Uint64("deadline"), 0)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("inserting wdpost_partition_tasks: ", err)
|
log.Error("inserting wdpost_partition_tasks: ", err)
|
||||||
return false, xerrors.Errorf("inserting wdpost_partition_tasks: %w", err)
|
return false, xerrors.Errorf("inserting wdpost_partition_tasks: %w", err)
|
||||||
}
|
}
|
||||||
_, err = tx.Exec("INSERT INTO harmony_test (task_id) VALUES ($1)", id)
|
_, err = tx.Exec("INSERT INTO harmony_test (task_id) VALUES ($1)", taskId)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, xerrors.Errorf("inserting into harmony_tests: %w", err)
|
return false, xerrors.Errorf("inserting into harmony_tests: %w", err)
|
||||||
}
|
}
|
||||||
@ -114,11 +109,11 @@ var wdPostTaskCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
return xerrors.Errorf("writing SQL transaction: %w", err)
|
return xerrors.Errorf("writing SQL transaction: %w", err)
|
||||||
}
|
}
|
||||||
fmt.Printf("Inserted task %v. Waiting for success ", id)
|
fmt.Printf("Inserted task %v. Waiting for success ", taskId)
|
||||||
var result sql.NullString
|
var result sql.NullString
|
||||||
for {
|
for {
|
||||||
time.Sleep(time.Second)
|
time.Sleep(time.Second)
|
||||||
err = deps.DB.QueryRow(ctx, `SELECT result FROM harmony_test WHERE task_id=$1`, id).Scan(&result)
|
err = deps.DB.QueryRow(ctx, `SELECT result FROM harmony_test WHERE task_id=$1`, taskId).Scan(&result)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading result from harmony_test: %w", err)
|
return xerrors.Errorf("reading result from harmony_test: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -353,6 +353,7 @@ func DefaultLotusProvider() *LotusProviderConfig {
|
|||||||
PreCommitControl: []string{},
|
PreCommitControl: []string{},
|
||||||
CommitControl: []string{},
|
CommitControl: []string{},
|
||||||
TerminateControl: []string{},
|
TerminateControl: []string{},
|
||||||
|
MinerAddresses: []string{},
|
||||||
}},
|
}},
|
||||||
Proving: ProvingConfig{
|
Proving: ProvingConfig{
|
||||||
ParallelCheckLimit: 32,
|
ParallelCheckLimit: 32,
|
||||||
|
Loading…
Reference in New Issue
Block a user