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

v1.10.1 to releases #6661

Merged
merged 28 commits into from
Jul 6, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
28 commits
Select commit Hold shift + click to select a range
38b476c
set version to v1.10.1-dev
magik6k Jul 2, 2021
bb2b134
commit batch: Initialize the FailedSectors map
magik6k Jul 1, 2021
1a86963
fix: miner balance is not enough, so that ProveCommitAggregate msg ex…
firesWu Jun 29, 2021
0421669
ensure agg fee is adequate
firesWu Jun 29, 2021
76fff49
remove precommit check in handleCommitFailed
GFZRZK Jun 28, 2021
ab2503f
gofmt
magik6k Jun 30, 2021
c21e275
handleSubmitCommitAggregate() exception handling
Jun 25, 2021
6d555c9
commit batch: AggregateAboveBaseFee config
magik6k Jul 1, 2021
3370450
commit batch: Regression test nil FailedSectors map
magik6k Jul 1, 2021
504882e
fix ticket expiration check, otherwise it may cause a large number of…
llifezou Jun 30, 2021
5aeacd2
fix getTicket: sector precommitted but expired case
llifezou Jul 1, 2021
4c3bcd1
Update extern/storage-sealing/states_sealing.go
llifezou Jul 2, 2021
db30d89
Update extern/storage-sealing/states_sealing.go
llifezou Jul 2, 2021
4fe3ecb
to optimize the batchwait
Jun 30, 2021
c5ea17f
Fix: precommit_batch method used the wrong cfg.PreCommitBatchWait
sunday527 Jul 2, 2021
ebbfe03
Fix tiny error in check-client-datacap
ribasushi Jul 2, 2021
0511770
storage: Fix FinalizeSector with sectors in stoage paths
magik6k Jul 1, 2021
29763df
set version to v1.10.1-rc1
magik6k Jul 2, 2021
9457444
Add v1.10.1-rc1 changelog
jennijuju Jul 2, 2021
a06ecde
recommend to update
jennijuju Jul 2, 2021
0b5d155
format fix and small clarification
jennijuju Jul 2, 2021
1f4ec38
Merge pull request #6666 from filecoin-project/jen/changelog
magik6k Jul 2, 2021
8ae14be
bump the version to v1.10.1
jennijuju Jul 5, 2021
b43fda8
Update CHANGELOG.md
jennijuju Jul 5, 2021
55df629
Merge pull request #6682 from filecoin-project/feat/v1.10.1
jennijuju Jul 5, 2021
a444ab2
Update CHANGELOG.md
jennijuju Jul 5, 2021
aec7d57
Update CHANGELOG.md
jennijuju Jul 5, 2021
7d2febf
Update CHANGELOG.md
jennijuju Jul 5, 2021
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
33 changes: 33 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,38 @@
# Lotus changelog

# 1.10.1 / 2021-07-05

This is an optional but **highly recommended** release of Lotus for lotus miners that has many bug fixes and improvements based on the feedback we got from the community since HyperDrive.

