Merge branch 'testnet/3' into feat/ipfsclient
This commit is contained in:
commit
0d4bf2e980
@ -100,7 +100,8 @@ const BlsSignatureCacheSize = 40000
|
||||
const BlockMessageLimit = 512
|
||||
|
||||
var DrandCoeffs = []string{
|
||||
"a2a34cf9a6be2f66b5385caa520364f994ae7dbac08371ffaca575dfb3e04c8e149b32dc78f077322c613a151dc07440",
|
||||
"b0c5baca062191f13099229c9a229a9946204f74fc28baa212745243553ab1f50b581b2086e24374ceb40fe34bd23ca2",
|
||||
"a9c6449cf647e0a0ffaf1e01277e2821213c80310165990daf77610208abfa0ce56c7e40995e26aff3873c624362ca78",
|
||||
"82c279cce744450e68de98ee08f9698a01dd38f8e3be3c53f2b840fb9d09ad62a0b6b87981e179e1b14bc9a2d284c985",
|
||||
"82d51308ad346c686f81b8094551597d7b963295cbf313401a93df9baf52d5ae98a87745bee70839a4d6e65c342bd15b",
|
||||
"94eebfd53f4ba6a3b8304236400a12e73885e5a781509a5c8d41d2e8b476923d8ea6052649b3c17282f596217f96c5de",
|
||||
"8dc4231e42b4edf39e86ef1579401692480647918275da767d3e558c520d6375ad953530610fd27daf110187877a65d0",
|
||||
}
|
||||
|
@ -2,6 +2,7 @@ package drand
|
||||
|
||||
import (
|
||||
"context"
|
||||
"math/rand"
|
||||
"sync"
|
||||
"time"
|
||||
|
||||
@ -23,7 +24,13 @@ import (
|
||||
var log = logging.Logger("drand")
|
||||
|
||||
var drandServers = []string{
|
||||
"drand-test3.nikkolasg.xyz:5003",
|
||||
"nicolas.drand.fil-test.net:443",
|
||||
"philipp.drand.fil-test.net:443",
|
||||
"mathilde.drand.fil-test.net:443",
|
||||
"ludovic.drand.fil-test.net:443",
|
||||
"gabbi.drand.fil-test.net:443",
|
||||
"linus.drand.fil-test.net:443",
|
||||
"jeff.drand.fil-test.net:443",
|
||||
}
|
||||
|
||||
var drandPubKey *dkey.DistPublic
|
||||
@ -51,7 +58,10 @@ func (dp *drandPeer) IsTLS() bool {
|
||||
|
||||
type DrandBeacon struct {
|
||||
client dnet.Client
|
||||
peers []dnet.Peer
|
||||
|
||||
peers []dnet.Peer
|
||||
peersIndex int
|
||||
peersIndexMtx sync.Mutex
|
||||
|
||||
pubkey *dkey.DistPublic
|
||||
|
||||
@ -78,7 +88,9 @@ func NewDrandBeacon(genesisTs, interval uint64) (*DrandBeacon, error) {
|
||||
db.peers = append(db.peers, &drandPeer{addr: ds, tls: true})
|
||||
}
|
||||
|
||||
groupResp, err := db.client.Group(context.TODO(), db.peers[0], &dproto.GroupRequest{})
|
||||
db.peersIndex = rand.Intn(len(db.peers))
|
||||
|
||||
groupResp, err := db.client.Group(context.TODO(), db.peers[db.peersIndex], &dproto.GroupRequest{})
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("failed to get group response from beacon peer: %w", err)
|
||||
}
|
||||
@ -101,17 +113,24 @@ func NewDrandBeacon(genesisTs, interval uint64) (*DrandBeacon, error) {
|
||||
|
||||
// TODO: the stream currently gives you back *all* values since drand genesis.
|
||||
// Having the stream in the background is merely an optimization, so not a big deal to disable it for now
|
||||
//go db.handleStreamingUpdates()
|
||||
// go db.handleStreamingUpdates()
|
||||
|
||||
return db, nil
|
||||
}
|
||||
|
||||
func (db *DrandBeacon) rotatePeersIndex() {
|
||||
db.peersIndexMtx.Lock()
|
||||
defer db.peersIndexMtx.Unlock()
|
||||
db.peersIndex = (db.peersIndex + 1) % len(db.peers)
|
||||
}
|
||||
|
||||
func (db *DrandBeacon) handleStreamingUpdates() {
|
||||
for {
|
||||
ch, err := db.client.PublicRandStream(context.Background(), db.peers[0], &dproto.PublicRandRequest{})
|
||||
ch, err := db.client.PublicRandStream(context.Background(), db.peers[db.peersIndex], &dproto.PublicRandRequest{})
|
||||
if err != nil {
|
||||
log.Warnf("failed to get public rand stream: %s", err)
|
||||
log.Warnf("trying again in 10 seconds")
|
||||
db.rotatePeersIndex()
|
||||
time.Sleep(time.Second * 10)
|
||||
continue
|
||||
}
|
||||
@ -122,7 +141,9 @@ func (db *DrandBeacon) handleStreamingUpdates() {
|
||||
Data: e.Signature,
|
||||
})
|
||||
}
|
||||
|
||||
log.Warn("drand beacon stream broke, reconnecting in 10 seconds")
|
||||
db.rotatePeersIndex()
|
||||
time.Sleep(time.Second * 10)
|
||||
}
|
||||
}
|
||||
@ -140,10 +161,11 @@ func (db *DrandBeacon) Entry(ctx context.Context, round uint64) <-chan beacon.Re
|
||||
out := make(chan beacon.Response, 1)
|
||||
|
||||
go func() {
|
||||
resp, err := db.client.PublicRand(ctx, db.peers[0], &dproto.PublicRandRequest{Round: round})
|
||||
resp, err := db.client.PublicRand(ctx, db.peers[db.peersIndex], &dproto.PublicRandRequest{Round: round})
|
||||
|
||||
var br beacon.Response
|
||||
if err != nil {
|
||||
db.rotatePeersIndex()
|
||||
br.Err = err
|
||||
} else {
|
||||
br.Entry.Round = resp.GetRound()
|
||||
|
@ -306,8 +306,11 @@ func (cg *ChainGen) nextBlockProof(ctx context.Context, pts *types.TipSet, m add
|
||||
return nil, nil, nil, xerrors.Errorf("failed to cbor marshal address: %w", err)
|
||||
}
|
||||
|
||||
ticketRand, err := cg.cs.GetRandomness(ctx, pts.Cids(), crypto.DomainSeparationTag_TicketProduction,
|
||||
round-build.TicketRandomnessLookback, buf.Bytes())
|
||||
if len(entries) == 0 {
|
||||
buf.Write(pts.MinTicket().VRFProof)
|
||||
}
|
||||
|
||||
ticketRand, err := store.DrawRandomness(rbase.Data, crypto.DomainSeparationTag_TicketProduction, round-build.TicketRandomnessLookback, buf.Bytes())
|
||||
if err != nil {
|
||||
return nil, nil, nil, err
|
||||
}
|
||||
|
@ -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,
|
||||
Owner: m.Worker,
|
||||
Worker: m.Worker,
|
||||
Peer: m.PeerId,
|
||||
SealProofType: spt,
|
||||
}
|
||||
|
||||
params := mustEnc(constructorParams)
|
||||
|
@ -667,8 +667,14 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock) err
|
||||
return xerrors.Errorf("failed to marshal miner address to cbor: %w", err)
|
||||
}
|
||||
|
||||
vrfBase, err := syncer.sm.ChainStore().GetRandomness(ctx, baseTs.Cids(),
|
||||
crypto.DomainSeparationTag_TicketProduction, h.Height-build.TicketRandomnessLookback, buf.Bytes())
|
||||
beaconBase := *prevBeacon
|
||||
if len(h.BeaconEntries) == 0 {
|
||||
buf.Write(baseTs.MinTicket().VRFProof)
|
||||
} else {
|
||||
beaconBase = h.BeaconEntries[len(h.BeaconEntries)-1]
|
||||
}
|
||||
|
||||
vrfBase, err := store.DrawRandomness(beaconBase.Data, crypto.DomainSeparationTag_TicketProduction, h.Height-build.TicketRandomnessLookback, buf.Bytes())
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to compute vrf base for ticket: %w", err)
|
||||
}
|
||||
|
@ -109,7 +109,7 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
|
||||
|
||||
p, err := homedir.Expand(ctx.String(repoFlag))
|
||||
if err != nil {
|
||||
return APIInfo{}, xerrors.Errorf("cound not exand home dir (%s): %w", repoFlag, err)
|
||||
return APIInfo{}, xerrors.Errorf("cound not expand home dir (%s): %w", repoFlag, err)
|
||||
}
|
||||
|
||||
r, err := repo.NewFS(p)
|
||||
@ -119,7 +119,7 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
|
||||
|
||||
ma, err := r.APIEndpoint()
|
||||
if err != nil {
|
||||
return APIInfo{}, xerrors.Errorf("could not get api enpoint: %w", err)
|
||||
return APIInfo{}, xerrors.Errorf("could not get api endpoint: %w", err)
|
||||
}
|
||||
|
||||
token, err := r.APIToken()
|
||||
|
52
cli/mpool.go
52
cli/mpool.go
@ -26,6 +26,12 @@ var mpoolCmd = &cli.Command{
|
||||
var mpoolPending = &cli.Command{
|
||||
Name: "pending",
|
||||
Usage: "Get pending messages",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "local",
|
||||
Usage: "print pending messages for addresses in local wallet only",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
@ -35,12 +41,32 @@ var mpoolPending = &cli.Command{
|
||||
|
||||
ctx := ReqContext(cctx)
|
||||
|
||||
var filter map[address.Address]struct{}
|
||||
if cctx.Bool("local") {
|
||||
filter = map[address.Address]struct{}{}
|
||||
|
||||
addrss, err := api.WalletList(ctx)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting local addresses: %w", err)
|
||||
}
|
||||
|
||||
for _, a := range addrss {
|
||||
filter[a] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
msgs, err := api.MpoolPending(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
|
||||
for _, msg := range msgs {
|
||||
if filter != nil{
|
||||
if _, has := filter[msg.Message.From]; !has {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
out, err := json.MarshalIndent(msg, "", " ")
|
||||
if err != nil {
|
||||
return err
|
||||
@ -95,6 +121,12 @@ type mpStat struct {
|
||||
var mpoolStat = &cli.Command{
|
||||
Name: "stat",
|
||||
Usage: "print mempool stats",
|
||||
Flags: []cli.Flag{
|
||||
&cli.BoolFlag{
|
||||
Name: "local",
|
||||
Usage: "print stats for addresses in local wallet only",
|
||||
},
|
||||
},
|
||||
Action: func(cctx *cli.Context) error {
|
||||
api, closer, err := GetFullNodeAPI(cctx)
|
||||
if err != nil {
|
||||
@ -109,6 +141,20 @@ var mpoolStat = &cli.Command{
|
||||
return xerrors.Errorf("getting chain head: %w", err)
|
||||
}
|
||||
|
||||
var filter map[address.Address]struct{}
|
||||
if cctx.Bool("local") {
|
||||
filter = map[address.Address]struct{}{}
|
||||
|
||||
addrss, err := api.WalletList(ctx)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("getting local addresses: %w", err)
|
||||
}
|
||||
|
||||
for _, a := range addrss {
|
||||
filter[a] = struct{}{}
|
||||
}
|
||||
}
|
||||
|
||||
msgs, err := api.MpoolPending(ctx, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return err
|
||||
@ -117,6 +163,12 @@ var mpoolStat = &cli.Command{
|
||||
buckets := map[address.Address]*statBucket{}
|
||||
|
||||
for _, v := range msgs {
|
||||
if filter != nil{
|
||||
if _, has := filter[v.Message.From]; !has {
|
||||
continue
|
||||
}
|
||||
}
|
||||
|
||||
bkt, ok := buckets[v.Message.From]
|
||||
if !ok {
|
||||
bkt = &statBucket{
|
||||
|
@ -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,11 +283,18 @@ 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),
|
||||
Peer: h.defaultMinerPeer,
|
||||
Owner: owner,
|
||||
Worker: owner,
|
||||
SealProofType: spt,
|
||||
Peer: h.defaultMinerPeer,
|
||||
})
|
||||
if err != nil {
|
||||
w.WriteHeader(400)
|
||||
|
@ -621,11 +621,16 @@ 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),
|
||||
Peer: peerid,
|
||||
Owner: owner,
|
||||
Worker: worker,
|
||||
SealProofType: spt,
|
||||
Peer: peerid,
|
||||
})
|
||||
if err != nil {
|
||||
return address.Undef, err
|
||||
|
@ -101,6 +101,12 @@
|
||||
"slug": "en+storing-data-troubleshooting",
|
||||
"github": "en/storing-data-troubleshooting.md",
|
||||
"value": null
|
||||
},
|
||||
{
|
||||
"title": "Information for Miners",
|
||||
"slug": "en+info-for-miners",
|
||||
"github": "en/miner-deals.md",
|
||||
"value": null
|
||||
}
|
||||
]
|
||||
},
|
||||
|
@ -117,6 +117,11 @@ Note that these might NOT be the minimum requirements for mining on Mainnet.
|
||||
|
||||
A list of benchmarked GPUs can be found [here](https://lotu.sh/en+hardware-mining#benchmarked-gpus-7393).
|
||||
|
||||
### Why is my GPU not being used when sealing a sector?
|
||||
|
||||
Sealing a sector does not involve constant GPU operations. It's possible
|
||||
that your GPU simply isn't necessary at the moment you checked.
|
||||
|
||||
## Advanced questions
|
||||
|
||||
### Is there a Docker image for lotus?
|
||||
|
41
documentation/en/miner-deals.md
Normal file
41
documentation/en/miner-deals.md
Normal file
@ -0,0 +1,41 @@
|
||||
# Information for Miners
|
||||
|
||||
Here is how a miner can get set up to accept storage deals. The first step is
|
||||
to install a Lotus node and sync to the top of the chain.
|
||||
|
||||
## Set up an ask
|
||||
|
||||
```
|
||||
lotus-storage-miner set-price <price>
|
||||
```
|
||||
|
||||
This command will set up your miner to accept deal proposals that meet the input price.
|
||||
The price is inputted in FIL per GiB per epoch, and the default is 0.0000000005.
|
||||
|
||||
<!-- TODO: Add info about setting min piece size, max piece size, duration -->
|
||||
|
||||
## Ensure you can be discovered
|
||||
|
||||
Clients need to be able to find you in order to make storage deals with you.
|
||||
While there isn't necessarily anything you need to do to become discoverable, here are some things you can
|
||||
try to check that people can connect to you.
|
||||
|
||||
To start off, make sure you are connected to at least some peers, and your port is
|
||||
open and working.
|
||||
|
||||
### Connect to your own node
|
||||
|
||||
If you are in contact with someone else running Lotus, you can ask them to try connecting
|
||||
to your node. To do so, provide them your peer ID, which you can get by running `lotus net id` on
|
||||
your node.
|
||||
|
||||
They can then try running `lotus net findpeer <peerID>` to get your address(es), and can then
|
||||
run `lotus net connect <address>` to connect to you. If successful, your node will now
|
||||
appear on their peers list (run `lotus net peers` to check).
|
||||
|
||||
You can also check this by running a second instance of Lotus yourself.
|
||||
|
||||
### Query your own ask
|
||||
|
||||
A client should be able to find your ask by running `lotus client query-ask <minerID>`. If
|
||||
someone is not able to retrieve your ask by doing so, then there is an issue with your node.
|
4
go.mod
4
go.mod
@ -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.20200429181200-c83b25321997
|
||||
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
8
go.sum
@ -133,8 +133,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.20200429181200-c83b25321997 h1:r92U7SyeHhvqjQKMkIGdYesKNAAcqGCLtGKPdhVS/OI=
|
||||
github.com/filecoin-project/chain-validation v0.0.6-0.20200429181200-c83b25321997/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=
|
||||
@ -181,8 +181,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=
|
||||
|
@ -65,7 +65,8 @@ func (s *RPCServer) handleWS(ctx context.Context, w http.ResponseWriter, r *http
|
||||
func (s *RPCServer) ServeHTTP(w http.ResponseWriter, r *http.Request) {
|
||||
ctx := r.Context()
|
||||
|
||||
if strings.Contains(r.Header.Get("Connection"), "Upgrade") {
|
||||
h := strings.ToLower(r.Header.Get("Connection"))
|
||||
if strings.Contains(h, "upgrade") {
|
||||
s.handleWS(ctx, w, r)
|
||||
return
|
||||
}
|
||||
|
@ -16,6 +16,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/beacon"
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
@ -345,7 +346,7 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
|
||||
rbase = bvals[len(bvals)-1]
|
||||
}
|
||||
|
||||
ticket, err := m.computeTicket(ctx, addr, &rbase, base)
|
||||
ticket, err := m.computeTicket(ctx, addr, &rbase, base, len(bvals) > 0)
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("scratching ticket failed: %w", err)
|
||||
}
|
||||
@ -393,7 +394,7 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
|
||||
return b, nil
|
||||
}
|
||||
|
||||
func (m *Miner) computeTicket(ctx context.Context, addr address.Address, brand *types.BeaconEntry, base *MiningBase) (*types.Ticket, error) {
|
||||
func (m *Miner) computeTicket(ctx context.Context, addr address.Address, brand *types.BeaconEntry, base *MiningBase, haveNewEntries bool) (*types.Ticket, error) {
|
||||
mi, err := m.api.StateMinerInfo(ctx, addr, types.EmptyTSK)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -407,8 +408,12 @@ func (m *Miner) computeTicket(ctx context.Context, addr address.Address, brand *
|
||||
if err := addr.MarshalCBOR(buf); err != nil {
|
||||
return nil, xerrors.Errorf("failed to marshal address to cbor: %w", err)
|
||||
}
|
||||
input, err := m.api.ChainGetRandomness(ctx, base.TipSet.Key(), crypto.DomainSeparationTag_TicketProduction,
|
||||
base.TipSet.Height()+base.NullRounds+1-build.TicketRandomnessLookback, buf.Bytes())
|
||||
|
||||
if !haveNewEntries {
|
||||
buf.Write(base.TipSet.MinTicket().VRFProof)
|
||||
}
|
||||
|
||||
input, err := store.DrawRandomness(brand.Data, crypto.DomainSeparationTag_TicketProduction, base.TipSet.Height()+base.NullRounds+1-build.TicketRandomnessLookback, buf.Bytes())
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -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)
|
||||
}
|
||||
|
@ -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"
|
||||
@ -21,9 +20,10 @@ import (
|
||||
const StartConfidence = 4 // TODO: config
|
||||
|
||||
type WindowPoStScheduler struct {
|
||||
api storageMinerApi
|
||||
prover storage.Prover
|
||||
proofType abi.RegisteredProof
|
||||
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 {
|
||||
|
Loading…
Reference in New Issue
Block a user