feat: api: add SectorNumber to MarketDealState (nv22)

This commit is contained in:
Rod Vagg 2024-05-16 12:46:24 +10:00
parent 3ee09115e6
commit f098fc2a66
24 changed files with 142 additions and 3 deletions

View File

@ -1166,13 +1166,15 @@ type MarketBalance struct {
}
type MarketDealState struct {
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
SlashEpoch abi.ChainEpoch // -1 if deal never slashed
SectorNumber abi.SectorNumber // 0 if not yet included in proven sector (0 is also a valid sector number).
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
SlashEpoch abi.ChainEpoch // -1 if deal never slashed
}
func MakeDealState(mds market.DealState) MarketDealState {
return MarketDealState{
SectorNumber: mds.SectorNumber(),
SectorStartEpoch: mds.SectorStartEpoch(),
LastUpdatedEpoch: mds.LastUpdatedEpoch(),
SlashEpoch: mds.SlashEpoch(),
@ -1183,6 +1185,10 @@ type mstate struct {
s MarketDealState
}
func (m mstate) SectorNumber() abi.SectorNumber {
return m.s.SectorNumber
}
func (m mstate) SectorStartEpoch() abi.ChainEpoch {
return m.s.SectorStartEpoch
}

View File

@ -21611,6 +21611,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -21678,6 +21679,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
@ -21848,6 +21853,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -21912,6 +21918,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"

View File

@ -8179,6 +8179,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -8243,6 +8244,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"

View File

@ -1327,6 +1327,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -1394,6 +1395,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
@ -2649,6 +2654,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -2716,6 +2722,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"

View File

@ -143,6 +143,7 @@ type DealProposal = markettypes.DealProposal
type DealLabel = markettypes.DealLabel
type DealState interface {
SectorNumber() abi.SectorNumber // 0 if not yet included in proven sector (0 is also a valid sector number)
SectorStartEpoch() abi.ChainEpoch // -1 if not yet included in proven sector
LastUpdatedEpoch() abi.ChainEpoch // -1 if deal state never updated
SlashEpoch() abi.ChainEpoch // -1 if deal never slashed
@ -185,6 +186,10 @@ type ProposalIDState struct {
type emptyDealState struct{}
func (e *emptyDealState) SectorNumber() abi.SectorNumber {
return 0
}
func (e *emptyDealState) SectorStartEpoch() abi.ChainEpoch {
return -1
}

View File

@ -252,6 +252,7 @@ type DealProposal = markettypes.DealProposal
type DealLabel = markettypes.DealLabel
type DealState interface {
SectorNumber() abi.SectorNumber // 0 if not yet included in proven sector (0 is also a valid sector number)
SectorStartEpoch() abi.ChainEpoch // -1 if not yet included in proven sector
LastUpdatedEpoch() abi.ChainEpoch // -1 if deal state never updated
SlashEpoch() abi.ChainEpoch // -1 if deal never slashed
@ -293,6 +294,10 @@ type ProposalIDState struct {
type emptyDealState struct{}
func (e *emptyDealState) SectorNumber() abi.SectorNumber {
return 0
}
func (e *emptyDealState) SectorStartEpoch() abi.ChainEpoch {
return -1
}

View File

@ -212,6 +212,14 @@ type dealStateV{{.v}} struct {
ds{{.v}} market{{.v}}.DealState
}
func (d dealStateV{{.v}}) SectorNumber() abi.SectorNumber {
{{if (le .v 12)}}
return 0
{{else}}
return d.ds{{.v}}.SectorNumber
{{end}}
}
func (d dealStateV{{.v}}) SectorStartEpoch() abi.ChainEpoch {
return d.ds{{.v}}.SectorStartEpoch
}

View File

@ -191,6 +191,12 @@ type dealStateV0 struct {
ds0 market0.DealState
}
func (d dealStateV0) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV0) SectorStartEpoch() abi.ChainEpoch {
return d.ds0.SectorStartEpoch
}

View File

@ -190,6 +190,12 @@ type dealStateV10 struct {
ds10 market10.DealState
}
func (d dealStateV10) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV10) SectorStartEpoch() abi.ChainEpoch {
return d.ds10.SectorStartEpoch
}

View File

@ -190,6 +190,12 @@ type dealStateV11 struct {
ds11 market11.DealState
}
func (d dealStateV11) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV11) SectorStartEpoch() abi.ChainEpoch {
return d.ds11.SectorStartEpoch
}

View File

@ -190,6 +190,12 @@ type dealStateV12 struct {
ds12 market12.DealState
}
func (d dealStateV12) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV12) SectorStartEpoch() abi.ChainEpoch {
return d.ds12.SectorStartEpoch
}

View File

@ -190,6 +190,12 @@ type dealStateV13 struct {
ds13 market13.DealState
}
func (d dealStateV13) SectorNumber() abi.SectorNumber {
return d.ds13.SectorNumber
}
func (d dealStateV13) SectorStartEpoch() abi.ChainEpoch {
return d.ds13.SectorStartEpoch
}

View File

@ -190,6 +190,12 @@ type dealStateV14 struct {
ds14 market14.DealState
}
func (d dealStateV14) SectorNumber() abi.SectorNumber {
return d.ds14.SectorNumber
}
func (d dealStateV14) SectorStartEpoch() abi.ChainEpoch {
return d.ds14.SectorStartEpoch
}

View File

@ -191,6 +191,12 @@ type dealStateV2 struct {
ds2 market2.DealState
}
func (d dealStateV2) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV2) SectorStartEpoch() abi.ChainEpoch {
return d.ds2.SectorStartEpoch
}

View File

@ -186,6 +186,12 @@ type dealStateV3 struct {
ds3 market3.DealState
}
func (d dealStateV3) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV3) SectorStartEpoch() abi.ChainEpoch {
return d.ds3.SectorStartEpoch
}

View File

@ -186,6 +186,12 @@ type dealStateV4 struct {
ds4 market4.DealState
}
func (d dealStateV4) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV4) SectorStartEpoch() abi.ChainEpoch {
return d.ds4.SectorStartEpoch
}

View File

@ -186,6 +186,12 @@ type dealStateV5 struct {
ds5 market5.DealState
}
func (d dealStateV5) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV5) SectorStartEpoch() abi.ChainEpoch {
return d.ds5.SectorStartEpoch
}

View File

@ -188,6 +188,12 @@ type dealStateV6 struct {
ds6 market6.DealState
}
func (d dealStateV6) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV6) SectorStartEpoch() abi.ChainEpoch {
return d.ds6.SectorStartEpoch
}

View File

@ -188,6 +188,12 @@ type dealStateV7 struct {
ds7 market7.DealState
}
func (d dealStateV7) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV7) SectorStartEpoch() abi.ChainEpoch {
return d.ds7.SectorStartEpoch
}

View File

@ -189,6 +189,12 @@ type dealStateV8 struct {
ds8 market8.DealState
}
func (d dealStateV8) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV8) SectorStartEpoch() abi.ChainEpoch {
return d.ds8.SectorStartEpoch
}

View File

@ -190,6 +190,12 @@ type dealStateV9 struct {
ds9 market9.DealState
}
func (d dealStateV9) SectorNumber() abi.SectorNumber {
return 0
}
func (d dealStateV9) SectorStartEpoch() abi.ChainEpoch {
return d.ds9.SectorStartEpoch
}

View File

@ -824,6 +824,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -1423,6 +1424,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101

View File

@ -5841,6 +5841,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -5919,6 +5920,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101

View File

@ -7529,6 +7529,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
@ -7607,6 +7608,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101