specs-actors v0.3

This commit is contained in:
Łukasz Magiera 2020-04-29 20:06:05 +02:00
parent 014092443f
commit 89b19af43f
9 changed files with 58 additions and 35 deletions

View File

@ -12,6 +12,7 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/abi/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
@ -49,13 +50,18 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
for i, m := range miners {
// Create miner through power actor
spt, err := ffiwrapper.SealProofTypeFromSectorSize(m.SectorSize)
if err != nil {
return cid.Undef, err
}
var maddr address.Address
{
constructorParams := &power.CreateMinerParams{
Owner: m.Worker,
Worker: m.Worker,
SectorSize: m.SectorSize,
Peer: m.PeerId,
SealProofType: spt,
}
params := mustEnc(constructorParams)

View File

@ -11,15 +11,17 @@ import (
"time"
rice "github.com/GeertJohan/go.rice"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log/v2"
"github.com/libp2p/go-libp2p-core/peer"
"golang.org/x/xerrors"
"gopkg.in/urfave/cli.v2"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/power"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build"
@ -281,10 +283,17 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
}
log.Infof("%s: push funds %s", owner, smsg.Cid())
spt, err := ffiwrapper.SealProofTypeFromSectorSize(abi.SectorSize(ssize))
if err != nil {
w.WriteHeader(400)
w.Write([]byte("sealprooftype: " + err.Error()))
return
}
params, err := actors.SerializeParams(&power.CreateMinerParams{
Owner: owner,
Worker: owner,
SectorSize: abi.SectorSize(ssize),
SealProofType: spt,
Peer: h.defaultMinerPeer,
})
if err != nil {

View File

@ -621,10 +621,15 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
return address.Undef, err
}
spt, err := ffiwrapper.SealProofTypeFromSectorSize(abi.SectorSize(ssize))
if err != nil {
return address.Undef, err
}
params, err := actors.SerializeParams(&power.CreateMinerParams{
Owner: owner,
Worker: worker,
SectorSize: abi.SectorSize(ssize),
SealProofType: spt,
Peer: peerid,
})
if err != nil {

4
go.mod
View File

@ -12,7 +12,7 @@ require (
github.com/davidlazar/go-crypto v0.0.0-20190912175916-7055855a373f // indirect
github.com/docker/go-units v0.4.0
github.com/drand/drand v0.7.2
github.com/filecoin-project/chain-validation v0.0.6-0.20200429002049-f137de961672
github.com/filecoin-project/chain-validation v0.0.6-0.20200429044622-fe33361958f5
github.com/filecoin-project/filecoin-ffi v0.0.0-20200427223233-a0014b17f124
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e
@ -27,7 +27,7 @@ require (
github.com/filecoin-project/go-statestore v0.1.0
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
github.com/filecoin-project/sector-storage v0.0.0-20200425102315-c19a25449861
github.com/filecoin-project/specs-actors v0.2.1-0.20200428232403-f0282340f59a
github.com/filecoin-project/specs-actors v0.3.0
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102
github.com/filecoin-project/storage-fsm v0.0.0-20200427182014-01487d5ad3c8
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1

8
go.sum
View File

@ -127,8 +127,8 @@ github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGj
github.com/fd/go-nat v1.0.0/go.mod h1:BTBu/CKvMmOMUPkKVef1pngt2WFH/lg7E6yQnulfp6E=
github.com/filecoin-project/chain-validation v0.0.3 h1:luT/8kJ0WdMIqQ9Bm31W4JkuYCW0wUb26AvnD4WK59M=
github.com/filecoin-project/chain-validation v0.0.3/go.mod h1:NCEGFjcWRjb8akWFSOXvU6n2efkWIqAeOKU6o5WBGQw=
github.com/filecoin-project/chain-validation v0.0.6-0.20200429002049-f137de961672 h1:RmZN2ZpsvXIAzxqVNoJwl+s+c2LSrGnu/ftfcq6babo=
github.com/filecoin-project/chain-validation v0.0.6-0.20200429002049-f137de961672/go.mod h1:YELmfkVO2elLyNa5RgKSo+qPywQu9V811L4Dyod4D2g=
github.com/filecoin-project/chain-validation v0.0.6-0.20200429044622-fe33361958f5 h1:riq69riV59q8AaMGlCOwYr96L30/BRSzz6aNBa1u8aY=
github.com/filecoin-project/chain-validation v0.0.6-0.20200429044622-fe33361958f5/go.mod h1:Lk9OjM6bsvk1KlTwkQN+RGOusGPqmaxcllvaz119xtc=
github.com/filecoin-project/go-address v0.0.0-20191219011437-af739c490b4f/go.mod h1:rCbpXPva2NKF9/J4X6sr7hbKBgQCxyFtRj7KOZqoIms=
github.com/filecoin-project/go-address v0.0.0-20200107215422-da8eea2842b5/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be h1:TooKBwR/g8jG0hZ3lqe9S5sy2vTUcLOZLlz3M5wGn2E=
@ -175,8 +175,8 @@ github.com/filecoin-project/specs-actors v0.0.0-20200210130641-2d1fbd8672cf/go.m
github.com/filecoin-project/specs-actors v0.0.0-20200409043918-e569f4a2f504/go.mod h1:mdJraXq5vMy0+/FqVQIrnNlpQ/Em6zeu06G/ltQ0/lA=
github.com/filecoin-project/specs-actors v0.2.0 h1:bKxloHLegeYJttIJbQjl4/tdsKOUtYtpiZsEfB4eOnI=
github.com/filecoin-project/specs-actors v0.2.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
github.com/filecoin-project/specs-actors v0.2.1-0.20200428232403-f0282340f59a h1:ElQ8+0qeXtBXwxDkSLH1pen+qxXkSySbIsg5ysQ7coc=
github.com/filecoin-project/specs-actors v0.2.1-0.20200428232403-f0282340f59a/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
github.com/filecoin-project/specs-actors v0.3.0 h1:QxgAuTrZr5TPqjyprZk0nTYW5o0JWpzbb5v+4UHHvN0=
github.com/filecoin-project/specs-actors v0.3.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
github.com/filecoin-project/specs-storage v0.0.0-20200410185809-9fbaaa08f275/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102 h1:T3f/zkuvgtgqcXrb0NO3BicuveGOxxUAMPa/Yif2kuE=
github.com/filecoin-project/specs-storage v0.0.0-20200417134612-61b2d91a6102/go.mod h1:xJ1/xl9+8zZeSSSFmDC3Wr6uusCTxyYPI0VeNVSFmPE=

View File

@ -97,12 +97,12 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di miner.DeadlineInfo
return nil, err
}
firstPartition, _, err := miner.PartitionsForDeadline(deadlines, di.Index)
firstPartition, _, err := miner.PartitionsForDeadline(deadlines, s.partitionSectors, di.Index)
if err != nil {
return nil, xerrors.Errorf("getting partitions for deadline: %w", err)
}
partitionCount, _, err := miner.DeadlineCount(deadlines, di.Index)
partitionCount, _, err := miner.DeadlineCount(deadlines, s.partitionSectors, di.Index)
if err != nil {
return nil, xerrors.Errorf("getting deadline partition count: %w", err)
}

View File

@ -8,7 +8,6 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-storage/storage"
@ -24,6 +23,7 @@ type WindowPoStScheduler struct {
api storageMinerApi
prover storage.Prover
proofType abi.RegisteredProof
partitionSectors uint64
actor address.Address
worker address.Address
@ -44,17 +44,20 @@ func NewWindowedPoStScheduler(api storageMinerApi, sb storage.Prover, actor addr
return nil, xerrors.Errorf("getting sector size: %w", err)
}
spt, err := ffiwrapper.SealProofTypeFromSectorSize(mi.SectorSize)
rt, err := mi.SealProofType.RegisteredWindowPoStProof()
if err != nil {
return nil, err
}
rt, err := spt.RegisteredWindowPoStProof()
if err != nil {
return nil, err
}
return &WindowPoStScheduler{
api: api,
prover: sb,
proofType: rt,
partitionSectors: mi.WindowPoStPartitionSectors,
return &WindowPoStScheduler{api: api, prover: sb, actor: actor, worker: worker, proofType: rt}, nil
actor: actor,
worker: worker,
}, nil
}
func deadlineEquals(a, b *miner.DeadlineInfo) bool {