Merge pull request #7261 from filecoin-project/feat/sectors-list-sealing-deals
Show deal sizes is sealing sectors
This commit is contained in:
commit
b7f771b258
@ -267,6 +267,11 @@ type SectorLog struct {
|
|||||||
Message string
|
Message string
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type SectorPiece struct {
|
||||||
|
Piece abi.PieceInfo
|
||||||
|
DealInfo *PieceDealInfo // nil for pieces which do not appear in deals (e.g. filler pieces)
|
||||||
|
}
|
||||||
|
|
||||||
type SectorInfo struct {
|
type SectorInfo struct {
|
||||||
SectorID abi.SectorNumber
|
SectorID abi.SectorNumber
|
||||||
State SectorState
|
State SectorState
|
||||||
@ -274,6 +279,7 @@ type SectorInfo struct {
|
|||||||
CommR *cid.Cid
|
CommR *cid.Cid
|
||||||
Proof []byte
|
Proof []byte
|
||||||
Deals []abi.DealID
|
Deals []abi.DealID
|
||||||
|
Pieces []SectorPiece
|
||||||
Ticket SealTicket
|
Ticket SealTicket
|
||||||
Seed SealSeed
|
Seed SealSeed
|
||||||
PreCommitMsg *cid.Cid
|
PreCommitMsg *cid.Cid
|
||||||
|
Binary file not shown.
@ -389,15 +389,30 @@ var sectorsListCmd = &cli.Command{
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if showRemoved || st.State != api.SectorState(sealing.Removed) {
|
if !showRemoved && st.State == api.SectorState(sealing.Removed) {
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
_, inSSet := commitedIDs[s]
|
_, inSSet := commitedIDs[s]
|
||||||
_, inASet := activeIDs[s]
|
_, inASet := activeIDs[s]
|
||||||
|
|
||||||
|
const verifiedPowerGainMul = 9
|
||||||
|
|
||||||
dw, vp := .0, .0
|
dw, vp := .0, .0
|
||||||
if st.Expiration-st.Activation > 0 {
|
estimate := st.Expiration-st.Activation <= 0
|
||||||
|
if !estimate {
|
||||||
rdw := big.Add(st.DealWeight, st.VerifiedDealWeight)
|
rdw := big.Add(st.DealWeight, st.VerifiedDealWeight)
|
||||||
dw = float64(big.Div(rdw, big.NewInt(int64(st.Expiration-st.Activation))).Uint64())
|
dw = float64(big.Div(rdw, big.NewInt(int64(st.Expiration-st.Activation))).Uint64())
|
||||||
vp = float64(big.Div(big.Mul(st.VerifiedDealWeight, big.NewInt(9)), big.NewInt(int64(st.Expiration-st.Activation))).Uint64())
|
vp = float64(big.Div(big.Mul(st.VerifiedDealWeight, big.NewInt(verifiedPowerGainMul)), big.NewInt(int64(st.Expiration-st.Activation))).Uint64())
|
||||||
|
} else {
|
||||||
|
for _, piece := range st.Pieces {
|
||||||
|
if piece.DealInfo != nil {
|
||||||
|
dw += float64(piece.Piece.Size)
|
||||||
|
if piece.DealInfo.DealProposal != nil && piece.DealInfo.DealProposal.VerifiedDeal {
|
||||||
|
vp += float64(piece.Piece.Size) * verifiedPowerGainMul
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
var deals int
|
var deals int
|
||||||
@ -433,20 +448,26 @@ var sectorsListCmd = &cli.Command{
|
|||||||
m["Expiration"] = "n/a"
|
m["Expiration"] = "n/a"
|
||||||
} else {
|
} else {
|
||||||
m["Expiration"] = lcli.EpochTime(head.Height(), exp)
|
m["Expiration"] = lcli.EpochTime(head.Height(), exp)
|
||||||
|
|
||||||
if !fast && deals > 0 {
|
|
||||||
m["DealWeight"] = units.BytesSize(dw)
|
|
||||||
if vp > 0 {
|
|
||||||
m["VerifiedPower"] = color.GreenString(units.BytesSize(vp))
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if st.Early > 0 {
|
if st.Early > 0 {
|
||||||
m["RecoveryTimeout"] = color.YellowString(lcli.EpochTime(head.Height(), st.Early))
|
m["RecoveryTimeout"] = color.YellowString(lcli.EpochTime(head.Height(), st.Early))
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if !fast && deals > 0 {
|
||||||
|
estWrap := func(s string) string {
|
||||||
|
if !estimate {
|
||||||
|
return s
|
||||||
|
}
|
||||||
|
return fmt.Sprintf("[%s]", s)
|
||||||
|
}
|
||||||
|
|
||||||
|
m["DealWeight"] = estWrap(units.BytesSize(dw))
|
||||||
|
if vp > 0 {
|
||||||
|
m["VerifiedPower"] = estWrap(color.GreenString(units.BytesSize(vp)))
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
if cctx.Bool("events") {
|
if cctx.Bool("events") {
|
||||||
var events int
|
var events int
|
||||||
for _, sectorLog := range st.Log {
|
for _, sectorLog := range st.Log {
|
||||||
@ -475,7 +496,7 @@ var sectorsListCmd = &cli.Command{
|
|||||||
start := time.Unix(int64(st.Log[0].Timestamp), 0)
|
start := time.Unix(int64(st.Log[0].Timestamp), 0)
|
||||||
|
|
||||||
for _, sectorLog := range st.Log {
|
for _, sectorLog := range st.Log {
|
||||||
if sectorLog.Kind == "event;sealing.SectorProving" {
|
if sectorLog.Kind == "event;sealing.SectorProving" { // todo: figure out a good way to not hardcode
|
||||||
end := time.Unix(int64(sectorLog.Timestamp), 0)
|
end := time.Unix(int64(sectorLog.Timestamp), 0)
|
||||||
dur := end.Sub(start)
|
dur := end.Sub(start)
|
||||||
|
|
||||||
@ -495,7 +516,6 @@ var sectorsListCmd = &cli.Command{
|
|||||||
|
|
||||||
tw.Write(m)
|
tw.Write(m)
|
||||||
}
|
}
|
||||||
}
|
|
||||||
|
|
||||||
return tw.Flush(os.Stdout)
|
return tw.Flush(os.Stdout)
|
||||||
},
|
},
|
||||||
|
@ -2019,6 +2019,7 @@ Response:
|
|||||||
"CommR": null,
|
"CommR": null,
|
||||||
"Proof": "Ynl0ZSBhcnJheQ==",
|
"Proof": "Ynl0ZSBhcnJheQ==",
|
||||||
"Deals": null,
|
"Deals": null,
|
||||||
|
"Pieces": null,
|
||||||
"Ticket": {
|
"Ticket": {
|
||||||
"Value": null,
|
"Value": null,
|
||||||
"Epoch": 10101
|
"Epoch": 10101
|
||||||
|
@ -94,10 +94,16 @@ func (m *Miner) SectorsStatus(ctx context.Context, sid abi.SectorNumber, showOnC
|
|||||||
}
|
}
|
||||||
|
|
||||||
deals := make([]abi.DealID, len(info.Pieces))
|
deals := make([]abi.DealID, len(info.Pieces))
|
||||||
|
pieces := make([]api.SectorPiece, len(info.Pieces))
|
||||||
for i, piece := range info.Pieces {
|
for i, piece := range info.Pieces {
|
||||||
|
pieces[i].Piece = piece.Piece
|
||||||
if piece.DealInfo == nil {
|
if piece.DealInfo == nil {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pdi := *piece.DealInfo // copy
|
||||||
|
pieces[i].DealInfo = &pdi
|
||||||
|
|
||||||
deals[i] = piece.DealInfo.DealID
|
deals[i] = piece.DealInfo.DealID
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -118,6 +124,7 @@ func (m *Miner) SectorsStatus(ctx context.Context, sid abi.SectorNumber, showOnC
|
|||||||
CommR: info.CommR,
|
CommR: info.CommR,
|
||||||
Proof: info.Proof,
|
Proof: info.Proof,
|
||||||
Deals: deals,
|
Deals: deals,
|
||||||
|
Pieces: pieces,
|
||||||
Ticket: api.SealTicket{
|
Ticket: api.SealTicket{
|
||||||
Value: info.TicketValue,
|
Value: info.TicketValue,
|
||||||
Epoch: info.TicketEpoch,
|
Epoch: info.TicketEpoch,
|
||||||
|
Loading…
Reference in New Issue
Block a user