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

fix: chain: use latest go-state-types types for miner UI #11566

Merged
merged 2 commits into from
Jan 22, 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
2 changes: 2 additions & 0 deletions api/docgen/docgen.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ import (
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v12/miner"
"github.com/filecoin-project/go-state-types/builtin/v9/verifreg"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/exitcode"
Expand Down Expand Up @@ -145,6 +146,7 @@ func init() {
allocationId := verifreg.AllocationId(0)
addExample(allocationId)
addExample(&allocationId)
addExample(miner.SectorOnChainInfoFlags(0))
addExample(map[verifreg.AllocationId]verifreg.Allocation{})
claimId := verifreg.ClaimId(0)
addExample(claimId)
Expand Down
21 changes: 11 additions & 10 deletions api/mocks/mock_full.go

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

21 changes: 11 additions & 10 deletions api/v0api/v0mocks/mock_full.go

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

Binary file modified build/openrpc/full.json.gz
Binary file not shown.
Binary file modified build/openrpc/gateway.json.gz
Binary file not shown.
3 changes: 2 additions & 1 deletion chain/actors/builtin/miner/actor.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import (

"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
miner12 "github.com/filecoin-project/go-state-types/builtin/v12/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/manifest"

Expand Down Expand Up @@ -152,7 +153,7 @@ type Partition interface {
UnprovenSectors() (bitfield.BitField, error)
}

type SectorOnChainInfo = minertypes.SectorOnChainInfo
type SectorOnChainInfo = miner12.SectorOnChainInfo

func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof, configWantSynthetic bool) (abi.RegisteredSealProof, error) {
// We added support for the new proofs in network version 7, and removed support for the old
Expand Down
3 changes: 2 additions & 1 deletion chain/actors/builtin/miner/miner.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
miner12 "github.com/filecoin-project/go-state-types/builtin/v12/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/dline"
Expand Down Expand Up @@ -212,7 +213,7 @@ type Partition interface {
UnprovenSectors() (bitfield.BitField, error)
}

type SectorOnChainInfo = minertypes.SectorOnChainInfo
type SectorOnChainInfo = miner12.SectorOnChainInfo

func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof, configWantSynthetic bool) (abi.RegisteredSealProof, error) {
// We added support for the new proofs in network version 7, and removed support for the old
Expand Down
6 changes: 5 additions & 1 deletion chain/actors/builtin/miner/state.go.template
Original file line number Diff line number Diff line change
Expand Up @@ -583,7 +583,11 @@ func fromV{{.v}}SectorOnChainInfo(v{{.v}} miner{{.v}}.SectorOnChainInfo) SectorO
ExpectedStoragePledge: v{{.v}}.ExpectedStoragePledge,
{{if (ge .v 7)}}
SectorKeyCID: v{{.v}}.SectorKeyCID,
{{end}}
{{end}}
{{if (ge .v 12)}}
PowerBaseEpoch: v{{.v}}.PowerBaseEpoch,
ReplacedDayReward: v{{.v}}.ReplacedDayReward,
{{end}}
}
return info
}
Expand Down
3 changes: 3 additions & 0 deletions chain/actors/builtin/miner/v12.go

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

12 changes: 6 additions & 6 deletions documentation/en/api-v0-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -5875,12 +5875,12 @@ Response:
"InitialPledge": "0",
"ExpectedDayReward": "0",
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"PowerBaseEpoch": 10101,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this not going to be an issue for API stability? And/or historical state?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm honestly not sure? But it is a breaking change that we've had in the protocol itself, so I feel like the API needs to break too here.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yeah, it does need to change. I guess: do it and see if anyone cares?

"ReplacedDayReward": "0",
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
"Flags": 0
}
]
```
Expand Down Expand Up @@ -6355,12 +6355,12 @@ Response:
"InitialPledge": "0",
"ExpectedDayReward": "0",
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"PowerBaseEpoch": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
"Flags": 0
}
]
```
Expand Down Expand Up @@ -6760,12 +6760,12 @@ Response:
"InitialPledge": "0",
"ExpectedDayReward": "0",
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"PowerBaseEpoch": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
"Flags": 0
}
```

Expand Down
12 changes: 6 additions & 6 deletions documentation/en/api-v1-unstable-methods.md
Original file line number Diff line number Diff line change
Expand Up @@ -7473,12 +7473,12 @@ Response:
"InitialPledge": "0",
"ExpectedDayReward": "0",
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"PowerBaseEpoch": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
"Flags": 0
}
]
```
Expand Down Expand Up @@ -7981,12 +7981,12 @@ Response:
"InitialPledge": "0",
"ExpectedDayReward": "0",
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"PowerBaseEpoch": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
"Flags": 0
}
]
```
Expand Down Expand Up @@ -8340,12 +8340,12 @@ Response:
"InitialPledge": "0",
"ExpectedDayReward": "0",
"ExpectedStoragePledge": "0",
"ReplacedSectorAge": 10101,
"PowerBaseEpoch": 10101,
"ReplacedDayReward": "0",
"SectorKeyCID": {
"/": "bafy2bzacea3wsdh6y3a36tb3skempjoxqpuyompjbmfeyf34fi3uy6uue42v4"
},
"SimpleQAPower": true
"Flags": 0
}
```

Expand Down
17 changes: 9 additions & 8 deletions storage/pipeline/mocks/api.go

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

Loading