## New Features
- commit batch: AggregateAboveBaseFee config #6650
- `AggregateAboveBaseFee` is added to miner sealing configuration for setting the network base fee to start aggregating proofs. When the network base fee is lower than this value, the prove commits will be submitted individually via `ProveCommitSector`. According to the [Batch Incentive Alignment](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0013.md#batch-incentive-alignment) introduced in FIP-0013, we recommend miners to set this value to 0.15 nanoFIL(which is the default value) to avoid unexpected aggregation fee in burn and enjoy the most benefits of aggregation!

## Bug Fixes
- storage: Fix FinalizeSector with sectors in storage paths #6652
- Fix tiny error in check-client-datacap #6664
- Fix: precommit_batch method used the wrong cfg.PreCommitBatchWait #6658
- to optimize the batchwait #6636
- fix getTicket: sector precommitted but expired case #6635
- handleSubmitCommitAggregate() exception handling #6595
- remove precommit check in handleCommitFailed #6634
- ensure agg fee is adequate
- fix: miner balance is not enough, so that ProveCommitAggregate msg exec failed #6623
- commit batch: Initialize the FailedSectors map #6647

Contributors

| Contributor | Commits | Lines ± | Files Changed |
|-------------|---------|---------|---------------|
| @magik6k| 7 | +151/-56 | 21 |
| @llifezou | 4 | +59/-20 | 4 |
| @johnli-helloworld | 2 | +45/-14 | 4 |
| @wangchao | 1 | +1/-27 | 1 |
| Jerry | 2 | +9/-4 | 2 |
| @zhoutian527 | 1 | +2/-2 | 1 |
| @ribasushi| 1 | +1/-1 | 1 |


# 1.10.0 / 2021-06-23

This is a mandatory release of Lotus that introduces Filecoin network v13, codenamed the HyperDrive upgrade. The
Expand Down
Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/miner.json.gz
Binary file not shown.
Binary file modified build/openrpc/worker.json.gz
Binary file not shown.
2 changes: 1 addition & 1 deletion build/version.go
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ func buildType() string {
}

// BuildVersion is the local build version, set by build system
const BuildVersion = "1.10.0"
const BuildVersion = "1.10.1"

func UserVersion() string {
return BuildVersion + buildType() + CurrentCommit
Expand Down
5 changes: 5 additions & 0 deletions chain/types/fil.go
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,11 @@ func (f FIL) Unitless() string {
return strings.TrimRight(strings.TrimRight(r.FloatString(18), "0"), ".")
}

var AttoFil = NewInt(1)
var FemtoFil = BigMul(AttoFil, NewInt(1000))
var PicoFil = BigMul(FemtoFil, NewInt(1000))
var NanoFil = BigMul(PicoFil, NewInt(1000))

var unitPrefixes = []string{"a", "f", "p", "n", "μ", "m"}

func (f FIL) Short() string {
Expand Down
2 changes: 1 addition & 1 deletion cli/filplus.go
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,7 @@ var filplusCheckClientCmd = &cli.Command{
return err
}
if dcap == nil {
return xerrors.Errorf("client %s is not a verified client", err)
return xerrors.Errorf("client %s is not a verified client", caddr)
}

fmt.Println(*dcap)
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-seal-worker/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ var storageAttachCmd = &cli.Command{
}

if !(cfg.CanStore || cfg.CanSeal) {
return xerrors.Errorf("must specify at least one of --store of --seal")
return xerrors.Errorf("must specify at least one of --store or --seal")
}

b, err := json.MarshalIndent(cfg, "", " ")
Expand Down
2 changes: 1 addition & 1 deletion cmd/lotus-storage-miner/storage.go
Original file line number Diff line number Diff line change
Expand Up @@ -145,7 +145,7 @@ over time
}

if !(cfg.CanStore || cfg.CanSeal) {
return xerrors.Errorf("must specify at least one of --store of --seal")
return xerrors.Errorf("must specify at least one of --store or --seal")
}

b, err := json.MarshalIndent(cfg, "", " ")
Expand Down
17 changes: 16 additions & 1 deletion extern/sector-storage/manager.go
Original file line number Diff line number Diff line change
Expand Up @@ -587,10 +587,25 @@ func (m *Manager) FinalizeSector(ctx context.Context, sector storage.SectorRef,
}
}

pathType := storiface.PathStorage
{
sealedStores, err := m.index.StorageFindSector(ctx, sector.ID, storiface.FTSealed, 0, false)
if err != nil {
return xerrors.Errorf("finding sealed sector: %w", err)
}

for _, store := range sealedStores {
if store.CanSeal {
pathType = storiface.PathSealing
break
}
}
}

selector := newExistingSelector(m.index, sector.ID, storiface.FTCache|storiface.FTSealed, false)

err := m.sched.Schedule(ctx, sector, sealtasks.TTFinalize, selector,
m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|unsealed, storiface.PathSealing, storiface.AcquireMove),
m.schedFetch(sector, storiface.FTCache|storiface.FTSealed|unsealed, pathType, storiface.AcquireMove),
func(ctx context.Context, w Worker) error {
_, err := m.waitSimpleCall(ctx)(w.FinalizeSector(ctx, sector, keepUnsealed))
return err
Expand Down
62 changes: 49 additions & 13 deletions extern/storage-sealing/commit_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,9 @@ import (

const arp = abi.RegisteredAggregationProof_SnarkPackV1

var aggFeeNum = big.NewInt(110)
var aggFeeDen = big.NewInt(100)

type CommitBatcherApi interface {
SendMsg(ctx context.Context, from, to address.Address, method abi.MethodNum, value, maxFee abi.TokenAmount, params []byte) (cid.Cid, error)
StateMinerInfo(context.Context, address.Address, TipSetToken) (miner.MinerInfo, error)
Expand Down Expand Up @@ -101,6 +104,7 @@ func (b *CommitBatcher) run() {
panic(err)
}

timer := time.NewTimer(b.batchWait(cfg.CommitBatchWait, cfg.CommitBatchSlack))
for {
if forceRes != nil {
forceRes <- lastMsg
Expand All @@ -116,7 +120,7 @@ func (b *CommitBatcher) run() {
return
case <-b.notify:
sendAboveMax = true
case <-b.batchWait(cfg.CommitBatchWait, cfg.CommitBatchSlack):
case <-timer.C:
// do nothing
case fr := <-b.force: // user triggered
forceRes = fr
Expand All @@ -127,17 +131,26 @@ func (b *CommitBatcher) run() {
if err != nil {
log.Warnw("CommitBatcher processBatch error", "error", err)
}

if !timer.Stop() {
select {
case <-timer.C:
default:
}
}

timer.Reset(b.batchWait(cfg.CommitBatchWait, cfg.CommitBatchSlack))
}
}

func (b *CommitBatcher) batchWait(maxWait, slack time.Duration) <-chan time.Time {
func (b *CommitBatcher) batchWait(maxWait, slack time.Duration) time.Duration {
now := time.Now()

b.lk.Lock()
defer b.lk.Unlock()

if len(b.todo) == 0 {
return nil
return maxWait
}

var cutoff time.Time
Expand All @@ -155,20 +168,20 @@ func (b *CommitBatcher) batchWait(maxWait, slack time.Duration) <-chan time.Time
}

if cutoff.IsZero() {
return time.After(maxWait)
return maxWait
}

cutoff = cutoff.Add(-slack)
if cutoff.Before(now) {
return time.After(time.Nanosecond) // can't return 0
return time.Nanosecond // can't return 0
}

wait := cutoff.Sub(now)
if wait > maxWait {
wait = maxWait
}

return time.After(wait)
return wait
}

func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes, error) {
Expand All @@ -191,7 +204,25 @@ func (b *CommitBatcher) maybeStartBatch(notif bool) ([]sealiface.CommitBatchRes,

var res []sealiface.CommitBatchRes

if total < cfg.MinCommitBatch || total < miner5.MinAggregatedSectors {
individual := (total < cfg.MinCommitBatch) || (total < miner5.MinAggregatedSectors)

if !individual && !cfg.AggregateAboveBaseFee.Equals(big.Zero()) {
tok, _, err := b.api.ChainHead(b.mctx)
if err != nil {
return nil, err
}

bf, err := b.api.ChainBaseFee(b.mctx, tok)
if err != nil {
return nil, xerrors.Errorf("couldn't get base fee: %w", err)
}

if bf.LessThan(cfg.AggregateAboveBaseFee) {
individual = true
}
}

if individual {
res, err = b.processIndividually()
} else {
res, err = b.processBatch(cfg)
Expand Down Expand Up @@ -227,7 +258,9 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa

total := len(b.todo)

var res sealiface.CommitBatchRes
res := sealiface.CommitBatchRes{
FailedSectors: map[abi.SectorNumber]string{},
}

params := miner5.ProveCommitAggregateParams{
SectorNumbers: bitfield.New(),
Expand Down Expand Up @@ -303,16 +336,18 @@ func (b *CommitBatcher) processBatch(cfg sealiface.Config) ([]sealiface.CommitBa
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("getting network version: %s", err)
}

aggFee := policy.AggregateNetworkFee(nv, len(infos), bf)
aggFee := big.Div(big.Mul(policy.AggregateNetworkFee(nv, len(infos), bf), aggFeeNum), aggFeeDen)

goodFunds := big.Add(maxFee, big.Add(collateral, aggFee))
needFunds := big.Add(collateral, aggFee)

from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, collateral)
goodFunds := big.Add(maxFee, needFunds)

from, _, err := b.addrSel(b.mctx, mi, api.CommitAddr, goodFunds, needFunds)
if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("no good address found: %w", err)
}

mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, miner.Methods.ProveCommitAggregate, collateral, maxFee, enc.Bytes())
mcid, err := b.api.SendMsg(b.mctx, from, b.maddr, miner.Methods.ProveCommitAggregate, needFunds, maxFee, enc.Bytes())
if err != nil {
return []sealiface.CommitBatchRes{res}, xerrors.Errorf("sending message failed: %w", err)
}
Expand All @@ -339,7 +374,8 @@ func (b *CommitBatcher) processIndividually() ([]sealiface.CommitBatchRes, error

for sn, info := range b.todo {
r := sealiface.CommitBatchRes{
Sectors: []abi.SectorNumber{sn},
Sectors: []abi.SectorNumber{sn},
FailedSectors: map[abi.SectorNumber]string{},
}

mcid, err := b.processSingle(mi, sn, info, tok)
Expand Down
1 change: 1 addition & 0 deletions extern/storage-sealing/fsm.go
Original file line number Diff line number Diff line change
Expand Up @@ -115,6 +115,7 @@ var fsmPlanners = map[SectorState]func(events []statemachine.Event, state *Secto
SubmitCommitAggregate: planOne(
on(SectorCommitAggregateSent{}, CommitWait),
on(SectorCommitFailed{}, CommitFailed),
on(SectorRetrySubmitCommit{}, SubmitCommit),
),
CommitWait: planOne(
on(SectorProving{}, FinalizeSector),
Expand Down
22 changes: 16 additions & 6 deletions extern/storage-sealing/precommit_batch.go
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ func (b *PreCommitBatcher) run() {
panic(err)
}

timer := time.NewTimer(b.batchWait(cfg.PreCommitBatchWait, cfg.PreCommitBatchSlack))
for {
if forceRes != nil {
forceRes <- lastRes
Expand All @@ -100,7 +101,7 @@ func (b *PreCommitBatcher) run() {
return
case <-b.notify:
sendAboveMax = true
case <-b.batchWait(cfg.PreCommitBatchWait, cfg.PreCommitBatchSlack):
case <-timer.C:
// do nothing
case fr := <-b.force: // user triggered
forceRes = fr
Expand All @@ -111,17 +112,26 @@ func (b *PreCommitBatcher) run() {
if err != nil {
log.Warnw("PreCommitBatcher processBatch error", "error", err)
}

if !timer.Stop() {
select {
case <-timer.C:
default:
}
}

timer.Reset(b.batchWait(cfg.PreCommitBatchWait, cfg.PreCommitBatchSlack))
}
}

func (b *PreCommitBatcher) batchWait(maxWait, slack time.Duration) <-chan time.Time {
func (b *PreCommitBatcher) batchWait(maxWait, slack time.Duration) time.Duration {
now := time.Now()

b.lk.Lock()
defer b.lk.Unlock()

if len(b.todo) == 0 {
return nil
return maxWait
}

var cutoff time.Time
Expand All @@ -139,20 +149,20 @@ func (b *PreCommitBatcher) batchWait(maxWait, slack time.Duration) <-chan time.T
}

if cutoff.IsZero() {
return time.After(maxWait)
return maxWait
}

cutoff = cutoff.Add(-slack)
if cutoff.Before(now) {
return time.After(time.Nanosecond) // can't return 0
return time.Nanosecond // can't return 0
}

wait := cutoff.Sub(now)
if wait > maxWait {
wait = maxWait
}

return time.After(wait)
return wait
}

func (b *PreCommitBatcher) maybeStartBatch(notif bool) ([]sealiface.PreCommitBatchRes, error) {
Expand Down
8 changes: 7 additions & 1 deletion extern/storage-sealing/sealiface/config.go
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
package sealiface

import "time"
import (
"time"

"github.com/filecoin-project/go-state-types/abi"
)

// this has to be in a separate package to not make lotus API depend on filecoin-ffi

Expand Down Expand Up @@ -31,6 +35,8 @@ type Config struct {
CommitBatchWait time.Duration
CommitBatchSlack time.Duration

AggregateAboveBaseFee abi.TokenAmount

TerminateBatchMax uint64
TerminateBatchMin uint64
TerminateBatchWait time.Duration
Expand Down
Loading