Skip to content

Commit

Permalink
fix: chain: use latest go-state-types types for miner UI
Browse files Browse the repository at this point in the history
  • Loading branch information
arajasek committed Jan 11, 2024
1 parent 512c70b commit c86f5a1
Show file tree
Hide file tree
Showing 11 changed files with 53 additions and 45 deletions.
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
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,
"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.

7 changes: 4 additions & 3 deletions storage/wdpost/wdpost_run_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin"
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/crypto"
"github.com/filecoin-project/go-state-types/dline"
Expand Down Expand Up @@ -73,13 +74,13 @@ func (m *mockStorageMinerAPI) StateMinerPartitions(ctx context.Context, a addres
return m.partitions, nil
}

func (m *mockStorageMinerAPI) StateMinerSectors(ctx context.Context, address address.Address, snos *bitfield.BitField, key types.TipSetKey) ([]*minertypes.SectorOnChainInfo, error) {
var sis []*minertypes.SectorOnChainInfo
func (m *mockStorageMinerAPI) StateMinerSectors(ctx context.Context, address address.Address, snos *bitfield.BitField, key types.TipSetKey) ([]*miner12.SectorOnChainInfo, error) {
var sis []*miner12.SectorOnChainInfo
if snos == nil {
panic("unsupported")
}
_ = snos.ForEach(func(i uint64) error {
sis = append(sis, &minertypes.SectorOnChainInfo{
sis = append(sis, &miner12.SectorOnChainInfo{
SectorNumber: abi.SectorNumber(i),
})
return nil
Expand Down

0 comments on commit c86f5a1

Please sign in to comment.