Merge branch 'master' into conformance-tests
This commit is contained in:
commit
4f4cebadc7
21
.github/ISSUE_TEMPLATE/sealingfailed.md
vendored
21
.github/ISSUE_TEMPLATE/sealingfailed.md
vendored
@ -17,18 +17,27 @@ A brief description of the problem you encountered while proving (sealing) a sec
|
|||||||
|
|
||||||
Including what commands you ran, and a description of your setup, is very helpful.
|
Including what commands you ran, and a description of your setup, is very helpful.
|
||||||
|
|
||||||
**Sectors list**
|
|
||||||
|
|
||||||
The output of `./lotus-miner sectors list`.
|
|
||||||
|
|
||||||
**Sectors status**
|
**Sectors status**
|
||||||
|
|
||||||
The output of `./lotus-miner sectors status --log <sectorId>` for the failed sector(s).
|
The output of `lotus-miner sectors status --log <sectorId>` for the failed sector(s).
|
||||||
|
|
||||||
**Lotus miner logs**
|
**Lotus miner logs**
|
||||||
|
|
||||||
Please go through the logs of your miner, and include screenshots of any error-like messages you find.
|
Please go through the logs of your miner, and include screenshots of any error-like messages you find.
|
||||||
|
|
||||||
|
Alternatively please upload full log files and share a link here
|
||||||
|
|
||||||
|
**Lotus miner diagnostic info**
|
||||||
|
|
||||||
|
Please collect the following diagnostic information, and share a link here
|
||||||
|
|
||||||
|
* lotus-miner diagnostic info `lotus-miner info all > allinfo`
|
||||||
|
|
||||||
|
** Code modifications **
|
||||||
|
|
||||||
|
If you have modified parts of lotus, please describe which areas were modified,
|
||||||
|
and the scope of those modifications
|
||||||
|
|
||||||
**Version**
|
**Version**
|
||||||
|
|
||||||
The output of `./lotus --version`.
|
The output of `lotus --version`.
|
||||||
|
3
Makefile
3
Makefile
@ -148,7 +148,7 @@ BINS+=lotus-fountain
|
|||||||
|
|
||||||
lotus-chainwatch:
|
lotus-chainwatch:
|
||||||
rm -f lotus-chainwatch
|
rm -f lotus-chainwatch
|
||||||
go build -o lotus-chainwatch ./cmd/lotus-chainwatch
|
go build $(GOFLAGS) -o lotus-chainwatch ./cmd/lotus-chainwatch
|
||||||
.PHONY: lotus-chainwatch
|
.PHONY: lotus-chainwatch
|
||||||
BINS+=lotus-chainwatch
|
BINS+=lotus-chainwatch
|
||||||
|
|
||||||
@ -272,6 +272,7 @@ dist-clean:
|
|||||||
|
|
||||||
type-gen:
|
type-gen:
|
||||||
go run ./gen/main.go
|
go run ./gen/main.go
|
||||||
|
go generate ./...
|
||||||
|
|
||||||
method-gen:
|
method-gen:
|
||||||
(cd ./lotuspond/front/src/chain && go run ./methodgen.go)
|
(cd ./lotuspond/front/src/chain && go run ./methodgen.go)
|
||||||
|
@ -6,6 +6,14 @@
|
|||||||
|
|
||||||
<h1 align="center">Project Lotus - 莲</h1>
|
<h1 align="center">Project Lotus - 莲</h1>
|
||||||
|
|
||||||
|
<p align="center">
|
||||||
|
<a href="https://circleci.com/gh/filecoin-project/lotus"><img src="https://circleci.com/gh/filecoin-project/lotus.svg?style=svg"></a>
|
||||||
|
<a href="https://codecov.io/gh/filecoin-project/lotus"><img src="https://codecov.io/gh/filecoin-project/lotus/branch/master/graph/badge.svg"></a>
|
||||||
|
<a href="https://goreportcard.com/report/github.com/filecoin-project/lotus"><img src="https://goreportcard.com/badge/github.com/filecoin-project/lotus" /></a>
|
||||||
|
<a href=""><img src="https://img.shields.io/badge/golang-%3E%3D1.14.7-blue.svg" /></a>
|
||||||
|
<br>
|
||||||
|
</p>
|
||||||
|
|
||||||
Lotus is an implementation of the Filecoin Distributed Storage Network. For more details about Filecoin, check out the [Filecoin Spec](https://spec.filecoin.io).
|
Lotus is an implementation of the Filecoin Distributed Storage Network. For more details about Filecoin, check out the [Filecoin Spec](https://spec.filecoin.io).
|
||||||
|
|
||||||
## Building & Documentation
|
## Building & Documentation
|
||||||
|
@ -4,11 +4,9 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||||
"github.com/libp2p/go-libp2p-core/network"
|
"github.com/libp2p/go-libp2p-core/network"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
)
|
)
|
||||||
@ -70,5 +68,5 @@ func (v Version) String() string {
|
|||||||
|
|
||||||
type NatInfo struct {
|
type NatInfo struct {
|
||||||
Reachability network.Reachability
|
Reachability network.Reachability
|
||||||
PublicAddr ma.Multiaddr
|
PublicAddr string
|
||||||
}
|
}
|
||||||
|
@ -244,7 +244,10 @@ type FullNode interface {
|
|||||||
// ClientMinerQueryOffer returns a QueryOffer for the specific miner and file.
|
// ClientMinerQueryOffer returns a QueryOffer for the specific miner and file.
|
||||||
ClientMinerQueryOffer(ctx context.Context, miner address.Address, root cid.Cid, piece *cid.Cid) (QueryOffer, error)
|
ClientMinerQueryOffer(ctx context.Context, miner address.Address, root cid.Cid, piece *cid.Cid) (QueryOffer, error)
|
||||||
// ClientRetrieve initiates the retrieval of a file, as specified in the order.
|
// ClientRetrieve initiates the retrieval of a file, as specified in the order.
|
||||||
ClientRetrieve(ctx context.Context, order RetrievalOrder, ref *FileRef) (<-chan marketevents.RetrievalEvent, error)
|
ClientRetrieve(ctx context.Context, order RetrievalOrder, ref *FileRef) error
|
||||||
|
// ClientRetrieveWithEvents initiates the retrieval of a file, as specified in the order, and provides a channel
|
||||||
|
// of status updates.
|
||||||
|
ClientRetrieveWithEvents(ctx context.Context, order RetrievalOrder, ref *FileRef) (<-chan marketevents.RetrievalEvent, error)
|
||||||
// ClientQueryAsk returns a signed StorageAsk from the specified miner.
|
// ClientQueryAsk returns a signed StorageAsk from the specified miner.
|
||||||
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error)
|
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error)
|
||||||
// ClientCalcCommP calculates the CommP for a specified file
|
// ClientCalcCommP calculates the CommP for a specified file
|
||||||
|
@ -12,9 +12,9 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
@ -6,9 +6,9 @@ import (
|
|||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
|
@ -15,11 +15,11 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||||
"github.com/filecoin-project/go-multistore"
|
"github.com/filecoin-project/go-multistore"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
@ -136,7 +136,8 @@ type FullNodeStruct struct {
|
|||||||
ClientStartDeal func(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) `perm:"admin"`
|
ClientStartDeal func(ctx context.Context, params *api.StartDealParams) (*cid.Cid, error) `perm:"admin"`
|
||||||
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
|
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
|
||||||
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
|
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
|
||||||
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) (<-chan marketevents.RetrievalEvent, error) `perm:"admin"`
|
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) error `perm:"admin"`
|
||||||
|
ClientRetrieveWithEvents func(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) (<-chan marketevents.RetrievalEvent, error) `perm:"admin"`
|
||||||
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) `perm:"read"`
|
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) `perm:"read"`
|
||||||
ClientCalcCommP func(ctx context.Context, inpath string) (*api.CommPRet, error) `perm:"read"`
|
ClientCalcCommP func(ctx context.Context, inpath string) (*api.CommPRet, error) `perm:"read"`
|
||||||
ClientGenCar func(ctx context.Context, ref api.FileRef, outpath string) error `perm:"write"`
|
ClientGenCar func(ctx context.Context, ref api.FileRef, outpath string) error `perm:"write"`
|
||||||
@ -425,10 +426,14 @@ func (c *FullNodeStruct) ClientListDeals(ctx context.Context) ([]api.DealInfo, e
|
|||||||
return c.Internal.ClientListDeals(ctx)
|
return c.Internal.ClientListDeals(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) (<-chan marketevents.RetrievalEvent, error) {
|
func (c *FullNodeStruct) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) error {
|
||||||
return c.Internal.ClientRetrieve(ctx, order, ref)
|
return c.Internal.ClientRetrieve(ctx, order, ref)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *FullNodeStruct) ClientRetrieveWithEvents(ctx context.Context, order api.RetrievalOrder, ref *api.FileRef) (<-chan marketevents.RetrievalEvent, error) {
|
||||||
|
return c.Internal.ClientRetrieveWithEvents(ctx, order, ref)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) {
|
func (c *FullNodeStruct) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) {
|
||||||
return c.Internal.ClientQueryAsk(ctx, p, miner)
|
return c.Internal.ClientQueryAsk(ctx, p, miner)
|
||||||
}
|
}
|
||||||
|
@ -39,7 +39,7 @@ func NewFullNodeRPC(addr string, requestHeader http.Header) (api.FullNode, jsonr
|
|||||||
}
|
}
|
||||||
|
|
||||||
// NewStorageMinerRPC creates a new http jsonrpc client for miner
|
// NewStorageMinerRPC creates a new http jsonrpc client for miner
|
||||||
func NewStorageMinerRPC(addr string, requestHeader http.Header) (api.StorageMiner, jsonrpc.ClientCloser, error) {
|
func NewStorageMinerRPC(addr string, requestHeader http.Header, opts ...jsonrpc.Option) (api.StorageMiner, jsonrpc.ClientCloser, error) {
|
||||||
var res apistruct.StorageMinerStruct
|
var res apistruct.StorageMinerStruct
|
||||||
closer, err := jsonrpc.NewMergeClient(addr, "Filecoin",
|
closer, err := jsonrpc.NewMergeClient(addr, "Filecoin",
|
||||||
[]interface{}{
|
[]interface{}{
|
||||||
@ -47,6 +47,7 @@ func NewStorageMinerRPC(addr string, requestHeader http.Header) (api.StorageMine
|
|||||||
&res.Internal,
|
&res.Internal,
|
||||||
},
|
},
|
||||||
requestHeader,
|
requestHeader,
|
||||||
|
opts...,
|
||||||
)
|
)
|
||||||
|
|
||||||
return &res, closer, err
|
return &res, closer, err
|
||||||
@ -75,7 +76,7 @@ func NewWorkerRPC(addr string, requestHeader http.Header) (api.WorkerAPI, jsonrp
|
|||||||
requestHeader,
|
requestHeader,
|
||||||
rpcenc.ReaderParamEncoder(u.String()),
|
rpcenc.ReaderParamEncoder(u.String()),
|
||||||
jsonrpc.WithNoReconnect(),
|
jsonrpc.WithNoReconnect(),
|
||||||
jsonrpc.WithWriteTimeout(30*time.Second),
|
jsonrpc.WithTimeout(30*time.Second),
|
||||||
)
|
)
|
||||||
|
|
||||||
return &res, closer, err
|
return &res, closer, err
|
||||||
|
@ -22,8 +22,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
"github.com/filecoin-project/lotus/miner"
|
"github.com/filecoin-project/lotus/miner"
|
||||||
sealing "github.com/filecoin-project/storage-fsm"
|
|
||||||
dag "github.com/ipfs/go-merkledag"
|
dag "github.com/ipfs/go-merkledag"
|
||||||
dstest "github.com/ipfs/go-merkledag/test"
|
dstest "github.com/ipfs/go-merkledag/test"
|
||||||
unixfile "github.com/ipfs/go-unixfs/file"
|
unixfile "github.com/ipfs/go-unixfs/file"
|
||||||
@ -398,7 +398,7 @@ func testRetrieval(t *testing.T, ctx context.Context, err error, client *impl.Fu
|
|||||||
Path: filepath.Join(rpath, "ret"),
|
Path: filepath.Join(rpath, "ret"),
|
||||||
IsCAR: carExport,
|
IsCAR: carExport,
|
||||||
}
|
}
|
||||||
updates, err := client.ClientRetrieve(ctx, offers[0].Order(caddr), ref)
|
updates, err := client.ClientRetrieveWithEvents(ctx, offers[0].Order(caddr), ref)
|
||||||
for update := range updates {
|
for update := range updates {
|
||||||
if update.Err != "" {
|
if update.Err != "" {
|
||||||
t.Fatalf("%v", err)
|
t.Fatalf("%v", err)
|
||||||
|
@ -12,10 +12,10 @@ import (
|
|||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/sector-storage/mock"
|
"github.com/filecoin-project/lotus/extern/sector-storage/mock"
|
||||||
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
miner2 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner2 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
sealing "github.com/filecoin-project/storage-fsm"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
@ -50,7 +50,7 @@ type MinerInfo struct {
|
|||||||
Worker address.Address // Must be an ID-address.
|
Worker address.Address // Must be an ID-address.
|
||||||
NewWorker address.Address // Must be an ID-address.
|
NewWorker address.Address // Must be an ID-address.
|
||||||
WorkerChangeEpoch abi.ChainEpoch
|
WorkerChangeEpoch abi.ChainEpoch
|
||||||
PeerId peer.ID
|
PeerId *peer.ID
|
||||||
Multiaddrs []abi.Multiaddrs
|
Multiaddrs []abi.Multiaddrs
|
||||||
SealProofType abi.RegisteredSealProof
|
SealProofType abi.RegisteredSealProof
|
||||||
SectorSize abi.SectorSize
|
SectorSize abi.SectorSize
|
||||||
@ -58,12 +58,17 @@ type MinerInfo struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func NewApiMinerInfo(info *miner.MinerInfo) MinerInfo {
|
func NewApiMinerInfo(info *miner.MinerInfo) MinerInfo {
|
||||||
|
var pid *peer.ID
|
||||||
|
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
||||||
|
pid = &peerID
|
||||||
|
}
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
NewWorker: address.Undef,
|
NewWorker: address.Undef,
|
||||||
WorkerChangeEpoch: -1,
|
WorkerChangeEpoch: -1,
|
||||||
PeerId: peer.ID(info.PeerId),
|
PeerId: pid,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
SealProofType: info.SealProofType,
|
SealProofType: info.SealProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
|
@ -89,11 +89,14 @@ const VerifSigCacheSize = 32000
|
|||||||
|
|
||||||
// TODO: If this is gonna stay, it should move to specs-actors
|
// TODO: If this is gonna stay, it should move to specs-actors
|
||||||
const BlockMessageLimit = 10000
|
const BlockMessageLimit = 10000
|
||||||
|
|
||||||
const BlockGasLimit = 10_000_000_000
|
const BlockGasLimit = 10_000_000_000
|
||||||
const BlockGasTarget = BlockGasLimit / 2
|
const BlockGasTarget = BlockGasLimit / 2
|
||||||
const BaseFeeMaxChangeDenom = 8 // 12.5%
|
const BaseFeeMaxChangeDenom = 8 // 12.5%
|
||||||
const InitialBaseFee = 100e6
|
const InitialBaseFee = 100e6
|
||||||
const MinimumBaseFee = 100
|
const MinimumBaseFee = 100
|
||||||
|
const PackingEfficiencyNum = 4
|
||||||
|
const PackingEfficiencyDenom = 5
|
||||||
|
|
||||||
// Actor consts
|
// Actor consts
|
||||||
// TODO: Pull from actors when its made not private
|
// TODO: Pull from actors when its made not private
|
||||||
|
@ -66,4 +66,7 @@ var (
|
|||||||
// Actor consts
|
// Actor consts
|
||||||
// TODO: Pull from actors when its made not private
|
// TODO: Pull from actors when its made not private
|
||||||
MinDealDuration = abi.ChainEpoch(180 * builtin.EpochsInDay)
|
MinDealDuration = abi.ChainEpoch(180 * builtin.EpochsInDay)
|
||||||
|
|
||||||
|
PackingEfficiencyNum int64 = 4
|
||||||
|
PackingEfficiencyDenom int64 = 5
|
||||||
)
|
)
|
||||||
|
@ -25,7 +25,7 @@ func buildType() string {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// BuildVersion is the local build version, set by build system
|
// BuildVersion is the local build version, set by build system
|
||||||
const BuildVersion = "0.4.5"
|
const BuildVersion = "0.4.6"
|
||||||
|
|
||||||
func UserVersion() string {
|
func UserVersion() string {
|
||||||
return BuildVersion + buildType() + CurrentCommit
|
return BuildVersion + buildType() + CurrentCommit
|
||||||
|
@ -34,11 +34,11 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/vm"
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
"github.com/filecoin-project/lotus/chain/wallet"
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
"github.com/filecoin-project/lotus/cmd/lotus-seed/seed"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
"github.com/filecoin-project/lotus/genesis"
|
||||||
"github.com/filecoin-project/lotus/lib/blockstore"
|
"github.com/filecoin-project/lotus/lib/blockstore"
|
||||||
"github.com/filecoin-project/lotus/lib/sigs"
|
"github.com/filecoin-project/lotus/lib/sigs"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("gen")
|
var log = logging.Logger("gen")
|
||||||
@ -107,6 +107,17 @@ var DefaultVerifregRootkeyActor = genesis.Actor{
|
|||||||
Meta: rootkeyMultisig.ActorMeta(),
|
Meta: rootkeyMultisig.ActorMeta(),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var remAccTestKey, _ = address.NewFromString("t1ceb34gnsc6qk5dt6n7xg6ycwzasjhbxm3iylkiy")
|
||||||
|
var remAccMeta = genesis.AccountMeta{
|
||||||
|
Owner: remAccTestKey,
|
||||||
|
}
|
||||||
|
|
||||||
|
var DefaultRemainderAccountActor = genesis.Actor{
|
||||||
|
Type: genesis.TAccount,
|
||||||
|
Balance: big.NewInt(0),
|
||||||
|
Meta: remAccMeta.ActorMeta(),
|
||||||
|
}
|
||||||
|
|
||||||
func NewGeneratorWithSectors(numSectors int) (*ChainGen, error) {
|
func NewGeneratorWithSectors(numSectors int) (*ChainGen, error) {
|
||||||
saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
saminer.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||||
@ -211,6 +222,7 @@ func NewGeneratorWithSectors(numSectors int) (*ChainGen, error) {
|
|||||||
*genm2,
|
*genm2,
|
||||||
},
|
},
|
||||||
VerifregRootKey: DefaultVerifregRootkeyActor,
|
VerifregRootKey: DefaultVerifregRootkeyActor,
|
||||||
|
RemainderAccount: DefaultRemainderAccountActor,
|
||||||
NetworkName: "",
|
NetworkName: "",
|
||||||
Timestamp: uint64(build.Clock.Now().Add(-500 * time.Duration(build.BlockDelaySecs) * time.Second).Unix()),
|
Timestamp: uint64(build.Clock.Now().Add(-500 * time.Duration(build.BlockDelaySecs) * time.Second).Unix()),
|
||||||
}
|
}
|
||||||
@ -304,7 +316,8 @@ func (cg *ChainGen) GenesisCar() ([]byte, error) {
|
|||||||
|
|
||||||
func CarWalkFunc(nd format.Node) (out []*format.Link, err error) {
|
func CarWalkFunc(nd format.Node) (out []*format.Link, err error) {
|
||||||
for _, link := range nd.Links() {
|
for _, link := range nd.Links() {
|
||||||
if link.Cid.Prefix().Codec == cid.FilCommitmentSealed || link.Cid.Prefix().Codec == cid.FilCommitmentUnsealed {
|
pref := link.Cid.Prefix()
|
||||||
|
if pref.Codec == cid.FilCommitmentSealed || pref.Codec == cid.FilCommitmentUnsealed {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
out = append(out, link)
|
out = append(out, link)
|
||||||
|
41
chain/gen/genesis/genblock.go
Normal file
41
chain/gen/genesis/genblock.go
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
package genesis
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/hex"
|
||||||
|
|
||||||
|
blocks "github.com/ipfs/go-block-format"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
"github.com/multiformats/go-multihash"
|
||||||
|
)
|
||||||
|
|
||||||
|
const genesisMultihashString = "1220107d821c25dc0735200249df94a8bebc9c8e489744f86a4ca8919e81f19dcd72"
|
||||||
|
const genesisBlockHex = "a5684461746574696d6573323031372d30352d30352030313a32373a3531674e6574776f726b6846696c65636f696e65546f6b656e6846696c65636f696e6c546f6b656e416d6f756e7473a36b546f74616c537570706c796d322c3030302c3030302c303030664d696e6572736d312c3430302c3030302c3030306c50726f746f636f6c4c616273a36b446576656c6f706d656e746b3330302c3030302c3030306b46756e6472616973696e676b3230302c3030302c3030306a466f756e646174696f6e6b3130302c3030302c303030674d657373616765784854686973206973207468652047656e6573697320426c6f636b206f66207468652046696c65636f696e20446563656e7472616c697a65642053746f72616765204e6574776f726b2e"
|
||||||
|
|
||||||
|
var cidBuilder = cid.V1Builder{Codec: cid.DagCBOR, MhType: multihash.SHA2_256}
|
||||||
|
|
||||||
|
func expectedCid() cid.Cid {
|
||||||
|
mh, err := multihash.FromHexString(genesisMultihashString)
|
||||||
|
if err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
return cid.NewCidV1(cidBuilder.Codec, mh)
|
||||||
|
}
|
||||||
|
|
||||||
|
func getGenesisBlock() (blocks.Block, error) {
|
||||||
|
genesisBlockData, err := hex.DecodeString(genesisBlockHex)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
genesisCid, err := cidBuilder.Sum(genesisBlockData)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
block, err := blocks.NewBlockWithCid(genesisBlockData, genesisCid)
|
||||||
|
if err != nil {
|
||||||
|
return nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
return block, nil
|
||||||
|
}
|
@ -3,6 +3,7 @@ package genesis
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
@ -258,11 +259,47 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
|||||||
Balance: types.NewInt(0),
|
Balance: types.NewInt(0),
|
||||||
Head: verifierState,
|
Head: verifierState,
|
||||||
})
|
})
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, xerrors.Errorf("setting account from actmap: %w", err)
|
return nil, nil, xerrors.Errorf("setting account from actmap: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalFilAllocated := big.Zero()
|
||||||
|
|
||||||
|
// flush as ForEach works on the HAMT
|
||||||
|
if _, err := state.Flush(ctx); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
err = state.ForEach(func(addr address.Address, act *types.Actor) error {
|
||||||
|
totalFilAllocated = big.Add(totalFilAllocated, act.Balance)
|
||||||
|
return nil
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, xerrors.Errorf("summing account balances in state tree: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
totalFil := big.Mul(big.NewInt(int64(build.FilBase)), big.NewInt(int64(build.FilecoinPrecision)))
|
||||||
|
remainingFil := big.Sub(totalFil, totalFilAllocated)
|
||||||
|
if remainingFil.Sign() < 0 {
|
||||||
|
return nil, nil, xerrors.Errorf("somehow overallocated filecoin (allocated = %s)", types.FIL(totalFilAllocated))
|
||||||
|
}
|
||||||
|
|
||||||
|
remAccKey, err := address.NewIDAddress(90)
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := createAccount(ctx, bs, cst, state, remAccKey, template.RemainderAccount); err != nil {
|
||||||
|
return nil, nil, err
|
||||||
|
}
|
||||||
|
err = state.SetActor(remAccKey, &types.Actor{
|
||||||
|
Code: builtin.AccountActorCodeID,
|
||||||
|
Balance: remainingFil,
|
||||||
|
Head: emptyobject,
|
||||||
|
})
|
||||||
|
if err != nil {
|
||||||
|
return nil, nil, xerrors.Errorf("set burnt funds account actor: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
return state, keyIDs, nil
|
return state, keyIDs, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -284,6 +321,7 @@ func createAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.IpldStore
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("setting account from actmap: %w", err)
|
return xerrors.Errorf("setting account from actmap: %w", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
} else if info.Type == genesis.TMultisig {
|
} else if info.Type == genesis.TMultisig {
|
||||||
var ainfo genesis.MultisigMeta
|
var ainfo genesis.MultisigMeta
|
||||||
if err := json.Unmarshal(info.Meta, &ainfo); err != nil {
|
if err := json.Unmarshal(info.Meta, &ainfo); err != nil {
|
||||||
@ -313,9 +351,10 @@ func createAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.IpldStore
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("setting account from actmap: %w", err)
|
return xerrors.Errorf("setting account from actmap: %w", err)
|
||||||
}
|
}
|
||||||
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return fmt.Errorf("failed to create account")
|
||||||
}
|
}
|
||||||
|
|
||||||
func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, stateroot cid.Cid, template genesis.Template, keyIDs map[address.Address]address.Address) (cid.Cid, error) {
|
func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, stateroot cid.Cid, template genesis.Template, keyIDs map[address.Address]address.Address) (cid.Cid, error) {
|
||||||
@ -434,10 +473,32 @@ func MakeGenesisBlock(ctx context.Context, bs bstore.Blockstore, sys vm.SyscallB
|
|||||||
VRFProof: []byte("vrf proof0000000vrf proof0000000"),
|
VRFProof: []byte("vrf proof0000000vrf proof0000000"),
|
||||||
}
|
}
|
||||||
|
|
||||||
|
filecoinGenesisCid, err := cid.Decode("bafyreiaqpwbbyjo4a42saasj36kkrpv4tsherf2e7bvezkert2a7dhonoi")
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to decode filecoin genesis block CID: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !expectedCid().Equals(filecoinGenesisCid) {
|
||||||
|
return nil, xerrors.Errorf("expectedCid != filecoinGenesisCid")
|
||||||
|
}
|
||||||
|
|
||||||
|
gblk, err := getGenesisBlock()
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to construct filecoin genesis block: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if !filecoinGenesisCid.Equals(gblk.Cid()) {
|
||||||
|
return nil, xerrors.Errorf("filecoinGenesisCid != gblk.Cid")
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := bs.Put(gblk); err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed writing filecoin genesis block to blockstore: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
b := &types.BlockHeader{
|
b := &types.BlockHeader{
|
||||||
Miner: builtin.SystemActorAddr,
|
Miner: builtin.SystemActorAddr,
|
||||||
Ticket: genesisticket,
|
Ticket: genesisticket,
|
||||||
Parents: []cid.Cid{},
|
Parents: []cid.Cid{filecoinGenesisCid},
|
||||||
Height: 0,
|
Height: 0,
|
||||||
ParentWeight: types.NewInt(0),
|
ParentWeight: types.NewInt(0),
|
||||||
ParentStateRoot: stateroot,
|
ParentStateRoot: stateroot,
|
||||||
|
@ -14,7 +14,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -262,6 +262,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
return cid.Undef, xerrors.Errorf("getting current total power: %w", err)
|
return cid.Undef, xerrors.Errorf("getting current total power: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
pcd := miner.PreCommitDepositForPower(epochReward.ThisEpochRewardSmoothed, tpow.QualityAdjPowerSmoothed, sectorWeight)
|
||||||
|
|
||||||
pledge := miner.InitialPledgeForPower(
|
pledge := miner.InitialPledgeForPower(
|
||||||
sectorWeight,
|
sectorWeight,
|
||||||
epochReward.ThisEpochBaselinePower,
|
epochReward.ThisEpochBaselinePower,
|
||||||
@ -271,6 +273,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
|||||||
circSupply(ctx, vm, minerInfos[i].maddr),
|
circSupply(ctx, vm, minerInfos[i].maddr),
|
||||||
)
|
)
|
||||||
|
|
||||||
|
pledge = big.Add(pcd, pledge)
|
||||||
|
|
||||||
fmt.Println(types.FIL(pledge))
|
fmt.Println(types.FIL(pledge))
|
||||||
_, err = doExecValue(ctx, vm, minerInfos[i].maddr, m.Worker, pledge, builtin.MethodsMiner.PreCommitSector, mustEnc(params))
|
_, err = doExecValue(ctx, vm, minerInfos[i].maddr, m.Worker, pledge, builtin.MethodsMiner.PreCommitSector, mustEnc(params))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,6 +4,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
@ -26,6 +26,28 @@ func noWinnersProb() []float64 {
|
|||||||
return noWinnersProbCache
|
return noWinnersProbCache
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var noWinnersProbAssumingCache []float64
|
||||||
|
var noWinnersProbAssumingOnce sync.Once
|
||||||
|
|
||||||
|
func noWinnersProbAssumingMoreThanOne() []float64 {
|
||||||
|
noWinnersProbAssumingOnce.Do(func() {
|
||||||
|
cond := math.Log(-1 + math.Exp(5))
|
||||||
|
poissPdf := func(x float64) float64 {
|
||||||
|
const Mu = 5
|
||||||
|
lg, _ := math.Lgamma(x + 1)
|
||||||
|
result := math.Exp((math.Log(Mu) * x) - lg - cond)
|
||||||
|
return result
|
||||||
|
}
|
||||||
|
|
||||||
|
out := make([]float64, 0, MaxBlocks)
|
||||||
|
for i := 0; i < MaxBlocks; i++ {
|
||||||
|
out = append(out, poissPdf(float64(i+1)))
|
||||||
|
}
|
||||||
|
noWinnersProbAssumingCache = out
|
||||||
|
})
|
||||||
|
return noWinnersProbAssumingCache
|
||||||
|
}
|
||||||
|
|
||||||
func binomialCoefficient(n, k float64) float64 {
|
func binomialCoefficient(n, k float64) float64 {
|
||||||
if k > n {
|
if k > n {
|
||||||
return math.NaN()
|
return math.NaN()
|
||||||
@ -40,7 +62,7 @@ func binomialCoefficient(n, k float64) float64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mp *MessagePool) blockProbabilities(tq float64) []float64 {
|
func (mp *MessagePool) blockProbabilities(tq float64) []float64 {
|
||||||
noWinners := noWinnersProb() // cache this
|
noWinners := noWinnersProbAssumingMoreThanOne()
|
||||||
|
|
||||||
p := 1 - tq
|
p := 1 - tq
|
||||||
binoPdf := func(x, trials float64) float64 {
|
binoPdf := func(x, trials float64) float64 {
|
||||||
@ -72,7 +94,7 @@ func (mp *MessagePool) blockProbabilities(tq float64) []float64 {
|
|||||||
for place := 0; place < MaxBlocks; place++ {
|
for place := 0; place < MaxBlocks; place++ {
|
||||||
var pPlace float64
|
var pPlace float64
|
||||||
for otherWinners, pCase := range noWinners {
|
for otherWinners, pCase := range noWinners {
|
||||||
pPlace += pCase * binoPdf(float64(place), float64(otherWinners+1))
|
pPlace += pCase * binoPdf(float64(place), float64(otherWinners))
|
||||||
}
|
}
|
||||||
out = append(out, pPlace)
|
out = append(out, pPlace)
|
||||||
}
|
}
|
||||||
|
@ -1,6 +1,11 @@
|
|||||||
package messagepool
|
package messagepool
|
||||||
|
|
||||||
import "testing"
|
import (
|
||||||
|
"math"
|
||||||
|
"math/rand"
|
||||||
|
"testing"
|
||||||
|
"time"
|
||||||
|
)
|
||||||
|
|
||||||
func TestBlockProbability(t *testing.T) {
|
func TestBlockProbability(t *testing.T) {
|
||||||
mp := &MessagePool{}
|
mp := &MessagePool{}
|
||||||
@ -13,3 +18,26 @@ func TestBlockProbability(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func TestWinnerProba(t *testing.T) {
|
||||||
|
rand.Seed(time.Now().UnixNano())
|
||||||
|
const N = 1000000
|
||||||
|
winnerProba := noWinnersProb()
|
||||||
|
sum := 0
|
||||||
|
for i := 0; i < N; i++ {
|
||||||
|
minersRand := rand.Float64()
|
||||||
|
j := 0
|
||||||
|
for ; j < MaxBlocks; j++ {
|
||||||
|
minersRand -= winnerProba[j]
|
||||||
|
if minersRand < 0 {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
}
|
||||||
|
sum += j
|
||||||
|
}
|
||||||
|
|
||||||
|
if avg := float64(sum) / N; math.Abs(avg-5) > 0.01 {
|
||||||
|
t.Fatalf("avg too far off: %f", avg)
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
@ -59,7 +59,7 @@ var (
|
|||||||
ErrBroadcastAnyway = errors.New("broadcasting message despite validation fail")
|
ErrBroadcastAnyway = errors.New("broadcasting message despite validation fail")
|
||||||
ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium")
|
ErrRBFTooLowPremium = errors.New("replace by fee has too low GasPremium")
|
||||||
|
|
||||||
ErrTryAgain = errors.New("state inconsistency while signing message; please try again")
|
ErrTryAgain = errors.New("state inconsistency while pushing message; please try again")
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
@ -76,7 +76,11 @@ type MessagePool struct {
|
|||||||
addSema chan struct{}
|
addSema chan struct{}
|
||||||
|
|
||||||
closer chan struct{}
|
closer chan struct{}
|
||||||
|
|
||||||
repubTk *clock.Ticker
|
repubTk *clock.Ticker
|
||||||
|
repubTrigger chan struct{}
|
||||||
|
|
||||||
|
republished map[cid.Cid]struct{}
|
||||||
|
|
||||||
localAddrs map[address.Address]struct{}
|
localAddrs map[address.Address]struct{}
|
||||||
|
|
||||||
@ -166,6 +170,7 @@ func New(api Provider, ds dtypes.MetadataDS, netName dtypes.NetworkName) (*Messa
|
|||||||
addSema: make(chan struct{}, 1),
|
addSema: make(chan struct{}, 1),
|
||||||
closer: make(chan struct{}),
|
closer: make(chan struct{}),
|
||||||
repubTk: build.Clock.Ticker(RepublishInterval),
|
repubTk: build.Clock.Ticker(RepublishInterval),
|
||||||
|
repubTrigger: make(chan struct{}, 1),
|
||||||
localAddrs: make(map[address.Address]struct{}),
|
localAddrs: make(map[address.Address]struct{}),
|
||||||
pending: make(map[address.Address]*msgSet),
|
pending: make(map[address.Address]*msgSet),
|
||||||
minGasPrice: types.NewInt(0),
|
minGasPrice: types.NewInt(0),
|
||||||
@ -224,6 +229,10 @@ func (mp *MessagePool) runLoop() {
|
|||||||
if err := mp.republishPendingMessages(); err != nil {
|
if err := mp.republishPendingMessages(); err != nil {
|
||||||
log.Errorf("error while republishing messages: %s", err)
|
log.Errorf("error while republishing messages: %s", err)
|
||||||
}
|
}
|
||||||
|
case <-mp.repubTrigger:
|
||||||
|
if err := mp.republishPendingMessages(); err != nil {
|
||||||
|
log.Errorf("error while republishing messages: %s", err)
|
||||||
|
}
|
||||||
case <-mp.pruneTrigger:
|
case <-mp.pruneTrigger:
|
||||||
if err := mp.pruneExcessMessages(); err != nil {
|
if err := mp.pruneExcessMessages(); err != nil {
|
||||||
log.Errorf("failed to prune excess messages from mempool: %s", err)
|
log.Errorf("failed to prune excess messages from mempool: %s", err)
|
||||||
@ -255,6 +264,11 @@ func (mp *MessagePool) verifyMsgBeforePush(m *types.SignedMessage, epoch abi.Cha
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (mp *MessagePool) Push(m *types.SignedMessage) (cid.Cid, error) {
|
func (mp *MessagePool) Push(m *types.SignedMessage) (cid.Cid, error) {
|
||||||
|
err := mp.checkMessage(m)
|
||||||
|
if err != nil {
|
||||||
|
return cid.Undef, err
|
||||||
|
}
|
||||||
|
|
||||||
// serialize push access to reduce lock contention
|
// serialize push access to reduce lock contention
|
||||||
mp.addSema <- struct{}{}
|
mp.addSema <- struct{}{}
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -262,7 +276,8 @@ func (mp *MessagePool) Push(m *types.SignedMessage) (cid.Cid, error) {
|
|||||||
}()
|
}()
|
||||||
|
|
||||||
mp.curTsLk.Lock()
|
mp.curTsLk.Lock()
|
||||||
epoch := mp.curTs.Height()
|
curTs := mp.curTs
|
||||||
|
epoch := curTs.Height()
|
||||||
mp.curTsLk.Unlock()
|
mp.curTsLk.Unlock()
|
||||||
if err := mp.verifyMsgBeforePush(m, epoch); err != nil {
|
if err := mp.verifyMsgBeforePush(m, epoch); err != nil {
|
||||||
return cid.Undef, err
|
return cid.Undef, err
|
||||||
@ -273,9 +288,17 @@ func (mp *MessagePool) Push(m *types.SignedMessage) (cid.Cid, error) {
|
|||||||
return cid.Undef, err
|
return cid.Undef, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := mp.Add(m); err != nil {
|
mp.curTsLk.Lock()
|
||||||
|
if mp.curTs != curTs {
|
||||||
|
mp.curTsLk.Unlock()
|
||||||
|
return cid.Undef, ErrTryAgain
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := mp.addTs(m, mp.curTs); err != nil {
|
||||||
|
mp.curTsLk.Unlock()
|
||||||
return cid.Undef, err
|
return cid.Undef, err
|
||||||
}
|
}
|
||||||
|
mp.curTsLk.Unlock()
|
||||||
|
|
||||||
mp.lk.Lock()
|
mp.lk.Lock()
|
||||||
if err := mp.addLocal(m, msgb); err != nil {
|
if err := mp.addLocal(m, msgb); err != nil {
|
||||||
@ -287,7 +310,7 @@ func (mp *MessagePool) Push(m *types.SignedMessage) (cid.Cid, error) {
|
|||||||
return m.Cid(), mp.api.PubSubPublish(build.MessagesTopic(mp.netName), msgb)
|
return m.Cid(), mp.api.PubSubPublish(build.MessagesTopic(mp.netName), msgb)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mp *MessagePool) Add(m *types.SignedMessage) error {
|
func (mp *MessagePool) checkMessage(m *types.SignedMessage) error {
|
||||||
// big messages are bad, anti DOS
|
// big messages are bad, anti DOS
|
||||||
if m.Size() > 32*1024 {
|
if m.Size() > 32*1024 {
|
||||||
return xerrors.Errorf("mpool message too large (%dB): %w", m.Size(), ErrMessageTooBig)
|
return xerrors.Errorf("mpool message too large (%dB): %w", m.Size(), ErrMessageTooBig)
|
||||||
@ -306,6 +329,15 @@ func (mp *MessagePool) Add(m *types.SignedMessage) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (mp *MessagePool) Add(m *types.SignedMessage) error {
|
||||||
|
err := mp.checkMessage(m)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
// serialize push access to reduce lock contention
|
// serialize push access to reduce lock contention
|
||||||
mp.addSema <- struct{}{}
|
mp.addSema <- struct{}{}
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -676,6 +708,7 @@ func (mp *MessagePool) HeadChange(revert []*types.TipSet, apply []*types.TipSet)
|
|||||||
mp.curTsLk.Lock()
|
mp.curTsLk.Lock()
|
||||||
defer mp.curTsLk.Unlock()
|
defer mp.curTsLk.Unlock()
|
||||||
|
|
||||||
|
repubTrigger := false
|
||||||
rmsgs := make(map[address.Address]map[uint64]*types.SignedMessage)
|
rmsgs := make(map[address.Address]map[uint64]*types.SignedMessage)
|
||||||
add := func(m *types.SignedMessage) {
|
add := func(m *types.SignedMessage) {
|
||||||
s, ok := rmsgs[m.Message.From]
|
s, ok := rmsgs[m.Message.From]
|
||||||
@ -700,6 +733,17 @@ func (mp *MessagePool) HeadChange(revert []*types.TipSet, apply []*types.TipSet)
|
|||||||
mp.Remove(from, nonce)
|
mp.Remove(from, nonce)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
maybeRepub := func(cid cid.Cid) {
|
||||||
|
if !repubTrigger {
|
||||||
|
mp.lk.Lock()
|
||||||
|
_, republished := mp.republished[cid]
|
||||||
|
mp.lk.Unlock()
|
||||||
|
if republished {
|
||||||
|
repubTrigger = true
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, ts := range revert {
|
for _, ts := range revert {
|
||||||
pts, err := mp.api.LoadTipSet(ts.Parents())
|
pts, err := mp.api.LoadTipSet(ts.Parents())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -726,16 +770,25 @@ func (mp *MessagePool) HeadChange(revert []*types.TipSet, apply []*types.TipSet)
|
|||||||
}
|
}
|
||||||
for _, msg := range smsgs {
|
for _, msg := range smsgs {
|
||||||
rm(msg.Message.From, msg.Message.Nonce)
|
rm(msg.Message.From, msg.Message.Nonce)
|
||||||
|
maybeRepub(msg.Cid())
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, msg := range bmsgs {
|
for _, msg := range bmsgs {
|
||||||
rm(msg.From, msg.Nonce)
|
rm(msg.From, msg.Nonce)
|
||||||
|
maybeRepub(msg.Cid())
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
mp.curTs = ts
|
mp.curTs = ts
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if repubTrigger {
|
||||||
|
select {
|
||||||
|
case mp.repubTrigger <- struct{}{}:
|
||||||
|
default:
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
for _, s := range rmsgs {
|
for _, s := range rmsgs {
|
||||||
for _, msg := range s {
|
for _, msg := range s {
|
||||||
if err := mp.addSkipChecks(msg); err != nil {
|
if err := mp.addSkipChecks(msg); err != nil {
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/messagepool/gasguess"
|
"github.com/filecoin-project/lotus/chain/messagepool/gasguess"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
)
|
)
|
||||||
|
|
||||||
const repubMsgLimit = 30
|
const repubMsgLimit = 30
|
||||||
@ -26,6 +27,7 @@ func (mp *MessagePool) republishPendingMessages() error {
|
|||||||
|
|
||||||
pending := make(map[address.Address]map[uint64]*types.SignedMessage)
|
pending := make(map[address.Address]map[uint64]*types.SignedMessage)
|
||||||
mp.lk.Lock()
|
mp.lk.Lock()
|
||||||
|
mp.republished = nil // clear this to avoid races triggering an early republish
|
||||||
for actor := range mp.localAddrs {
|
for actor := range mp.localAddrs {
|
||||||
mset, ok := mp.pending[actor]
|
mset, ok := mp.pending[actor]
|
||||||
if !ok {
|
if !ok {
|
||||||
@ -115,6 +117,7 @@ func (mp *MessagePool) republishPendingMessages() error {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count := 0
|
||||||
log.Infof("republishing %d messages", len(msgs))
|
log.Infof("republishing %d messages", len(msgs))
|
||||||
for _, m := range msgs {
|
for _, m := range msgs {
|
||||||
mb, err := m.Serialize()
|
mb, err := m.Serialize()
|
||||||
@ -126,7 +129,20 @@ func (mp *MessagePool) republishPendingMessages() error {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("cannot publish: %w", err)
|
return xerrors.Errorf("cannot publish: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
count++
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// track most recently republished messages
|
||||||
|
republished := make(map[cid.Cid]struct{})
|
||||||
|
for _, m := range msgs[:count] {
|
||||||
|
republished[m.Cid()] = struct{}{}
|
||||||
|
}
|
||||||
|
|
||||||
|
mp.lk.Lock()
|
||||||
|
// update the republished set so that we can trigger early republish from head changes
|
||||||
|
mp.republished = republished
|
||||||
|
mp.lk.Unlock()
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
@ -834,7 +834,7 @@ func TestOptimalMessageSelection3(t *testing.T) {
|
|||||||
nMessages := int(build.BlockGasLimit/gasLimit) + 1
|
nMessages := int(build.BlockGasLimit/gasLimit) + 1
|
||||||
for i := 0; i < nMessages; i++ {
|
for i := 0; i < nMessages; i++ {
|
||||||
for j := 0; j < nActors; j++ {
|
for j := 0; j < nActors; j++ {
|
||||||
premium := 500000 + 20000*(nActors-j) + (nMessages+2-i)/(3*nActors) + i%3
|
premium := 500000 + 10000*(nActors-j) + (nMessages+2-i)/(30*nActors) + i%3
|
||||||
m := makeTestMessage(wallets[j], actors[j], actors[j%nActors], uint64(i), gasLimit, uint64(premium))
|
m := makeTestMessage(wallets[j], actors[j], actors[j%nActors], uint64(i), gasLimit, uint64(premium))
|
||||||
mustAdd(t, mp, m)
|
mustAdd(t, mp, m)
|
||||||
}
|
}
|
||||||
@ -874,7 +874,7 @@ func TestOptimalMessageSelection3(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand, getPremium func() uint64) (float64, float64) {
|
func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand, getPremium func() uint64) (float64, float64, float64) {
|
||||||
// in this test we use 300 actors and send 10 blocks of messages.
|
// in this test we use 300 actors and send 10 blocks of messages.
|
||||||
// actors send with an randomly distributed premium dictated by the getPremium function.
|
// actors send with an randomly distributed premium dictated by the getPremium function.
|
||||||
// a number of miners select with varying ticket quality and we compare the
|
// a number of miners select with varying ticket quality and we compare the
|
||||||
@ -934,8 +934,11 @@ func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand, getPremium fu
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
capacityBoost := 0.0
|
totalGreedyCapacity := 0.0
|
||||||
rewardBoost := 0.0
|
totalGreedyReward := 0.0
|
||||||
|
totalOptimalCapacity := 0.0
|
||||||
|
totalOptimalReward := 0.0
|
||||||
|
totalBestTQReward := 0.0
|
||||||
const runs = 1
|
const runs = 1
|
||||||
for i := 0; i < runs; i++ {
|
for i := 0; i < runs; i++ {
|
||||||
// 2. optimal selection
|
// 2. optimal selection
|
||||||
@ -945,31 +948,38 @@ func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand, getPremium fu
|
|||||||
for ; i < MaxBlocks && minersRand > 0; i++ {
|
for ; i < MaxBlocks && minersRand > 0; i++ {
|
||||||
minersRand -= winerProba[i]
|
minersRand -= winerProba[i]
|
||||||
}
|
}
|
||||||
nMiners := i
|
nMiners := i - 1
|
||||||
if nMiners == 0 {
|
if nMiners < 1 {
|
||||||
nMiners = 1
|
nMiners = 1
|
||||||
}
|
}
|
||||||
|
|
||||||
optMsgs := make(map[cid.Cid]*types.SignedMessage)
|
optMsgs := make(map[cid.Cid]*types.SignedMessage)
|
||||||
|
bestTq := 0.0
|
||||||
|
var bestMsgs []*types.SignedMessage
|
||||||
for j := 0; j < nMiners; j++ {
|
for j := 0; j < nMiners; j++ {
|
||||||
tq := rng.Float64()
|
tq := rng.Float64()
|
||||||
msgs, err := mp.SelectMessages(ts, tq)
|
msgs, err := mp.SelectMessages(ts, tq)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
if tq > bestTq {
|
||||||
|
bestMsgs = msgs
|
||||||
|
}
|
||||||
|
|
||||||
for _, m := range msgs {
|
for _, m := range msgs {
|
||||||
optMsgs[m.Cid()] = m
|
optMsgs[m.Cid()] = m
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
totalGreedyCapacity += float64(len(greedyMsgs))
|
||||||
|
totalOptimalCapacity += float64(len(optMsgs))
|
||||||
boost := float64(len(optMsgs)) / float64(len(greedyMsgs))
|
boost := float64(len(optMsgs)) / float64(len(greedyMsgs))
|
||||||
capacityBoost += boost
|
|
||||||
|
|
||||||
t.Logf("nMiners: %d", nMiners)
|
t.Logf("nMiners: %d", nMiners)
|
||||||
t.Logf("greedy capacity %d, optimal capacity %d (x %.1f )", len(greedyMsgs),
|
t.Logf("greedy capacity %d, optimal capacity %d (x %.1f )", len(greedyMsgs),
|
||||||
len(optMsgs), boost)
|
len(optMsgs), boost)
|
||||||
if len(greedyMsgs) > len(optMsgs) {
|
if len(greedyMsgs) > len(optMsgs) {
|
||||||
t.Fatal("greedy capacity higher than optimal capacity; wtf")
|
t.Errorf("greedy capacity higher than optimal capacity; wtf")
|
||||||
}
|
}
|
||||||
|
|
||||||
greedyReward := big.NewInt(0)
|
greedyReward := big.NewInt(0)
|
||||||
@ -982,25 +992,34 @@ func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand, getPremium fu
|
|||||||
optReward.Add(optReward, mp.getGasReward(m, baseFee, ts))
|
optReward.Add(optReward, mp.getGasReward(m, baseFee, ts))
|
||||||
}
|
}
|
||||||
|
|
||||||
|
bestTqReward := big.NewInt(0)
|
||||||
|
for _, m := range bestMsgs {
|
||||||
|
bestTqReward.Add(bestTqReward, mp.getGasReward(m, baseFee, ts))
|
||||||
|
}
|
||||||
|
|
||||||
|
totalBestTQReward += float64(bestTqReward.Uint64())
|
||||||
|
|
||||||
nMinersBig := big.NewInt(int64(nMiners))
|
nMinersBig := big.NewInt(int64(nMiners))
|
||||||
greedyAvgReward, _ := new(big.Rat).SetFrac(greedyReward, nMinersBig).Float64()
|
greedyAvgReward, _ := new(big.Rat).SetFrac(greedyReward, nMinersBig).Float64()
|
||||||
|
totalGreedyReward += greedyAvgReward
|
||||||
optimalAvgReward, _ := new(big.Rat).SetFrac(optReward, nMinersBig).Float64()
|
optimalAvgReward, _ := new(big.Rat).SetFrac(optReward, nMinersBig).Float64()
|
||||||
|
totalOptimalReward += optimalAvgReward
|
||||||
|
|
||||||
boost = optimalAvgReward / greedyAvgReward
|
boost = optimalAvgReward / greedyAvgReward
|
||||||
rewardBoost += boost
|
|
||||||
t.Logf("greedy reward: %.0f, optimal reward: %.0f (x %.1f )", greedyAvgReward,
|
t.Logf("greedy reward: %.0f, optimal reward: %.0f (x %.1f )", greedyAvgReward,
|
||||||
optimalAvgReward, boost)
|
optimalAvgReward, boost)
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
capacityBoost /= runs
|
capacityBoost := totalOptimalCapacity / totalGreedyCapacity
|
||||||
rewardBoost /= runs
|
rewardBoost := totalOptimalReward / totalGreedyReward
|
||||||
t.Logf("Average capacity boost: %f", capacityBoost)
|
t.Logf("Average capacity boost: %f", capacityBoost)
|
||||||
t.Logf("Average reward boost: %f", rewardBoost)
|
t.Logf("Average reward boost: %f", rewardBoost)
|
||||||
|
t.Logf("Average best tq reward: %f", totalBestTQReward/runs/1e12)
|
||||||
|
|
||||||
logging.SetLogLevel("messagepool", "info")
|
logging.SetLogLevel("messagepool", "info")
|
||||||
|
|
||||||
return capacityBoost, rewardBoost
|
return capacityBoost, rewardBoost, totalBestTQReward / runs / 1e12
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeExpPremiumDistribution(rng *rand.Rand) func() uint64 {
|
func makeExpPremiumDistribution(rng *rand.Rand) func() uint64 {
|
||||||
@ -1018,35 +1037,41 @@ func makeZipfPremiumDistribution(rng *rand.Rand) func() uint64 {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestCompetitiveMessageSelectionExp(t *testing.T) {
|
func TestCompetitiveMessageSelectionExp(t *testing.T) {
|
||||||
var capacityBoost, rewardBoost float64
|
var capacityBoost, rewardBoost, tqReward float64
|
||||||
seeds := []int64{1947, 1976, 2020, 2100, 10000, 143324, 432432, 131, 32, 45}
|
seeds := []int64{1947, 1976, 2020, 2100, 10000, 143324, 432432, 131, 32, 45}
|
||||||
for _, seed := range seeds {
|
for _, seed := range seeds {
|
||||||
t.Log("running competitive message selection with Exponential premium distribution and seed", seed)
|
t.Log("running competitive message selection with Exponential premium distribution and seed", seed)
|
||||||
rng := rand.New(rand.NewSource(seed))
|
rng := rand.New(rand.NewSource(seed))
|
||||||
cb, rb := testCompetitiveMessageSelection(t, rng, makeExpPremiumDistribution(rng))
|
cb, rb, tqR := testCompetitiveMessageSelection(t, rng, makeExpPremiumDistribution(rng))
|
||||||
capacityBoost += cb
|
capacityBoost += cb
|
||||||
rewardBoost += rb
|
rewardBoost += rb
|
||||||
|
tqReward += tqR
|
||||||
}
|
}
|
||||||
|
|
||||||
capacityBoost /= float64(len(seeds))
|
capacityBoost /= float64(len(seeds))
|
||||||
rewardBoost /= float64(len(seeds))
|
rewardBoost /= float64(len(seeds))
|
||||||
|
tqReward /= float64(len(seeds))
|
||||||
t.Logf("Average capacity boost across all seeds: %f", capacityBoost)
|
t.Logf("Average capacity boost across all seeds: %f", capacityBoost)
|
||||||
t.Logf("Average reward boost across all seeds: %f", rewardBoost)
|
t.Logf("Average reward boost across all seeds: %f", rewardBoost)
|
||||||
|
t.Logf("Average reward of best ticket across all seeds: %f", tqReward)
|
||||||
}
|
}
|
||||||
|
|
||||||
func TestCompetitiveMessageSelectionZipf(t *testing.T) {
|
func TestCompetitiveMessageSelectionZipf(t *testing.T) {
|
||||||
var capacityBoost, rewardBoost float64
|
var capacityBoost, rewardBoost, tqReward float64
|
||||||
seeds := []int64{1947, 1976, 2020, 2100, 10000, 143324, 432432, 131, 32, 45}
|
seeds := []int64{1947, 1976, 2020, 2100, 10000, 143324, 432432, 131, 32, 45}
|
||||||
for _, seed := range seeds {
|
for _, seed := range seeds {
|
||||||
t.Log("running competitive message selection with Zipf premium distribution and seed", seed)
|
t.Log("running competitive message selection with Zipf premium distribution and seed", seed)
|
||||||
rng := rand.New(rand.NewSource(seed))
|
rng := rand.New(rand.NewSource(seed))
|
||||||
cb, rb := testCompetitiveMessageSelection(t, rng, makeZipfPremiumDistribution(rng))
|
cb, rb, tqR := testCompetitiveMessageSelection(t, rng, makeZipfPremiumDistribution(rng))
|
||||||
capacityBoost += cb
|
capacityBoost += cb
|
||||||
rewardBoost += rb
|
rewardBoost += rb
|
||||||
|
tqReward += tqR
|
||||||
}
|
}
|
||||||
|
|
||||||
|
tqReward /= float64(len(seeds))
|
||||||
capacityBoost /= float64(len(seeds))
|
capacityBoost /= float64(len(seeds))
|
||||||
rewardBoost /= float64(len(seeds))
|
rewardBoost /= float64(len(seeds))
|
||||||
t.Logf("Average capacity boost across all seeds: %f", capacityBoost)
|
t.Logf("Average capacity boost across all seeds: %f", capacityBoost)
|
||||||
t.Logf("Average reward boost across all seeds: %f", rewardBoost)
|
t.Logf("Average reward boost across all seeds: %f", rewardBoost)
|
||||||
|
t.Logf("Average reward of best ticket across all seeds: %f", tqReward)
|
||||||
}
|
}
|
||||||
|
@ -3,9 +3,10 @@ package stmgr
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
"github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
@ -323,7 +324,7 @@ func (sm *StateManager) computeTipSetState(ctx context.Context, ts *types.TipSet
|
|||||||
|
|
||||||
var parentEpoch abi.ChainEpoch
|
var parentEpoch abi.ChainEpoch
|
||||||
pstate := blks[0].ParentStateRoot
|
pstate := blks[0].ParentStateRoot
|
||||||
if len(blks[0].Parents) > 0 {
|
if blks[0].Height > 0 {
|
||||||
parent, err := sm.cs.GetBlock(blks[0].Parents[0])
|
parent, err := sm.cs.GetBlock(blks[0].Parents[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, cid.Undef, xerrors.Errorf("getting parent block: %w", err)
|
return cid.Undef, cid.Undef, xerrors.Errorf("getting parent block: %w", err)
|
||||||
@ -787,7 +788,7 @@ type genesisActor struct {
|
|||||||
initBal abi.TokenAmount
|
initBal abi.TokenAmount
|
||||||
}
|
}
|
||||||
|
|
||||||
// sets up information about the non-multisig actors in the genesis state
|
// sets up information about the actors in the genesis state
|
||||||
func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
||||||
|
|
||||||
gi := genesisInfo{}
|
gi := genesisInfo{}
|
||||||
@ -850,12 +851,14 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
} else if act.Code == builtin.AccountActorCodeID {
|
} else if act.Code == builtin.AccountActorCodeID {
|
||||||
|
// should exclude burnt funds actor and "remainder account actor"
|
||||||
// should only ever be "faucet" accounts in testnets
|
// should only ever be "faucet" accounts in testnets
|
||||||
kaddr, err := address.NewFromBytes([]byte(k))
|
kaddr, err := address.NewFromBytes([]byte(k))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("decoding address: %w", err)
|
return xerrors.Errorf("decoding address: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if kaddr != builtin.BurntFundsActorAddr {
|
||||||
kid, err := sTree.LookupID(kaddr)
|
kid, err := sTree.LookupID(kaddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("resolving address: %w", err)
|
return xerrors.Errorf("resolving address: %w", err)
|
||||||
@ -866,6 +869,7 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
|||||||
initBal: act.Balance,
|
initBal: act.Balance,
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
}
|
||||||
return nil
|
return nil
|
||||||
})
|
})
|
||||||
|
|
||||||
@ -888,6 +892,83 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// sets up information about the actors in the genesis state
|
||||||
|
// For testnet we use a hardcoded set of multisig states, instead of what's actually in the genesis multisigs
|
||||||
|
// We also do not consider ANY account actors (including the faucet)
|
||||||
|
func (sm *StateManager) setupGenesisActorsTestnet(ctx context.Context) error {
|
||||||
|
|
||||||
|
gi := genesisInfo{}
|
||||||
|
|
||||||
|
gb, err := sm.cs.GetGenesis()
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("getting genesis block: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
gts, err := types.NewTipSet([]*types.BlockHeader{gb})
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("getting genesis tipset: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
st, _, err := sm.TipSetState(ctx, gts)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("getting genesis tipset state: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
cst := cbor.NewCborStore(sm.cs.Blockstore())
|
||||||
|
sTree, err := state.LoadStateTree(cst, st)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("loading state tree: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
gi.genesisMarketFunds, err = getFilMarketLocked(ctx, sTree)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("setting up genesis market funds: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
gi.genesisPledge, err = getFilPowerLocked(ctx, sTree)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("setting up genesis pledge: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount)
|
||||||
|
|
||||||
|
// 6 months
|
||||||
|
sixMonths := abi.ChainEpoch(183 * builtin.EpochsInDay)
|
||||||
|
totalsByEpoch[sixMonths] = big.NewInt(49_929_341)
|
||||||
|
totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700))
|
||||||
|
|
||||||
|
// 1 year
|
||||||
|
oneYear := abi.ChainEpoch(365 * builtin.EpochsInDay)
|
||||||
|
totalsByEpoch[oneYear] = big.NewInt(22_421_712)
|
||||||
|
|
||||||
|
// 2 years
|
||||||
|
twoYears := abi.ChainEpoch(2 * 365 * builtin.EpochsInDay)
|
||||||
|
totalsByEpoch[twoYears] = big.NewInt(7_223_364)
|
||||||
|
|
||||||
|
// 3 years
|
||||||
|
threeYears := abi.ChainEpoch(3 * 365 * builtin.EpochsInDay)
|
||||||
|
totalsByEpoch[threeYears] = big.NewInt(87_637_883)
|
||||||
|
|
||||||
|
// 6 years
|
||||||
|
sixYears := abi.ChainEpoch(6 * 365 * builtin.EpochsInDay)
|
||||||
|
totalsByEpoch[sixYears] = big.NewInt(100_000_000)
|
||||||
|
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
|
||||||
|
|
||||||
|
gi.genesisMsigs = make([]multisig.State, 0, len(totalsByEpoch))
|
||||||
|
for k, v := range totalsByEpoch {
|
||||||
|
ns := multisig.State{
|
||||||
|
InitialBalance: v,
|
||||||
|
UnlockDuration: k,
|
||||||
|
PendingTxns: cid.Undef,
|
||||||
|
}
|
||||||
|
gi.genesisMsigs = append(gi.genesisMsigs, ns)
|
||||||
|
}
|
||||||
|
|
||||||
|
sm.genInfo = &gi
|
||||||
|
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
// GetVestedFunds returns all funds that have "left" actors that are in the genesis state:
|
// GetVestedFunds returns all funds that have "left" actors that are in the genesis state:
|
||||||
// - For Multisigs, it counts the actual amounts that have vested at the given epoch
|
// - For Multisigs, it counts the actual amounts that have vested at the given epoch
|
||||||
// - For Accounts, it counts max(currentBalance - genesisBalance, 0).
|
// - For Accounts, it counts max(currentBalance - genesisBalance, 0).
|
||||||
@ -898,7 +979,7 @@ func (sm *StateManager) GetFilVested(ctx context.Context, height abi.ChainEpoch,
|
|||||||
vf = big.Add(vf, au)
|
vf = big.Add(vf, au)
|
||||||
}
|
}
|
||||||
|
|
||||||
// these should only ever be "faucet" accounts in testnets
|
// there should not be any such accounts in testnet (and also none in mainnet?)
|
||||||
for _, v := range sm.genInfo.genesisActors {
|
for _, v := range sm.genInfo.genesisActors {
|
||||||
act, err := st.GetActor(v.addr)
|
act, err := st.GetActor(v.addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -988,7 +1069,7 @@ func (sm *StateManager) GetCirculatingSupplyDetailed(ctx context.Context, height
|
|||||||
sm.genesisMsigLk.Lock()
|
sm.genesisMsigLk.Lock()
|
||||||
defer sm.genesisMsigLk.Unlock()
|
defer sm.genesisMsigLk.Unlock()
|
||||||
if sm.genInfo == nil {
|
if sm.genInfo == nil {
|
||||||
err := sm.setupGenesisActors(ctx)
|
err := sm.setupGenesisActorsTestnet(ctx)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.CirculatingSupply{}, xerrors.Errorf("failed to setup genesis information: %w", err)
|
return api.CirculatingSupply{}, xerrors.Errorf("failed to setup genesis information: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/account"
|
"github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||||
@ -293,14 +293,8 @@ func StateMinerInfo(ctx context.Context, sm *StateManager, ts *types.TipSet, mad
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetMinerSlashed(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (bool, error) {
|
func GetMinerSlashed(ctx context.Context, sm *StateManager, ts *types.TipSet, maddr address.Address) (bool, error) {
|
||||||
var mas miner.State
|
|
||||||
_, err := sm.LoadActorState(ctx, maddr, &mas, ts)
|
|
||||||
if err != nil {
|
|
||||||
return false, xerrors.Errorf("(get miner slashed) failed to load miner actor state")
|
|
||||||
}
|
|
||||||
|
|
||||||
var spas power.State
|
var spas power.State
|
||||||
_, err = sm.LoadActorState(ctx, builtin.StoragePowerActorAddr, &spas, ts)
|
_, err := sm.LoadActorState(ctx, builtin.StoragePowerActorAddr, &spas, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, xerrors.Errorf("(get miner slashed) failed to load power actor state")
|
return false, xerrors.Errorf("(get miner slashed) failed to load power actor state")
|
||||||
}
|
}
|
||||||
|
@ -7,11 +7,26 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
)
|
)
|
||||||
|
|
||||||
func computeNextBaseFee(baseFee types.BigInt, gasLimitUsed int64, noOfBlocks int) types.BigInt {
|
func computeNextBaseFee(baseFee types.BigInt, gasLimitUsed int64, noOfBlocks int) types.BigInt {
|
||||||
delta := gasLimitUsed/int64(noOfBlocks) - build.BlockGasTarget
|
// deta := 1/PackingEfficiency * gasLimitUsed/noOfBlocks - build.BlockGasTarget
|
||||||
|
// change := baseFee * deta / BlockGasTarget / BaseFeeMaxChangeDenom
|
||||||
|
// nextBaseFee = baseFee + change
|
||||||
|
// nextBaseFee = max(nextBaseFee, build.MinimumBaseFee)
|
||||||
|
|
||||||
|
delta := build.PackingEfficiencyDenom * gasLimitUsed / (int64(noOfBlocks) * build.PackingEfficiencyNum)
|
||||||
|
delta -= build.BlockGasTarget
|
||||||
|
|
||||||
|
// cap change at 12.5% (BaseFeeMaxChangeDenom) by capping delta
|
||||||
|
if delta > build.BlockGasTarget {
|
||||||
|
delta = build.BlockGasTarget
|
||||||
|
}
|
||||||
|
if delta < -build.BlockGasTarget {
|
||||||
|
delta = -build.BlockGasTarget
|
||||||
|
}
|
||||||
|
|
||||||
change := big.Mul(baseFee, big.NewInt(delta))
|
change := big.Mul(baseFee, big.NewInt(delta))
|
||||||
change = big.Div(change, big.NewInt(build.BlockGasTarget))
|
change = big.Div(change, big.NewInt(build.BlockGasTarget))
|
||||||
@ -26,17 +41,30 @@ func computeNextBaseFee(baseFee types.BigInt, gasLimitUsed int64, noOfBlocks int
|
|||||||
|
|
||||||
func (cs *ChainStore) ComputeBaseFee(ctx context.Context, ts *types.TipSet) (abi.TokenAmount, error) {
|
func (cs *ChainStore) ComputeBaseFee(ctx context.Context, ts *types.TipSet) (abi.TokenAmount, error) {
|
||||||
zero := abi.NewTokenAmount(0)
|
zero := abi.NewTokenAmount(0)
|
||||||
|
|
||||||
|
// totalLimit is sum of GasLimits of unique messages in a tipset
|
||||||
totalLimit := int64(0)
|
totalLimit := int64(0)
|
||||||
|
|
||||||
|
seen := make(map[cid.Cid]struct{})
|
||||||
|
|
||||||
for _, b := range ts.Blocks() {
|
for _, b := range ts.Blocks() {
|
||||||
msg1, msg2, err := cs.MessagesForBlock(b)
|
msg1, msg2, err := cs.MessagesForBlock(b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return zero, xerrors.Errorf("error getting messages for: %s: %w", b.Cid(), err)
|
return zero, xerrors.Errorf("error getting messages for: %s: %w", b.Cid(), err)
|
||||||
}
|
}
|
||||||
for _, m := range msg1 {
|
for _, m := range msg1 {
|
||||||
|
c := m.Cid()
|
||||||
|
if _, ok := seen[c]; !ok {
|
||||||
totalLimit += m.GasLimit
|
totalLimit += m.GasLimit
|
||||||
|
seen[c] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
for _, m := range msg2 {
|
for _, m := range msg2 {
|
||||||
|
c := m.Cid()
|
||||||
|
if _, ok := seen[c]; !ok {
|
||||||
totalLimit += m.Message.GasLimit
|
totalLimit += m.Message.GasLimit
|
||||||
|
seen[c] = struct{}{}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
parentBaseFee := ts.Blocks()[0].ParentBaseFee
|
parentBaseFee := ts.Blocks()[0].ParentBaseFee
|
||||||
|
@ -18,10 +18,10 @@ func TestBaseFee(t *testing.T) {
|
|||||||
}{
|
}{
|
||||||
{100e6, 0, 1, 87.5e6},
|
{100e6, 0, 1, 87.5e6},
|
||||||
{100e6, 0, 5, 87.5e6},
|
{100e6, 0, 5, 87.5e6},
|
||||||
{100e6, build.BlockGasTarget, 1, 100e6},
|
{100e6, build.BlockGasTarget, 1, 103.125e6},
|
||||||
{100e6, build.BlockGasTarget * 2, 2, 100e6},
|
{100e6, build.BlockGasTarget * 2, 2, 103.125e6},
|
||||||
{100e6, build.BlockGasLimit * 2, 2, 112.5e6},
|
{100e6, build.BlockGasLimit * 2, 2, 112.5e6},
|
||||||
{100e6, build.BlockGasLimit * 1.5, 2, 106.25e6},
|
{100e6, build.BlockGasLimit * 1.5, 2, 110937500},
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, test := range tests {
|
for _, test := range tests {
|
||||||
|
@ -1177,15 +1177,20 @@ func (cs *ChainStore) Export(ctx context.Context, ts *types.TipSet, w io.Writer)
|
|||||||
return xerrors.Errorf("unmarshaling block header (cid=%s): %w", blk, err)
|
return xerrors.Errorf("unmarshaling block header (cid=%s): %w", blk, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, p := range b.Parents {
|
|
||||||
blocksToWalk = append(blocksToWalk, p)
|
|
||||||
}
|
|
||||||
|
|
||||||
cids, err := recurseLinks(cs.bs, b.Messages, []cid.Cid{b.Messages})
|
cids, err := recurseLinks(cs.bs, b.Messages, []cid.Cid{b.Messages})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("recursing messages failed: %w", err)
|
return xerrors.Errorf("recursing messages failed: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
if b.Height > 0 {
|
||||||
|
for _, p := range b.Parents {
|
||||||
|
blocksToWalk = append(blocksToWalk, p)
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
// include the genesis block
|
||||||
|
cids = append(cids, b.Parents...)
|
||||||
|
}
|
||||||
|
|
||||||
out := cids
|
out := cids
|
||||||
|
|
||||||
if b.Height == 0 {
|
if b.Height == 0 {
|
||||||
|
@ -195,6 +195,8 @@ func fetchCids(
|
|||||||
}
|
}
|
||||||
|
|
||||||
type BlockValidator struct {
|
type BlockValidator struct {
|
||||||
|
self peer.ID
|
||||||
|
|
||||||
peers *lru.TwoQueueCache
|
peers *lru.TwoQueueCache
|
||||||
|
|
||||||
killThresh int
|
killThresh int
|
||||||
@ -211,9 +213,10 @@ type BlockValidator struct {
|
|||||||
keycache map[string]address.Address
|
keycache map[string]address.Address
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewBlockValidator(chain *store.ChainStore, stmgr *stmgr.StateManager, blacklist func(peer.ID)) *BlockValidator {
|
func NewBlockValidator(self peer.ID, chain *store.ChainStore, stmgr *stmgr.StateManager, blacklist func(peer.ID)) *BlockValidator {
|
||||||
p, _ := lru.New2Q(4096)
|
p, _ := lru.New2Q(4096)
|
||||||
return &BlockValidator{
|
return &BlockValidator{
|
||||||
|
self: self,
|
||||||
peers: p,
|
peers: p,
|
||||||
killThresh: 10,
|
killThresh: 10,
|
||||||
blacklist: blacklist,
|
blacklist: blacklist,
|
||||||
@ -243,6 +246,10 @@ func (bv *BlockValidator) flagPeer(p peer.ID) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) pubsub.ValidationResult {
|
func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) pubsub.ValidationResult {
|
||||||
|
if pid == bv.self {
|
||||||
|
return bv.validateLocalBlock(ctx, msg)
|
||||||
|
}
|
||||||
|
|
||||||
// track validation time
|
// track validation time
|
||||||
begin := build.Clock.Now()
|
begin := build.Clock.Now()
|
||||||
defer func() {
|
defer func() {
|
||||||
@ -257,25 +264,10 @@ func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub
|
|||||||
bv.flagPeer(pid)
|
bv.flagPeer(pid)
|
||||||
}
|
}
|
||||||
|
|
||||||
// make sure the block can be decoded
|
blk, what, err := bv.decodeAndCheckBlock(msg)
|
||||||
blk, err := types.DecodeBlockMsg(msg.GetData())
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error("got invalid block over pubsub: ", err)
|
log.Error("got invalid block over pubsub: ", err)
|
||||||
recordFailure("invalid")
|
recordFailure(what)
|
||||||
return pubsub.ValidationReject
|
|
||||||
}
|
|
||||||
|
|
||||||
// check the message limit constraints
|
|
||||||
if len(blk.BlsMessages)+len(blk.SecpkMessages) > build.BlockMessageLimit {
|
|
||||||
log.Warnf("received block with too many messages over pubsub")
|
|
||||||
recordFailure("too_many_messages")
|
|
||||||
return pubsub.ValidationReject
|
|
||||||
}
|
|
||||||
|
|
||||||
// make sure we have a signature
|
|
||||||
if blk.Header.BlockSig == nil {
|
|
||||||
log.Warnf("received block without a signature over pubsub")
|
|
||||||
recordFailure("missing_signature")
|
|
||||||
return pubsub.ValidationReject
|
return pubsub.ValidationReject
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -332,6 +324,45 @@ func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub
|
|||||||
return pubsub.ValidationAccept
|
return pubsub.ValidationAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (bv *BlockValidator) validateLocalBlock(ctx context.Context, msg *pubsub.Message) pubsub.ValidationResult {
|
||||||
|
stats.Record(ctx, metrics.BlockPublished.M(1))
|
||||||
|
|
||||||
|
blk, what, err := bv.decodeAndCheckBlock(msg)
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("got invalid local block: %s", err)
|
||||||
|
ctx, _ = tag.New(ctx, tag.Insert(metrics.FailureType, what))
|
||||||
|
stats.Record(ctx, metrics.BlockValidationFailure.M(1))
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
if count := bv.recvBlocks.add(blk.Header.Cid()); count > 0 {
|
||||||
|
log.Warnf("local block has been seen %d times; ignoring", count)
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.ValidatorData = blk
|
||||||
|
stats.Record(ctx, metrics.BlockValidationSuccess.M(1))
|
||||||
|
return pubsub.ValidationAccept
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bv *BlockValidator) decodeAndCheckBlock(msg *pubsub.Message) (*types.BlockMsg, string, error) {
|
||||||
|
blk, err := types.DecodeBlockMsg(msg.GetData())
|
||||||
|
if err != nil {
|
||||||
|
return nil, "invalid", xerrors.Errorf("error decoding block: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
if count := len(blk.BlsMessages) + len(blk.SecpkMessages); count > build.BlockMessageLimit {
|
||||||
|
return nil, "too_many_messages", fmt.Errorf("block contains too many messages (%d)", count)
|
||||||
|
}
|
||||||
|
|
||||||
|
// make sure we have a signature
|
||||||
|
if blk.Header.BlockSig == nil {
|
||||||
|
return nil, "missing_signature", fmt.Errorf("block without a signature")
|
||||||
|
}
|
||||||
|
|
||||||
|
return blk, "", nil
|
||||||
|
}
|
||||||
|
|
||||||
func (bv *BlockValidator) isChainNearSynced() bool {
|
func (bv *BlockValidator) isChainNearSynced() bool {
|
||||||
ts := bv.chain.GetHeaviestTipSet()
|
ts := bv.chain.GetHeaviestTipSet()
|
||||||
timestamp := ts.MinTimestamp()
|
timestamp := ts.MinTimestamp()
|
||||||
@ -485,14 +516,19 @@ func (brc *blockReceiptCache) add(bcid cid.Cid) int {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type MessageValidator struct {
|
type MessageValidator struct {
|
||||||
|
self peer.ID
|
||||||
mpool *messagepool.MessagePool
|
mpool *messagepool.MessagePool
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMessageValidator(mp *messagepool.MessagePool) *MessageValidator {
|
func NewMessageValidator(self peer.ID, mp *messagepool.MessagePool) *MessageValidator {
|
||||||
return &MessageValidator{mp}
|
return &MessageValidator{self: self, mpool: mp}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) pubsub.ValidationResult {
|
func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) pubsub.ValidationResult {
|
||||||
|
if pid == mv.self {
|
||||||
|
return mv.validateLocalMessage(ctx, msg)
|
||||||
|
}
|
||||||
|
|
||||||
stats.Record(ctx, metrics.MessageReceived.M(1))
|
stats.Record(ctx, metrics.MessageReceived.M(1))
|
||||||
m, err := types.DecodeSignedMessage(msg.Message.GetData())
|
m, err := types.DecodeSignedMessage(msg.Message.GetData())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -520,6 +556,45 @@ func (mv *MessageValidator) Validate(ctx context.Context, pid peer.ID, msg *pubs
|
|||||||
return pubsub.ValidationAccept
|
return pubsub.ValidationAccept
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (mv *MessageValidator) validateLocalMessage(ctx context.Context, msg *pubsub.Message) pubsub.ValidationResult {
|
||||||
|
// do some lightweight validation
|
||||||
|
stats.Record(ctx, metrics.MessagePublished.M(1))
|
||||||
|
|
||||||
|
m, err := types.DecodeSignedMessage(msg.Message.GetData())
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("failed to decode local message: %s", err)
|
||||||
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Size() > 32*1024 {
|
||||||
|
log.Warnf("local message is too large! (%dB)", m.Size())
|
||||||
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
if m.Message.To == address.Undef {
|
||||||
|
log.Warn("local message has invalid destination address")
|
||||||
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
if !m.Message.Value.LessThan(types.TotalFilecoinInt) {
|
||||||
|
log.Warnf("local messages has too high value: %s", m.Message.Value)
|
||||||
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := mv.mpool.VerifyMsgSig(m); err != nil {
|
||||||
|
log.Warnf("signature verification failed for local message: %s", err)
|
||||||
|
stats.Record(ctx, metrics.MessageValidationFailure.M(1))
|
||||||
|
return pubsub.ValidationIgnore
|
||||||
|
}
|
||||||
|
|
||||||
|
stats.Record(ctx, metrics.MessageValidationSuccess.M(1))
|
||||||
|
return pubsub.ValidationAccept
|
||||||
|
}
|
||||||
|
|
||||||
func HandleIncomingMessages(ctx context.Context, mpool *messagepool.MessagePool, msub *pubsub.Subscription) {
|
func HandleIncomingMessages(ctx context.Context, mpool *messagepool.MessagePool, msub *pubsub.Subscription) {
|
||||||
for {
|
for {
|
||||||
_, err := msub.Next(ctx)
|
_, err := msub.Next(ctx)
|
||||||
|
@ -24,7 +24,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
|
@ -23,7 +23,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/runtime"
|
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -550,7 +550,7 @@ func interactiveDeal(cctx *cli.Context) error {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
a, err := api.ClientQueryAsk(ctx, mi.PeerId, maddr)
|
a, err := api.ClientQueryAsk(ctx, *mi.PeerId, maddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
printErr(xerrors.Errorf("failed to query ask: %w", err))
|
printErr(xerrors.Errorf("failed to query ask: %w", err))
|
||||||
state = "miner"
|
state = "miner"
|
||||||
@ -847,28 +847,28 @@ var clientRetrieveCmd = &cli.Command{
|
|||||||
Path: cctx.Args().Get(1),
|
Path: cctx.Args().Get(1),
|
||||||
IsCAR: cctx.Bool("car"),
|
IsCAR: cctx.Bool("car"),
|
||||||
}
|
}
|
||||||
updates, err := fapi.ClientRetrieve(ctx, offer.Order(payer), ref)
|
updates, err := fapi.ClientRetrieveWithEvents(ctx, offer.Order(payer), ref)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("error setting up retrieval: %w", err)
|
return xerrors.Errorf("error setting up retrieval: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
for {
|
for {
|
||||||
select {
|
select {
|
||||||
case evt, chOpen := <-updates:
|
case evt, ok := <-updates:
|
||||||
|
if ok {
|
||||||
fmt.Printf("> Recv: %s, Paid %s, %s (%s)\n",
|
fmt.Printf("> Recv: %s, Paid %s, %s (%s)\n",
|
||||||
types.SizeStr(types.NewInt(evt.BytesReceived)),
|
types.SizeStr(types.NewInt(evt.BytesReceived)),
|
||||||
types.FIL(evt.FundsSpent),
|
types.FIL(evt.FundsSpent),
|
||||||
retrievalmarket.ClientEvents[evt.Event],
|
retrievalmarket.ClientEvents[evt.Event],
|
||||||
retrievalmarket.DealStatuses[evt.Status],
|
retrievalmarket.DealStatuses[evt.Status],
|
||||||
)
|
)
|
||||||
|
} else {
|
||||||
if !chOpen {
|
|
||||||
fmt.Println("Success")
|
fmt.Println("Success")
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if evt.Err != "" {
|
if evt.Err != "" {
|
||||||
return xerrors.Errorf("retrieval failed: %v", err)
|
return xerrors.Errorf("retrieval failed: %s", evt.Err)
|
||||||
}
|
}
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return xerrors.Errorf("retrieval timed out")
|
return xerrors.Errorf("retrieval timed out")
|
||||||
@ -926,11 +926,11 @@ var clientQueryAskCmd = &cli.Command{
|
|||||||
return xerrors.Errorf("failed to get peerID for miner: %w", err)
|
return xerrors.Errorf("failed to get peerID for miner: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if peer.ID(mi.PeerId) == peer.ID("SETME") {
|
if peer.ID(*mi.PeerId) == peer.ID("SETME") {
|
||||||
return fmt.Errorf("the miner hasn't initialized yet")
|
return fmt.Errorf("the miner hasn't initialized yet")
|
||||||
}
|
}
|
||||||
|
|
||||||
pid = peer.ID(mi.PeerId)
|
pid = peer.ID(*mi.PeerId)
|
||||||
}
|
}
|
||||||
|
|
||||||
ask, err := api.ClientQueryAsk(ctx, pid, maddr)
|
ask, err := api.ClientQueryAsk(ctx, pid, maddr)
|
||||||
|
12
cli/cmd.go
12
cli/cmd.go
@ -26,7 +26,7 @@ import (
|
|||||||
var log = logging.Logger("cli")
|
var log = logging.Logger("cli")
|
||||||
|
|
||||||
const (
|
const (
|
||||||
metadataTraceConetxt = "traceContext"
|
metadataTraceContext = "traceContext"
|
||||||
)
|
)
|
||||||
|
|
||||||
// custom CLI error
|
// custom CLI error
|
||||||
@ -132,7 +132,7 @@ func GetAPIInfo(ctx *cli.Context, t repo.RepoType) (APIInfo, error) {
|
|||||||
|
|
||||||
p, err := homedir.Expand(ctx.String(repoFlag))
|
p, err := homedir.Expand(ctx.String(repoFlag))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return APIInfo{}, xerrors.Errorf("cound not expand home dir (%s): %w", repoFlag, err)
|
return APIInfo{}, xerrors.Errorf("could not expand home dir (%s): %w", repoFlag, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
r, err := repo.NewFS(p)
|
r, err := repo.NewFS(p)
|
||||||
@ -198,17 +198,17 @@ func GetFullNodeAPI(ctx *cli.Context) (api.FullNode, jsonrpc.ClientCloser, error
|
|||||||
return client.NewFullNodeRPC(addr, headers)
|
return client.NewFullNodeRPC(addr, headers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetStorageMinerAPI(ctx *cli.Context) (api.StorageMiner, jsonrpc.ClientCloser, error) {
|
func GetStorageMinerAPI(ctx *cli.Context, opts ...jsonrpc.Option) (api.StorageMiner, jsonrpc.ClientCloser, error) {
|
||||||
addr, headers, err := GetRawAPI(ctx, repo.StorageMiner)
|
addr, headers, err := GetRawAPI(ctx, repo.StorageMiner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, err
|
return nil, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return client.NewStorageMinerRPC(addr, headers)
|
return client.NewStorageMinerRPC(addr, headers, opts...)
|
||||||
}
|
}
|
||||||
|
|
||||||
func DaemonContext(cctx *cli.Context) context.Context {
|
func DaemonContext(cctx *cli.Context) context.Context {
|
||||||
if mtCtx, ok := cctx.App.Metadata[metadataTraceConetxt]; ok {
|
if mtCtx, ok := cctx.App.Metadata[metadataTraceContext]; ok {
|
||||||
return mtCtx.(context.Context)
|
return mtCtx.(context.Context)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,6 +238,7 @@ var CommonCommands = []*cli.Command{
|
|||||||
logCmd,
|
logCmd,
|
||||||
waitApiCmd,
|
waitApiCmd,
|
||||||
fetchParamCmd,
|
fetchParamCmd,
|
||||||
|
pprofCmd,
|
||||||
VersionCmd,
|
VersionCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -256,6 +257,7 @@ var Commands = []*cli.Command{
|
|||||||
WithCategory("developer", fetchParamCmd),
|
WithCategory("developer", fetchParamCmd),
|
||||||
WithCategory("network", netCmd),
|
WithCategory("network", netCmd),
|
||||||
WithCategory("network", syncCmd),
|
WithCategory("network", syncCmd),
|
||||||
|
pprofCmd,
|
||||||
VersionCmd,
|
VersionCmd,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
46
cli/mpool.go
46
cli/mpool.go
@ -24,6 +24,7 @@ var mpoolCmd = &cli.Command{
|
|||||||
mpoolStat,
|
mpoolStat,
|
||||||
mpoolReplaceCmd,
|
mpoolReplaceCmd,
|
||||||
mpoolFindCmd,
|
mpoolFindCmd,
|
||||||
|
mpoolConfig,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -415,3 +416,48 @@ var mpoolFindCmd = &cli.Command{
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var mpoolConfig = &cli.Command{
|
||||||
|
Name: "config",
|
||||||
|
Usage: "get or set current mpool configuration",
|
||||||
|
ArgsUsage: "[new-config]",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
if cctx.Args().Len() > 1 {
|
||||||
|
return cli.ShowCommandHelp(cctx, cctx.Command.Name)
|
||||||
|
}
|
||||||
|
|
||||||
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
if cctx.Args().Len() == 0 {
|
||||||
|
cfg, err := api.MpoolGetConfig(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
bytes, err := json.Marshal(cfg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(string(bytes))
|
||||||
|
} else {
|
||||||
|
cfg := new(types.MpoolConfig)
|
||||||
|
bytes := []byte(cctx.Args().Get(0))
|
||||||
|
|
||||||
|
err := json.Unmarshal(bytes, cfg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return api.MpoolSetConfig(ctx, cfg)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
@ -222,8 +222,8 @@ var NetReachability = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
fmt.Println("AutoNAT status: ", i.Reachability.String())
|
fmt.Println("AutoNAT status: ", i.Reachability.String())
|
||||||
if i.PublicAddr != nil {
|
if i.PublicAddr != "" {
|
||||||
fmt.Println("Public address: ", i.PublicAddr.String())
|
fmt.Println("Public address: ", i.PublicAddr)
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
|
58
cli/pprof.go
Normal file
58
cli/pprof.go
Normal file
@ -0,0 +1,58 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"io"
|
||||||
|
"net/http"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
|
manet "github.com/multiformats/go-multiaddr-net"
|
||||||
|
)
|
||||||
|
|
||||||
|
var pprofCmd = &cli.Command{
|
||||||
|
Name: "pprof",
|
||||||
|
Hidden: true,
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
PprofGoroutines,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var PprofGoroutines = &cli.Command{
|
||||||
|
Name: "goroutines",
|
||||||
|
Usage: "Get goroutine stacks",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
ti, ok := cctx.App.Metadata["repoType"]
|
||||||
|
if !ok {
|
||||||
|
log.Errorf("unknown repo type, are you sure you want to use GetAPI?")
|
||||||
|
ti = repo.FullNode
|
||||||
|
}
|
||||||
|
t, ok := ti.(repo.RepoType)
|
||||||
|
if !ok {
|
||||||
|
log.Errorf("repoType type does not match the type of repo.RepoType")
|
||||||
|
}
|
||||||
|
ainfo, err := GetAPIInfo(cctx, t)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("could not get API info: %w", err)
|
||||||
|
}
|
||||||
|
_, addr, err := manet.DialArgs(ainfo.Addr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
addr = "http://" + addr + "/debug/pprof/goroutine?debug=2"
|
||||||
|
|
||||||
|
r, err := http.Get(addr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := io.Copy(os.Stdout, r.Body); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
return r.Body.Close()
|
||||||
|
},
|
||||||
|
}
|
@ -25,7 +25,7 @@ import (
|
|||||||
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||||
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/ipfs/go-datastore"
|
"github.com/ipfs/go-datastore"
|
||||||
|
@ -21,9 +21,9 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper/basicfs"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
@ -14,7 +14,7 @@ func main() {
|
|||||||
if err := logging.SetLogLevel("*", "info"); err != nil {
|
if err := logging.SetLogLevel("*", "info"); err != nil {
|
||||||
log.Fatal(err)
|
log.Fatal(err)
|
||||||
}
|
}
|
||||||
log.Info("Starting chainwatch")
|
log.Info("Starting chainwatch", " v", build.UserVersion())
|
||||||
|
|
||||||
app := &cli.App{
|
app := &cli.App{
|
||||||
Name: "lotus-chainwatch",
|
Name: "lotus-chainwatch",
|
||||||
|
@ -8,8 +8,6 @@ import (
|
|||||||
"golang.org/x/sync/errgroup"
|
"golang.org/x/sync/errgroup"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/chain/events/state"
|
"github.com/filecoin-project/lotus/chain/events/state"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
@ -17,6 +15,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
_init "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
_init "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
typegen "github.com/whyrusleeping/cbor-gen"
|
typegen "github.com/whyrusleeping/cbor-gen"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -232,20 +231,24 @@ func (p *Processor) storeActorHeads(actors map[cid.Cid]ActorTips) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := tx.Exec(`
|
if _, err := tx.Exec(`
|
||||||
create temp table a (like actors excluding constraints) on commit drop;
|
create temp table a_tmp (like actors excluding constraints) on commit drop;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return xerrors.Errorf("prep temp: %w", err)
|
return xerrors.Errorf("prep temp: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt, err := tx.Prepare(`copy a (id, code, head, nonce, balance, stateroot) from stdin `)
|
stmt, err := tx.Prepare(`copy a_tmp (id, code, head, nonce, balance, stateroot) from stdin `)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for code, actTips := range actors {
|
for code, actTips := range actors {
|
||||||
|
actorName := code.String()
|
||||||
|
if builtin.IsBuiltinActor(code) {
|
||||||
|
actorName = builtin.ActorNameByCode(code)
|
||||||
|
}
|
||||||
for _, actorInfo := range actTips {
|
for _, actorInfo := range actTips {
|
||||||
for _, a := range actorInfo {
|
for _, a := range actorInfo {
|
||||||
if _, err := stmt.Exec(a.addr.String(), code.String(), a.act.Head.String(), a.act.Nonce, a.act.Balance.String(), a.stateroot.String()); err != nil {
|
if _, err := stmt.Exec(a.addr.String(), actorName, a.act.Head.String(), a.act.Nonce, a.act.Balance.String(), a.stateroot.String()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -256,7 +259,7 @@ func (p *Processor) storeActorHeads(actors map[cid.Cid]ActorTips) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := tx.Exec(`insert into actors select * from a on conflict do nothing `); err != nil {
|
if _, err := tx.Exec(`insert into actors select * from a_tmp on conflict do nothing `); err != nil {
|
||||||
return xerrors.Errorf("actor put: %w", err)
|
return xerrors.Errorf("actor put: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -274,20 +277,24 @@ func (p *Processor) storeActorStates(actors map[cid.Cid]ActorTips) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := tx.Exec(`
|
if _, err := tx.Exec(`
|
||||||
create temp table a (like actor_states excluding constraints) on commit drop;
|
create temp table as_tmp (like actor_states excluding constraints) on commit drop;
|
||||||
`); err != nil {
|
`); err != nil {
|
||||||
return xerrors.Errorf("prep temp: %w", err)
|
return xerrors.Errorf("prep temp: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
stmt, err := tx.Prepare(`copy a (head, code, state) from stdin `)
|
stmt, err := tx.Prepare(`copy as_tmp (head, code, state) from stdin `)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
for code, actTips := range actors {
|
for code, actTips := range actors {
|
||||||
|
actorName := code.String()
|
||||||
|
if builtin.IsBuiltinActor(code) {
|
||||||
|
actorName = builtin.ActorNameByCode(code)
|
||||||
|
}
|
||||||
for _, actorInfo := range actTips {
|
for _, actorInfo := range actTips {
|
||||||
for _, a := range actorInfo {
|
for _, a := range actorInfo {
|
||||||
if _, err := stmt.Exec(a.act.Head.String(), code.String(), a.state); err != nil {
|
if _, err := stmt.Exec(a.act.Head.String(), actorName, a.state); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -298,7 +305,7 @@ func (p *Processor) storeActorStates(actors map[cid.Cid]ActorTips) error {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := tx.Exec(`insert into actor_states select * from a on conflict do nothing `); err != nil {
|
if _, err := tx.Exec(`insert into actor_states select * from as_tmp on conflict do nothing `); err != nil {
|
||||||
return xerrors.Errorf("actor put: %w", err)
|
return xerrors.Errorf("actor put: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -879,11 +879,15 @@ func (p *Processor) storeMinersActorInfoState(ctx context.Context, miners []mine
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
var pid string
|
||||||
|
if mi.PeerId != nil {
|
||||||
|
pid = mi.PeerId.String()
|
||||||
|
}
|
||||||
if _, err := stmt.Exec(
|
if _, err := stmt.Exec(
|
||||||
m.common.addr.String(),
|
m.common.addr.String(),
|
||||||
mi.Owner.String(),
|
mi.Owner.String(),
|
||||||
mi.Worker.String(),
|
mi.Worker.String(),
|
||||||
mi.PeerId.String(),
|
pid,
|
||||||
mi.SectorSize.ShortString(),
|
mi.SectorSize.ShortString(),
|
||||||
); err != nil {
|
); err != nil {
|
||||||
log.Errorw("failed to store miner state", "state", m.state, "info", m.state.Info, "error", err)
|
log.Errorw("failed to store miner state", "state", m.state, "info", m.state.Info, "error", err)
|
||||||
|
@ -30,11 +30,10 @@ func (p *Processor) subMpool(ctx context.Context) {
|
|||||||
|
|
||||||
loop:
|
loop:
|
||||||
for {
|
for {
|
||||||
time.Sleep(10 * time.Millisecond)
|
|
||||||
select {
|
select {
|
||||||
case update := <-sub:
|
case update := <-sub:
|
||||||
updates = append(updates, update)
|
updates = append(updates, update)
|
||||||
default:
|
case <-time.After(10 * time.Millisecond):
|
||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -336,16 +336,19 @@ where rnk <= $1
|
|||||||
}
|
}
|
||||||
var c string
|
var c string
|
||||||
if err := rows.Scan(&c); err != nil {
|
if err := rows.Scan(&c); err != nil {
|
||||||
return nil, xerrors.Errorf("Failed to scan unprocessed blocks: %w", err)
|
log.Errorf("Failed to scan unprocessed blocks: %s", err.Error())
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
ci, err := cid.Parse(c)
|
ci, err := cid.Parse(c)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("Failed to parse unprocessed blocks: %w", err)
|
log.Errorf("Failed to parse unprocessed blocks: %s", err.Error())
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
bh, err := p.node.ChainGetBlock(ctx, ci)
|
bh, err := p.node.ChainGetBlock(ctx, ci)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// this is a pretty serious issue.
|
// this is a pretty serious issue.
|
||||||
return nil, xerrors.Errorf("Failed to get block header %s: %w", ci.String(), err)
|
log.Errorf("Failed to get block header %s: %s", ci.String(), err.Error())
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
out[ci] = bh
|
out[ci] = bh
|
||||||
if bh.Height < minBlock {
|
if bh.Height < minBlock {
|
||||||
|
@ -46,7 +46,11 @@ create table if not exists chain_economics
|
|||||||
(
|
(
|
||||||
parent_state_root text not null
|
parent_state_root text not null
|
||||||
constraint chain_economics_pk primary key,
|
constraint chain_economics_pk primary key,
|
||||||
circulating_fil text not null
|
circulating_fil text not null,
|
||||||
|
vested_fil text not null,
|
||||||
|
mined_fil text not null,
|
||||||
|
burnt_fil text not null,
|
||||||
|
locked_fil text not null
|
||||||
);
|
);
|
||||||
|
|
||||||
create table if not exists block_cids
|
create table if not exists block_cids
|
||||||
@ -235,7 +239,7 @@ func (s *Syncer) unsyncedBlocks(ctx context.Context, head *types.TipSet, since t
|
|||||||
log.Debugw("To visit", "toVisit", toVisit.Len(), "toSync", len(toSync), "current_height", bh.Height)
|
log.Debugw("To visit", "toVisit", toVisit.Len(), "toSync", len(toSync), "current_height", bh.Height)
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(bh.Parents) == 0 {
|
if bh.Height == 0 {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -283,12 +287,16 @@ func (s *Syncer) storeCirculatingSupply(ctx context.Context, tipset *types.TipSe
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ceInsert := `insert into chain_economics (parent_state_root, circulating_fil) values ('%s', '%s');`
|
ceInsert := `insert into chain_economics (parent_state_root, circulating_fil, vested_fil, mined_fil, burnt_fil, locked_fil)` +
|
||||||
|
`values ('%s', '%s', '%s', '%s', '%s', '%s');`
|
||||||
|
|
||||||
if _, err := s.db.Exec(fmt.Sprintf(ceInsert,
|
if _, err := s.db.Exec(fmt.Sprintf(ceInsert,
|
||||||
tipset.ParentState().String(),
|
tipset.ParentState().String(),
|
||||||
// TODO: Include all the details maybe?
|
|
||||||
supply.FilCirculating.String(),
|
supply.FilCirculating.String(),
|
||||||
|
supply.FilVested.String(),
|
||||||
|
supply.FilMined.String(),
|
||||||
|
supply.FilBurnt.String(),
|
||||||
|
supply.FilLocked.String(),
|
||||||
)); err != nil {
|
)); err != nil {
|
||||||
return xerrors.Errorf("insert circulating supply for tipset (%s): %w", tipset.Key().String(), err)
|
return xerrors.Errorf("insert circulating supply for tipset (%s): %w", tipset.Key().String(), err)
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,7 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
76
cmd/lotus-keygen/main.go
Normal file
76
cmd/lotus-keygen/main.go
Normal file
@ -0,0 +1,76 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"encoding/json"
|
||||||
|
"fmt"
|
||||||
|
"os"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
func main() {
|
||||||
|
|
||||||
|
app := cli.NewApp()
|
||||||
|
app.Flags = []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "type",
|
||||||
|
Aliases: []string{"t"},
|
||||||
|
Value: "bls",
|
||||||
|
Usage: "specify key type to generate (bls or secp256k1)",
|
||||||
|
},
|
||||||
|
}
|
||||||
|
app.Action = func(cctx *cli.Context) error {
|
||||||
|
memks := wallet.NewMemKeyStore()
|
||||||
|
w, err := wallet.NewWallet(memks)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
var kt crypto.SigType
|
||||||
|
switch cctx.String("type") {
|
||||||
|
case "bls":
|
||||||
|
kt = crypto.SigTypeBLS
|
||||||
|
case "secp256k1":
|
||||||
|
kt = crypto.SigTypeSecp256k1
|
||||||
|
default:
|
||||||
|
return fmt.Errorf("unrecognized key type: %q", cctx.String("type"))
|
||||||
|
}
|
||||||
|
|
||||||
|
kaddr, err := w.GenerateKey(kt)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
ki, err := w.Export(kaddr)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fi, err := os.Create(fmt.Sprintf("%s.key", kaddr))
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer fi.Close()
|
||||||
|
|
||||||
|
b, err := json.Marshal(ki)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if _, err := fi.Write(b); err != nil {
|
||||||
|
return fmt.Errorf("failed to write key info to file: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println("Generated new key: ", kaddr)
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := app.Run(os.Args); err != nil {
|
||||||
|
fmt.Println(err)
|
||||||
|
os.Exit(1)
|
||||||
|
}
|
||||||
|
}
|
@ -10,6 +10,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strconv"
|
"strconv"
|
||||||
|
"time"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
@ -20,6 +21,7 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"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"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
"github.com/filecoin-project/specs-actors/actors/runtime/exitcode"
|
||||||
@ -70,16 +72,24 @@ func main() {
|
|||||||
EnvVars: []string{"LOTUS_PCR_PATH"},
|
EnvVars: []string{"LOTUS_PCR_PATH"},
|
||||||
Value: "~/.lotuspcr", // TODO: Consider XDG_DATA_HOME
|
Value: "~/.lotuspcr", // TODO: Consider XDG_DATA_HOME
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "log-level",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_LOG_LEVEL"},
|
||||||
|
Hidden: true,
|
||||||
|
Value: "info",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Before: func(cctx *cli.Context) error {
|
||||||
|
return logging.SetLogLevel("main", cctx.String("log-level"))
|
||||||
},
|
},
|
||||||
|
|
||||||
Commands: local,
|
Commands: local,
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := app.Run(os.Args); err != nil {
|
if err := app.Run(os.Args); err != nil {
|
||||||
log.Warn(err)
|
log.Errorw("exit in error", "err", err)
|
||||||
|
os.Exit(1)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
var versionCmd = &cli.Command{
|
var versionCmd = &cli.Command{
|
||||||
@ -90,6 +100,7 @@ var versionCmd = &cli.Command{
|
|||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
var runCmd = &cli.Command{
|
var runCmd = &cli.Command{
|
||||||
Name: "run",
|
Name: "run",
|
||||||
Usage: "Start message reimpursement",
|
Usage: "Start message reimpursement",
|
||||||
@ -97,17 +108,34 @@ var runCmd = &cli.Command{
|
|||||||
&cli.StringFlag{
|
&cli.StringFlag{
|
||||||
Name: "from",
|
Name: "from",
|
||||||
EnvVars: []string{"LOTUS_PCR_FROM"},
|
EnvVars: []string{"LOTUS_PCR_FROM"},
|
||||||
|
Usage: "wallet address to send refund from",
|
||||||
},
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "no-sync",
|
Name: "no-sync",
|
||||||
EnvVars: []string{"LOTUS_PCR_NO_SYNC"},
|
EnvVars: []string{"LOTUS_PCR_NO_SYNC"},
|
||||||
|
Usage: "do not wait for chain sync to complete",
|
||||||
},
|
},
|
||||||
&cli.IntFlag{
|
&cli.IntFlag{
|
||||||
Name: "percent-extra",
|
Name: "percent-extra",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_PERCENT_EXTRA"},
|
||||||
|
Usage: "extra funds to send above the refund",
|
||||||
Value: 3,
|
Value: 3,
|
||||||
},
|
},
|
||||||
|
&cli.IntFlag{
|
||||||
|
Name: "max-message-queue",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_MAX_MESSAGE_QUEUE"},
|
||||||
|
Usage: "set the maximum number of messages that can be queue in the mpool",
|
||||||
|
Value: 3000,
|
||||||
|
},
|
||||||
|
&cli.BoolFlag{
|
||||||
|
Name: "dry-run",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_DRY_RUN"},
|
||||||
|
Usage: "do not send any messages",
|
||||||
|
Value: false,
|
||||||
|
},
|
||||||
&cli.IntFlag{
|
&cli.IntFlag{
|
||||||
Name: "head-delay",
|
Name: "head-delay",
|
||||||
|
EnvVars: []string{"LOTUS_PCR_HEAD_DELAY"},
|
||||||
Usage: "the number of tipsets to delay message processing to smooth chain reorgs",
|
Usage: "the number of tipsets to delay message processing to smooth chain reorgs",
|
||||||
Value: int(build.MessageConfidence),
|
Value: int(build.MessageConfidence),
|
||||||
},
|
},
|
||||||
@ -150,15 +178,52 @@ var runCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
percentExtra := cctx.Int("percent-extra")
|
percentExtra := cctx.Int("percent-extra")
|
||||||
|
maxMessageQueue := cctx.Int("max-message-queue")
|
||||||
|
dryRun := cctx.Bool("dry-run")
|
||||||
|
|
||||||
|
rf := &refunder{
|
||||||
|
api: api,
|
||||||
|
wallet: from,
|
||||||
|
percentExtra: percentExtra,
|
||||||
|
dryRun: dryRun,
|
||||||
|
}
|
||||||
|
|
||||||
for tipset := range tipsetsCh {
|
for tipset := range tipsetsCh {
|
||||||
if err := ProcessTipset(ctx, api, tipset, from, percentExtra); err != nil {
|
refunds, err := rf.ProcessTipset(ctx, tipset)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := rf.Refund(ctx, tipset, refunds); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := r.SetHeight(tipset.Height()); err != nil {
|
if err := r.SetHeight(tipset.Height()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
for {
|
||||||
|
msgs, err := api.MpoolPending(ctx, types.EmptyTSK)
|
||||||
|
if err != nil {
|
||||||
|
log.Warnw("failed to fetch pending messages", "err", err)
|
||||||
|
time.Sleep(time.Duration(int64(time.Second) * int64(build.BlockDelaySecs)))
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
count := 0
|
||||||
|
for _, msg := range msgs {
|
||||||
|
if msg.Message.From == from {
|
||||||
|
count = count + 1
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
if count < maxMessageQueue {
|
||||||
|
break
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Warnw("messages in mpool over max message queue", "message_count", count, "max_message_queue", maxMessageQueue)
|
||||||
|
time.Sleep(time.Duration(int64(time.Second) * int64(build.BlockDelaySecs)))
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
@ -167,6 +232,7 @@ var runCmd = &cli.Command{
|
|||||||
|
|
||||||
type MinersRefund struct {
|
type MinersRefund struct {
|
||||||
refunds map[address.Address]types.BigInt
|
refunds map[address.Address]types.BigInt
|
||||||
|
count int
|
||||||
}
|
}
|
||||||
|
|
||||||
func NewMinersRefund() *MinersRefund {
|
func NewMinersRefund() *MinersRefund {
|
||||||
@ -180,11 +246,13 @@ func (m *MinersRefund) Track(addr address.Address, value types.BigInt) {
|
|||||||
m.refunds[addr] = types.NewInt(0)
|
m.refunds[addr] = types.NewInt(0)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
m.count = m.count + 1
|
||||||
|
|
||||||
m.refunds[addr] = types.BigAdd(m.refunds[addr], value)
|
m.refunds[addr] = types.BigAdd(m.refunds[addr], value)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MinersRefund) Count() int {
|
func (m *MinersRefund) Count() int {
|
||||||
return len(m.refunds)
|
return m.count
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *MinersRefund) Miners() []address.Address {
|
func (m *MinersRefund) Miners() []address.Address {
|
||||||
@ -200,50 +268,58 @@ func (m *MinersRefund) GetRefund(addr address.Address) types.BigInt {
|
|||||||
return m.refunds[addr]
|
return m.refunds[addr]
|
||||||
}
|
}
|
||||||
|
|
||||||
type processTipSetApi interface {
|
type refunderNodeApi interface {
|
||||||
ChainGetParentMessages(ctx context.Context, blockCid cid.Cid) ([]api.Message, error)
|
ChainGetParentMessages(ctx context.Context, blockCid cid.Cid) ([]api.Message, error)
|
||||||
ChainGetParentReceipts(ctx context.Context, blockCid cid.Cid) ([]*types.MessageReceipt, error)
|
ChainGetParentReceipts(ctx context.Context, blockCid cid.Cid) ([]*types.MessageReceipt, error)
|
||||||
|
ChainGetTipSetByHeight(ctx context.Context, epoch abi.ChainEpoch, tsk types.TipSetKey) (*types.TipSet, error)
|
||||||
StateMinerInitialPledgeCollateral(ctx context.Context, addr address.Address, precommitInfo miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error)
|
StateMinerInitialPledgeCollateral(ctx context.Context, addr address.Address, precommitInfo miner.SectorPreCommitInfo, tsk types.TipSetKey) (types.BigInt, error)
|
||||||
|
StateSectorPreCommitInfo(ctx context.Context, addr address.Address, sector abi.SectorNumber, tsk types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error)
|
||||||
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
||||||
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error)
|
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *api.MessageSendSpec) (*types.SignedMessage, error)
|
||||||
GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error)
|
GasEstimateGasPremium(ctx context.Context, nblocksincl uint64, sender address.Address, gaslimit int64, tsk types.TipSetKey) (types.BigInt, error)
|
||||||
WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error)
|
WalletBalance(ctx context.Context, addr address.Address) (types.BigInt, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
func ProcessTipset(ctx context.Context, api processTipSetApi, tipset *types.TipSet, wallet address.Address, percentExtra int) error {
|
type refunder struct {
|
||||||
log.Infow("processing tipset", "height", tipset.Height(), "key", tipset.Key().String())
|
api refunderNodeApi
|
||||||
|
wallet address.Address
|
||||||
|
percentExtra int
|
||||||
|
dryRun bool
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet) (*MinersRefund, error) {
|
||||||
cids := tipset.Cids()
|
cids := tipset.Cids()
|
||||||
if len(cids) == 0 {
|
if len(cids) == 0 {
|
||||||
return fmt.Errorf("no cids in tipset")
|
log.Errorw("no cids in tipset", "height", tipset.Height(), "key", tipset.Key())
|
||||||
|
return nil, fmt.Errorf("no cids in tipset")
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs, err := api.ChainGetParentMessages(ctx, cids[0])
|
msgs, err := r.api.ChainGetParentMessages(ctx, cids[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorw("failed to get tipset parent messages", "err", err)
|
log.Errorw("failed to get tipset parent messages", "err", err, "height", tipset.Height(), "key", tipset.Key())
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
recps, err := api.ChainGetParentReceipts(ctx, cids[0])
|
recps, err := r.api.ChainGetParentReceipts(ctx, cids[0])
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorw("failed to get tipset parent receipts", "err", err)
|
log.Errorw("failed to get tipset parent receipts", "err", err, "height", tipset.Height(), "key", tipset.Key())
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
if len(msgs) != len(recps) {
|
if len(msgs) != len(recps) {
|
||||||
log.Errorw("message length does not match receipts length", "messages", len(msgs), "receipts", len(recps))
|
log.Errorw("message length does not match receipts length", "height", tipset.Height(), "key", tipset.Key(), "messages", len(msgs), "receipts", len(recps))
|
||||||
return nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
refunds := NewMinersRefund()
|
refunds := NewMinersRefund()
|
||||||
|
|
||||||
count := 0
|
refundValue := types.NewInt(0)
|
||||||
for i, msg := range msgs {
|
for i, msg := range msgs {
|
||||||
m := msg.Message
|
m := msg.Message
|
||||||
|
|
||||||
a, err := api.StateGetActor(ctx, m.To, tipset.Key())
|
a, err := r.api.StateGetActor(ctx, m.To, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnw("failed to look up state actor", "actor", m.To)
|
log.Warnw("failed to look up state actor", "height", tipset.Height(), "key", tipset.Key(), "actor", m.To)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -251,39 +327,87 @@ func ProcessTipset(ctx context.Context, api processTipSetApi, tipset *types.TipS
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
// we only care to look at PreCommitSector messages
|
var messageMethod string
|
||||||
if m.Method != builtin.MethodsMiner.PreCommitSector {
|
|
||||||
|
switch m.Method {
|
||||||
|
case builtin.MethodsMiner.ProveCommitSector:
|
||||||
|
messageMethod = "ProveCommitSector"
|
||||||
|
if recps[i].ExitCode != exitcode.Ok {
|
||||||
|
log.Debugw("skipping non-ok exitcode message", "method", messageMethod, "cid", msg.Cid, "miner", m.To, "exitcode", recps[i].ExitCode)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var proveCommitSector miner.ProveCommitSectorParams
|
||||||
|
if err := proveCommitSector.UnmarshalCBOR(bytes.NewBuffer(m.Params)); err != nil {
|
||||||
|
log.Warnw("failed to decode provecommit params", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
// We use the parent tipset key because precommit information is removed when ProveCommitSector is executed
|
||||||
|
precommitChainInfo, err := r.api.StateSectorPreCommitInfo(ctx, m.To, proveCommitSector.SectorNumber, tipset.Parents())
|
||||||
|
if err != nil {
|
||||||
|
log.Warnw("failed to get precommit info for sector", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To, "sector_number", proveCommitSector.SectorNumber)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
precommitTipset, err := r.api.ChainGetTipSetByHeight(ctx, precommitChainInfo.PreCommitEpoch, tipset.Key())
|
||||||
|
if err != nil {
|
||||||
|
log.Warnf("failed to lookup precommit epoch", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To, "sector_number", proveCommitSector.SectorNumber)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
collateral, err := r.api.StateMinerInitialPledgeCollateral(ctx, m.To, precommitChainInfo.Info, precommitTipset.Key())
|
||||||
|
if err != nil {
|
||||||
|
log.Warnw("failed to get initial pledge collateral", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To, "sector_number", proveCommitSector.SectorNumber)
|
||||||
|
}
|
||||||
|
|
||||||
|
collateral = big.Sub(collateral, precommitChainInfo.PreCommitDeposit)
|
||||||
|
if collateral.LessThan(big.Zero()) {
|
||||||
|
log.Debugw("skipping zero pledge collateral difference", "method", messageMethod, "cid", msg.Cid, "miner", m.To, "sector_number", proveCommitSector.SectorNumber)
|
||||||
|
continue
|
||||||
|
}
|
||||||
|
|
||||||
|
refundValue = collateral
|
||||||
|
case builtin.MethodsMiner.PreCommitSector:
|
||||||
|
messageMethod = "PreCommitSector"
|
||||||
|
|
||||||
if recps[i].ExitCode != exitcode.Ok {
|
if recps[i].ExitCode != exitcode.Ok {
|
||||||
log.Debugw("skipping non-ok exitcode message", "cid", msg.Cid.String(), "exitcode", recps[i].ExitCode)
|
log.Debugw("skipping non-ok exitcode message", "method", messageMethod, "cid", msg.Cid, "miner", m.To, "exitcode", recps[i].ExitCode)
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
var precommitInfo miner.SectorPreCommitInfo
|
var precommitInfo miner.SectorPreCommitInfo
|
||||||
if err := precommitInfo.UnmarshalCBOR(bytes.NewBuffer(m.Params)); err != nil {
|
if err := precommitInfo.UnmarshalCBOR(bytes.NewBuffer(m.Params)); err != nil {
|
||||||
log.Warnw("failed to decode precommit params", "err", err)
|
log.Warnw("failed to decode precommit params", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
refundValue, err := api.StateMinerInitialPledgeCollateral(ctx, m.To, precommitInfo, tipset.Key())
|
collateral, err := r.api.StateMinerInitialPledgeCollateral(ctx, m.To, precommitInfo, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnw("failed to calculate", "err", err)
|
log.Warnw("failed to calculate initial pledge collateral", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To, "sector_number", precommitInfo.SectorNumber)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
if percentExtra > 0 {
|
refundValue = collateral
|
||||||
refundValue = types.BigAdd(refundValue, types.BigDiv(refundValue, types.NewInt(100*uint64(percentExtra))))
|
default:
|
||||||
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infow("processing message", "from", m.From, "to", m.To, "value", m.Value.String(), "gas_fee_cap", m.GasFeeCap.String(), "gas_premium", m.GasPremium.String(), "gas_used", fmt.Sprintf("%d", recps[i].GasUsed), "refund", refundValue.String())
|
if r.percentExtra > 0 {
|
||||||
|
refundValue = types.BigAdd(refundValue, types.BigDiv(types.BigMul(refundValue, types.NewInt(100)), types.NewInt(uint64(r.percentExtra))))
|
||||||
|
}
|
||||||
|
|
||||||
|
log.Debugw("processing message", "method", messageMethod, "cid", msg.Cid, "from", m.From, "to", m.To, "value", m.Value, "gas_fee_cap", m.GasFeeCap, "gas_premium", m.GasPremium, "gas_used", recps[i].GasUsed, "refund", refundValue)
|
||||||
|
|
||||||
count = count + 1
|
|
||||||
refunds.Track(m.From, refundValue)
|
refunds.Track(m.From, refundValue)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
return refunds, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (r *refunder) Refund(ctx context.Context, tipset *types.TipSet, refunds *MinersRefund) error {
|
||||||
if refunds.Count() == 0 {
|
if refunds.Count() == 0 {
|
||||||
log.Debugw("no messages to refund in tipset")
|
log.Debugw("no messages to refund in tipset", "height", tipset.Height(), "key", tipset.Key())
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -294,15 +418,15 @@ func ProcessTipset(ctx context.Context, api processTipSetApi, tipset *types.TipS
|
|||||||
refundValue := refunds.GetRefund(maddr)
|
refundValue := refunds.GetRefund(maddr)
|
||||||
|
|
||||||
// We want to try and ensure these messages get mined quickly
|
// We want to try and ensure these messages get mined quickly
|
||||||
gasPremium, err := api.GasEstimateGasPremium(ctx, 0, wallet, 0, tipset.Key())
|
gasPremium, err := r.api.GasEstimateGasPremium(ctx, 0, r.wallet, 0, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnw("failed to estimate gas premium", "err", err)
|
log.Warnw("failed to estimate gas premium", "err", err, "height", tipset.Height(), "key", tipset.Key())
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
msg := &types.Message{
|
msg := &types.Message{
|
||||||
Value: refundValue,
|
Value: refundValue,
|
||||||
From: wallet,
|
From: r.wallet,
|
||||||
To: maddr,
|
To: maddr,
|
||||||
|
|
||||||
GasPremium: gasPremium,
|
GasPremium: gasPremium,
|
||||||
@ -312,32 +436,34 @@ func ProcessTipset(ctx context.Context, api processTipSetApi, tipset *types.TipS
|
|||||||
messages = append(messages, msg)
|
messages = append(messages, msg)
|
||||||
}
|
}
|
||||||
|
|
||||||
balance, err := api.WalletBalance(ctx, wallet)
|
balance, err := r.api.WalletBalance(ctx, r.wallet)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
log.Errorw("failed to get wallet balance", "err", err, "height", tipset.Height(), "key", tipset.Key())
|
||||||
return xerrors.Errorf("failed to get wallet balance :%w", err)
|
return xerrors.Errorf("failed to get wallet balance :%w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Calculate the minimum balance as the total refund we need to issue plus 5% to cover fees
|
// Calculate the minimum balance as the total refund we need to issue plus 5% to cover fees
|
||||||
minBalance := types.BigAdd(refundSum, types.BigDiv(refundSum, types.NewInt(500)))
|
minBalance := types.BigAdd(refundSum, types.BigDiv(refundSum, types.NewInt(500)))
|
||||||
if balance.LessThan(minBalance) {
|
if balance.LessThan(minBalance) {
|
||||||
log.Errorw("not sufficent funds to cover refunds", "balance", balance.String(), "refund_sum", refundSum.String(), "minimum_required", minBalance.String())
|
log.Errorw("not sufficent funds to cover refunds", "balance", balance, "refund_sum", refundSum, "minimum_required", minBalance)
|
||||||
return xerrors.Errorf("wallet does not have enough balance to cover refund")
|
return xerrors.Errorf("wallet does not have enough balance to cover refund")
|
||||||
}
|
}
|
||||||
|
|
||||||
failures := 0
|
failures := 0
|
||||||
refundSum.SetUint64(0)
|
refundSum.SetUint64(0)
|
||||||
for _, msg := range messages {
|
for _, msg := range messages {
|
||||||
if _, err = api.MpoolPushMessage(ctx, msg, nil); err != nil {
|
if !r.dryRun {
|
||||||
|
if _, err = r.api.MpoolPushMessage(ctx, msg, nil); err != nil {
|
||||||
log.Errorw("failed to MpoolPushMessage", "err", err, "msg", msg)
|
log.Errorw("failed to MpoolPushMessage", "err", err, "msg", msg)
|
||||||
failures = failures + 1
|
failures = failures + 1
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
refundSum = types.BigAdd(refundSum, msg.Value)
|
refundSum = types.BigAdd(refundSum, msg.Value)
|
||||||
}
|
}
|
||||||
|
|
||||||
log.Infow("tipset stats", "messages_sent", len(messages)-failures, "refund_sum", refundSum.String(), "messages_failures", failures)
|
log.Infow("tipset stats", "height", tipset.Height(), "key", tipset.Key(), "messages_sent", len(messages)-failures, "refund_sum", refundSum, "messages_failures", failures, "messages_processed", refunds.Count())
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -22,18 +22,18 @@ import (
|
|||||||
"github.com/filecoin-project/go-jsonrpc"
|
"github.com/filecoin-project/go-jsonrpc"
|
||||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/api/apistruct"
|
"github.com/filecoin-project/lotus/api/apistruct"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||||
"github.com/filecoin-project/lotus/lib/rpcenc"
|
"github.com/filecoin-project/lotus/lib/rpcenc"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
sectorstorage "github.com/filecoin-project/sector-storage"
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("main")
|
var log = logging.Logger("main")
|
||||||
@ -164,7 +164,9 @@ var runCmd = &cli.Command{
|
|||||||
var closer func()
|
var closer func()
|
||||||
var err error
|
var err error
|
||||||
for {
|
for {
|
||||||
nodeApi, closer, err = lcli.GetStorageMinerAPI(cctx)
|
nodeApi, closer, err = lcli.GetStorageMinerAPI(cctx,
|
||||||
|
jsonrpc.WithNoReconnect(),
|
||||||
|
jsonrpc.WithTimeout(30*time.Second))
|
||||||
if err == nil {
|
if err == nil {
|
||||||
break
|
break
|
||||||
}
|
}
|
||||||
@ -429,9 +431,13 @@ func watchMinerConn(ctx context.Context, cctx *cli.Context, nodeApi api.StorageM
|
|||||||
"run",
|
"run",
|
||||||
fmt.Sprintf("--listen=%s", cctx.String("listen")),
|
fmt.Sprintf("--listen=%s", cctx.String("listen")),
|
||||||
fmt.Sprintf("--no-local-storage=%t", cctx.Bool("no-local-storage")),
|
fmt.Sprintf("--no-local-storage=%t", cctx.Bool("no-local-storage")),
|
||||||
|
fmt.Sprintf("--addpiece=%t", cctx.Bool("addpiece")),
|
||||||
fmt.Sprintf("--precommit1=%t", cctx.Bool("precommit1")),
|
fmt.Sprintf("--precommit1=%t", cctx.Bool("precommit1")),
|
||||||
|
fmt.Sprintf("--unseal=%t", cctx.Bool("unseal")),
|
||||||
fmt.Sprintf("--precommit2=%t", cctx.Bool("precommit2")),
|
fmt.Sprintf("--precommit2=%t", cctx.Bool("precommit2")),
|
||||||
fmt.Sprintf("--commit=%t", cctx.Bool("commit")),
|
fmt.Sprintf("--commit=%t", cctx.Bool("commit")),
|
||||||
|
fmt.Sprintf("--parallel-fetch-limit=%d", cctx.Int("parallel-fetch-limit")),
|
||||||
|
fmt.Sprintf("--timeout=%s", cctx.String("timeout")),
|
||||||
}, os.Environ()); err != nil {
|
}, os.Environ()); err != nil {
|
||||||
fmt.Println(err)
|
fmt.Println(err)
|
||||||
}
|
}
|
||||||
|
@ -5,8 +5,9 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
|
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/sector-storage"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
type worker struct {
|
type worker struct {
|
||||||
|
@ -51,6 +51,7 @@ var genesisNewCmd = &cli.Command{
|
|||||||
Accounts: []genesis.Actor{},
|
Accounts: []genesis.Actor{},
|
||||||
Miners: []genesis.Miner{},
|
Miners: []genesis.Miner{},
|
||||||
VerifregRootKey: gen.DefaultVerifregRootkeyActor,
|
VerifregRootKey: gen.DefaultVerifregRootkeyActor,
|
||||||
|
RemainderAccount: gen.DefaultRemainderAccountActor,
|
||||||
NetworkName: cctx.String("network-name"),
|
NetworkName: cctx.String("network-name"),
|
||||||
}
|
}
|
||||||
if out.NetworkName == "" {
|
if out.NetworkName == "" {
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/docker/go-units"
|
"github.com/docker/go-units"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
|
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
|
@ -19,7 +19,7 @@ import (
|
|||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/sector-storage/zerocomm"
|
"github.com/filecoin-project/lotus/extern/sector-storage/zerocomm"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
@ -27,10 +27,10 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/wallet"
|
"github.com/filecoin-project/lotus/chain/wallet"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
"github.com/filecoin-project/lotus/genesis"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper/basicfs"
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("preseal")
|
var log = logging.Logger("preseal")
|
||||||
|
@ -3,6 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
ma "github.com/multiformats/go-multiaddr"
|
ma "github.com/multiformats/go-multiaddr"
|
||||||
@ -22,6 +23,7 @@ var actorCmd = &cli.Command{
|
|||||||
Subcommands: []*cli.Command{
|
Subcommands: []*cli.Command{
|
||||||
actorSetAddrsCmd,
|
actorSetAddrsCmd,
|
||||||
actorWithdrawCmd,
|
actorWithdrawCmd,
|
||||||
|
actorSetPeeridCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -57,7 +59,14 @@ var actorSetAddrsCmd = &cli.Command{
|
|||||||
return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err)
|
return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
addrs = append(addrs, maddr.Bytes())
|
maddrNop2p, strip := ma.SplitFunc(maddr, func(c ma.Component) bool {
|
||||||
|
return c.Protocol().Code == ma.P_P2P
|
||||||
|
})
|
||||||
|
|
||||||
|
if strip != nil {
|
||||||
|
fmt.Println("Stripping peerid ", strip, " from ", maddr)
|
||||||
|
}
|
||||||
|
addrs = append(addrs, maddrNop2p.Bytes())
|
||||||
}
|
}
|
||||||
|
|
||||||
maddr, err := nodeAPI.ActorAddress(ctx)
|
maddr, err := nodeAPI.ActorAddress(ctx)
|
||||||
@ -82,7 +91,7 @@ var actorSetAddrsCmd = &cli.Command{
|
|||||||
From: minfo.Worker,
|
From: minfo.Worker,
|
||||||
Value: types.NewInt(0),
|
Value: types.NewInt(0),
|
||||||
GasLimit: gasLimit,
|
GasLimit: gasLimit,
|
||||||
Method: 18,
|
Method: builtin.MethodsMiner.ChangeMultiaddrs,
|
||||||
Params: params,
|
Params: params,
|
||||||
}, nil)
|
}, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -95,6 +104,71 @@ var actorSetAddrsCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var actorSetPeeridCmd = &cli.Command{
|
||||||
|
Name: "set-peer-id",
|
||||||
|
Usage: "set the peer id of your miner",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.Int64Flag{
|
||||||
|
Name: "gas-limit",
|
||||||
|
Usage: "set gas limit",
|
||||||
|
Value: 0,
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
|
||||||
|
api, acloser, err := lcli.GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer acloser()
|
||||||
|
|
||||||
|
ctx := lcli.ReqContext(cctx)
|
||||||
|
|
||||||
|
pid, err := peer.IDFromString(cctx.Args().Get(0))
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to parse input as a peerId: %w", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
maddr, err := nodeAPI.ActorAddress(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
minfo, err := api.StateMinerInfo(ctx, maddr, types.EmptyTSK)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
params, err := actors.SerializeParams(&miner.ChangePeerIDParams{NewID: abi.PeerID(pid)})
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
gasLimit := cctx.Int64("gas-limit")
|
||||||
|
|
||||||
|
smsg, err := api.MpoolPushMessage(ctx, &types.Message{
|
||||||
|
To: maddr,
|
||||||
|
From: minfo.Worker,
|
||||||
|
Value: types.NewInt(0),
|
||||||
|
GasLimit: gasLimit,
|
||||||
|
Method: builtin.MethodsMiner.ChangePeerID,
|
||||||
|
Params: params,
|
||||||
|
}, nil)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("Requested peerid change in message %s\n", smsg.Cid())
|
||||||
|
return nil
|
||||||
|
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
var actorWithdrawCmd = &cli.Command{
|
var actorWithdrawCmd = &cli.Command{
|
||||||
Name: "withdraw",
|
Name: "withdraw",
|
||||||
Usage: "withdraw available balance",
|
Usage: "withdraw available balance",
|
||||||
|
22
cmd/lotus-storage-miner/config.go
Normal file
22
cmd/lotus-storage-miner/config.go
Normal file
@ -0,0 +1,22 @@
|
|||||||
|
package main
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/node/config"
|
||||||
|
)
|
||||||
|
|
||||||
|
var configCmd = &cli.Command{
|
||||||
|
Name: "config",
|
||||||
|
Usage: "Output default configuration",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
comm, err := config.ConfigComment(config.DefaultStorageMiner())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
fmt.Println(string(comm))
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
@ -11,9 +11,9 @@ import (
|
|||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
sealing "github.com/filecoin-project/storage-fsm"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
@ -148,6 +148,11 @@ var infoAllCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fmt.Println("\n#: Goroutines")
|
||||||
|
if err := lcli.PprofGoroutines.Action(cctx); err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
@ -25,9 +25,9 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
cborutil "github.com/filecoin-project/go-cbor-util"
|
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
sectorstorage "github.com/filecoin-project/sector-storage"
|
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
@ -41,13 +41,13 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
"github.com/filecoin-project/lotus/chain/gen/slashfilter"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
sealing "github.com/filecoin-project/lotus/extern/storage-sealing"
|
||||||
"github.com/filecoin-project/lotus/genesis"
|
"github.com/filecoin-project/lotus/genesis"
|
||||||
"github.com/filecoin-project/lotus/miner"
|
"github.com/filecoin-project/lotus/miner"
|
||||||
"github.com/filecoin-project/lotus/node/modules"
|
"github.com/filecoin-project/lotus/node/modules"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
"github.com/filecoin-project/lotus/storage"
|
"github.com/filecoin-project/lotus/storage"
|
||||||
sealing "github.com/filecoin-project/storage-fsm"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var initCmd = &cli.Command{
|
var initCmd = &cli.Command{
|
||||||
@ -440,6 +440,7 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode,
|
|||||||
SealProofType: spt,
|
SealProofType: spt,
|
||||||
}, sectorstorage.SealerConfig{
|
}, sectorstorage.SealerConfig{
|
||||||
ParallelFetchLimit: 10,
|
ParallelFetchLimit: 10,
|
||||||
|
AllowAddPiece: true,
|
||||||
AllowPreCommit1: true,
|
AllowPreCommit1: true,
|
||||||
AllowPreCommit2: true,
|
AllowPreCommit2: true,
|
||||||
AllowCommit: true,
|
AllowCommit: true,
|
||||||
|
@ -32,6 +32,7 @@ func main() {
|
|||||||
initCmd,
|
initCmd,
|
||||||
runCmd,
|
runCmd,
|
||||||
stopCmd,
|
stopCmd,
|
||||||
|
configCmd,
|
||||||
lcli.WithCategory("chain", actorCmd),
|
lcli.WithCategory("chain", actorCmd),
|
||||||
lcli.WithCategory("chain", infoCmd),
|
lcli.WithCategory("chain", infoCmd),
|
||||||
lcli.WithCategory("market", storageDealsCmd),
|
lcli.WithCategory("market", storageDealsCmd),
|
||||||
|
@ -13,7 +13,7 @@ import (
|
|||||||
"github.com/fatih/color"
|
"github.com/fatih/color"
|
||||||
"github.com/urfave/cli/v2"
|
"github.com/urfave/cli/v2"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
@ -18,8 +18,8 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
@ -30,6 +30,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
"github.com/filecoin-project/lotus/chain/vm"
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
lcli "github.com/filecoin-project/lotus/cli"
|
lcli "github.com/filecoin-project/lotus/cli"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/lotus/lib/blockstore"
|
"github.com/filecoin-project/lotus/lib/blockstore"
|
||||||
"github.com/filecoin-project/lotus/lib/peermgr"
|
"github.com/filecoin-project/lotus/lib/peermgr"
|
||||||
"github.com/filecoin-project/lotus/lib/ulimit"
|
"github.com/filecoin-project/lotus/lib/ulimit"
|
||||||
@ -39,7 +40,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/node/modules/testing"
|
"github.com/filecoin-project/lotus/node/modules/testing"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
|
@ -75,8 +75,16 @@
|
|||||||
"slug": "en+arch",
|
"slug": "en+arch",
|
||||||
"github": "en/architecture.md",
|
"github": "en/architecture.md",
|
||||||
"value": null,
|
"value": null,
|
||||||
"posts": []
|
"posts": [
|
||||||
}, {
|
{
|
||||||
|
"title": "The Message Pool",
|
||||||
|
"slug": "en+mpool",
|
||||||
|
"github": "en/mpool.md",
|
||||||
|
"value": null
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
"title": "Storage Mining",
|
"title": "Storage Mining",
|
||||||
"slug": "en+mining",
|
"slug": "en+mining",
|
||||||
"github": "en/mining.md",
|
"github": "en/mining.md",
|
||||||
|
@ -9,7 +9,7 @@ Anyone can set up a **Lotus Node** and connect to the **Lotus Testnet**. This is
|
|||||||
If you are trying to use `lotus` from China. You should set this **environment variable** on your machine:
|
If you are trying to use `lotus` from China. You should set this **environment variable** on your machine:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Get started
|
## Get started
|
||||||
|
@ -7,7 +7,7 @@ The **Lotus Worker** is an extra process that can offload heavy processing tasks
|
|||||||
If you are trying to use `lotus-worker` from China. You should set this **environment variable** on your machine:
|
If you are trying to use `lotus-worker` from China. You should set this **environment variable** on your machine:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Get Started
|
## Get Started
|
||||||
|
@ -9,7 +9,7 @@ It is useful to [join the Testnet](https://docs.lotu.sh/en+join-testnet) prior t
|
|||||||
If you are trying to use `lotus-miner` from China. You should set this **environment variable** on your machine.
|
If you are trying to use `lotus-miner` from China. You should set this **environment variable** on your machine.
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
export IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
||||||
```
|
```
|
||||||
|
|
||||||
## Get started
|
## Get started
|
||||||
|
161
documentation/en/mpool.md
Normal file
161
documentation/en/mpool.md
Normal file
@ -0,0 +1,161 @@
|
|||||||
|
# The Message Pool
|
||||||
|
|
||||||
|
The Message Pool (mpool) is the component of lotus that handles
|
||||||
|
pending messages for inclusion in the chain. Messages are added to the
|
||||||
|
mpool either directly for locally published messages or through pubsub
|
||||||
|
propagation. Whenever a miner is ready to create a block for a
|
||||||
|
tipset, it invokes the mpool selection algorithm which selects an
|
||||||
|
appropriate set of messages such that it optimizes miner reward and
|
||||||
|
chain capacity.
|
||||||
|
|
||||||
|
## API
|
||||||
|
|
||||||
|
The full node API defines the following methods for interacting with the mpool:
|
||||||
|
```
|
||||||
|
MpoolPending(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)
|
||||||
|
MpoolSelect(context.Context, types.TipSetKey, float64) ([]*types.SignedMessage, error)
|
||||||
|
MpoolPush(context.Context, *types.SignedMessage) (cid.Cid, error)
|
||||||
|
MpoolPushMessage(ctx context.Context, msg *types.Message, spec *MessageSendSpec) (*types.SignedMessage, error)
|
||||||
|
MpoolGetNonce(context.Context, address.Address) (uint64, error)
|
||||||
|
MpoolSub(context.Context) (<-chan MpoolUpdate, error)
|
||||||
|
MpoolGetConfig(context.Context) (*types.MpoolConfig, error)
|
||||||
|
MpoolSetConfig(context.Context, *types.MpoolConfig) error
|
||||||
|
```
|
||||||
|
|
||||||
|
### MpoolPending
|
||||||
|
|
||||||
|
Returns the list of messages that are pending for a tipset.
|
||||||
|
|
||||||
|
### MpoolSelect
|
||||||
|
|
||||||
|
Selects and returns a list of pending messages for inclusion in the next block.
|
||||||
|
|
||||||
|
### MpoolPush
|
||||||
|
|
||||||
|
Pushes a signed message to the mpool; returns the CID of the message.
|
||||||
|
|
||||||
|
### MpoolPushMessage
|
||||||
|
|
||||||
|
Atomically assigns a nonce, signs, and pushes a message to the mpool.
|
||||||
|
|
||||||
|
The MaxFee field of the spec argument is only used when
|
||||||
|
GasFeeCap/GasPremium fields aren't specified in the message. When
|
||||||
|
maxFee is set to 0, MpoolPushMessage will guess appropriate fee based
|
||||||
|
on current chain conditions.
|
||||||
|
|
||||||
|
### MpoolGetNonce
|
||||||
|
|
||||||
|
Returns the next nonce for the specified sender. Note that this method may not be atomic.
|
||||||
|
Use `MpoolPushMessage` instead.
|
||||||
|
|
||||||
|
### MpoolSub
|
||||||
|
|
||||||
|
Returns a channel to receive notifications about updates to the message pool.
|
||||||
|
Note that the context *must* be cancelled when the caller is done with the subscription.
|
||||||
|
|
||||||
|
### MpoolGetConfig
|
||||||
|
|
||||||
|
Returns (a copy of) the current mpool configuration.
|
||||||
|
|
||||||
|
### MpoolSetConfig
|
||||||
|
|
||||||
|
Sets the mpool configuration to (a copy of) the supplied configuration object.
|
||||||
|
|
||||||
|
|
||||||
|
## Command Line Interfae
|
||||||
|
|
||||||
|
The lotus command line interface defines an `mpool` command which
|
||||||
|
allows a user to interact with the mpool.
|
||||||
|
|
||||||
|
The following commands are supported:
|
||||||
|
```
|
||||||
|
lotus mpool pending [--local]
|
||||||
|
lotus mpool sub
|
||||||
|
lotus mpool stat [--local]
|
||||||
|
lotus mpool replace [--gas-feecap <feecap>] [--gas-premium <premium>] [--gas-limit <limit>] [from] [nonce]
|
||||||
|
lotus mpool find [--from <address>] [--to <address>] [--method <int>]
|
||||||
|
lotus mpool config [<configuration>]
|
||||||
|
```
|
||||||
|
|
||||||
|
### lotus mpool pending
|
||||||
|
Prints the pending messages in the mpool, as returned by the `MpoolPending` API call.
|
||||||
|
If `--local` is specified, it only prints pending messages for addresses in the local wallet.
|
||||||
|
|
||||||
|
### lotus mpool sub
|
||||||
|
Subscribes to mpool changes using the `MpoolSub` API call and prints the stream of mpool
|
||||||
|
updates.
|
||||||
|
|
||||||
|
### lotus mpool stat
|
||||||
|
Prints various mpool statistics.
|
||||||
|
If `--local` is specified then only prints statistics for addresses in the local wallet.
|
||||||
|
|
||||||
|
### lotus mpool replace
|
||||||
|
Replaces a message in the mpool.
|
||||||
|
|
||||||
|
### lotus mpool find
|
||||||
|
Searches for messages in the mpool.
|
||||||
|
|
||||||
|
### lotus mpool config
|
||||||
|
Gets or sets the current mpool configuration.
|
||||||
|
|
||||||
|
## Configuration
|
||||||
|
|
||||||
|
The mpool a few parameters that can be configured by the user, either through the API
|
||||||
|
or the command line interface.
|
||||||
|
|
||||||
|
The config struct is defined as follows:
|
||||||
|
```
|
||||||
|
type MpoolConfig struct {
|
||||||
|
PriorityAddrs []address.Address
|
||||||
|
SizeLimitHigh int
|
||||||
|
SizeLimitLow int
|
||||||
|
ReplaceByFeeRatio float64
|
||||||
|
PruneCooldown time.Duration
|
||||||
|
GasLimitOverestimation float64
|
||||||
|
}
|
||||||
|
|
||||||
|
```
|
||||||
|
|
||||||
|
The meaning of these fields is as follows:
|
||||||
|
- `PriorityAddrs` -- these are the addresses of actors whose pending messages should always
|
||||||
|
be included in a block during message selection, regardless of profitability.
|
||||||
|
Miners should configure their own worker addresses so that they include their own messages
|
||||||
|
when they produce a new block.
|
||||||
|
Default is empty.
|
||||||
|
- `SizeLimitHigh` -- this is the maximum number of pending messages before triggering a
|
||||||
|
prune in the message pool. Note that messages from priority addresses are never pruned.
|
||||||
|
Defafult is 30000.
|
||||||
|
- `SizeLimitLow` -- this is the number of pending messages that should be kept after a prune.
|
||||||
|
Default is 20000.
|
||||||
|
- `ReplaceByFeeRatio` -- this is the gas fee ratio for replacing messages in the mpool.
|
||||||
|
Whenever a message is replaced, the `GasPremium` must be increased by this ratio.
|
||||||
|
Default is 1.25.
|
||||||
|
- `PruneCooldown` -- this is the period of time to wait before triggering a new prune.
|
||||||
|
Default is 1min.
|
||||||
|
- `GasLimitOverestimation` -- this is a parameter that controls the gas limit overestimation for new messages.
|
||||||
|
Default is 1.25.
|
||||||
|
|
||||||
|
|
||||||
|
## Message Selection
|
||||||
|
|
||||||
|
A few words regarding message selection are pertinent. In message
|
||||||
|
selection, a miner selects a set of messages from the pending messages
|
||||||
|
for inclusion to the next block in order to maximize its reward. The
|
||||||
|
problem however is NP-hard (it's an instance of knapsack packing),
|
||||||
|
further confounded by the fact that miners don't communicate their
|
||||||
|
tickets to each other. So at best we can approximate the optimal
|
||||||
|
selection in a reasonable amount of time.
|
||||||
|
|
||||||
|
The mpool employs a sophisticated algorithm for selecting messages for
|
||||||
|
inclusion, given the ticket quality of a miner. The ticket quality
|
||||||
|
reflects the probability of execution order for a block in the
|
||||||
|
tipset. Given the ticket quality the algorithm computes the
|
||||||
|
probability of each block, and picks dependent chains of messages such
|
||||||
|
that the reward is maximized, while also optimizing the capacity of
|
||||||
|
the chain. If the ticket quality is sufficiently high, then a greedy
|
||||||
|
selection algorithm is used instead that simply picks dependent chains of
|
||||||
|
maximum reward. Note that pending message chains from priority addresses
|
||||||
|
are always selected, regardless of their profitability.
|
||||||
|
|
||||||
|
For algorithm details, please prefer to the implementation in
|
||||||
|
`chain/messagepool/selection.go`.
|
79
extern/sector-storage/.circleci/config.yml
vendored
79
extern/sector-storage/.circleci/config.yml
vendored
@ -1,79 +0,0 @@
|
|||||||
version: 2.1
|
|
||||||
orbs:
|
|
||||||
go: gotest/tools@0.0.9
|
|
||||||
executors:
|
|
||||||
golang:
|
|
||||||
docker:
|
|
||||||
- image: circleci/golang:1.13
|
|
||||||
resource_class: 2xlarge
|
|
||||||
commands:
|
|
||||||
prepare-git-checkout:
|
|
||||||
steps:
|
|
||||||
- checkout
|
|
||||||
- run: git submodule sync
|
|
||||||
- run: git submodule update --init --recursive
|
|
||||||
install-build-dependencies:
|
|
||||||
steps:
|
|
||||||
- run: sudo apt-get update
|
|
||||||
- run: sudo apt-get install -y jq ocl-icd-opencl-dev
|
|
||||||
- run: ./extern/filecoin-ffi/install-filcrypto
|
|
||||||
download-groth-params-and-verifying-keys:
|
|
||||||
steps:
|
|
||||||
- restore_cache:
|
|
||||||
name: Restore parameters cache
|
|
||||||
keys:
|
|
||||||
- 'v26a-2k-lotus-params'
|
|
||||||
paths:
|
|
||||||
- /var/tmp/filecoin-proof-parameters/
|
|
||||||
- run: |
|
|
||||||
DIR=$(pwd)
|
|
||||||
cd $(mktemp -d)
|
|
||||||
go get github.com/filecoin-project/go-paramfetch/paramfetch
|
|
||||||
go build -o go-paramfetch github.com/filecoin-project/go-paramfetch/paramfetch
|
|
||||||
./go-paramfetch 2048 "${DIR}/parameters.json"
|
|
||||||
- save_cache:
|
|
||||||
name: Save parameters cache
|
|
||||||
key: 'v26a-2k-lotus-params'
|
|
||||||
paths:
|
|
||||||
- /var/tmp/filecoin-proof-parameters/
|
|
||||||
jobs:
|
|
||||||
test:
|
|
||||||
executor: golang
|
|
||||||
environment:
|
|
||||||
RUST_LOG: info
|
|
||||||
steps:
|
|
||||||
- prepare-git-checkout
|
|
||||||
- install-build-dependencies
|
|
||||||
- download-groth-params-and-verifying-keys
|
|
||||||
- run: go test -v -timeout 10m ./...
|
|
||||||
mod-tidy-check:
|
|
||||||
executor: golang
|
|
||||||
steps:
|
|
||||||
- prepare-git-checkout
|
|
||||||
- go/mod-download
|
|
||||||
- go/mod-tidy-check
|
|
||||||
gofmt-check:
|
|
||||||
executor: golang
|
|
||||||
steps:
|
|
||||||
- prepare-git-checkout
|
|
||||||
- go/mod-download
|
|
||||||
- run: "! go fmt ./... 2>&1 | read"
|
|
||||||
lint-check:
|
|
||||||
executor: golang
|
|
||||||
steps:
|
|
||||||
- prepare-git-checkout
|
|
||||||
- install-build-dependencies
|
|
||||||
- go/mod-download
|
|
||||||
- go/install-golangci-lint:
|
|
||||||
gobin: $HOME/.local/bin
|
|
||||||
version: 1.23.8
|
|
||||||
- run:
|
|
||||||
command: $HOME/.local/bin/golangci-lint run -v --concurrency 2
|
|
||||||
workflows:
|
|
||||||
version: 2.1
|
|
||||||
build_and_test:
|
|
||||||
jobs:
|
|
||||||
- mod-tidy-check
|
|
||||||
- lint-check
|
|
||||||
- gofmt-check
|
|
||||||
- test
|
|
2
extern/sector-storage/.gitignore
vendored
2
extern/sector-storage/.gitignore
vendored
@ -1,2 +0,0 @@
|
|||||||
.update-modules
|
|
||||||
.filecoin-build
|
|
4
extern/sector-storage/.gitmodules
vendored
4
extern/sector-storage/.gitmodules
vendored
@ -1,4 +0,0 @@
|
|||||||
[submodule "extern/filecoin-ffi"]
|
|
||||||
path = extern/filecoin-ffi
|
|
||||||
url = https://github.com/filecoin-project/filecoin-ffi.git
|
|
||||||
branch = master
|
|
5
extern/sector-storage/LICENSE-APACHE
vendored
5
extern/sector-storage/LICENSE-APACHE
vendored
@ -1,5 +0,0 @@
|
|||||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
|
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
|
|
19
extern/sector-storage/LICENSE-MIT
vendored
19
extern/sector-storage/LICENSE-MIT
vendored
@ -1,19 +0,0 @@
|
|||||||
The MIT License (MIT)
|
|
||||||
|
|
||||||
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
||||||
of this software and associated documentation files (the "Software"), to deal
|
|
||||||
in the Software without restriction, including without limitation the rights
|
|
||||||
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
||||||
copies of the Software, and to permit persons to whom the Software is
|
|
||||||
furnished to do so, subject to the following conditions:
|
|
||||||
|
|
||||||
The above copyright notice and this permission notice shall be included in
|
|
||||||
all copies or substantial portions of the Software.
|
|
||||||
|
|
||||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
||||||
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
||||||
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
||||||
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
||||||
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
||||||
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
|
||||||
THE SOFTWARE.
|
|
29
extern/sector-storage/Makefile
vendored
29
extern/sector-storage/Makefile
vendored
@ -1,29 +0,0 @@
|
|||||||
all: build
|
|
||||||
.PHONY: all
|
|
||||||
|
|
||||||
SUBMODULES=
|
|
||||||
|
|
||||||
FFI_PATH:=./extern/filecoin-ffi/
|
|
||||||
FFI_DEPS:=.install-filcrypto
|
|
||||||
FFI_DEPS:=$(addprefix $(FFI_PATH),$(FFI_DEPS))
|
|
||||||
|
|
||||||
$(FFI_DEPS): .filecoin-build ;
|
|
||||||
|
|
||||||
.filecoin-build: $(FFI_PATH)
|
|
||||||
$(MAKE) -C $(FFI_PATH) $(FFI_DEPS:$(FFI_PATH)%=%)
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
.update-modules:
|
|
||||||
git submodule update --init --recursive
|
|
||||||
@touch $@
|
|
||||||
|
|
||||||
test: .update-modules .filecoin-build
|
|
||||||
go test -v ./...
|
|
||||||
.PHONY: test
|
|
||||||
SUBMODULES+=test
|
|
||||||
|
|
||||||
build: $(SUBMODULES)
|
|
||||||
|
|
||||||
clean:
|
|
||||||
rm -f .filecoin-build
|
|
||||||
rm -f .update-modules
|
|
6
extern/sector-storage/faults.go
vendored
6
extern/sector-storage/faults.go
vendored
@ -8,16 +8,16 @@ import (
|
|||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
)
|
)
|
||||||
|
|
||||||
// TODO: Track things more actively
|
// FaultTracker TODO: Track things more actively
|
||||||
type FaultTracker interface {
|
type FaultTracker interface {
|
||||||
CheckProvable(ctx context.Context, spt abi.RegisteredSealProof, sectors []abi.SectorID) ([]abi.SectorID, error)
|
CheckProvable(ctx context.Context, spt abi.RegisteredSealProof, sectors []abi.SectorID) ([]abi.SectorID, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
// Returns unprovable sectors
|
// CheckProvable returns unprovable sectors
|
||||||
func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredSealProof, sectors []abi.SectorID) ([]abi.SectorID, error) {
|
func (m *Manager) CheckProvable(ctx context.Context, spt abi.RegisteredSealProof, sectors []abi.SectorID) ([]abi.SectorID, error) {
|
||||||
var bad []abi.SectorID
|
var bad []abi.SectorID
|
||||||
|
|
||||||
|
12
extern/sector-storage/ffiwrapper/basicfs/fs.go
vendored
12
extern/sector-storage/ffiwrapper/basicfs/fs.go
vendored
@ -8,8 +8,8 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type sectorFile struct {
|
type sectorFile struct {
|
||||||
@ -25,20 +25,20 @@ type Provider struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (b *Provider) AcquireSector(ctx context.Context, id abi.SectorID, existing stores.SectorFileType, allocate stores.SectorFileType, ptype stores.PathType) (stores.SectorPaths, func(), error) {
|
func (b *Provider) AcquireSector(ctx context.Context, id abi.SectorID, existing stores.SectorFileType, allocate stores.SectorFileType, ptype stores.PathType) (stores.SectorPaths, func(), error) {
|
||||||
if err := os.Mkdir(filepath.Join(b.Root, stores.FTUnsealed.String()), 0755); err != nil && !os.IsExist(err) {
|
if err := os.Mkdir(filepath.Join(b.Root, stores.FTUnsealed.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||||
return stores.SectorPaths{}, nil, err
|
return stores.SectorPaths{}, nil, err
|
||||||
}
|
}
|
||||||
if err := os.Mkdir(filepath.Join(b.Root, stores.FTSealed.String()), 0755); err != nil && !os.IsExist(err) {
|
if err := os.Mkdir(filepath.Join(b.Root, stores.FTSealed.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||||
return stores.SectorPaths{}, nil, err
|
return stores.SectorPaths{}, nil, err
|
||||||
}
|
}
|
||||||
if err := os.Mkdir(filepath.Join(b.Root, stores.FTCache.String()), 0755); err != nil && !os.IsExist(err) {
|
if err := os.Mkdir(filepath.Join(b.Root, stores.FTCache.String()), 0755); err != nil && !os.IsExist(err) { // nolint
|
||||||
return stores.SectorPaths{}, nil, err
|
return stores.SectorPaths{}, nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
done := func() {}
|
done := func() {}
|
||||||
|
|
||||||
out := stores.SectorPaths{
|
out := stores.SectorPaths{
|
||||||
Id: id,
|
ID: id,
|
||||||
}
|
}
|
||||||
|
|
||||||
for _, fileType := range stores.PathTypes {
|
for _, fileType := range stores.PathTypes {
|
||||||
|
12
extern/sector-storage/ffiwrapper/partialfile.go
vendored
12
extern/sector-storage/ffiwrapper/partialfile.go
vendored
@ -12,8 +12,8 @@ import (
|
|||||||
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
const veryLargeRle = 1 << 20
|
const veryLargeRle = 1 << 20
|
||||||
@ -58,7 +58,7 @@ func writeTrailer(maxPieceSize int64, w *os.File, r rlepluslazy.RunIterator) err
|
|||||||
}
|
}
|
||||||
|
|
||||||
func createPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialFile, error) {
|
func createPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialFile, error) {
|
||||||
f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0644)
|
f, err := os.OpenFile(path, os.O_RDWR|os.O_CREATE, 0644) // nolint
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("openning partial file '%s': %w", path, err)
|
return nil, xerrors.Errorf("openning partial file '%s': %w", path, err)
|
||||||
}
|
}
|
||||||
@ -82,7 +82,7 @@ func createPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialF
|
|||||||
return nil
|
return nil
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.Close()
|
_ = f.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
if err := f.Close(); err != nil {
|
if err := f.Close(); err != nil {
|
||||||
@ -93,7 +93,7 @@ func createPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialF
|
|||||||
}
|
}
|
||||||
|
|
||||||
func openPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialFile, error) {
|
func openPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialFile, error) {
|
||||||
f, err := os.OpenFile(path, os.O_RDWR, 0644)
|
f, err := os.OpenFile(path, os.O_RDWR, 0644) // nolint
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("openning partial file '%s': %w", path, err)
|
return nil, xerrors.Errorf("openning partial file '%s': %w", path, err)
|
||||||
}
|
}
|
||||||
@ -161,7 +161,7 @@ func openPartialFile(maxPieceSize abi.PaddedPieceSize, path string) (*partialFil
|
|||||||
return nil
|
return nil
|
||||||
}()
|
}()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
f.Close()
|
_ = f.Close()
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
|
32
extern/sector-storage/ffiwrapper/sealer_cgo.go
vendored
32
extern/sector-storage/ffiwrapper/sealer_cgo.go
vendored
@ -20,10 +20,10 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/fr32"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fr32"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
"github.com/filecoin-project/sector-storage/zerocomm"
|
"github.com/filecoin-project/lotus/extern/sector-storage/zerocomm"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ Storage = &Sealer{}
|
var _ Storage = &Sealer{}
|
||||||
@ -190,7 +190,7 @@ func (sb *Sealer) pieceCid(in []byte) (cid.Cid, error) {
|
|||||||
return cid.Undef, xerrors.Errorf("generating piece commitment: %w", err)
|
return cid.Undef, xerrors.Errorf("generating piece commitment: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
prf.Close()
|
_ = prf.Close()
|
||||||
|
|
||||||
return pieceCID, werr()
|
return pieceCID, werr()
|
||||||
}
|
}
|
||||||
@ -225,7 +225,7 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector abi.SectorID, offset s
|
|||||||
default:
|
default:
|
||||||
return xerrors.Errorf("acquire unsealed sector path (existing): %w", err)
|
return xerrors.Errorf("acquire unsealed sector path (existing): %w", err)
|
||||||
}
|
}
|
||||||
defer pf.Close()
|
defer pf.Close() // nolint
|
||||||
|
|
||||||
allocated, err := pf.Allocated()
|
allocated, err := pf.Allocated()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -247,11 +247,11 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector abi.SectorID, offset s
|
|||||||
}
|
}
|
||||||
defer srcDone()
|
defer srcDone()
|
||||||
|
|
||||||
sealed, err := os.OpenFile(srcPaths.Sealed, os.O_RDONLY, 0644)
|
sealed, err := os.OpenFile(srcPaths.Sealed, os.O_RDONLY, 0644) // nolint:gosec
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("opening sealed file: %w", err)
|
return xerrors.Errorf("opening sealed file: %w", err)
|
||||||
}
|
}
|
||||||
defer sealed.Close()
|
defer sealed.Close() // nolint
|
||||||
|
|
||||||
var at, nextat abi.PaddedPieceSize
|
var at, nextat abi.PaddedPieceSize
|
||||||
first := true
|
first := true
|
||||||
@ -287,7 +287,7 @@ func (sb *Sealer) UnsealPiece(ctx context.Context, sector abi.SectorID, offset s
|
|||||||
{
|
{
|
||||||
go func() {
|
go func() {
|
||||||
defer close(outWait)
|
defer close(outWait)
|
||||||
defer opr.Close()
|
defer opr.Close() // nolint
|
||||||
|
|
||||||
padwriter := fr32.NewPadWriter(out)
|
padwriter := fr32.NewPadWriter(out)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -377,18 +377,18 @@ func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector abi.Se
|
|||||||
|
|
||||||
ok, err := pf.HasAllocated(offset, size)
|
ok, err := pf.HasAllocated(offset, size)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pf.Close()
|
_ = pf.Close()
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if !ok {
|
if !ok {
|
||||||
pf.Close()
|
_ = pf.Close()
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
f, err := pf.Reader(offset.Padded(), size.Padded())
|
f, err := pf.Reader(offset.Padded(), size.Padded())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
pf.Close()
|
_ = pf.Close()
|
||||||
return false, xerrors.Errorf("getting partial file reader: %w", err)
|
return false, xerrors.Errorf("getting partial file reader: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -398,7 +398,7 @@ func (sb *Sealer) ReadPiece(ctx context.Context, writer io.Writer, sector abi.Se
|
|||||||
}
|
}
|
||||||
|
|
||||||
if _, err := io.CopyN(writer, upr, int64(size)); err != nil {
|
if _, err := io.CopyN(writer, upr, int64(size)); err != nil {
|
||||||
pf.Close()
|
_ = pf.Close()
|
||||||
return false, xerrors.Errorf("reading unsealed file: %w", err)
|
return false, xerrors.Errorf("reading unsealed file: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -416,7 +416,7 @@ func (sb *Sealer) SealPreCommit1(ctx context.Context, sector abi.SectorID, ticke
|
|||||||
}
|
}
|
||||||
defer done()
|
defer done()
|
||||||
|
|
||||||
e, err := os.OpenFile(paths.Sealed, os.O_RDWR|os.O_CREATE, 0644)
|
e, err := os.OpenFile(paths.Sealed, os.O_RDWR|os.O_CREATE, 0644) // nolint:gosec
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("ensuring sealed file exists: %w", err)
|
return nil, xerrors.Errorf("ensuring sealed file exists: %w", err)
|
||||||
}
|
}
|
||||||
@ -424,7 +424,7 @@ func (sb *Sealer) SealPreCommit1(ctx context.Context, sector abi.SectorID, ticke
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Mkdir(paths.Cache, 0755); err != nil {
|
if err := os.Mkdir(paths.Cache, 0755); err != nil { // nolint
|
||||||
if os.IsExist(err) {
|
if os.IsExist(err) {
|
||||||
log.Warnf("existing cache in %s; removing", paths.Cache)
|
log.Warnf("existing cache in %s; removing", paths.Cache)
|
||||||
|
|
||||||
@ -432,7 +432,7 @@ func (sb *Sealer) SealPreCommit1(ctx context.Context, sector abi.SectorID, ticke
|
|||||||
return nil, xerrors.Errorf("remove existing sector cache from %s (sector %d): %w", paths.Cache, sector, err)
|
return nil, xerrors.Errorf("remove existing sector cache from %s (sector %d): %w", paths.Cache, sector, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := os.Mkdir(paths.Cache, 0755); err != nil {
|
if err := os.Mkdir(paths.Cache, 0755); err != nil { // nolint:gosec
|
||||||
return nil, xerrors.Errorf("mkdir cache path after cleanup: %w", err)
|
return nil, xerrors.Errorf("mkdir cache path after cleanup: %w", err)
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
|
18
extern/sector-storage/ffiwrapper/sealer_test.go
vendored
18
extern/sector-storage/ffiwrapper/sealer_test.go
vendored
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"math/rand"
|
"math/rand"
|
||||||
@ -16,17 +15,20 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
logging "github.com/ipfs/go-log"
|
logging "github.com/ipfs/go-log"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
|
||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper/basicfs"
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
@ -220,12 +222,12 @@ func post(t *testing.T, sealer *Sealer, seals ...seal) time.Time {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func getGrothParamFileAndVerifyingKeys(s abi.SectorSize) {
|
func getGrothParamFileAndVerifyingKeys(s abi.SectorSize) {
|
||||||
dat, err := ioutil.ReadFile("../parameters.json")
|
dat, err := ioutil.ReadFile("../../../build/proof-params/parameters.json")
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
err = paramfetch.GetParams(dat, uint64(s))
|
err = paramfetch.GetParams(context.TODO(), dat, uint64(s))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(xerrors.Errorf("failed to acquire Groth parameters for 2KiB sectors: %w", err))
|
panic(xerrors.Errorf("failed to acquire Groth parameters for 2KiB sectors: %w", err))
|
||||||
}
|
}
|
||||||
@ -443,8 +445,8 @@ func BenchmarkWriteWithAlignment(b *testing.B) {
|
|||||||
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
tf, _ := ioutil.TempFile("/tmp/", "scrb-")
|
||||||
b.StartTimer()
|
b.StartTimer()
|
||||||
|
|
||||||
ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg2KiBV1, rf, bt, tf, nil)
|
ffi.WriteWithAlignment(abi.RegisteredSealProof_StackedDrg2KiBV1, rf, bt, tf, nil) // nolint:errcheck
|
||||||
w()
|
_ = w()
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
extern/sector-storage/ffiwrapper/types.go
vendored
6
extern/sector-storage/ffiwrapper/types.go
vendored
@ -9,9 +9,9 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper/basicfs"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper/basicfs"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Validator interface {
|
type Validator interface {
|
||||||
|
@ -3,10 +3,11 @@ package ffiwrapper
|
|||||||
import (
|
import (
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-bitfield/rle"
|
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
// merge gaps between ranges which are close to each other
|
// merge gaps between ranges which are close to each other
|
||||||
|
10
extern/sector-storage/ffiwrapper/verifier_cgo.go
vendored
10
extern/sector-storage/ffiwrapper/verifier_cgo.go
vendored
@ -4,14 +4,16 @@ package ffiwrapper
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"go.opencensus.io/trace"
|
|
||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
|
|
||||||
|
"go.opencensus.io/trace"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) {
|
func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []abi.SectorInfo, randomness abi.PoStRandomness) ([]abi.PoStProof, error) {
|
||||||
|
4
extern/sector-storage/fr32/fr32.go
vendored
4
extern/sector-storage/fr32/fr32.go
vendored
@ -44,8 +44,8 @@ func mt(in, out []byte, padLen int, op func(unpadded, padded []byte)) {
|
|||||||
wg.Wait()
|
wg.Wait()
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assumes len(in)%127==0 and len(out)%128==0
|
|
||||||
func Pad(in, out []byte) {
|
func Pad(in, out []byte) {
|
||||||
|
// Assumes len(in)%127==0 and len(out)%128==0
|
||||||
if len(out) > int(MTTresh) {
|
if len(out) > int(MTTresh) {
|
||||||
mt(in, out, len(out), pad)
|
mt(in, out, len(out), pad)
|
||||||
return
|
return
|
||||||
@ -94,8 +94,8 @@ func pad(in, out []byte) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Assumes len(in)%128==0 and len(out)%127==0
|
|
||||||
func Unpad(in []byte, out []byte) {
|
func Unpad(in []byte, out []byte) {
|
||||||
|
// Assumes len(in)%128==0 and len(out)%127==0
|
||||||
if len(in) > int(MTTresh) {
|
if len(in) > int(MTTresh) {
|
||||||
mt(out, in, len(in), unpad)
|
mt(out, in, len(in), unpad)
|
||||||
return
|
return
|
||||||
|
@ -2,18 +2,19 @@ package fr32_test
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"github.com/filecoin-project/sector-storage/fr32"
|
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/fr32"
|
||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestWriteTwoPcs(t *testing.T) {
|
func TestWriteTwoPcs(t *testing.T) {
|
||||||
@ -39,7 +40,7 @@ func TestWriteTwoPcs(t *testing.T) {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := tf.Seek(io.SeekStart, 0); err != nil {
|
if _, err := tf.Seek(io.SeekStart, 0); err != nil { // nolint:staticcheck
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
6
extern/sector-storage/fr32/fr32_test.go
vendored
6
extern/sector-storage/fr32/fr32_test.go
vendored
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/stretchr/testify/require"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/sector-storage/fr32"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fr32"
|
||||||
)
|
)
|
||||||
|
|
||||||
func padFFI(buf []byte) []byte {
|
func padFFI(buf []byte) []byte {
|
||||||
@ -28,7 +28,7 @@ func padFFI(buf []byte) []byte {
|
|||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := tf.Seek(io.SeekStart, 0); err != nil {
|
if _, err := tf.Seek(io.SeekStart, 0); err != nil { // nolint:staticcheck
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
2
extern/sector-storage/fr32/readers_test.go
vendored
2
extern/sector-storage/fr32/readers_test.go
vendored
@ -9,7 +9,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/fr32"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fr32"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestUnpadReader(t *testing.T) {
|
func TestUnpadReader(t *testing.T) {
|
||||||
|
@ -24,6 +24,6 @@ func FileSize(path string) (SizeInfo, error) {
|
|||||||
// NOTE: stat.Blocks is in 512B blocks, NOT in stat.Blksize
|
// NOTE: stat.Blocks is in 512B blocks, NOT in stat.Blksize
|
||||||
// See https://www.gnu.org/software/libc/manual/html_node/Attribute-Meanings.html
|
// See https://www.gnu.org/software/libc/manual/html_node/Attribute-Meanings.html
|
||||||
return SizeInfo{
|
return SizeInfo{
|
||||||
int64(stat.Blocks) * 512, // NOTE: int64 cast is needed on osx
|
int64(stat.Blocks) * 512, // nolint NOTE: int64 cast is needed on osx
|
||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
33
extern/sector-storage/go.mod
vendored
33
extern/sector-storage/go.mod
vendored
@ -1,33 +0,0 @@
|
|||||||
module github.com/filecoin-project/sector-storage
|
|
||||||
|
|
||||||
go 1.13
|
|
||||||
|
|
||||||
require (
|
|
||||||
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e
|
|
||||||
github.com/elastic/go-sysinfo v1.3.0
|
|
||||||
github.com/filecoin-project/filecoin-ffi v0.30.4-0.20200716204036-cddc56607e1d
|
|
||||||
github.com/filecoin-project/go-bitfield v0.1.2
|
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663
|
|
||||||
github.com/filecoin-project/specs-actors v0.8.2
|
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea
|
|
||||||
github.com/google/uuid v1.1.1
|
|
||||||
github.com/gorilla/mux v1.7.4
|
|
||||||
github.com/hashicorp/go-multierror v1.0.0
|
|
||||||
github.com/ipfs/go-cid v0.0.6
|
|
||||||
github.com/ipfs/go-ipfs-files v0.0.7
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669 // indirect
|
|
||||||
github.com/ipfs/go-log v1.0.4
|
|
||||||
github.com/ipfs/go-log/v2 v2.0.5
|
|
||||||
github.com/mattn/go-isatty v0.0.9 // indirect
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0
|
|
||||||
github.com/stretchr/testify v1.6.1
|
|
||||||
go.opencensus.io v0.22.3
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b // indirect
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3 // indirect
|
|
||||||
)
|
|
||||||
|
|
||||||
replace github.com/filecoin-project/storage-fsm => ../storage-fsm
|
|
||||||
|
|
||||||
replace github.com/filecoin-project/filecoin-ffi => ../filecoin-ffi
|
|
384
extern/sector-storage/go.sum
vendored
384
extern/sector-storage/go.sum
vendored
@ -1,384 +0,0 @@
|
|||||||
cloud.google.com/go v0.26.0/go.mod h1:aQUYkXzVsufM+DwF1aE+0xfcU+56JwCaLick0ClmMTw=
|
|
||||||
github.com/BurntSushi/toml v0.3.1 h1:WXkYYl6Yr3qBf1K79EBnL4mak0OimBfB0XUf9Vl28OQ=
|
|
||||||
github.com/BurntSushi/toml v0.3.1/go.mod h1:xHWCNGjB5oqiDr8zfno3MHue2Ht5sIBksp03qcyfWMU=
|
|
||||||
github.com/aead/siphash v1.0.1/go.mod h1:Nywa3cDsYNNK3gaciGTWPwHt0wlpNV15vwmswBAUSII=
|
|
||||||
github.com/btcsuite/btcd v0.20.1-beta/go.mod h1:wVuoA8VJLEcwgqHBwHmzLRazpKxTv13Px/pDuV7OomQ=
|
|
||||||
github.com/btcsuite/btclog v0.0.0-20170628155309-84c8d2346e9f/go.mod h1:TdznJufoqS23FtqVCzL0ZqgP5MqXbb4fg/WgDys70nA=
|
|
||||||
github.com/btcsuite/btcutil v0.0.0-20190425235716-9e5f4b9a998d/go.mod h1:+5NJ2+qvTyV9exUAL/rxXi3DcLg2Ts+ymUAY5y4NvMg=
|
|
||||||
github.com/btcsuite/go-socks v0.0.0-20170105172521-4720035b7bfd/go.mod h1:HHNXQzUsZCxOoE+CPiyCTO6x34Zs86zZUiwtpXoGdtg=
|
|
||||||
github.com/btcsuite/goleveldb v0.0.0-20160330041536-7834afc9e8cd/go.mod h1:F+uVaaLLH7j4eDXPRvw78tMflu7Ie2bzYOH4Y8rRKBY=
|
|
||||||
github.com/btcsuite/snappy-go v0.0.0-20151229074030-0bdef8d06723/go.mod h1:8woku9dyThutzjeg+3xrA5iCpBRH8XEEg3lh6TiUghc=
|
|
||||||
github.com/btcsuite/websocket v0.0.0-20150119174127-31079b680792/go.mod h1:ghJtEyQwv5/p4Mg4C0fgbePVuGr935/5ddU9Z3TmDRY=
|
|
||||||
github.com/btcsuite/winsvc v1.0.0/go.mod h1:jsenWakMcC0zFBFurPLEAyrnc/teJEM1O46fmI40EZs=
|
|
||||||
github.com/client9/misspell v0.3.4/go.mod h1:qj6jICC3Q7zFZvVWo7KLAzC3yx5G7kyvSDkc90ppPyw=
|
|
||||||
github.com/coreos/go-semver v0.3.0/go.mod h1:nnelYz7RCh+5ahJtPPxZlU+153eP4D4r3EedlOD2RNk=
|
|
||||||
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3 h1:HVTnpeuvF6Owjd5mniCL8DEXo7uYXdQEmOP4FJbV5tg=
|
|
||||||
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3/go.mod h1:p1d6YEZWvFzEh4KLyvBcVSnrfNDDvK2zfK/4x2v/4pE=
|
|
||||||
github.com/davecgh/go-spew v0.0.0-20171005155431-ecdeabc65495/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/davecgh/go-spew v1.1.0/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
|
|
||||||
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
|
|
||||||
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e h1:lj77EKYUpYXTd8CD/+QMIf8b6OIOTsfEBSXiAzuEHTU=
|
|
||||||
github.com/detailyang/go-fallocate v0.0.0-20180908115635-432fa640bd2e/go.mod h1:3ZQK6DMPSz/QZ73jlWxBtUhNA8xZx7LzUFSq/OfP8vk=
|
|
||||||
github.com/elastic/go-sysinfo v1.3.0 h1:eb2XFGTMlSwG/yyU9Y8jVAYLIzU2sFzWXwo2gmetyrE=
|
|
||||||
github.com/elastic/go-sysinfo v1.3.0/go.mod h1:i1ZYdU10oLNfRzq4vq62BEwD2fH8KaWh6eh0ikPT9F0=
|
|
||||||
github.com/elastic/go-windows v1.0.0 h1:qLURgZFkkrYyTTkvYpsZIgf83AUsdIHfvlJaqaZ7aSY=
|
|
||||||
github.com/elastic/go-windows v1.0.0/go.mod h1:TsU0Nrp7/y3+VwE82FoZF8gC/XFg/Elz6CcloAxnPgU=
|
|
||||||
github.com/fatih/color v1.8.0 h1:5bzFgL+oy7JITMTxUPJ00n7VxmYd/PdMp5mHFX40/RY=
|
|
||||||
github.com/fatih/color v1.8.0/go.mod h1:3l45GVGkyrnYNl9HoIjnp2NnNWvh6hLAqD8yTfGjnw8=
|
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be h1:TooKBwR/g8jG0hZ3lqe9S5sy2vTUcLOZLlz3M5wGn2E=
|
|
||||||
github.com/filecoin-project/go-address v0.0.2-0.20200218010043-eb9bb40ed5be/go.mod h1:SAOwJoakQ8EPjwNIsiakIQKsoKdkcbx8U3IapgCg9R0=
|
|
||||||
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200131012142-05d80eeccc5e/go.mod h1:boRtQhzmxNocrMxOXo1NYn4oUc1NGvR8tEa79wApNXg=
|
|
||||||
github.com/filecoin-project/go-amt-ipld/v2 v2.0.1-0.20200424220931-6263827e49f2/go.mod h1:boRtQhzmxNocrMxOXo1NYn4oUc1NGvR8tEa79wApNXg=
|
|
||||||
github.com/filecoin-project/go-amt-ipld/v2 v2.1.0/go.mod h1:nfFPoGyX0CU9SkXX8EoCcSuHN1XcbN0c6KBh7yvP5fs=
|
|
||||||
github.com/filecoin-project/go-bitfield v0.0.0-20200416002808-b3ee67ec9060/go.mod h1:iodsLxOFZnqKtjj2zkgqzoGNrv6vUqj69AT/J8DKXEw=
|
|
||||||
github.com/filecoin-project/go-bitfield v0.0.1/go.mod h1:Ry9/iUlWSyjPUzlAvdnfy4Gtvrq4kWmWDztCU1yEgJY=
|
|
||||||
github.com/filecoin-project/go-bitfield v0.1.2 h1:TjLregCoyP1/5lm7WCM0axyV1myIHwbjGa21skuu5tk=
|
|
||||||
github.com/filecoin-project/go-bitfield v0.1.2/go.mod h1:CNl9WG8hgR5mttCnUErjcQjGvuiZjRqK9rHVBsQF4oM=
|
|
||||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMXdBnCiXjfCYx/hLqFxccPoqsSveQFxVLvNxy9bus=
|
|
||||||
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ=
|
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f h1:GxJzR3oRIMTPtpZ0b7QF8FKPK6/iPAc7trhlL5k/g+s=
|
|
||||||
github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663 h1:eYxi6vI5CyeXD15X1bB3bledDXbqKxqf0wQzTLgwYwA=
|
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.2-0.20200218225740-47c639bab663/go.mod h1:fZzmf4tftbwf9S37XRifoJlz7nCjRdIrMGLR07dKLCc=
|
|
||||||
github.com/filecoin-project/specs-actors v0.3.0/go.mod h1:nQYnFbQ7Y0bHZyq6HDEuVlCPR+U3z5Q3wMOQ+2aiV+Y=
|
|
||||||
github.com/filecoin-project/specs-actors v0.6.1/go.mod h1:dRdy3cURykh2R8O/DKqy8olScl70rmIS7GrB4hB1IDY=
|
|
||||||
github.com/filecoin-project/specs-actors v0.8.2 h1:fpAPOPqWqmzJCWHpm6P1XDRSpQrxyY5Pzh5H3doYs7Q=
|
|
||||||
github.com/filecoin-project/specs-actors v0.8.2/go.mod h1:Q3ACV5kBLvqPaYbthc/J1lGMJ5OwogmD9pzdtPRMdCw=
|
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea h1:iixjULRQFPn7Q9KlIqfwLJnlAXO10bbkI+xy5GKGdLY=
|
|
||||||
github.com/filecoin-project/specs-storage v0.1.1-0.20200622113353-88a9704877ea/go.mod h1:Pr5ntAaxsh+sLG/LYiL4tKzvA83Vk5vLODYhfNwOg7k=
|
|
||||||
github.com/fsnotify/fsnotify v1.4.7/go.mod h1:jwhsz4b93w/PPRr/qN1Yymfu8t87LnFCMoQvtojpjFo=
|
|
||||||
github.com/gogo/protobuf v1.2.1/go.mod h1:hp+jE20tsWTFYpLwKvXlhS1hjn+gTNwPg2I6zVXpSg4=
|
|
||||||
github.com/gogo/protobuf v1.3.1 h1:DqDEcV5aeaTmdFBePNpYsp3FlcVH/2ISVVM9Qf8PSls=
|
|
||||||
github.com/gogo/protobuf v1.3.1/go.mod h1:SlYgWuQ5SjCEi6WLHjHCa1yvBfUnHcTbrrZtXPKa29o=
|
|
||||||
github.com/golang/glog v0.0.0-20160126235308-23def4e6c14b/go.mod h1:SBH7ygxi8pfUlaOkMMuAQtPIUF8ecWP5IEl/CR7VP2Q=
|
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6 h1:ZgQEtGgCBiWRM39fZuwSd1LwSqqSW0hOdXCYYDX0R3I=
|
|
||||||
github.com/golang/groupcache v0.0.0-20190702054246-869f871628b6/go.mod h1:cIg4eruTrX1D+g88fzRXU5OdNfaM+9IcxsU14FzY7Hc=
|
|
||||||
github.com/golang/mock v1.1.1/go.mod h1:oTYuIxOrZwtPieC+H1uAHpcLFnEyAGVDL/k47Jfbm0A=
|
|
||||||
github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/golang/protobuf v1.3.1/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U=
|
|
||||||
github.com/google/go-cmp v0.3.0/go.mod h1:8QqcDgzrUqlUb/G2PQTWiueGozuR1884gddMywk6iLU=
|
|
||||||
github.com/google/go-cmp v0.4.0 h1:xsAVV57WRhGj6kEIi8ReJzQlHHqcBYCElAvkovg3B/4=
|
|
||||||
github.com/google/go-cmp v0.4.0/go.mod h1:v8dTdLbMG2kIc/vJvl+f65V22dbkXbowE6jgT/gNBxE=
|
|
||||||
github.com/google/renameio v0.1.0/go.mod h1:KWCgfxg9yswjAJkECMjeO8J8rahYeXnNhOm40UhjYkI=
|
|
||||||
github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY=
|
|
||||||
github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
|
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1 h1:EGx4pi6eqNxGaHF6qqu48+N2wcFQ5qg5FXgOdqsJ5d8=
|
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20181017120253-0766667cb4d1/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f h1:KMlcu9X58lhTA/KrfX8Bi1LQSO4pzoVjTiL3h4Jk+Zk=
|
|
||||||
github.com/gopherjs/gopherjs v0.0.0-20190812055157-5d271430af9f/go.mod h1:wJfORRmW1u3UXTncJ5qlYoELFm8eSnnEO6hX4iZ3EWY=
|
|
||||||
github.com/gorilla/mux v1.7.4 h1:VuZ8uybHlWmqV03+zRzdwKL4tUnIp1MAQtp1mIFE1bc=
|
|
||||||
github.com/gorilla/mux v1.7.4/go.mod h1:DVbg23sWSpFRCP0SfiEN6jmj59UnW/n46BH5rLB71So=
|
|
||||||
github.com/gxed/hashland/keccakpg v0.0.1/go.mod h1:kRzw3HkwxFU1mpmPP8v1WyQzwdGfmKFJ6tItnhQ67kU=
|
|
||||||
github.com/gxed/hashland/murmur3 v0.0.1/go.mod h1:KjXop02n4/ckmZSnY2+HKcLud/tcmvhST0bie/0lS48=
|
|
||||||
github.com/hashicorp/errwrap v1.0.0 h1:hLrqtEDnRye3+sgx6z4qVLNuviH3MR5aQ0ykNJa/UYA=
|
|
||||||
github.com/hashicorp/errwrap v1.0.0/go.mod h1:YH+1FKiLXxHSkmPseP+kNlulaMuP3n2brvKWEqk/Jc4=
|
|
||||||
github.com/hashicorp/go-multierror v1.0.0 h1:iVjPR7a6H0tWELX5NxNe7bYopibicUzc7uPribsnS6o=
|
|
||||||
github.com/hashicorp/go-multierror v1.0.0/go.mod h1:dHtQlpGsu+cZNNAkkCN/P3hoUDHhCYQXV3UM06sGGrk=
|
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
|
||||||
github.com/ipfs/go-block-format v0.0.2 h1:qPDvcP19izTjU8rgo6p7gTXZlkMkF5bz5G3fqIsSCPE=
|
|
||||||
github.com/ipfs/go-block-format v0.0.2/go.mod h1:AWR46JfpcObNfg3ok2JHDUfdiHRgWhJgCQF+KIgOPJY=
|
|
||||||
github.com/ipfs/go-cid v0.0.1/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
|
||||||
github.com/ipfs/go-cid v0.0.2/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
|
||||||
github.com/ipfs/go-cid v0.0.3/go.mod h1:GHWU/WuQdMPmIosc4Yn1bcCT7dSeX4lBafM7iqUPQvM=
|
|
||||||
github.com/ipfs/go-cid v0.0.5 h1:o0Ix8e/ql7Zb5UVUJEUfjsWCIY8t48++9lR8qi6oiJU=
|
|
||||||
github.com/ipfs/go-cid v0.0.5/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
|
|
||||||
github.com/ipfs/go-cid v0.0.6-0.20200501230655-7c82f3b81c00/go.mod h1:plgt+Y5MnOey4vO4UlUazGqdbEXuFYitED67FexhXog=
|
|
||||||
github.com/ipfs/go-cid v0.0.6 h1:go0y+GcDOGeJIV01FeBsta4FHngoA4Wz7KMeLkXAhMs=
|
|
||||||
github.com/ipfs/go-cid v0.0.6/go.mod h1:6Ux9z5e+HpkQdckYoX1PG/6xqKspzlEIR5SDmgqgC/I=
|
|
||||||
github.com/ipfs/go-hamt-ipld v0.0.15-0.20200131012125-dd88a59d3f2e/go.mod h1:9aQJu/i/TaRDW6jqB5U217dLIDopn50wxLdHXM2CTfE=
|
|
||||||
github.com/ipfs/go-hamt-ipld v0.1.1/go.mod h1:1EZCr2v0jlCnhpa+aZ0JZYp8Tt2w16+JJOAVz17YcDk=
|
|
||||||
github.com/ipfs/go-ipfs-files v0.0.7 h1:s5BRD12ndahqYifeH1S8Z73zqZhR+3IdKYAG9PiETs0=
|
|
||||||
github.com/ipfs/go-ipfs-files v0.0.7/go.mod h1:wiN/jSG8FKyk7N0WyctKSvq3ljIa2NNTiZB55kpTdOs=
|
|
||||||
github.com/ipfs/go-ipfs-util v0.0.1 h1:Wz9bL2wB2YBJqggkA4dD7oSmqB4cAnpNbGrlHJulv50=
|
|
||||||
github.com/ipfs/go-ipfs-util v0.0.1/go.mod h1:spsl5z8KUnrve+73pOhSVZND1SIxPW5RyBCNzQxlJBc=
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.3/go.mod h1:wTBtrQZA3SoFKMVkp6cn6HMRteIB1VsmHA0AQFOn7Nc=
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.4 h1:Aw3KPOKXjvrm6VjwJvFf1F1ekR/BH3jdof3Bk7OTiSA=
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.4/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669 h1:jIVle1vGSzxyUhseYNEqd7qcDVRrIbJ7UxGwao70cF0=
|
|
||||||
github.com/ipfs/go-ipld-cbor v0.0.5-0.20200204214505-252690b78669/go.mod h1:BkCduEx3XBCO6t2Sfo5BaHzuok7hbhdMm9Oh8B2Ftq4=
|
|
||||||
github.com/ipfs/go-ipld-format v0.0.1 h1:HCu4eB/Gh+KD/Q0M8u888RFkorTWNIL3da4oc5dwc80=
|
|
||||||
github.com/ipfs/go-ipld-format v0.0.1/go.mod h1:kyJtbkDALmFHv3QR6et67i35QzO3S0dCDnkOJhcZkms=
|
|
||||||
github.com/ipfs/go-ipld-format v0.0.2 h1:OVAGlyYT6JPZ0pEfGntFPS40lfrDmaDbQwNHEY2G9Zs=
|
|
||||||
github.com/ipfs/go-ipld-format v0.0.2/go.mod h1:4B6+FM2u9OJ9zCV+kSbgFAZlOrv1Hqbf0INGQgiKf9k=
|
|
||||||
github.com/ipfs/go-log v0.0.1/go.mod h1:kL1d2/hzSpI0thNYjiKfjanbVNU+IIGA/WnNESY9leM=
|
|
||||||
github.com/ipfs/go-log v1.0.0/go.mod h1:JO7RzlMK6rA+CIxFMLOuB6Wf5b81GDiKElL7UPSIKjA=
|
|
||||||
github.com/ipfs/go-log v1.0.4 h1:6nLQdX4W8P9yZZFH7mO+X/PzjN8Laozm/lMJ6esdgzY=
|
|
||||||
github.com/ipfs/go-log v1.0.4/go.mod h1:oDCg2FkjogeFOhqqb+N39l2RpTNPL6F/StPkB3kPgcs=
|
|
||||||
github.com/ipfs/go-log/v2 v2.0.5 h1:fL4YI+1g5V/b1Yxr1qAiXTMg1H8z9vx/VmJxBuQMHvU=
|
|
||||||
github.com/ipfs/go-log/v2 v2.0.5/go.mod h1:eZs4Xt4ZUJQFM3DlanGhy7TkwwawCZcSByscwkWG+dw=
|
|
||||||
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52 h1:QG4CGBqCeuBo6aZlGAamSkxWdgWfZGeE49eUOWJPA4c=
|
|
||||||
github.com/ipsn/go-secp256k1 v0.0.0-20180726113642-9d62b9f0bc52/go.mod h1:fdg+/X9Gg4AsAIzWpEHwnqd+QY3b7lajxyjE1m4hkq4=
|
|
||||||
github.com/jbenet/go-cienv v0.1.0/go.mod h1:TqNnHUmJgXau0nCzC7kXWeotg3J9W34CUv5Djy1+FlA=
|
|
||||||
github.com/jbenet/goprocess v0.1.3/go.mod h1:5yspPrukOVuOLORacaBi858NqyClJPQxYZlqdZVfqY4=
|
|
||||||
github.com/jessevdk/go-flags v0.0.0-20141203071132-1679536dcc89/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
|
||||||
github.com/jessevdk/go-flags v1.4.0/go.mod h1:4FA24M0QyGHXBuZZK/XkWh8h0e1EYbRYJSGM75WSRxI=
|
|
||||||
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901 h1:rp+c0RAYOWj8l6qbCUTSiRLG/iKnW3K3/QfPPuSsBt4=
|
|
||||||
github.com/joeshaw/multierror v0.0.0-20140124173710-69b34d4ec901/go.mod h1:Z86h9688Y0wesXCyonoVr47MasHilkuLMqGhRZ4Hpak=
|
|
||||||
github.com/jrick/logrotate v1.0.0/go.mod h1:LNinyqDIJnpAur+b8yyulnQw/wDuN1+BYKlTRt3OuAQ=
|
|
||||||
github.com/jtolds/gls v4.2.1+incompatible h1:fSuqC+Gmlu6l/ZYAoZzx2pyucC8Xza35fpRVWLVmUEE=
|
|
||||||
github.com/jtolds/gls v4.2.1+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
|
||||||
github.com/jtolds/gls v4.20.0+incompatible h1:xdiiI2gbIgH/gLH7ADydsJ1uDOEzR8yvV7C0MuV77Wo=
|
|
||||||
github.com/jtolds/gls v4.20.0+incompatible/go.mod h1:QJZ7F/aHp+rZTRtaJ1ow/lLfFfVYBRgL+9YlvaHOwJU=
|
|
||||||
github.com/kami-zh/go-capturer v0.0.0-20171211120116-e492ea43421d/go.mod h1:P2viExyCEfeWGU259JnaQ34Inuec4R38JCyBx2edgD0=
|
|
||||||
github.com/kisielk/errcheck v1.1.0/go.mod h1:EZBBE59ingxPouuu3KfxchcWSUPOHkagtvWXihfKN4Q=
|
|
||||||
github.com/kisielk/errcheck v1.2.0/go.mod h1:/BMXB+zMLi60iA8Vv6Ksmxu/1UDYcXs4uQLJ+jE2L00=
|
|
||||||
github.com/kisielk/gotool v1.0.0/go.mod h1:XhKaO+MFFWcvkIS/tQcRk01m1F5IRFswLeQ+oQHNcck=
|
|
||||||
github.com/kkdai/bstream v0.0.0-20161212061736-f391b8402d23/go.mod h1:J+Gs4SYgM6CZQHDETBtE9HaSEkGmuNXF86RwHhHUvq4=
|
|
||||||
github.com/konsorten/go-windows-terminal-sequences v1.0.1/go.mod h1:T0+1ngSBFLxvqU3pZ+m/2kptfBszLMUkC4ZK/EgS/cQ=
|
|
||||||
github.com/kr/pretty v0.1.0 h1:L/CwN0zerZDmRFUapSPitk6f+Q3+0za1rQkzVuMiMFI=
|
|
||||||
github.com/kr/pretty v0.1.0/go.mod h1:dAy3ld7l9f0ibDNOQOHHMYYIIbhfbHSm3C4ZsoJORNo=
|
|
||||||
github.com/kr/pty v1.1.1/go.mod h1:pFQYn66WHrOpPYNljwOMqo10TkYh1fy3cYio2l3bCsQ=
|
|
||||||
github.com/kr/text v0.1.0 h1:45sCR5RtlFHMR4UwH9sdQ5TC8v0qDQCHnXt+kaKSTVE=
|
|
||||||
github.com/kr/text v0.1.0/go.mod h1:4Jbv+DJW3UT/LiOwJeYQe1efqtUx/iVham/4vfdArNI=
|
|
||||||
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
|
|
||||||
github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw=
|
|
||||||
github.com/libp2p/go-openssl v0.0.4/go.mod h1:unDrJpgy3oFr+rqXsarWifmJuNnJR4chtO1HmaZjggc=
|
|
||||||
github.com/mailru/easyjson v0.0.0-20180823135443-60711f1a8329/go.mod h1:C1wdFJiN94OJF2b5HbByQZoLdCWB1Yqtg26g4irojpc=
|
|
||||||
github.com/mattn/go-colorable v0.0.9/go.mod h1:9vuHe8Xs5qXnSaW/c/ABM9alt+Vo+STaOChaDxuIBZU=
|
|
||||||
github.com/mattn/go-colorable v0.1.1/go.mod h1:FuOcm+DKB9mbwrcAfNl7/TZVBZ6rcnceauSikq3lYCQ=
|
|
||||||
github.com/mattn/go-colorable v0.1.4 h1:snbPLB8fVfU9iwbbo30TPtbLRzwWu6aJS6Xh4eaaviA=
|
|
||||||
github.com/mattn/go-colorable v0.1.4/go.mod h1:U0ppj6V5qS13XJ6of8GYAs25YV2eR4EVcfRqFIhoBtE=
|
|
||||||
github.com/mattn/go-isatty v0.0.3/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
|
||||||
github.com/mattn/go-isatty v0.0.4/go.mod h1:M+lRXTBqGeGNdLjl/ufCoiOlB5xdOkqRJdNxMWT7Zi4=
|
|
||||||
github.com/mattn/go-isatty v0.0.5/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.8/go.mod h1:Iq45c/XA43vh69/j3iqttzPXn0bhXyGjM0Hdxcsrc5s=
|
|
||||||
github.com/mattn/go-isatty v0.0.9 h1:d5US/mDsogSGW37IV293h//ZFaeajb69h+EHFsv2xGg=
|
|
||||||
github.com/mattn/go-isatty v0.0.9/go.mod h1:YNRxwqDuOph6SZLI9vUUz6OYw3QyUt7WiY2yME+cCiQ=
|
|
||||||
github.com/mattn/go-runewidth v0.0.7 h1:Ei8KR0497xHyKJPAv59M1dkC+rOZCMBJ+t3fZ+twI54=
|
|
||||||
github.com/mattn/go-runewidth v0.0.7/go.mod h1:H031xJmbD/WCDINGzjvQ9THkh0rPKHF+m2gUSrubnMI=
|
|
||||||
github.com/mgutz/ansi v0.0.0-20170206155736-9520e82c474b/go.mod h1:01TrycV0kFyexm33Z7vhZRXopbI8J3TDReVlkTgMUxE=
|
|
||||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1 h1:lYpkrQH5ajf0OXOcUbGjvZxxijuBwbbmlSxLiuofa+g=
|
|
||||||
github.com/minio/blake2b-simd v0.0.0-20160723061019-3f5f724cb5b1/go.mod h1:pD8RvIylQ358TN4wwqatJ8rNavkEINozVn9DtGI3dfQ=
|
|
||||||
github.com/minio/sha256-simd v0.0.0-20190131020904-2d45a736cd16/go.mod h1:2FMWW+8GMoPweT6+pI63m9YE3Lmw4J71hV56Chs1E/U=
|
|
||||||
github.com/minio/sha256-simd v0.1.1-0.20190913151208-6de447530771/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
|
|
||||||
github.com/minio/sha256-simd v0.1.1 h1:5QHSlgo3nt5yKOJrC7W8w7X+NFl8cMPZm96iu8kKUJU=
|
|
||||||
github.com/minio/sha256-simd v0.1.1/go.mod h1:B5e1o+1/KgNmWrSQK08Y6Z1Vb5pwIktudl0J58iy0KM=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0 h1:lukF9ziXFxDFPkA1vsr5zpc1XuPDn/wFntq5mG+4E0Y=
|
|
||||||
github.com/mitchellh/go-homedir v1.1.0/go.mod h1:SfyaCUpYCn1Vlf4IUYiD9fPX4A5wJrkLzIz1N1q0pr0=
|
|
||||||
github.com/mr-tron/base58 v1.1.0/go.mod h1:xcD2VGqlgYjBdcBLw+TuYLr8afG+Hj8g2eTVqeSzSU8=
|
|
||||||
github.com/mr-tron/base58 v1.1.2/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
|
||||||
github.com/mr-tron/base58 v1.1.3 h1:v+sk57XuaCKGXpWtVBX8YJzO7hMGx4Aajh4TQbdEFdc=
|
|
||||||
github.com/mr-tron/base58 v1.1.3/go.mod h1:BinMc/sQntlIE1frQmRFPUoPA1Zkr8VRgBdjWI2mNwc=
|
|
||||||
github.com/multiformats/go-base32 v0.0.3 h1:tw5+NhuwaOjJCC5Pp82QuXbrmLzWg7uxlMFp8Nq/kkI=
|
|
||||||
github.com/multiformats/go-base32 v0.0.3/go.mod h1:pLiuGC8y0QR3Ue4Zug5UzK9LjgbkL8NSQj0zQ5Nz/AA=
|
|
||||||
github.com/multiformats/go-base36 v0.1.0 h1:JR6TyF7JjGd3m6FbLU2cOxhC0Li8z8dLNGQ89tUg4F4=
|
|
||||||
github.com/multiformats/go-base36 v0.1.0/go.mod h1:kFGE83c6s80PklsHO9sRn2NCoffoRdUUOENyW/Vv6sM=
|
|
||||||
github.com/multiformats/go-multiaddr v0.2.0/go.mod h1:0nO36NvPpyV4QzvTLi/lafl2y95ncPj0vFwVF6k6wJ4=
|
|
||||||
github.com/multiformats/go-multibase v0.0.1 h1:PN9/v21eLywrFWdFNsFKaU04kLJzuYzmrJR+ubhT9qA=
|
|
||||||
github.com/multiformats/go-multibase v0.0.1/go.mod h1:bja2MqRZ3ggyXtZSEDKpl0uO/gviWFaSteVbWT51qgs=
|
|
||||||
github.com/multiformats/go-multibase v0.0.3 h1:l/B6bJDQjvQ5G52jw4QGSYeOTZoAwIO77RblWplfIqk=
|
|
||||||
github.com/multiformats/go-multibase v0.0.3/go.mod h1:5+1R4eQrT3PkYZ24C3W2Ue2tPwIdYQD509ZjSb5y9Oc=
|
|
||||||
github.com/multiformats/go-multihash v0.0.1/go.mod h1:w/5tugSrLEbWqlcgJabL3oHFKTwfvkofsjW2Qa1ct4U=
|
|
||||||
github.com/multiformats/go-multihash v0.0.8/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
|
|
||||||
github.com/multiformats/go-multihash v0.0.10/go.mod h1:YSLudS+Pi8NHE7o6tb3D8vrpKa63epEDmG8nTduyAew=
|
|
||||||
github.com/multiformats/go-multihash v0.0.13 h1:06x+mk/zj1FoMsgNejLpy6QTvJqlSt/BhLEy87zidlc=
|
|
||||||
github.com/multiformats/go-multihash v0.0.13/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
|
|
||||||
github.com/multiformats/go-multihash v0.0.14 h1:QoBceQYQQtNUuf6s7wHxnE2c8bhbMqhfGzNI032se/I=
|
|
||||||
github.com/multiformats/go-multihash v0.0.14/go.mod h1:VdAWLKTwram9oKAatUcLxBNUjdtcVwxObEQBtRfuyjc=
|
|
||||||
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
|
||||||
github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
|
||||||
github.com/multiformats/go-varint v0.0.5 h1:XVZwSo04Cs3j/jS0uAEPpT3JY6DzMcVLLoWOSnCxOjg=
|
|
||||||
github.com/multiformats/go-varint v0.0.5/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
|
||||||
github.com/onsi/ginkgo v1.6.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
|
||||||
github.com/onsi/ginkgo v1.7.0/go.mod h1:lLunBs/Ym6LB5Z9jYTR76FiuTmxDTDusOGeTQH+WWjE=
|
|
||||||
github.com/onsi/gomega v1.4.3/go.mod h1:ex+gbHU/CVuBBDIJjb2X0qEXbFg53c61hWP/1CpauHY=
|
|
||||||
github.com/opentracing/opentracing-go v1.0.2/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
|
||||||
github.com/opentracing/opentracing-go v1.1.0 h1:pWlfV3Bxv7k65HYwkikxat0+s3pV4bsqf19k25Ur8rU=
|
|
||||||
github.com/opentracing/opentracing-go v1.1.0/go.mod h1:UkNAQd3GIcIGf0SeVgPpRdFStlNbqXla1AfSYxPUl2o=
|
|
||||||
github.com/pkg/errors v0.8.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pkg/errors v0.9.1 h1:FEBLx1zS214owpjy7qsBeixbURkuhQAwrK5UwLGTwt4=
|
|
||||||
github.com/pkg/errors v0.9.1/go.mod h1:bwawxfHBFNV+L2hUp1rHADufV3IMtnDRdf1r5NINEl0=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
|
|
||||||
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
|
|
||||||
github.com/polydawn/refmt v0.0.0-20190221155625-df39d6c2d992/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
|
||||||
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 h1:CskT+S6Ay54OwxBGB0R3Rsx4Muto6UnEYTyKJbyRIAI=
|
|
||||||
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
|
||||||
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a h1:hjZfReYVLbqFkAtr2us7vdy04YWz3LVAirzP7reh8+M=
|
|
||||||
github.com/polydawn/refmt v0.0.0-20190809202753-05966cbd336a/go.mod h1:uIp+gprXxxrWSjjklXD+mN4wed/tMfjMMmN/9+JsA9o=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0 h1:c8R11WC8m7KNMkTv/0+Be8vvwo4I3/Ut9AC2FW8fX3U=
|
|
||||||
github.com/prometheus/procfs v0.0.0-20190425082905-87a4384529e0/go.mod h1:TjEm7ze935MbeOT/UhFTIMYKhuLP4wbCsTZCD3I8kEA=
|
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0 h1:OdAsTTz6OkFY5QxjkYwrChwuRruF69c169dPK26NUlk=
|
|
||||||
github.com/remyoudompheng/bigfft v0.0.0-20200410134404-eec4a21b6bb0/go.mod h1:qqbHyh8v60DhA7CoWK5oRCqLrMHRGoxYCSS9EjAz6Eo=
|
|
||||||
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
|
|
||||||
github.com/sirupsen/logrus v1.2.0/go.mod h1:LxeOpSwHxABJmUn/MG1IvRgCAasNZTLOkJPxbbu5VWo=
|
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d h1:zE9ykElWQ6/NYmHa3jpm/yHnI4xSofP+UP6SpjHcSeM=
|
|
||||||
github.com/smartystreets/assertions v0.0.0-20180927180507-b2de0cb4f26d/go.mod h1:OnSkiWE9lh6wB0YB77sQom3nweQdgAjqCqsofrRNTgc=
|
|
||||||
github.com/smartystreets/assertions v1.0.1 h1:voD4ITNjPL5jjBfgR/r8fPIIBrliWrWHeiJApdr3r4w=
|
|
||||||
github.com/smartystreets/assertions v1.0.1/go.mod h1:kHHU4qYBaI3q23Pp3VPrmWhuIUrLW/7eUrw0BU5VaoM=
|
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa h1:E+gaaifzi2xF65PbDmuKI3PhLWY6G5opMLniFq8vmXA=
|
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190222223459-a17d461953aa/go.mod h1:2RVY1rIf+2J2o/IM9+vPq9RzmHDSseB7FoXiSNIUsoU=
|
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337 h1:WN9BUFbdyOsSH/XohnWpXOlq9NBD5sGAB2FciQMUEe8=
|
|
||||||
github.com/smartystreets/goconvey v0.0.0-20190731233626-505e41936337/go.mod h1:syvi0/a8iFYH4r/RixwvyeAJjdLS9QV7WQ/tjFTllLA=
|
|
||||||
github.com/smola/gocompat v0.2.0/go.mod h1:1B0MlxbmoZNo3h8guHp8HztB3BSYR5itql9qtVc0ypY=
|
|
||||||
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572/go.mod h1:w0SWMsp6j9O/dk4/ZpIhL+3CkG8ofA2vuv7k+ltqUMc=
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0 h1:7c1g84S4BPRrfL5Xrdp6fOJ206sU9y293DDHaoy0bLI=
|
|
||||||
github.com/spaolacci/murmur3 v1.1.0/go.mod h1:JwIasOWyU6f++ZhiEuf87xNszmSA2myDM2Kzu9HwQUA=
|
|
||||||
github.com/src-d/envconfig v1.0.0/go.mod h1:Q9YQZ7BKITldTBnoxsE5gOeB5y66RyPXeue/R4aaNBc=
|
|
||||||
github.com/stretchr/objx v0.1.0/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/objx v0.1.1/go.mod h1:HFkY916IF+rwdDfMAkV7OtwuqBVzrE8GR6GFx+wExME=
|
|
||||||
github.com/stretchr/testify v1.2.2/go.mod h1:a8OnRcib4nhh0OaRAV+Yts87kKdq0PP7pXfy6kDkUVs=
|
|
||||||
github.com/stretchr/testify v1.3.0/go.mod h1:M5WIy9Dh21IEIfnGCwXGc5bZfKNJtfHm1UVUgZn+9EI=
|
|
||||||
github.com/stretchr/testify v1.4.0 h1:2E4SXV/wtOkTonXsotYi4li6zVWxYlZuYNCXe9XRJyk=
|
|
||||||
github.com/stretchr/testify v1.4.0/go.mod h1:j7eGeouHqKxXV5pUuKE4zz7dFj8WfuZ+81PSLYec5m4=
|
|
||||||
github.com/stretchr/testify v1.6.1 h1:hDPOHmpOpP40lSULcqw7IrRb/u7w6RpDC9399XyoNd0=
|
|
||||||
github.com/stretchr/testify v1.6.1/go.mod h1:6Fq8oRcR53rry900zMqJjRRixrwX3KX962/h/Wwjteg=
|
|
||||||
github.com/tj/go-spin v1.1.0 h1:lhdWZsvImxvZ3q1C5OIB7d72DuOwP4O2NdBg9PyzNds=
|
|
||||||
github.com/tj/go-spin v1.1.0/go.mod h1:Mg1mzmePZm4dva8Qz60H2lHwmJ2loum4VIrLgVnKwh4=
|
|
||||||
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436 h1:qOpVTI+BrstcjTZLm2Yz/3sOnqkzj3FQoh0g+E5s3Gc=
|
|
||||||
github.com/warpfork/go-wish v0.0.0-20180510122957-5ad1f5abf436/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
|
||||||
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830 h1:8kxMKmKzXXL4Ru1nyhvdms/JjWt+3YLpvRb/bAjO/y0=
|
|
||||||
github.com/warpfork/go-wish v0.0.0-20190328234359-8b3e70f8e830/go.mod h1:x6AKhvSSexNrVSrViXSHUEbICjmGXhtgABaHIySUSGw=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20191216205031-b047b6acb3c0/go.mod h1:xdlJQaiqipF0HW+Mzpg7XRM3fWbGvfgFlcppuvlkIvY=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e h1:JY8o/ebUUrCYetWmjRCNghxC59cOEaili83rxPRQCLw=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200414195334-429a0b5e922e/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200504204219-64967432584d/go.mod h1:W5MvapuoHRP8rz4vxjwCK1pDqF1aQcWsV5PZ+AHbqdg=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377 h1:LHFlP/ktDvOnCap7PsT87cs7Gwd0p+qv6Qm5g2ZPR+I=
|
|
||||||
github.com/whyrusleeping/cbor-gen v0.0.0-20200715143311-227fab5a2377/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
|
|
||||||
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
|
|
||||||
github.com/x-cray/logrus-prefixed-formatter v0.5.2/go.mod h1:2duySbKsL6M18s5GU7VPsoEPHyzalCE06qoARUCeBBE=
|
|
||||||
github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829 h1:wb7xrDzfkLgPHsSEBm+VSx6aDdi64VtV0xvP0E6j8bk=
|
|
||||||
github.com/xlab/c-for-go v0.0.0-20200718154222-87b0065af829/go.mod h1:h/1PEBwj7Ym/8kOuMWvO2ujZ6Lt+TMbySEXNhjjR87I=
|
|
||||||
github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245 h1:Sw125DKxZhPUI4JLlWugkzsrlB50jR9v2khiD9FxuSo=
|
|
||||||
github.com/xlab/pkgconfig v0.0.0-20170226114623-cea12a0fd245/go.mod h1:C+diUUz7pxhNY6KAoLgrTYARGWnt82zWTylZlxT92vk=
|
|
||||||
github.com/xorcare/golden v0.6.0/go.mod h1:7T39/ZMvaSEZlBPoYfVFmsBLmUl3uz9IuzWj/U6FtvQ=
|
|
||||||
github.com/yuin/goldmark v1.1.32/go.mod h1:3hX8gzYuyVAZsxl0MRgGTJEmQBFcNTphYh9decYSb74=
|
|
||||||
go.opencensus.io v0.22.2/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.opencensus.io v0.22.3 h1:8sGtKOrtQqkN1bp2AtX+misvLIlOmsEsNd+9NIcPEm8=
|
|
||||||
go.opencensus.io v0.22.3/go.mod h1:yxeiOL68Rb0Xd1ddK5vPZ/oVn4vY4Ynel7k9FzqtOIw=
|
|
||||||
go.uber.org/atomic v1.4.0 h1:cxzIVoETapQEqDhQu3QfnvXAV4AlzcvUCxkVUFw3+EU=
|
|
||||||
go.uber.org/atomic v1.4.0/go.mod h1:gD2HeocX3+yG+ygLZcrzQJaqmWj9AIm7n08wl/qW/PE=
|
|
||||||
go.uber.org/atomic v1.5.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
|
||||||
go.uber.org/atomic v1.6.0 h1:Ezj3JGmsOnG1MoRWQkPBsKLe9DwWD9QeXzTRzzldNVk=
|
|
||||||
go.uber.org/atomic v1.6.0/go.mod h1:sABNBOSYdrvTF6hTgEIbc7YasKWGhgEQZyfxyTvoXHQ=
|
|
||||||
go.uber.org/multierr v1.1.0 h1:HoEmRHQPVSqub6w2z2d2EOVs2fjyFRGyofhKuyDq0QI=
|
|
||||||
go.uber.org/multierr v1.1.0/go.mod h1:wR5kodmAFQ0UK8QlbwjlSNy0Z68gJhDJUG5sjR94q/0=
|
|
||||||
go.uber.org/multierr v1.4.0 h1:f3WCSC2KzAcBXGATIxAB1E2XuCpNU255wNKZ505qi3E=
|
|
||||||
go.uber.org/multierr v1.4.0/go.mod h1:VgVr7evmIr6uPjLBxg28wmKNXyqE9akIJ5XnfpiKl+4=
|
|
||||||
go.uber.org/multierr v1.5.0 h1:KCa4XfM8CWFCpxXRGok+Q0SS/0XBhMDbHHGABQLvD2A=
|
|
||||||
go.uber.org/multierr v1.5.0/go.mod h1:FeouvMocqHpRaaGuG9EjoKcStLC43Zu/fmqdUMPcKYU=
|
|
||||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee h1:0mgffUl7nfd+FpvXMVz4IDEaUSmT1ysygQC7qYo7sG4=
|
|
||||||
go.uber.org/tools v0.0.0-20190618225709-2cfd321de3ee/go.mod h1:vJERXedbb3MVM5f9Ejo0C68/HhF8uaILCdgjnY+goOA=
|
|
||||||
go.uber.org/zap v1.10.0 h1:ORx85nbTijNz8ljznvCMR1ZBIPKFn3jQrag10X2AsuM=
|
|
||||||
go.uber.org/zap v1.10.0/go.mod h1:vwi/ZaCAaUcBkycHslxD9B2zi4UTXhF60s6SWpuDF0Q=
|
|
||||||
go.uber.org/zap v1.14.1 h1:nYDKopTbvAPq/NrUVZwT15y2lpROBiLLyoRTbXOYWOo=
|
|
||||||
go.uber.org/zap v1.14.1/go.mod h1:Mb2vm2krFEG5DV0W9qcHBYFtp/Wku1cvYaqPsS/WYfc=
|
|
||||||
golang.org/x/crypto v0.0.0-20170930174604-9419663f5a44/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20180904163835-0709b304e793/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190211182817-74369b46fc67/go.mod h1:6SG95UA2DQfeDnfUPMdvaQW0Q7yPrPDi9nlGo2tz2b4=
|
|
||||||
golang.org/x/crypto v0.0.0-20190308221718-c2843e01d9a2/go.mod h1:djNgcEr1/C05ACkg1iLfiJU5Ep61QUkGW8qpdssI0+w=
|
|
||||||
golang.org/x/crypto v0.0.0-20190510104115-cbcb75029529/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20190611184440-5c40567a22f8/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550 h1:ObdrDkeb4kJdCP557AjRjq69pTHfNouLtWZG7j9rPN8=
|
|
||||||
golang.org/x/crypto v0.0.0-20191011191535-87dc89f01550/go.mod h1:yigFU9vqHzYiE8UmvKecakEJjdnWj3jj499lnFckfCI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9 h1:psW17arqaxU48Z5kZ0CQnkZWQJsqcURM6tKiBApRjXI=
|
|
||||||
golang.org/x/crypto v0.0.0-20200622213623-75b288015ac9/go.mod h1:LzIPMQfyMNhhGPhUkYOs5KpL4U8rLKemX1yGLhDgUto=
|
|
||||||
golang.org/x/exp v0.0.0-20190121172915-509febef88a4/go.mod h1:CJ0aWSM057203Lf6IL+f9T1iT9GByDxfZKAQTCR3kQA=
|
|
||||||
golang.org/x/lint v0.0.0-20181026193005-c67002cb31c3/go.mod h1:UVdnD1Gm6xHRNCYTkRU2/jEulfH38KcIWyp/GAMgvoE=
|
|
||||||
golang.org/x/lint v0.0.0-20190227174305-5b3e6a55c961/go.mod h1:wehouNa3lNwaWXcvxsM5YxQ5yQlVC4a0KAMCusXpPoU=
|
|
||||||
golang.org/x/lint v0.0.0-20190313153728-d0100b6bd8b3/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20190930215403-16217165b5de/go.mod h1:6SW0HCj/g11FgYtHlgUYUwCkIfeOF89ocIRzGO/8vkc=
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b h1:Wh+f8QHJXR411sJR8/vRBTZ7YapZaRvUcLFFJhusH0k=
|
|
||||||
golang.org/x/lint v0.0.0-20200302205851-738671d3881b/go.mod h1:3xt1FjdF8hUf6vQPIChWIBhFzV8gjjsPE/fR3IyQdNY=
|
|
||||||
golang.org/x/mod v0.0.0-20190513183733-4bf6d317e70e/go.mod h1:mXi4GBBbnImb6dmsKGUJ2LatrhH/nqhxcFungHvyanc=
|
|
||||||
golang.org/x/mod v0.1.1-0.20191105210325-c90efee705ee/go.mod h1:QqPTAvyqsEbceGzBzNggFXnrqF1CaUcvgkdR5Ot7KZg=
|
|
||||||
golang.org/x/mod v0.3.0 h1:RM4zey1++hCTbCVQfnWeKs9/IEsaBLA8vTkd0WVtmH4=
|
|
||||||
golang.org/x/mod v0.3.0/go.mod h1:s0Qsj1ACt9ePp/hMypM3fl4fZqREWJwdYDEqhRiZZUA=
|
|
||||||
golang.org/x/net v0.0.0-20180724234803-3673e40ba225/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20180826012351-8a410e7b638d/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20180906233101-161cd47e91fd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190213061140-3a22650c66bd/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190227160552-c95aed5357e7/go.mod h1:mL1N/T3taQHkDXs73rZJwtUhF3w3ftmwwsq0BUmARs4=
|
|
||||||
golang.org/x/net v0.0.0-20190311183353-d8887717615a/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190404232315-eb5bcb51f2a3/go.mod h1:t9HGtf8HONx5eT2rtn7q6eTqICYqUVnKs3thJo3Qplg=
|
|
||||||
golang.org/x/net v0.0.0-20190620200207-3b0461eec859/go.mod h1:z5CRVTTTmAJ677TzLLGU+0bjPO0LkuOLi4/5GtJWs/s=
|
|
||||||
golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
|
|
||||||
golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
|
|
||||||
golang.org/x/sync v0.0.0-20180314180146-1d60e4601c6f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181108010431-42b317875d0f/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20181221193216-37e7f081c4d4/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190227155943-e225da77a7e6/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20190423024810-112230192c58/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sync v0.0.0-20200625203802-6e8e738ad208/go.mod h1:RxMgew5VJxzue5/jJTE5uejpjVlOe/izrB70Jof72aM=
|
|
||||||
golang.org/x/sys v0.0.0-20180202135801-37707fdb30a5/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180830151530-49385e6e1522/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180905080454-ebe1bf3edb33/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20180909124046-d0be0721c37e/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190215142949-d0b11bdaac8a/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190219092855-153ac476189d/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190222072716-a9d3bda3a223/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190302025703-b6889370fb10/go.mod h1:STP8DvDyc/dI5b8T5hshtkjS+E42TnysNCUPdjciGhY=
|
|
||||||
golang.org/x/sys v0.0.0-20190412213103-97732733099d/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190502145724-3ef323f4f1fd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190626221950-04f50cda93cb/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190813064441-fde4db37ae7a/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20190826190057-c7b8b68b1456/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae h1:QoJmnb9uyPCrH8GIg9uRLn4Ta45yhcQtpymCd0AavO8=
|
|
||||||
golang.org/x/sys v0.0.0-20191025021431-6c3a3bfe00ae/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd h1:xhmwyvizuTgC2qz7ZlMluP20uW+C3Rm0FD/WLDX8884=
|
|
||||||
golang.org/x/sys v0.0.0-20200323222414-85ca7c5b95cd/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
|
|
||||||
golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
|
|
||||||
golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
|
|
||||||
golang.org/x/tools v0.0.0-20180221164845-07fd8470d635/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20180917221912-90fa682c2a6e/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20181030221726-6c7e314b6563/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20181130052023-1c3d964395ce/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190114222345-bf090417da8b/go.mod h1:n7NCudcB/nEzxVGmLbDWY5pfWTLqBcC2KZ6jyYvM4mQ=
|
|
||||||
golang.org/x/tools v0.0.0-20190226205152-f727befe758c/go.mod h1:9Yl7xja0Znq3iFh3HoIrodX9oNMXvdceNzlUR8zjMvY=
|
|
||||||
golang.org/x/tools v0.0.0-20190311212946-11955173bddd/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190328211700-ab21143f2384/go.mod h1:LCzVGOaR6xXOjkQ3onu1FJEFr0SW1gC7cKk1uF8kGRs=
|
|
||||||
golang.org/x/tools v0.0.0-20190621195816-6e04913cbbac/go.mod h1:/rFqwRUd4F7ZHNgwSSTFct+R/Kf4OFW1sUzUTQQTgfc=
|
|
||||||
golang.org/x/tools v0.0.0-20191029041327-9cc4af7d6b2c/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191029190741-b9c20aec41a5/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191119224855-298f0cb1881e/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20191130070609-6e064ea0cf2d/go.mod h1:b+2E5dAYhXwXZwtnZ6UAqBI28+e2cm9otk0dWdXHAEo=
|
|
||||||
golang.org/x/tools v0.0.0-20200130002326-2f3ba24bd6e7/go.mod h1:TB2adYChydJhpapKDTa4BR/hXlZSLoq2Wpct/0txZ28=
|
|
||||||
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d h1:F3OmlXCzYtG9YE6tXDnUOlJBzVzHF8EcmZ1yTJlcgIk=
|
|
||||||
golang.org/x/tools v0.0.0-20200711155855-7342f9734a7d/go.mod h1:njjCfa9FT2d7l9Bc6FUM5FLjQPp3cFF28FI3qnDFljA=
|
|
||||||
golang.org/x/xerrors v0.0.0-20190717185122-a985d3407aa7/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191011141410-1b5146add898/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543 h1:E7g+9GITq07hpfrRu66IVDexMakfv52eLZ2CXBWiKr4=
|
|
||||||
golang.org/x/xerrors v0.0.0-20191204190536-9bdfabe68543/go.mod h1:I/5z698sn9Ka8TeJc9MKroUUfqBBauWjQqLJ2OPfmY0=
|
|
||||||
google.golang.org/appengine v1.1.0/go.mod h1:EbEs0AVv82hx2wNQdGPgUI5lhzA/G0D9YwlJXL52JkM=
|
|
||||||
google.golang.org/appengine v1.4.0/go.mod h1:xpcJRLb0r/rnEns0DIKYYv+WjYCduHsrkT7/EB5XEv4=
|
|
||||||
google.golang.org/genproto v0.0.0-20180817151627-c66870c02cf8/go.mod h1:JiN7NxoALGmiZfu7CAH4rXhgtRTLTxftemlI0sWmxmc=
|
|
||||||
google.golang.org/genproto v0.0.0-20190425155659-357c62f0e4bb/go.mod h1:VzzqZJRnGkLBvHegQrXjBqPurQTc5/KpmUdxsrq26oE=
|
|
||||||
google.golang.org/grpc v1.19.0/go.mod h1:mqu4LbDTu4XGKhr4mRzUsmM4RtVoemTSY81AxZiDr8c=
|
|
||||||
google.golang.org/grpc v1.20.1/go.mod h1:10oTOabMzJvdu6/UiuZezV6QK5dSlG84ov/aaiqXj38=
|
|
||||||
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15 h1:YR8cESwS4TdDjEe65xsg0ogRM/Nc3DYOhEAlW+xobZo=
|
|
||||||
gopkg.in/check.v1 v1.0.0-20190902080502-41f04d3bba15/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
|
|
||||||
gopkg.in/cheggaaa/pb.v1 v1.0.28 h1:n1tBJnnK2r7g9OW2btFH91V92STTUevLXYFb8gy9EMk=
|
|
||||||
gopkg.in/cheggaaa/pb.v1 v1.0.28/go.mod h1:V/YB90LKu/1FcN3WVnfiiE5oMCibMjukxqG/qStrOgw=
|
|
||||||
gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
|
|
||||||
gopkg.in/fsnotify.v1 v1.4.7/go.mod h1:Tz8NjZHkW78fSQdbUxIjBTcgA1z1m8ZHf0WmKUhAMys=
|
|
||||||
gopkg.in/src-d/go-cli.v0 v0.0.0-20181105080154-d492247bbc0d/go.mod h1:z+K8VcOYVYcSwSjGebuDL6176A1XskgbtNl64NSg+n8=
|
|
||||||
gopkg.in/src-d/go-log.v1 v1.0.1/go.mod h1:GN34hKP0g305ysm2/hctJ0Y8nWP3zxXXJ8GFabTyABE=
|
|
||||||
gopkg.in/tomb.v1 v1.0.0-20141024135613-dd632973f1e7/go.mod h1:dt/ZhP58zS4L8KSrWDmTeBkI65Dw0HsyUHuEVlX15mw=
|
|
||||||
gopkg.in/yaml.v2 v2.2.1/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4 h1:/eiJrUcujPVeJ3xlSWaiNi3uSVmDGBK1pDHUHAnao1I=
|
|
||||||
gopkg.in/yaml.v2 v2.2.4/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0 h1:clyUAQHOM3G0M3f5vQj7LuJrETvjVot3Z5el9nffUtU=
|
|
||||||
gopkg.in/yaml.v2 v2.3.0/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
|
|
||||||
gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
|
|
||||||
honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
|
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3 h1:3JgtbtFHMiCmsznwGVTUWbgGov+pVqnlf1dEJTNAXeM=
|
|
||||||
honnef.co/go/tools v0.0.1-2019.2.3/go.mod h1:a3bituU0lyd329TUQxRnasdCoJDkEUEAqEt0JzvZhAg=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3 h1:sXmLre5bzIR6ypkjXCDI3jHPssRhc8KD/Ome589sc3U=
|
|
||||||
honnef.co/go/tools v0.0.1-2020.1.3/go.mod h1:X/FiERA/W4tHapMX5mGpAtMSVEeEUOyHaw9vFzvIQ3k=
|
|
||||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb h1:jhnBjNi9UFpfpl8YZhA9CrOqpnJdvzuiHsl/dnxl11M=
|
|
||||||
howett.net/plist v0.0.0-20181124034731-591f970eefbb/go.mod h1:vMygbs4qMhSZSc4lCUl2OEE+rDiIIJAIdR4m7MiMcm0=
|
|
||||||
modernc.org/cc v1.0.0 h1:nPibNuDEx6tvYrUAtvDTTw98rx5juGsa5zuDnKwEEQQ=
|
|
||||||
modernc.org/cc v1.0.0/go.mod h1:1Sk4//wdnYJiUIxnW8ddKpaOJCF37yAdqYnkxUpaYxw=
|
|
||||||
modernc.org/golex v1.0.0 h1:wWpDlbK8ejRfSyi0frMyhilD3JBvtcx2AdGDnU+JtsE=
|
|
||||||
modernc.org/golex v1.0.0/go.mod h1:b/QX9oBD/LhixY6NDh+IdGv17hgB+51fET1i2kPSmvk=
|
|
||||||
modernc.org/mathutil v1.1.1 h1:FeylZSVX8S+58VsyJlkEj2bcpdytmp9MmDKZkKx8OIE=
|
|
||||||
modernc.org/mathutil v1.1.1/go.mod h1:mZW8CKdRPY1v87qxC/wUdX5O1qDzXMP5TH3wjfpga6E=
|
|
||||||
modernc.org/strutil v1.1.0 h1:+1/yCzZxY2pZwwrsbH+4T7BQMoLQ9QiBshRC9eicYsc=
|
|
||||||
modernc.org/strutil v1.1.0/go.mod h1:lstksw84oURvj9y3tn8lGvRxyRC1S2+g5uuIzNfIOBs=
|
|
||||||
modernc.org/xc v1.0.0 h1:7ccXrupWZIS3twbUGrtKmHS2DXY6xegFua+6O3xgAFU=
|
|
||||||
modernc.org/xc v1.0.0/go.mod h1:mRNCo0bvLjGhHO9WsyuKVU4q0ceiDDDoEeWDJHrNx8I=
|
|
8
extern/sector-storage/localworker.go
vendored
8
extern/sector-storage/localworker.go
vendored
@ -15,10 +15,10 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
storage2 "github.com/filecoin-project/specs-storage/storage"
|
storage2 "github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
var pathTypes = []stores.SectorFileType{stores.FTUnsealed, stores.FTSealed, stores.FTCache}
|
var pathTypes = []stores.SectorFileType{stores.FTUnsealed, stores.FTSealed, stores.FTCache}
|
||||||
|
17
extern/sector-storage/manager.go
vendored
17
extern/sector-storage/manager.go
vendored
@ -3,10 +3,11 @@ package sectorstorage
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"errors"
|
"errors"
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
|
||||||
"io"
|
"io"
|
||||||
"net/http"
|
"net/http"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
"github.com/mitchellh/go-homedir"
|
"github.com/mitchellh/go-homedir"
|
||||||
@ -15,10 +16,10 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("advmgr")
|
var log = logging.Logger("advmgr")
|
||||||
@ -79,6 +80,7 @@ type SealerConfig struct {
|
|||||||
ParallelFetchLimit int
|
ParallelFetchLimit int
|
||||||
|
|
||||||
// Local worker config
|
// Local worker config
|
||||||
|
AllowAddPiece bool
|
||||||
AllowPreCommit1 bool
|
AllowPreCommit1 bool
|
||||||
AllowPreCommit2 bool
|
AllowPreCommit2 bool
|
||||||
AllowCommit bool
|
AllowCommit bool
|
||||||
@ -117,7 +119,10 @@ func New(ctx context.Context, ls stores.LocalStorage, si stores.SectorIndex, cfg
|
|||||||
go m.sched.runSched()
|
go m.sched.runSched()
|
||||||
|
|
||||||
localTasks := []sealtasks.TaskType{
|
localTasks := []sealtasks.TaskType{
|
||||||
sealtasks.TTAddPiece, sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTReadUnsealed,
|
sealtasks.TTCommit1, sealtasks.TTFinalize, sealtasks.TTFetch, sealtasks.TTReadUnsealed,
|
||||||
|
}
|
||||||
|
if sc.AllowAddPiece {
|
||||||
|
localTasks = append(localTasks, sealtasks.TTAddPiece)
|
||||||
}
|
}
|
||||||
if sc.AllowPreCommit1 {
|
if sc.AllowPreCommit1 {
|
||||||
localTasks = append(localTasks, sealtasks.TTPreCommit1)
|
localTasks = append(localTasks, sealtasks.TTPreCommit1)
|
||||||
|
14
extern/sector-storage/manager_test.go
vendored
14
extern/sector-storage/manager_test.go
vendored
@ -5,22 +5,22 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
"fmt"
|
"fmt"
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
|
||||||
logging "github.com/ipfs/go-log"
|
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
"os"
|
"os"
|
||||||
"path/filepath"
|
"path/filepath"
|
||||||
"strings"
|
"strings"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/stretchr/testify/require"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/google/uuid"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
logging "github.com/ipfs/go-log"
|
||||||
|
"github.com/stretchr/testify/require"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
16
extern/sector-storage/mock/mock.go
vendored
16
extern/sector-storage/mock/mock.go
vendored
@ -16,8 +16,8 @@ import (
|
|||||||
logging "github.com/ipfs/go-log"
|
logging "github.com/ipfs/go-log"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/ffiwrapper"
|
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
var log = logging.Logger("sbmock")
|
var log = logging.Logger("sbmock")
|
||||||
@ -76,8 +76,8 @@ func (mgr *SectorMgr) NewSector(ctx context.Context, sector abi.SectorID) error
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorId abi.SectorID, existingPieces []abi.UnpaddedPieceSize, size abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorID abi.SectorID, existingPieces []abi.UnpaddedPieceSize, size abi.UnpaddedPieceSize, r io.Reader) (abi.PieceInfo, error) {
|
||||||
log.Warn("Add piece: ", sectorId, size, mgr.proofType)
|
log.Warn("Add piece: ", sectorID, size, mgr.proofType)
|
||||||
|
|
||||||
var b bytes.Buffer
|
var b bytes.Buffer
|
||||||
tr := io.TeeReader(r, &b)
|
tr := io.TeeReader(r, &b)
|
||||||
@ -92,12 +92,12 @@ func (mgr *SectorMgr) AddPiece(ctx context.Context, sectorId abi.SectorID, exist
|
|||||||
mgr.lk.Lock()
|
mgr.lk.Lock()
|
||||||
mgr.pieces[c] = b.Bytes()
|
mgr.pieces[c] = b.Bytes()
|
||||||
|
|
||||||
ss, ok := mgr.sectors[sectorId]
|
ss, ok := mgr.sectors[sectorID]
|
||||||
if !ok {
|
if !ok {
|
||||||
ss = §orState{
|
ss = §orState{
|
||||||
state: statePacking,
|
state: statePacking,
|
||||||
}
|
}
|
||||||
mgr.sectors[sectorId] = ss
|
mgr.sectors[sectorID] = ss
|
||||||
}
|
}
|
||||||
mgr.lk.Unlock()
|
mgr.lk.Unlock()
|
||||||
|
|
||||||
@ -260,7 +260,7 @@ func opFinishWait(ctx context.Context) {
|
|||||||
func AddOpFinish(ctx context.Context) (context.Context, func()) {
|
func AddOpFinish(ctx context.Context) (context.Context, func()) {
|
||||||
done := make(chan struct{})
|
done := make(chan struct{})
|
||||||
|
|
||||||
return context.WithValue(ctx, "opfinish", done), func() {
|
return context.WithValue(ctx, "opfinish", done), func() { // nolint
|
||||||
close(done)
|
close(done)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -338,7 +338,7 @@ func (mgr *SectorMgr) StageFakeData(mid abi.ActorID) (abi.SectorID, []abi.PieceI
|
|||||||
}
|
}
|
||||||
|
|
||||||
buf := make([]byte, usize)
|
buf := make([]byte, usize)
|
||||||
rand.Read(buf)
|
_, _ = rand.Read(buf) // nolint:gosec
|
||||||
|
|
||||||
id := abi.SectorID{
|
id := abi.SectorID{
|
||||||
Miner: mid,
|
Miner: mid,
|
||||||
|
152
extern/sector-storage/parameters.json
vendored
152
extern/sector-storage/parameters.json
vendored
@ -1,152 +0,0 @@
|
|||||||
{
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.params": {
|
|
||||||
"cid": "QmeDRyxek34F1H6xJY6AkFdWvPsy5F6dKTrebV3ZtWT4ky",
|
|
||||||
"digest": "f5827f2d8801c62c831e0f972f6dc8bb",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0170db1f394b35d995252228ee359194b13199d259380541dc529fb0099096b0.vk": {
|
|
||||||
"cid": "QmUw1ZmG4BBbX19MsbH3zAEGKUc42iFJc5ZAyomDHeJTsA",
|
|
||||||
"digest": "398fecdb4b2de445125852bc3c080b35",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0cfb4f178bbb71cf2ecfcd42accce558b27199ab4fb59cb78f2483fe21ef36d9.params": {
|
|
||||||
"cid": "QmUeNKp9YZpiAFm81RV5KuxH1FDGJx2DuwcbU2XNSZLLSv",
|
|
||||||
"digest": "2b6d2972ac9e862e8134d98fb695b0c5",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-0cfb4f178bbb71cf2ecfcd42accce558b27199ab4fb59cb78f2483fe21ef36d9.vk": {
|
|
||||||
"cid": "QmQaQmTXX995Akd66ggtJY5bNx6Gkxk8P34JTdMMq8393G",
|
|
||||||
"digest": "3688c9eb256b7b17f411dad78d5ef74a",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-3ea05428c9d11689f23529cde32fd30aabd50f7d2c93657c1d3650bca3e8ea9e.params": {
|
|
||||||
"cid": "QmfEYTMSkwGJTumQx26iKXGNKiYh3mmAC4SkdybZpJCj5p",
|
|
||||||
"digest": "09bff16aed893349d94485cfae366a9c",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-3ea05428c9d11689f23529cde32fd30aabd50f7d2c93657c1d3650bca3e8ea9e.vk": {
|
|
||||||
"cid": "QmP4ThPieSUJyRanjibWpT5R5cCMzMAU4j8Y7kBn7CSW1Q",
|
|
||||||
"digest": "142f2f7e8f1b1779290315cabfd2c803",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-50c7368dea9593ed0989e70974d28024efa9d156d585b7eea1be22b2e753f331.params": {
|
|
||||||
"cid": "QmcAixrHsz29DgvtZiMc2kQjvPRvWxYUp36QYmRDZbmREm",
|
|
||||||
"digest": "8f987f64d434365562180b96ec12e299",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-50c7368dea9593ed0989e70974d28024efa9d156d585b7eea1be22b2e753f331.vk": {
|
|
||||||
"cid": "QmT4iFnbL6r4txS5PXsiV7NTzbhCxHy54PvdkJJGV2VFXb",
|
|
||||||
"digest": "94b6c24ac01924f4feeecedd16b5d77d",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-5294475db5237a2e83c3e52fd6c2b03859a1831d45ed08c4f35dbf9a803165a9.params": {
|
|
||||||
"cid": "QmbjFst6SFCK1KsTQrfwPdxf3VTNa1raed574tEZZ9PoyQ",
|
|
||||||
"digest": "2c245fe8179839dd6c6cdea207c67ae8",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-5294475db5237a2e83c3e52fd6c2b03859a1831d45ed08c4f35dbf9a803165a9.vk": {
|
|
||||||
"cid": "QmQJKmvZN1a5cQ1Nw6CDyXs3nuRPzvyU5NvCFMUL2BfcZC",
|
|
||||||
"digest": "56ae47bfda53bb8d22981ed8d8d27d72",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-7d739b8cf60f1b0709eeebee7730e297683552e4b69cab6984ec0285663c5781.params": {
|
|
||||||
"cid": "QmQCABxeTpdvXTyjDyk7nPBxkQzCh7MXfGztWnSXEPKMLW",
|
|
||||||
"digest": "7e6b2eb5ecbb11ac651ad66ebbb2075a",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-0-0-7d739b8cf60f1b0709eeebee7730e297683552e4b69cab6984ec0285663c5781.vk": {
|
|
||||||
"cid": "QmPBweyugh5Sx4umk8ULhgEGbjY8xmWLfU6M7EMpc8Mad6",
|
|
||||||
"digest": "94a8d9e25a9ab9674d339833664eba25",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-0377ded656c6f524f1618760bffe4e0a1c51d5a70c4509eedae8a27555733edc.params": {
|
|
||||||
"cid": "QmY5yax1E9KymBnCeHksE9Zi8NieZbmwcpoDGoabkeeb9h",
|
|
||||||
"digest": "c909ea9e3fe25ab9b391a64593afdbba",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-0377ded656c6f524f1618760bffe4e0a1c51d5a70c4509eedae8a27555733edc.vk": {
|
|
||||||
"cid": "QmXnPo4yH5mwMguwrvqgRfduSttbmPrXtbBfbwU21wQWHt",
|
|
||||||
"digest": "caf900461e988bbf86dbcaca087b7864",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-559e581f022bb4e4ec6e719e563bf0e026ad6de42e56c18714a2c692b1b88d7e.params": {
|
|
||||||
"cid": "QmZtzzPWwmZEgR7MSMvXRbt9KVK8k4XZ5RLWHybHJW9SdE",
|
|
||||||
"digest": "a2844f0703f186d143a06146a04577d8",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-0-559e581f022bb4e4ec6e719e563bf0e026ad6de42e56c18714a2c692b1b88d7e.vk": {
|
|
||||||
"cid": "QmWxEA7EdQCUJTzjNpxg5XTF45D2uVyYnN1QRUb5TRYU8M",
|
|
||||||
"digest": "2306247a1e616dbe07f01b88196c2044",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.params": {
|
|
||||||
"cid": "QmP676KwuvyF9Y64uJnXvLtvD1xcuWQ6wD23RzYtQ6dd4f",
|
|
||||||
"digest": "215b1c667a4f46a1d0178338df568615",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-2627e4006b67f99cef990c0a47d5426cb7ab0a0ad58fc1061547bf2d28b09def.vk": {
|
|
||||||
"cid": "QmPvPwbJtcSGyqB1rQJhSF5yvFbX9ZBSsHVej5F8JUyHUJ",
|
|
||||||
"digest": "0c9c423b28b1455fcbc329a1045fd4dd",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-b62098629d07946e9028127e70295ed996fe3ed25b0f9f88eb610a0ab4385a3c.params": {
|
|
||||||
"cid": "QmUxPQfvckzm1t6MFRdDZ1fDK5UJzAjK7pTZ97cwyachdr",
|
|
||||||
"digest": "965132f51ae445b0e6d32692b7561995",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v27-proof-of-spacetime-fallback-merkletree-poseidon_hasher-8-8-2-b62098629d07946e9028127e70295ed996fe3ed25b0f9f88eb610a0ab4385a3c.vk": {
|
|
||||||
"cid": "QmTxq2EBnQWb5R8tS4MHdchj4vNfLYGoSXxwJFvs5xgW4K",
|
|
||||||
"digest": "fc8c3d26e0e56373ad96cb41520d55a6",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-032d3138d22506ec0082ed72b2dcba18df18477904e35bafee82b3793b06832f.params": {
|
|
||||||
"cid": "QmRjgZHERgqGoRagR788Kh6ybi26csVYa8mqbqhmZm57Jx",
|
|
||||||
"digest": "cfc7b0897d1eee48c586f7beb89e67f7",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-032d3138d22506ec0082ed72b2dcba18df18477904e35bafee82b3793b06832f.vk": {
|
|
||||||
"cid": "QmNjvnvFP7KgovHUddULoB19fBHT81iz7NcUbzEHZUUPsm",
|
|
||||||
"digest": "fb59bd061c987eac7068008c44de346b",
|
|
||||||
"sector_size": 2048
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-6babf46ce344ae495d558e7770a585b2382d54f225af8ed0397b8be7c3fcd472.params": {
|
|
||||||
"cid": "QmTpRPBA4dt8fgGpcVzi4L1KA1U2eBHCE8WVmS2GUygMvT",
|
|
||||||
"digest": "36d465915b0afbf96bd08e7915e00952",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-6babf46ce344ae495d558e7770a585b2382d54f225af8ed0397b8be7c3fcd472.vk": {
|
|
||||||
"cid": "QmRzDyVfQCLsxspoVsed5bcQRsG6KiktngJfcNBL3TJPZe",
|
|
||||||
"digest": "99d16df0eb6a7e227a4f4570c4f6b6f1",
|
|
||||||
"sector_size": 536870912
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-ecd683648512ab1765faa2a5f14bab48f676e633467f0aa8aad4b55dcb0652bb.params": {
|
|
||||||
"cid": "QmV8ZjTSGzDUWmFvsq9NSyPBR7eDDUcvCPNgj2yE7HMAFu",
|
|
||||||
"digest": "34f3ddf1d1c9f41c0cd73b91e8b4bc27",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-0-0-sha256_hasher-ecd683648512ab1765faa2a5f14bab48f676e633467f0aa8aad4b55dcb0652bb.vk": {
|
|
||||||
"cid": "QmTa3VbjTiqJWU6r4WKayaQrUaaBsrpp5UDqYvPDd2C5hs",
|
|
||||||
"digest": "ec62d59651daa5631d3d1e9c782dd940",
|
|
||||||
"sector_size": 8388608
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-0-sha256_hasher-82a357d2f2ca81dc61bb45f4a762807aedee1b0a53fd6c4e77b46a01bfef7820.params": {
|
|
||||||
"cid": "Qmf8ngfArxrv9tFWDqBcNegdBMymvuakwyHKd1pbW3pbsb",
|
|
||||||
"digest": "a16d6f4c6424fb280236739f84b24f97",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-0-sha256_hasher-82a357d2f2ca81dc61bb45f4a762807aedee1b0a53fd6c4e77b46a01bfef7820.vk": {
|
|
||||||
"cid": "QmfQgVFerArJ6Jupwyc9tKjLD9n1J9ajLHBdpY465tRM7M",
|
|
||||||
"digest": "7a139d82b8a02e35279d657e197f5c1f",
|
|
||||||
"sector_size": 34359738368
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-2-sha256_hasher-96f1b4a04c5c51e4759bbf224bbc2ef5a42c7100f16ec0637123f16a845ddfb2.params": {
|
|
||||||
"cid": "QmfDha8271nXJn14Aq3qQeghjMBWbs6HNSGa6VuzCVk4TW",
|
|
||||||
"digest": "5d3cd3f107a3bea8a96d1189efd2965c",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
},
|
|
||||||
"v27-stacked-proof-of-replication-merkletree-poseidon_hasher-8-8-2-sha256_hasher-96f1b4a04c5c51e4759bbf224bbc2ef5a42c7100f16ec0637123f16a845ddfb2.vk": {
|
|
||||||
"cid": "QmRVtTtiFzHJTHurYzaCvetGAchux9cktixT4aGHthN6Zt",
|
|
||||||
"digest": "62c366405404e60f171e661492740b1c",
|
|
||||||
"sector_size": 68719476736
|
|
||||||
}
|
|
||||||
}
|
|
2
extern/sector-storage/request_queue_test.go
vendored
2
extern/sector-storage/request_queue_test.go
vendored
@ -4,7 +4,7 @@ import (
|
|||||||
"fmt"
|
"fmt"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestRequestQueue(t *testing.T) {
|
func TestRequestQueue(t *testing.T) {
|
||||||
|
2
extern/sector-storage/resources.go
vendored
2
extern/sector-storage/resources.go
vendored
@ -3,7 +3,7 @@ package sectorstorage
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Resources struct {
|
type Resources struct {
|
||||||
|
2
extern/sector-storage/roprov.go
vendored
2
extern/sector-storage/roprov.go
vendored
@ -7,7 +7,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
)
|
)
|
||||||
|
|
||||||
type readonlyProvider struct {
|
type readonlyProvider struct {
|
||||||
|
12
extern/sector-storage/sched.go
vendored
12
extern/sector-storage/sched.go
vendored
@ -12,8 +12,8 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
type schedPrioCtxKey int
|
type schedPrioCtxKey int
|
||||||
@ -323,15 +323,15 @@ func (sh *scheduler) trySched() {
|
|||||||
|
|
||||||
// Pick best worker (shuffle in case some workers are equally as good)
|
// Pick best worker (shuffle in case some workers are equally as good)
|
||||||
rand.Shuffle(len(acceptableWindows[sqi]), func(i, j int) {
|
rand.Shuffle(len(acceptableWindows[sqi]), func(i, j int) {
|
||||||
acceptableWindows[sqi][i], acceptableWindows[sqi][j] = acceptableWindows[sqi][j], acceptableWindows[sqi][i]
|
acceptableWindows[sqi][i], acceptableWindows[sqi][j] = acceptableWindows[sqi][j], acceptableWindows[sqi][i] // nolint:scopelint
|
||||||
})
|
})
|
||||||
sort.SliceStable(acceptableWindows[sqi], func(i, j int) bool {
|
sort.SliceStable(acceptableWindows[sqi], func(i, j int) bool {
|
||||||
wii := sh.openWindows[acceptableWindows[sqi][i]].worker
|
wii := sh.openWindows[acceptableWindows[sqi][i]].worker // nolint:scopelint
|
||||||
wji := sh.openWindows[acceptableWindows[sqi][j]].worker
|
wji := sh.openWindows[acceptableWindows[sqi][j]].worker // nolint:scopelint
|
||||||
|
|
||||||
if wii == wji {
|
if wii == wji {
|
||||||
// for the same worker prefer older windows
|
// for the same worker prefer older windows
|
||||||
return acceptableWindows[sqi][i] < acceptableWindows[sqi][j]
|
return acceptableWindows[sqi][i] < acceptableWindows[sqi][j] // nolint:scopelint
|
||||||
}
|
}
|
||||||
|
|
||||||
wi := sh.workers[wii]
|
wi := sh.workers[wii]
|
||||||
|
2
extern/sector-storage/sched_resources.go
vendored
2
extern/sector-storage/sched_resources.go
vendored
@ -3,7 +3,7 @@ package sectorstorage
|
|||||||
import (
|
import (
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
)
|
)
|
||||||
|
|
||||||
func (a *activeResources) withResources(id WorkerID, wr storiface.WorkerResources, r Resources, locker sync.Locker, cb func() error) error {
|
func (a *activeResources) withResources(id WorkerID, wr storiface.WorkerResources, r Resources, locker sync.Locker, cb func() error) error {
|
||||||
|
8
extern/sector-storage/sched_test.go
vendored
8
extern/sector-storage/sched_test.go
vendored
@ -14,10 +14,10 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
"github.com/filecoin-project/sector-storage/fsutil"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
"github.com/filecoin-project/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
"github.com/filecoin-project/sector-storage/stores"
|
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||||
"github.com/filecoin-project/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user