Skip to content

Commit

Permalink
Remove a misleading miner actor abstraction
Browse files Browse the repository at this point in the history
We shouldn't implement CBOR functions on the "abstract" miner info. Otherwise,
we could end up trying to actually _use_ this "abstract" info when decoding
state (which won't work across version).

Also remove the use of these CBOR functions, and instead explicitly use miner0
types. We'll have to abstract over versions eventually, but we'll probably need
some form of abstract miner builder (or maybe even adding some "add sector",
etc. functions to the current miner abstraction?
  • Loading branch information
Stebalien committed Sep 23, 2020
1 parent 97a97fe commit 46f5b62
Show file tree
Hide file tree
Showing 3 changed files with 3 additions and 326 deletions.
313 changes: 0 additions & 313 deletions chain/actors/builtin/miner/cbor_gen.go

This file was deleted.

6 changes: 3 additions & 3 deletions chain/events/state/predicates_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ func createEmptyMinerState(ctx context.Context, t *testing.T, store adt.Store, o
func createSectorsAMT(ctx context.Context, t *testing.T, store adt.Store, sectors []miner.SectorOnChainInfo) cid.Cid {
root := adt.MakeEmptyArray(store)
for _, sector := range sectors {
sector := sector
sector := (miner0.SectorOnChainInfo)(sector)
err := root.Set(uint64(sector.SectorNumber), &sector)
require.NoError(t, err)
}
Expand Down Expand Up @@ -614,8 +614,8 @@ const (
)

// returns a unique SectorPreCommitInfo with each invocation with SectorNumber set to `sectorNo`.
func newSectorPreCommitInfo(sectorNo abi.SectorNumber, sealed cid.Cid, expiration abi.ChainEpoch) *miner.SectorPreCommitInfo {
return &miner.SectorPreCommitInfo{
func newSectorPreCommitInfo(sectorNo abi.SectorNumber, sealed cid.Cid, expiration abi.ChainEpoch) *miner0.SectorPreCommitInfo {
return &miner0.SectorPreCommitInfo{
SealProof: abi.RegisteredSealProof_StackedDrg32GiBV1,
SectorNumber: sectorNo,
SealedCID: sealed,
Expand Down
10 changes: 0 additions & 10 deletions gen/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@ import (
"fmt"
"os"

"github.com/filecoin-project/lotus/chain/actors/builtin/miner"

gen "github.com/whyrusleeping/cbor-gen"

"github.com/filecoin-project/lotus/api"
Expand Down Expand Up @@ -77,12 +75,4 @@ func main() {
fmt.Println(err)
os.Exit(1)
}

err = gen.WriteTupleEncodersToFile("./chain/actors/builtin/miner/cbor_gen.go", "miner",
miner.SectorOnChainInfo{},
)
if err != nil {
fmt.Println(err)
os.Exit(1)
}
}

0 comments on commit 46f5b62

Please sign in to comment.