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

feat: api: add SectorNumber to MarketDealState (nv22) #11998

Merged
merged 1 commit into from
May 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
12 changes: 9 additions & 3 deletions api/api_full.go
Original file line number Diff line number Diff line change
Expand Up @@ -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).
rvagg marked this conversation as resolved.
Show resolved Hide resolved
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(),
Expand All @@ -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
}
Expand Down
10 changes: 10 additions & 0 deletions build/openrpc/full.json
Original file line number Diff line number Diff line change
Expand Up @@ -21611,6 +21611,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -21678,6 +21679,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
Expand Down Expand Up @@ -21848,6 +21853,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -21912,6 +21918,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
Expand Down
5 changes: 5 additions & 0 deletions build/openrpc/gateway.json
Original file line number Diff line number Diff line change
Expand Up @@ -8179,6 +8179,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -8243,6 +8244,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
Expand Down
10 changes: 10 additions & 0 deletions build/openrpc/miner.json
Original file line number Diff line number Diff line change
Expand Up @@ -1327,6 +1327,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -1394,6 +1395,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
Expand Down Expand Up @@ -2649,6 +2654,7 @@
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -2716,6 +2722,10 @@
"title": "number",
"type": "number"
},
"SectorNumber": {
"title": "number",
"type": "number"
},
"SectorStartEpoch": {
"title": "number",
"type": "number"
Expand Down
5 changes: 5 additions & 0 deletions chain/actors/builtin/market/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
5 changes: 5 additions & 0 deletions chain/actors/builtin/market/market.go
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
}
Expand Down
8 changes: 8 additions & 0 deletions chain/actors/builtin/market/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -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
}
Expand Down
6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v0.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v10.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v11.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v12.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v13.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v14.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v2.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v3.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v4.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v5.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v6.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v7.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v8.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 6 additions & 0 deletions chain/actors/builtin/market/v9.go

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 2 additions & 0 deletions documentation/en/api-v0-methods-miner.md
Original file line number Diff line number Diff line change
Expand Up @@ -824,6 +824,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -1423,6 +1424,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down
2 changes: 2 additions & 0 deletions documentation/en/api-v0-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -5841,6 +5841,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down Expand Up @@ -5919,6 +5920,7 @@ Response:
"ClientCollateral": "0"
},
"State": {
"SectorNumber": 9,
"SectorStartEpoch": 10101,
"LastUpdatedEpoch": 10101,
"SlashEpoch": 10101
Expand Down
Loading