Merge remote-tracking branch 'origin/master' into testnet/3
This commit is contained in:
commit
69ec3c205a
@ -7,6 +7,9 @@ executors:
|
|||||||
docker:
|
docker:
|
||||||
- image: circleci/golang:1.13
|
- image: circleci/golang:1.13
|
||||||
resource_class: 2xlarge
|
resource_class: 2xlarge
|
||||||
|
ubuntu:
|
||||||
|
docker:
|
||||||
|
- image: ubuntu:19.10
|
||||||
|
|
||||||
commands:
|
commands:
|
||||||
install-deps:
|
install-deps:
|
||||||
@ -24,6 +27,8 @@ commands:
|
|||||||
description: is a darwin build environment?
|
description: is a darwin build environment?
|
||||||
type: boolean
|
type: boolean
|
||||||
steps:
|
steps:
|
||||||
|
- checkout
|
||||||
|
- git_fetch_all_tags
|
||||||
- checkout
|
- checkout
|
||||||
- when:
|
- when:
|
||||||
condition: << parameters.linux >>
|
condition: << parameters.linux >>
|
||||||
@ -46,7 +51,27 @@ commands:
|
|||||||
key: 'v20-1k-lotus-params'
|
key: 'v20-1k-lotus-params'
|
||||||
paths:
|
paths:
|
||||||
- /var/tmp/filecoin-proof-parameters/
|
- /var/tmp/filecoin-proof-parameters/
|
||||||
|
install_ipfs:
|
||||||
|
steps:
|
||||||
|
- run: |
|
||||||
|
apt update
|
||||||
|
apt install -y wget
|
||||||
|
wget https://github.com/ipfs/go-ipfs/releases/download/v0.4.22/go-ipfs_v0.4.22_linux-amd64.tar.gz
|
||||||
|
wget https://github.com/ipfs/go-ipfs/releases/download/v0.4.22/go-ipfs_v0.4.22_linux-amd64.tar.gz.sha512
|
||||||
|
if [ "$(sha512sum go-ipfs_v0.4.22_linux-amd64.tar.gz)" != "$(cat go-ipfs_v0.4.22_linux-amd64.tar.gz.sha512)" ]
|
||||||
|
then
|
||||||
|
echo "ipfs failed checksum check"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
tar -xf go-ipfs_v0.4.22_linux-amd64.tar.gz
|
||||||
|
mv go-ipfs/ipfs /usr/local/bin/ipfs
|
||||||
|
chmod +x /usr/local/bin/ipfs
|
||||||
|
git_fetch_all_tags:
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: fetch all tags
|
||||||
|
command: |
|
||||||
|
git fetch --all
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
mod-tidy-check:
|
mod-tidy-check:
|
||||||
@ -74,6 +99,13 @@ jobs:
|
|||||||
path: lotus
|
path: lotus
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: lotus-storage-miner
|
path: lotus-storage-miner
|
||||||
|
- store_artifacts:
|
||||||
|
path: lotus-seal-worker
|
||||||
|
- run: mkdir linux && mv lotus lotus-storage-miner lotus-seal-worker linux/
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: "."
|
||||||
|
paths:
|
||||||
|
- linux
|
||||||
|
|
||||||
test: &test
|
test: &test
|
||||||
description: |
|
description: |
|
||||||
@ -153,7 +185,7 @@ jobs:
|
|||||||
- "~/go/src/github.com"
|
- "~/go/src/github.com"
|
||||||
- "~/go/src/golang.org"
|
- "~/go/src/golang.org"
|
||||||
|
|
||||||
test-short:
|
test-short:
|
||||||
<<: *test
|
<<: *test
|
||||||
|
|
||||||
build-macos:
|
build-macos:
|
||||||
@ -196,6 +228,13 @@ jobs:
|
|||||||
path: lotus
|
path: lotus
|
||||||
- store_artifacts:
|
- store_artifacts:
|
||||||
path: lotus-storage-miner
|
path: lotus-storage-miner
|
||||||
|
- store_artifacts:
|
||||||
|
path: lotus-seal-worker
|
||||||
|
- run: mkdir darwin && mv lotus lotus-storage-miner lotus-seal-worker darwin/
|
||||||
|
- persist_to_workspace:
|
||||||
|
root: "."
|
||||||
|
paths:
|
||||||
|
- darwin
|
||||||
- save_cache:
|
- save_cache:
|
||||||
name: save cargo cache
|
name: save cargo cache
|
||||||
key: v3-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/lotus/go.sum" }}
|
key: v3-go-deps-{{ arch }}-{{ checksum "~/go/src/github.com/filecoin-project/lotus/go.sum" }}
|
||||||
@ -246,6 +285,26 @@ jobs:
|
|||||||
lint-all:
|
lint-all:
|
||||||
<<: *lint
|
<<: *lint
|
||||||
|
|
||||||
|
publish:
|
||||||
|
description: publish binary artifacts
|
||||||
|
executor: ubuntu
|
||||||
|
steps:
|
||||||
|
- run:
|
||||||
|
name: Install git jq curl
|
||||||
|
command: apt update && apt install -y git jq curl
|
||||||
|
- checkout
|
||||||
|
- git_fetch_all_tags
|
||||||
|
- checkout
|
||||||
|
- install_ipfs
|
||||||
|
- attach_workspace:
|
||||||
|
at: "."
|
||||||
|
- run:
|
||||||
|
name: Create bundles
|
||||||
|
command: ./scripts/build-bundle.sh
|
||||||
|
- run:
|
||||||
|
name: Publish release
|
||||||
|
command: ./scripts/publish-release.sh
|
||||||
|
|
||||||
|
|
||||||
workflows:
|
workflows:
|
||||||
version: 2.1
|
version: 2.1
|
||||||
@ -255,8 +314,38 @@ workflows:
|
|||||||
args: "--new-from-rev origin/master"
|
args: "--new-from-rev origin/master"
|
||||||
- test:
|
- test:
|
||||||
codecov-upload: true
|
codecov-upload: true
|
||||||
|
- mod-tidy-check
|
||||||
- test-short:
|
- test-short:
|
||||||
go-test-flags: "--timeout 10m --short"
|
go-test-flags: "--timeout 10m --short"
|
||||||
- mod-tidy-check
|
filters:
|
||||||
- build-all
|
tags:
|
||||||
- build-macos
|
only:
|
||||||
|
- /^v\d+\.\d+\.\d+$/
|
||||||
|
- build-all:
|
||||||
|
requires:
|
||||||
|
- test-short
|
||||||
|
filters:
|
||||||
|
tags:
|
||||||
|
only:
|
||||||
|
- /^v\d+\.\d+\.\d+$/
|
||||||
|
- build-macos:
|
||||||
|
requires:
|
||||||
|
- test-short
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore:
|
||||||
|
- /.*/
|
||||||
|
tags:
|
||||||
|
only:
|
||||||
|
- /^v\d+\.\d+\.\d+$/
|
||||||
|
- publish:
|
||||||
|
requires:
|
||||||
|
- build-all
|
||||||
|
- build-macos
|
||||||
|
filters:
|
||||||
|
branches:
|
||||||
|
ignore:
|
||||||
|
- /.*/
|
||||||
|
tags:
|
||||||
|
only:
|
||||||
|
- /^v\d+\.\d+\.\d+$/
|
||||||
|
3
.gitignore
vendored
3
.gitignore
vendored
@ -26,6 +26,9 @@ build/paramfetch.sh
|
|||||||
/blocks.svg
|
/blocks.svg
|
||||||
/chainwatch
|
/chainwatch
|
||||||
/chainwatch.db
|
/chainwatch.db
|
||||||
|
/bundle
|
||||||
|
/darwin
|
||||||
|
/linux
|
||||||
|
|
||||||
*-fuzz.zip
|
*-fuzz.zip
|
||||||
/chain/types/work_msg/
|
/chain/types/work_msg/
|
||||||
|
@ -1,7 +1,8 @@
|
|||||||
linters:
|
linters:
|
||||||
disable-all: true
|
disable-all: true
|
||||||
enable:
|
enable:
|
||||||
- vet
|
- gofmt
|
||||||
|
- govet
|
||||||
- goimports
|
- goimports
|
||||||
- misspell
|
- misspell
|
||||||
- goconst
|
- goconst
|
||||||
|
@ -29,6 +29,9 @@ type Common interface {
|
|||||||
|
|
||||||
// Version provides information about API provider
|
// Version provides information about API provider
|
||||||
Version(context.Context) (Version, error)
|
Version(context.Context) (Version, error)
|
||||||
|
|
||||||
|
LogList(context.Context) ([]string, error)
|
||||||
|
LogSetLevel(context.Context, string, string) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// Version provides various build-time information
|
// Version provides various build-time information
|
||||||
|
@ -31,25 +31,26 @@ type FullNode interface {
|
|||||||
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
|
ChainGetBlockMessages(context.Context, cid.Cid) (*BlockMessages, error)
|
||||||
ChainGetParentReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)
|
ChainGetParentReceipts(context.Context, cid.Cid) ([]*types.MessageReceipt, error)
|
||||||
ChainGetParentMessages(context.Context, cid.Cid) ([]Message, error)
|
ChainGetParentMessages(context.Context, cid.Cid) ([]Message, error)
|
||||||
ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
|
ChainGetTipSetByHeight(context.Context, uint64, types.TipSetKey) (*types.TipSet, error)
|
||||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||||
ChainSetHead(context.Context, *types.TipSet) error
|
ChainSetHead(context.Context, types.TipSetKey) error
|
||||||
ChainGetGenesis(context.Context) (*types.TipSet, error)
|
ChainGetGenesis(context.Context) (*types.TipSet, error)
|
||||||
ChainTipSetWeight(context.Context, *types.TipSet) (types.BigInt, error)
|
ChainTipSetWeight(context.Context, types.TipSetKey) (types.BigInt, error)
|
||||||
ChainGetNode(ctx context.Context, p string) (interface{}, error)
|
ChainGetNode(ctx context.Context, p string) (interface{}, error)
|
||||||
ChainGetMessage(context.Context, cid.Cid) (*types.Message, error)
|
ChainGetMessage(context.Context, cid.Cid) (*types.Message, error)
|
||||||
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*store.HeadChange, error)
|
ChainGetPath(ctx context.Context, from types.TipSetKey, to types.TipSetKey) ([]*store.HeadChange, error)
|
||||||
ChainExport(context.Context, *types.TipSet) (<-chan []byte, error)
|
ChainExport(context.Context, types.TipSetKey) (<-chan []byte, error)
|
||||||
|
|
||||||
// syncer
|
// syncer
|
||||||
SyncState(context.Context) (*SyncState, error)
|
SyncState(context.Context) (*SyncState, error)
|
||||||
SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) error
|
SyncSubmitBlock(ctx context.Context, blk *types.BlockMsg) error
|
||||||
SyncIncomingBlocks(ctx context.Context) (<-chan *types.BlockHeader, error)
|
SyncIncomingBlocks(ctx context.Context) (<-chan *types.BlockHeader, error)
|
||||||
SyncMarkBad(ctx context.Context, bcid cid.Cid) error
|
SyncMarkBad(ctx context.Context, bcid cid.Cid) error
|
||||||
|
SyncCheckBad(ctx context.Context, bcid cid.Cid) (string, error)
|
||||||
|
|
||||||
// messages
|
// messages
|
||||||
MpoolPending(context.Context, *types.TipSet) ([]*types.SignedMessage, error)
|
MpoolPending(context.Context, types.TipSetKey) ([]*types.SignedMessage, error)
|
||||||
MpoolPush(context.Context, *types.SignedMessage) (cid.Cid, error)
|
MpoolPush(context.Context, *types.SignedMessage) (cid.Cid, error)
|
||||||
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error) // get nonce, sign, push
|
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error) // get nonce, sign, push
|
||||||
MpoolGetNonce(context.Context, address.Address) (uint64, error)
|
MpoolGetNonce(context.Context, address.Address) (uint64, error)
|
||||||
@ -59,7 +60,7 @@ type FullNode interface {
|
|||||||
|
|
||||||
// miner
|
// miner
|
||||||
|
|
||||||
MinerCreateBlock(context.Context, address.Address, *types.TipSet, *types.Ticket, *types.EPostProof, []*types.SignedMessage, uint64, uint64) (*types.BlockMsg, error)
|
MinerCreateBlock(context.Context, address.Address, types.TipSetKey, *types.Ticket, *types.EPostProof, []*types.SignedMessage, uint64, uint64) (*types.BlockMsg, error)
|
||||||
|
|
||||||
// // UX ?
|
// // UX ?
|
||||||
|
|
||||||
@ -97,35 +98,35 @@ type FullNode interface {
|
|||||||
//ClientListAsks() []Ask
|
//ClientListAsks() []Ask
|
||||||
|
|
||||||
// if tipset is nil, we'll use heaviest
|
// if tipset is nil, we'll use heaviest
|
||||||
StateCall(context.Context, *types.Message, *types.TipSet) (*MethodCall, error)
|
StateCall(context.Context, *types.Message, types.TipSetKey) (*MethodCall, error)
|
||||||
StateReplay(context.Context, *types.TipSet, cid.Cid) (*ReplayResults, error)
|
StateReplay(context.Context, types.TipSetKey, cid.Cid) (*ReplayResults, error)
|
||||||
StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error)
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
||||||
StateReadState(ctx context.Context, act *types.Actor, ts *types.TipSet) (*ActorState, error)
|
StateReadState(ctx context.Context, act *types.Actor, tsk types.TipSetKey) (*ActorState, error)
|
||||||
StateListMessages(ctx context.Context, match *types.Message, ts *types.TipSet, toht uint64) ([]cid.Cid, error)
|
StateListMessages(ctx context.Context, match *types.Message, tsk types.TipSetKey, toht uint64) ([]cid.Cid, error)
|
||||||
|
|
||||||
StateMinerSectors(context.Context, address.Address, *types.TipSet) ([]*ChainSectorInfo, error)
|
StateMinerSectors(context.Context, address.Address, types.TipSetKey) ([]*ChainSectorInfo, error)
|
||||||
StateMinerProvingSet(context.Context, address.Address, *types.TipSet) ([]*ChainSectorInfo, error)
|
StateMinerProvingSet(context.Context, address.Address, types.TipSetKey) ([]*ChainSectorInfo, error)
|
||||||
StateMinerPower(context.Context, address.Address, *types.TipSet) (MinerPower, error)
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (MinerPower, error)
|
||||||
StateMinerWorker(context.Context, address.Address, *types.TipSet) (address.Address, error)
|
StateMinerWorker(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error)
|
StateMinerPeerID(ctx context.Context, m address.Address, tsk types.TipSetKey) (peer.ID, error)
|
||||||
StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error)
|
StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error)
|
||||||
StateMinerSectorSize(context.Context, address.Address, *types.TipSet) (uint64, error)
|
StateMinerSectorSize(context.Context, address.Address, types.TipSetKey) (uint64, error)
|
||||||
StateMinerFaults(context.Context, address.Address, *types.TipSet) ([]uint64, error)
|
StateMinerFaults(context.Context, address.Address, types.TipSetKey) ([]uint64, error)
|
||||||
StatePledgeCollateral(context.Context, *types.TipSet) (types.BigInt, error)
|
StatePledgeCollateral(context.Context, types.TipSetKey) (types.BigInt, error)
|
||||||
StateWaitMsg(context.Context, cid.Cid) (*MsgWait, error)
|
StateWaitMsg(context.Context, cid.Cid) (*MsgWait, error)
|
||||||
StateListMiners(context.Context, *types.TipSet) ([]address.Address, error)
|
StateListMiners(context.Context, types.TipSetKey) ([]address.Address, error)
|
||||||
StateListActors(context.Context, *types.TipSet) ([]address.Address, error)
|
StateListActors(context.Context, types.TipSetKey) ([]address.Address, error)
|
||||||
StateMarketBalance(context.Context, address.Address, *types.TipSet) (actors.StorageParticipantBalance, error)
|
StateMarketBalance(context.Context, address.Address, types.TipSetKey) (actors.StorageParticipantBalance, error)
|
||||||
StateMarketParticipants(context.Context, *types.TipSet) (map[string]actors.StorageParticipantBalance, error)
|
StateMarketParticipants(context.Context, types.TipSetKey) (map[string]actors.StorageParticipantBalance, error)
|
||||||
StateMarketDeals(context.Context, *types.TipSet) (map[string]actors.OnChainDeal, error)
|
StateMarketDeals(context.Context, types.TipSetKey) (map[string]actors.OnChainDeal, error)
|
||||||
StateMarketStorageDeal(context.Context, uint64, *types.TipSet) (*actors.OnChainDeal, error)
|
StateMarketStorageDeal(context.Context, uint64, types.TipSetKey) (*actors.OnChainDeal, error)
|
||||||
StateLookupID(context.Context, address.Address, *types.TipSet) (address.Address, error)
|
StateLookupID(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error)
|
StateChangedActors(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
|
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
||||||
StateMinerSectorCount(context.Context, address.Address, *types.TipSet) (MinerSectors, error)
|
StateMinerSectorCount(context.Context, address.Address, types.TipSetKey) (MinerSectors, error)
|
||||||
StateCompute(context.Context, uint64, []*types.Message, *types.TipSet) (cid.Cid, error)
|
StateCompute(context.Context, uint64, []*types.Message, types.TipSetKey) (cid.Cid, error)
|
||||||
|
|
||||||
MsigGetAvailableBalance(context.Context, address.Address, *types.TipSet) (types.BigInt, error)
|
MsigGetAvailableBalance(context.Context, address.Address, types.TipSetKey) (types.BigInt, error)
|
||||||
|
|
||||||
MarketEnsureAvailable(context.Context, address.Address, types.BigInt) error
|
MarketEnsureAvailable(context.Context, address.Address, types.BigInt) error
|
||||||
// MarketFreeBalance
|
// MarketFreeBalance
|
||||||
|
@ -32,6 +32,9 @@ type CommonStruct struct {
|
|||||||
|
|
||||||
ID func(context.Context) (peer.ID, error) `perm:"read"`
|
ID func(context.Context) (peer.ID, error) `perm:"read"`
|
||||||
Version func(context.Context) (api.Version, error) `perm:"read"`
|
Version func(context.Context) (api.Version, error) `perm:"read"`
|
||||||
|
|
||||||
|
LogList func(context.Context) ([]string, error) `perm:"write"`
|
||||||
|
LogSetLevel func(context.Context, string, string) error `perm:"write"`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -48,29 +51,30 @@ type FullNodeStruct struct {
|
|||||||
ChainGetBlockMessages func(context.Context, cid.Cid) (*api.BlockMessages, error) `perm:"read"`
|
ChainGetBlockMessages func(context.Context, cid.Cid) (*api.BlockMessages, error) `perm:"read"`
|
||||||
ChainGetParentReceipts func(context.Context, cid.Cid) ([]*types.MessageReceipt, error) `perm:"read"`
|
ChainGetParentReceipts func(context.Context, cid.Cid) ([]*types.MessageReceipt, error) `perm:"read"`
|
||||||
ChainGetParentMessages func(context.Context, cid.Cid) ([]api.Message, error) `perm:"read"`
|
ChainGetParentMessages func(context.Context, cid.Cid) ([]api.Message, error) `perm:"read"`
|
||||||
ChainGetTipSetByHeight func(context.Context, uint64, *types.TipSet) (*types.TipSet, error) `perm:"read"`
|
ChainGetTipSetByHeight func(context.Context, uint64, types.TipSetKey) (*types.TipSet, error) `perm:"read"`
|
||||||
ChainReadObj func(context.Context, cid.Cid) ([]byte, error) `perm:"read"`
|
ChainReadObj func(context.Context, cid.Cid) ([]byte, error) `perm:"read"`
|
||||||
ChainHasObj func(context.Context, cid.Cid) (bool, error) `perm:"read"`
|
ChainHasObj func(context.Context, cid.Cid) (bool, error) `perm:"read"`
|
||||||
ChainSetHead func(context.Context, *types.TipSet) error `perm:"admin"`
|
ChainSetHead func(context.Context, types.TipSetKey) error `perm:"admin"`
|
||||||
ChainGetGenesis func(context.Context) (*types.TipSet, error) `perm:"read"`
|
ChainGetGenesis func(context.Context) (*types.TipSet, error) `perm:"read"`
|
||||||
ChainTipSetWeight func(context.Context, *types.TipSet) (types.BigInt, error) `perm:"read"`
|
ChainTipSetWeight func(context.Context, types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
||||||
ChainGetNode func(ctx context.Context, p string) (interface{}, error) `perm:"read"`
|
ChainGetNode func(ctx context.Context, p string) (interface{}, error) `perm:"read"`
|
||||||
ChainGetMessage func(context.Context, cid.Cid) (*types.Message, error) `perm:"read"`
|
ChainGetMessage func(context.Context, cid.Cid) (*types.Message, error) `perm:"read"`
|
||||||
ChainGetPath func(context.Context, types.TipSetKey, types.TipSetKey) ([]*store.HeadChange, error) `perm:"read"`
|
ChainGetPath func(context.Context, types.TipSetKey, types.TipSetKey) ([]*store.HeadChange, error) `perm:"read"`
|
||||||
ChainExport func(context.Context, *types.TipSet) (<-chan []byte, error) `perm:"read"`
|
ChainExport func(context.Context, types.TipSetKey) (<-chan []byte, error) `perm:"read"`
|
||||||
|
|
||||||
SyncState func(context.Context) (*api.SyncState, error) `perm:"read"`
|
SyncState func(context.Context) (*api.SyncState, error) `perm:"read"`
|
||||||
SyncSubmitBlock func(ctx context.Context, blk *types.BlockMsg) error `perm:"write"`
|
SyncSubmitBlock func(ctx context.Context, blk *types.BlockMsg) error `perm:"write"`
|
||||||
SyncIncomingBlocks func(ctx context.Context) (<-chan *types.BlockHeader, error) `perm:"read"`
|
SyncIncomingBlocks func(ctx context.Context) (<-chan *types.BlockHeader, error) `perm:"read"`
|
||||||
SyncMarkBad func(ctx context.Context, bcid cid.Cid) error `perm:"admin"`
|
SyncMarkBad func(ctx context.Context, bcid cid.Cid) error `perm:"admin"`
|
||||||
|
SyncCheckBad func(ctx context.Context, bcid cid.Cid) (string, error) `perm:"read"`
|
||||||
|
|
||||||
MpoolPending func(context.Context, *types.TipSet) ([]*types.SignedMessage, error) `perm:"read"`
|
MpoolPending func(context.Context, types.TipSetKey) ([]*types.SignedMessage, error) `perm:"read"`
|
||||||
MpoolPush func(context.Context, *types.SignedMessage) (cid.Cid, error) `perm:"write"`
|
MpoolPush func(context.Context, *types.SignedMessage) (cid.Cid, error) `perm:"write"`
|
||||||
MpoolPushMessage func(context.Context, *types.Message) (*types.SignedMessage, error) `perm:"sign"`
|
MpoolPushMessage func(context.Context, *types.Message) (*types.SignedMessage, error) `perm:"sign"`
|
||||||
MpoolGetNonce func(context.Context, address.Address) (uint64, error) `perm:"read"`
|
MpoolGetNonce func(context.Context, address.Address) (uint64, error) `perm:"read"`
|
||||||
MpoolSub func(context.Context) (<-chan api.MpoolUpdate, error) `perm:"read"`
|
MpoolSub func(context.Context) (<-chan api.MpoolUpdate, error) `perm:"read"`
|
||||||
|
|
||||||
MinerCreateBlock func(context.Context, address.Address, *types.TipSet, *types.Ticket, *types.EPostProof, []*types.SignedMessage, uint64, uint64) (*types.BlockMsg, error) `perm:"write"`
|
MinerCreateBlock func(context.Context, address.Address, types.TipSetKey, *types.Ticket, *types.EPostProof, []*types.SignedMessage, uint64, uint64) (*types.BlockMsg, error) `perm:"write"`
|
||||||
|
|
||||||
WalletNew func(context.Context, string) (address.Address, error) `perm:"write"`
|
WalletNew func(context.Context, string) (address.Address, error) `perm:"write"`
|
||||||
WalletHas func(context.Context, address.Address) (bool, error) `perm:"write"`
|
WalletHas func(context.Context, address.Address) (bool, error) `perm:"write"`
|
||||||
@ -93,34 +97,34 @@ type FullNodeStruct struct {
|
|||||||
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"`
|
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"`
|
||||||
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error) `perm:"read"`
|
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerSectors func(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
StateMinerSectors func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||||
StateMinerProvingSet func(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
StateMinerProvingSet func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||||
StateMinerPower func(context.Context, address.Address, *types.TipSet) (api.MinerPower, error) `perm:"read"`
|
StateMinerPower func(context.Context, address.Address, types.TipSetKey) (api.MinerPower, error) `perm:"read"`
|
||||||
StateMinerWorker func(context.Context, address.Address, *types.TipSet) (address.Address, error) `perm:"read"`
|
StateMinerWorker func(context.Context, address.Address, types.TipSetKey) (address.Address, error) `perm:"read"`
|
||||||
StateMinerPeerID func(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) `perm:"read"`
|
StateMinerPeerID func(ctx context.Context, m address.Address, tsk types.TipSetKey) (peer.ID, error) `perm:"read"`
|
||||||
StateMinerElectionPeriodStart func(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) `perm:"read"`
|
StateMinerElectionPeriodStart func(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error) `perm:"read"`
|
||||||
StateMinerSectorSize func(context.Context, address.Address, *types.TipSet) (uint64, error) `perm:"read"`
|
StateMinerSectorSize func(context.Context, address.Address, types.TipSetKey) (uint64, error) `perm:"read"`
|
||||||
StateMinerFaults func(context.Context, address.Address, *types.TipSet) ([]uint64, error) `perm:"read"`
|
StateMinerFaults func(context.Context, address.Address, types.TipSetKey) ([]uint64, error) `perm:"read"`
|
||||||
StateCall func(context.Context, *types.Message, *types.TipSet) (*api.MethodCall, error) `perm:"read"`
|
StateCall func(context.Context, *types.Message, types.TipSetKey) (*api.MethodCall, error) `perm:"read"`
|
||||||
StateReplay func(context.Context, *types.TipSet, cid.Cid) (*api.ReplayResults, error) `perm:"read"`
|
StateReplay func(context.Context, types.TipSetKey, cid.Cid) (*api.ReplayResults, error) `perm:"read"`
|
||||||
StateGetActor func(context.Context, address.Address, *types.TipSet) (*types.Actor, error) `perm:"read"`
|
StateGetActor func(context.Context, address.Address, types.TipSetKey) (*types.Actor, error) `perm:"read"`
|
||||||
StateReadState func(context.Context, *types.Actor, *types.TipSet) (*api.ActorState, error) `perm:"read"`
|
StateReadState func(context.Context, *types.Actor, types.TipSetKey) (*api.ActorState, error) `perm:"read"`
|
||||||
StatePledgeCollateral func(context.Context, *types.TipSet) (types.BigInt, error) `perm:"read"`
|
StatePledgeCollateral func(context.Context, types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
||||||
StateWaitMsg func(context.Context, cid.Cid) (*api.MsgWait, error) `perm:"read"`
|
StateWaitMsg func(context.Context, cid.Cid) (*api.MsgWait, error) `perm:"read"`
|
||||||
StateListMiners func(context.Context, *types.TipSet) ([]address.Address, error) `perm:"read"`
|
StateListMiners func(context.Context, types.TipSetKey) ([]address.Address, error) `perm:"read"`
|
||||||
StateListActors func(context.Context, *types.TipSet) ([]address.Address, error) `perm:"read"`
|
StateListActors func(context.Context, types.TipSetKey) ([]address.Address, error) `perm:"read"`
|
||||||
StateMarketBalance func(context.Context, address.Address, *types.TipSet) (actors.StorageParticipantBalance, error) `perm:"read"`
|
StateMarketBalance func(context.Context, address.Address, types.TipSetKey) (actors.StorageParticipantBalance, error) `perm:"read"`
|
||||||
StateMarketParticipants func(context.Context, *types.TipSet) (map[string]actors.StorageParticipantBalance, error) `perm:"read"`
|
StateMarketParticipants func(context.Context, types.TipSetKey) (map[string]actors.StorageParticipantBalance, error) `perm:"read"`
|
||||||
StateMarketDeals func(context.Context, *types.TipSet) (map[string]actors.OnChainDeal, error) `perm:"read"`
|
StateMarketDeals func(context.Context, types.TipSetKey) (map[string]actors.OnChainDeal, error) `perm:"read"`
|
||||||
StateMarketStorageDeal func(context.Context, uint64, *types.TipSet) (*actors.OnChainDeal, error) `perm:"read"`
|
StateMarketStorageDeal func(context.Context, uint64, types.TipSetKey) (*actors.OnChainDeal, error) `perm:"read"`
|
||||||
StateLookupID func(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) `perm:"read"`
|
StateLookupID func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) `perm:"read"`
|
||||||
StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"`
|
StateChangedActors func(context.Context, cid.Cid, cid.Cid) (map[string]types.Actor, error) `perm:"read"`
|
||||||
StateGetReceipt func(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error) `perm:"read"`
|
StateGetReceipt func(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error) `perm:"read"`
|
||||||
StateMinerSectorCount func(context.Context, address.Address, *types.TipSet) (api.MinerSectors, error) `perm:"read"`
|
StateMinerSectorCount func(context.Context, address.Address, types.TipSetKey) (api.MinerSectors, error) `perm:"read"`
|
||||||
StateListMessages func(ctx context.Context, match *types.Message, ts *types.TipSet, toht uint64) ([]cid.Cid, error) `perm:"read"`
|
StateListMessages func(ctx context.Context, match *types.Message, tsk types.TipSetKey, toht uint64) ([]cid.Cid, error) `perm:"read"`
|
||||||
StateCompute func(context.Context, uint64, []*types.Message, *types.TipSet) (cid.Cid, error) `perm:"read"`
|
StateCompute func(context.Context, uint64, []*types.Message, types.TipSetKey) (cid.Cid, error) `perm:"read"`
|
||||||
|
|
||||||
MsigGetAvailableBalance func(context.Context, address.Address, *types.TipSet) (types.BigInt, error) `perm:"read"`
|
MsigGetAvailableBalance func(context.Context, address.Address, types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
||||||
|
|
||||||
MarketEnsureAvailable func(context.Context, address.Address, types.BigInt) error `perm:"sign"`
|
MarketEnsureAvailable func(context.Context, address.Address, types.BigInt) error `perm:"sign"`
|
||||||
|
|
||||||
@ -140,8 +144,8 @@ type FullNodeStruct struct {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerSectorCount(ctx context.Context, addr address.Address, ts *types.TipSet) (api.MinerSectors, error) {
|
func (c *FullNodeStruct) StateMinerSectorCount(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MinerSectors, error) {
|
||||||
return c.Internal.StateMinerSectorCount(ctx, addr, ts)
|
return c.Internal.StateMinerSectorCount(ctx, addr, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
type StorageMinerStruct struct {
|
type StorageMinerStruct struct {
|
||||||
@ -203,6 +207,14 @@ func (c *CommonStruct) Version(ctx context.Context) (api.Version, error) {
|
|||||||
return c.Internal.Version(ctx)
|
return c.Internal.Version(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (c *CommonStruct) LogList(ctx context.Context) ([]string, error) {
|
||||||
|
return c.Internal.LogList(ctx)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *CommonStruct) LogSetLevel(ctx context.Context, group, level string) error {
|
||||||
|
return c.Internal.LogSetLevel(ctx, group, level)
|
||||||
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ClientListImports(ctx context.Context) ([]api.Import, error) {
|
func (c *FullNodeStruct) ClientListImports(ctx context.Context) ([]api.Import, error) {
|
||||||
return c.Internal.ClientListImports(ctx)
|
return c.Internal.ClientListImports(ctx)
|
||||||
}
|
}
|
||||||
@ -238,8 +250,8 @@ func (c *FullNodeStruct) ClientQueryAsk(ctx context.Context, p peer.ID, miner ad
|
|||||||
return c.Internal.ClientQueryAsk(ctx, p, miner)
|
return c.Internal.ClientQueryAsk(ctx, p, miner)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) MpoolPending(ctx context.Context, ts *types.TipSet) ([]*types.SignedMessage, error) {
|
func (c *FullNodeStruct) MpoolPending(ctx context.Context, tsk types.TipSetKey) ([]*types.SignedMessage, error) {
|
||||||
return c.Internal.MpoolPending(ctx, ts)
|
return c.Internal.MpoolPending(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) MpoolPush(ctx context.Context, smsg *types.SignedMessage) (cid.Cid, error) {
|
func (c *FullNodeStruct) MpoolPush(ctx context.Context, smsg *types.SignedMessage) (cid.Cid, error) {
|
||||||
@ -254,7 +266,7 @@ func (c *FullNodeStruct) MpoolSub(ctx context.Context) (<-chan api.MpoolUpdate,
|
|||||||
return c.Internal.MpoolSub(ctx)
|
return c.Internal.MpoolSub(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) MinerCreateBlock(ctx context.Context, addr address.Address, base *types.TipSet, ticket *types.Ticket, eproof *types.EPostProof, msgs []*types.SignedMessage, height, ts uint64) (*types.BlockMsg, error) {
|
func (c *FullNodeStruct) MinerCreateBlock(ctx context.Context, addr address.Address, base types.TipSetKey, ticket *types.Ticket, eproof *types.EPostProof, msgs []*types.SignedMessage, height, ts uint64) (*types.BlockMsg, error) {
|
||||||
return c.Internal.MinerCreateBlock(ctx, addr, base, ticket, eproof, msgs, height, ts)
|
return c.Internal.MinerCreateBlock(ctx, addr, base, ticket, eproof, msgs, height, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -266,8 +278,8 @@ func (c *FullNodeStruct) ChainGetRandomness(ctx context.Context, pts types.TipSe
|
|||||||
return c.Internal.ChainGetRandomness(ctx, pts, round)
|
return c.Internal.ChainGetRandomness(ctx, pts, round)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ChainGetTipSetByHeight(ctx context.Context, h uint64, ts *types.TipSet) (*types.TipSet, error) {
|
func (c *FullNodeStruct) ChainGetTipSetByHeight(ctx context.Context, h uint64, tsk types.TipSetKey) (*types.TipSet, error) {
|
||||||
return c.Internal.ChainGetTipSetByHeight(ctx, h, ts)
|
return c.Internal.ChainGetTipSetByHeight(ctx, h, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) WalletNew(ctx context.Context, typ string) (address.Address, error) {
|
func (c *FullNodeStruct) WalletNew(ctx context.Context, typ string) (address.Address, error) {
|
||||||
@ -346,16 +358,16 @@ func (c *FullNodeStruct) ChainHasObj(ctx context.Context, o cid.Cid) (bool, erro
|
|||||||
return c.Internal.ChainHasObj(ctx, o)
|
return c.Internal.ChainHasObj(ctx, o)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ChainSetHead(ctx context.Context, ts *types.TipSet) error {
|
func (c *FullNodeStruct) ChainSetHead(ctx context.Context, tsk types.TipSetKey) error {
|
||||||
return c.Internal.ChainSetHead(ctx, ts)
|
return c.Internal.ChainSetHead(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ChainGetGenesis(ctx context.Context) (*types.TipSet, error) {
|
func (c *FullNodeStruct) ChainGetGenesis(ctx context.Context) (*types.TipSet, error) {
|
||||||
return c.Internal.ChainGetGenesis(ctx)
|
return c.Internal.ChainGetGenesis(ctx)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ChainTipSetWeight(ctx context.Context, ts *types.TipSet) (types.BigInt, error) {
|
func (c *FullNodeStruct) ChainTipSetWeight(ctx context.Context, tsk types.TipSetKey) (types.BigInt, error) {
|
||||||
return c.Internal.ChainTipSetWeight(ctx, ts)
|
return c.Internal.ChainTipSetWeight(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ChainGetNode(ctx context.Context, p string) (interface{}, error) {
|
func (c *FullNodeStruct) ChainGetNode(ctx context.Context, p string) (interface{}, error) {
|
||||||
@ -370,8 +382,8 @@ func (c *FullNodeStruct) ChainGetPath(ctx context.Context, from types.TipSetKey,
|
|||||||
return c.Internal.ChainGetPath(ctx, from, to)
|
return c.Internal.ChainGetPath(ctx, from, to)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ChainExport(ctx context.Context, ts *types.TipSet) (<-chan []byte, error) {
|
func (c *FullNodeStruct) ChainExport(ctx context.Context, tsk types.TipSetKey) (<-chan []byte, error) {
|
||||||
return c.Internal.ChainExport(ctx, ts)
|
return c.Internal.ChainExport(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) SyncState(ctx context.Context) (*api.SyncState, error) {
|
func (c *FullNodeStruct) SyncState(ctx context.Context) (*api.SyncState, error) {
|
||||||
@ -390,107 +402,111 @@ func (c *FullNodeStruct) SyncMarkBad(ctx context.Context, bcid cid.Cid) error {
|
|||||||
return c.Internal.SyncMarkBad(ctx, bcid)
|
return c.Internal.SyncMarkBad(ctx, bcid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerSectors(ctx context.Context, addr address.Address, ts *types.TipSet) ([]*api.ChainSectorInfo, error) {
|
func (c *FullNodeStruct) SyncCheckBad(ctx context.Context, bcid cid.Cid) (string, error) {
|
||||||
return c.Internal.StateMinerSectors(ctx, addr, ts)
|
return c.Internal.SyncCheckBad(ctx, bcid)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerProvingSet(ctx context.Context, addr address.Address, ts *types.TipSet) ([]*api.ChainSectorInfo, error) {
|
func (c *FullNodeStruct) StateMinerSectors(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
return c.Internal.StateMinerProvingSet(ctx, addr, ts)
|
return c.Internal.StateMinerSectors(ctx, addr, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerPower(ctx context.Context, a address.Address, ts *types.TipSet) (api.MinerPower, error) {
|
func (c *FullNodeStruct) StateMinerProvingSet(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
return c.Internal.StateMinerPower(ctx, a, ts)
|
return c.Internal.StateMinerProvingSet(ctx, addr, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerWorker(ctx context.Context, m address.Address, ts *types.TipSet) (address.Address, error) {
|
func (c *FullNodeStruct) StateMinerPower(ctx context.Context, a address.Address, tsk types.TipSetKey) (api.MinerPower, error) {
|
||||||
return c.Internal.StateMinerWorker(ctx, m, ts)
|
return c.Internal.StateMinerPower(ctx, a, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) {
|
func (c *FullNodeStruct) StateMinerWorker(ctx context.Context, m address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||||
return c.Internal.StateMinerPeerID(ctx, m, ts)
|
return c.Internal.StateMinerWorker(ctx, m, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) {
|
func (c *FullNodeStruct) StateMinerPeerID(ctx context.Context, m address.Address, tsk types.TipSetKey) (peer.ID, error) {
|
||||||
return c.Internal.StateMinerElectionPeriodStart(ctx, actor, ts)
|
return c.Internal.StateMinerPeerID(ctx, m, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerSectorSize(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) {
|
func (c *FullNodeStruct) StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error) {
|
||||||
return c.Internal.StateMinerSectorSize(ctx, actor, ts)
|
return c.Internal.StateMinerElectionPeriodStart(ctx, actor, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMinerFaults(ctx context.Context, actor address.Address, ts *types.TipSet) ([]uint64, error) {
|
func (c *FullNodeStruct) StateMinerSectorSize(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error) {
|
||||||
return c.Internal.StateMinerFaults(ctx, actor, ts)
|
return c.Internal.StateMinerSectorSize(ctx, actor, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateCall(ctx context.Context, msg *types.Message, ts *types.TipSet) (*api.MethodCall, error) {
|
func (c *FullNodeStruct) StateMinerFaults(ctx context.Context, actor address.Address, tsk types.TipSetKey) ([]uint64, error) {
|
||||||
return c.Internal.StateCall(ctx, msg, ts)
|
return c.Internal.StateMinerFaults(ctx, actor, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateReplay(ctx context.Context, ts *types.TipSet, mc cid.Cid) (*api.ReplayResults, error) {
|
func (c *FullNodeStruct) StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*api.MethodCall, error) {
|
||||||
return c.Internal.StateReplay(ctx, ts, mc)
|
return c.Internal.StateCall(ctx, msg, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error) {
|
func (c *FullNodeStruct) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.ReplayResults, error) {
|
||||||
return c.Internal.StateGetActor(ctx, actor, ts)
|
return c.Internal.StateReplay(ctx, tsk, mc)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateReadState(ctx context.Context, act *types.Actor, ts *types.TipSet) (*api.ActorState, error) {
|
func (c *FullNodeStruct) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||||||
return c.Internal.StateReadState(ctx, act, ts)
|
return c.Internal.StateGetActor(ctx, actor, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StatePledgeCollateral(ctx context.Context, ts *types.TipSet) (types.BigInt, error) {
|
func (c *FullNodeStruct) StateReadState(ctx context.Context, act *types.Actor, tsk types.TipSetKey) (*api.ActorState, error) {
|
||||||
return c.Internal.StatePledgeCollateral(ctx, ts)
|
return c.Internal.StateReadState(ctx, act, tsk)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (c *FullNodeStruct) StatePledgeCollateral(ctx context.Context, tsk types.TipSetKey) (types.BigInt, error) {
|
||||||
|
return c.Internal.StatePledgeCollateral(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateWaitMsg(ctx context.Context, msgc cid.Cid) (*api.MsgWait, error) {
|
func (c *FullNodeStruct) StateWaitMsg(ctx context.Context, msgc cid.Cid) (*api.MsgWait, error) {
|
||||||
return c.Internal.StateWaitMsg(ctx, msgc)
|
return c.Internal.StateWaitMsg(ctx, msgc)
|
||||||
}
|
}
|
||||||
func (c *FullNodeStruct) StateListMiners(ctx context.Context, ts *types.TipSet) ([]address.Address, error) {
|
func (c *FullNodeStruct) StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) {
|
||||||
return c.Internal.StateListMiners(ctx, ts)
|
return c.Internal.StateListMiners(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateListActors(ctx context.Context, ts *types.TipSet) ([]address.Address, error) {
|
func (c *FullNodeStruct) StateListActors(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) {
|
||||||
return c.Internal.StateListActors(ctx, ts)
|
return c.Internal.StateListActors(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMarketBalance(ctx context.Context, addr address.Address, ts *types.TipSet) (actors.StorageParticipantBalance, error) {
|
func (c *FullNodeStruct) StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (actors.StorageParticipantBalance, error) {
|
||||||
return c.Internal.StateMarketBalance(ctx, addr, ts)
|
return c.Internal.StateMarketBalance(ctx, addr, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMarketParticipants(ctx context.Context, ts *types.TipSet) (map[string]actors.StorageParticipantBalance, error) {
|
func (c *FullNodeStruct) StateMarketParticipants(ctx context.Context, tsk types.TipSetKey) (map[string]actors.StorageParticipantBalance, error) {
|
||||||
return c.Internal.StateMarketParticipants(ctx, ts)
|
return c.Internal.StateMarketParticipants(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMarketDeals(ctx context.Context, ts *types.TipSet) (map[string]actors.OnChainDeal, error) {
|
func (c *FullNodeStruct) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]actors.OnChainDeal, error) {
|
||||||
return c.Internal.StateMarketDeals(ctx, ts)
|
return c.Internal.StateMarketDeals(ctx, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateMarketStorageDeal(ctx context.Context, dealid uint64, ts *types.TipSet) (*actors.OnChainDeal, error) {
|
func (c *FullNodeStruct) StateMarketStorageDeal(ctx context.Context, dealid uint64, tsk types.TipSetKey) (*actors.OnChainDeal, error) {
|
||||||
return c.Internal.StateMarketStorageDeal(ctx, dealid, ts)
|
return c.Internal.StateMarketStorageDeal(ctx, dealid, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateLookupID(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) {
|
func (c *FullNodeStruct) StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||||
return c.Internal.StateLookupID(ctx, addr, ts)
|
return c.Internal.StateLookupID(ctx, addr, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateChangedActors(ctx context.Context, olnstate cid.Cid, newstate cid.Cid) (map[string]types.Actor, error) {
|
func (c *FullNodeStruct) StateChangedActors(ctx context.Context, olnstate cid.Cid, newstate cid.Cid) (map[string]types.Actor, error) {
|
||||||
return c.Internal.StateChangedActors(ctx, olnstate, newstate)
|
return c.Internal.StateChangedActors(ctx, olnstate, newstate)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateGetReceipt(ctx context.Context, msg cid.Cid, ts *types.TipSet) (*types.MessageReceipt, error) {
|
func (c *FullNodeStruct) StateGetReceipt(ctx context.Context, msg cid.Cid, tsk types.TipSetKey) (*types.MessageReceipt, error) {
|
||||||
return c.Internal.StateGetReceipt(ctx, msg, ts)
|
return c.Internal.StateGetReceipt(ctx, msg, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateListMessages(ctx context.Context, match *types.Message, ts *types.TipSet, toht uint64) ([]cid.Cid, error) {
|
func (c *FullNodeStruct) StateListMessages(ctx context.Context, match *types.Message, tsk types.TipSetKey, toht uint64) ([]cid.Cid, error) {
|
||||||
return c.Internal.StateListMessages(ctx, match, ts, toht)
|
return c.Internal.StateListMessages(ctx, match, tsk, toht)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) StateCompute(ctx context.Context, height uint64, msgs []*types.Message, ts *types.TipSet) (cid.Cid, error) {
|
func (c *FullNodeStruct) StateCompute(ctx context.Context, height uint64, msgs []*types.Message, tsk types.TipSetKey) (cid.Cid, error) {
|
||||||
return c.Internal.StateCompute(ctx, height, msgs, ts)
|
return c.Internal.StateCompute(ctx, height, msgs, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) MsigGetAvailableBalance(ctx context.Context, a address.Address, ts *types.TipSet) (types.BigInt, error) {
|
func (c *FullNodeStruct) MsigGetAvailableBalance(ctx context.Context, a address.Address, tsk types.TipSetKey) (types.BigInt, error) {
|
||||||
return c.Internal.MsigGetAvailableBalance(ctx, a, ts)
|
return c.Internal.MsigGetAvailableBalance(ctx, a, tsk)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) MarketEnsureAvailable(ctx context.Context, addr address.Address, amt types.BigInt) error {
|
func (c *FullNodeStruct) MarketEnsureAvailable(ctx context.Context, addr address.Address, amt types.BigInt) error {
|
||||||
|
@ -21,6 +21,8 @@ func SupportedSectorSize(ssize uint64) bool {
|
|||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const SectorChallengeRatioDiv = 25
|
||||||
|
|
||||||
// /////
|
// /////
|
||||||
// Payments
|
// Payments
|
||||||
|
|
||||||
|
@ -6,7 +6,6 @@ import (
|
|||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
|
||||||
ffi "github.com/filecoin-project/filecoin-ffi"
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-amt-ipld/v2"
|
"github.com/filecoin-project/go-amt-ipld/v2"
|
||||||
amt2 "github.com/filecoin-project/go-amt-ipld/v2"
|
amt2 "github.com/filecoin-project/go-amt-ipld/v2"
|
||||||
@ -441,7 +440,7 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
|
|||||||
}
|
}
|
||||||
|
|
||||||
activeFaults := uint64(0)
|
activeFaults := uint64(0)
|
||||||
var sectorInfos []ffi.PublicSectorInfo
|
var sectorInfos []types.PublicSectorInfo
|
||||||
if err := pss.ForEach(vmctx.Context(), func(id uint64, v *cbg.Deferred) error {
|
if err := pss.ForEach(vmctx.Context(), func(id uint64, v *cbg.Deferred) error {
|
||||||
if faults[id] {
|
if faults[id] {
|
||||||
activeFaults++
|
activeFaults++
|
||||||
@ -452,7 +451,7 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
|
|||||||
if err := cbor.DecodeInto(v.Raw, &comms); err != nil {
|
if err := cbor.DecodeInto(v.Raw, &comms); err != nil {
|
||||||
return xerrors.New("could not decode comms")
|
return xerrors.New("could not decode comms")
|
||||||
}
|
}
|
||||||
si := ffi.PublicSectorInfo{
|
si := types.PublicSectorInfo{
|
||||||
SectorID: id,
|
SectorID: id,
|
||||||
}
|
}
|
||||||
commR := comms[0]
|
commR := comms[0]
|
||||||
@ -470,11 +469,11 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
|
|||||||
|
|
||||||
proverID := vmctx.Message().To // TODO: normalize to ID address
|
proverID := vmctx.Message().To // TODO: normalize to ID address
|
||||||
|
|
||||||
var candidates []sectorbuilder.EPostCandidate
|
var candidates []types.Candidate
|
||||||
for _, t := range params.Candidates {
|
for _, t := range params.Candidates {
|
||||||
var partial [32]byte
|
var partial [32]byte
|
||||||
copy(partial[:], t.Partial)
|
copy(partial[:], t.Partial)
|
||||||
candidates = append(candidates, sectorbuilder.EPostCandidate{
|
candidates = append(candidates, types.Candidate{
|
||||||
PartialTicket: partial,
|
PartialTicket: partial,
|
||||||
SectorID: t.SectorID,
|
SectorID: t.SectorID,
|
||||||
SectorChallengeIndex: t.ChallengeIndex,
|
SectorChallengeIndex: t.ChallengeIndex,
|
||||||
@ -482,7 +481,7 @@ func (sma StorageMinerActor) SubmitFallbackPoSt(act *types.Actor, vmctx types.VM
|
|||||||
}
|
}
|
||||||
|
|
||||||
if ok, lerr := vmctx.Sys().VerifyFallbackPost(vmctx.Context(), mi.SectorSize,
|
if ok, lerr := vmctx.Sys().VerifyFallbackPost(vmctx.Context(), mi.SectorSize,
|
||||||
sectorbuilder.NewSortedPublicSectorInfo(sectorInfos), seed[:], params.Proof, candidates, proverID, activeFaults); !ok || lerr != nil {
|
sectorInfos, seed[:], params.Proof, candidates, proverID, activeFaults); !ok || lerr != nil {
|
||||||
if lerr != nil {
|
if lerr != nil {
|
||||||
// TODO: study PoST errors
|
// TODO: study PoST errors
|
||||||
return nil, aerrors.Absorb(lerr, 4, "PoST error")
|
return nil, aerrors.Absorb(lerr, 4, "PoST error")
|
||||||
|
@ -21,10 +21,15 @@ func NewBadBlockCache() *BadBlockCache {
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bts *BadBlockCache) Add(c cid.Cid) {
|
func (bts *BadBlockCache) Add(c cid.Cid, reason string) {
|
||||||
bts.badBlocks.Add(c, nil)
|
bts.badBlocks.Add(c, reason)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (bts *BadBlockCache) Has(c cid.Cid) bool {
|
func (bts *BadBlockCache) Has(c cid.Cid) (string, bool) {
|
||||||
return bts.badBlocks.Contains(c)
|
rval, ok := bts.badBlocks.Get(c)
|
||||||
|
if !ok {
|
||||||
|
return "", false
|
||||||
|
}
|
||||||
|
|
||||||
|
return rval.(string), true
|
||||||
}
|
}
|
||||||
|
@ -33,10 +33,10 @@ type heightHandler struct {
|
|||||||
type eventApi interface {
|
type eventApi interface {
|
||||||
ChainNotify(context.Context) (<-chan []*store.HeadChange, error)
|
ChainNotify(context.Context) (<-chan []*store.HeadChange, error)
|
||||||
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
||||||
ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
|
ChainGetTipSetByHeight(context.Context, uint64, types.TipSetKey) (*types.TipSet, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
|
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
||||||
|
|
||||||
StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error) // optional / for CalledMsg
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) // optional / for CalledMsg
|
||||||
}
|
}
|
||||||
|
|
||||||
type Events struct {
|
type Events struct {
|
||||||
|
@ -192,7 +192,7 @@ func (e *calledEvents) applyWithConfidence(ts *types.TipSet) {
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
rec, err := e.cs.StateGetReceipt(e.ctx, event.msg.Cid(), ts)
|
rec, err := e.cs.StateGetReceipt(e.ctx, event.msg.Cid(), ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
|
@ -40,15 +40,15 @@ type fakeCS struct {
|
|||||||
sub func(rev, app []*types.TipSet)
|
sub func(rev, app []*types.TipSet)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fcs *fakeCS) StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error) {
|
func (fcs *fakeCS) StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error) {
|
||||||
return nil, nil
|
return nil, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fcs *fakeCS) StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error) {
|
func (fcs *fakeCS) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||||||
panic("Not Implemented")
|
panic("Not Implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
func (fcs *fakeCS) ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error) {
|
func (fcs *fakeCS) ChainGetTipSetByHeight(context.Context, uint64, types.TipSetKey) (*types.TipSet, error) {
|
||||||
panic("Not Implemented")
|
panic("Not Implemented")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -8,7 +8,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type tsByHFunc func(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
|
type tsByHFunc func(context.Context, uint64, types.TipSetKey) (*types.TipSet, error)
|
||||||
|
|
||||||
// tipSetCache implements a simple ring-buffer cache to keep track of recent
|
// tipSetCache implements a simple ring-buffer cache to keep track of recent
|
||||||
// tipsets
|
// tipsets
|
||||||
@ -93,7 +93,7 @@ func (tsc *tipSetCache) getNonNull(height uint64) (*types.TipSet, error) {
|
|||||||
func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) {
|
func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) {
|
||||||
if tsc.len == 0 {
|
if tsc.len == 0 {
|
||||||
log.Warnf("tipSetCache.get: cache is empty, requesting from storage (h=%d)", height)
|
log.Warnf("tipSetCache.get: cache is empty, requesting from storage (h=%d)", height)
|
||||||
return tsc.storage(context.TODO(), height, nil)
|
return tsc.storage(context.TODO(), height, types.EmptyTSK)
|
||||||
}
|
}
|
||||||
|
|
||||||
headH := tsc.cache[tsc.start].Height()
|
headH := tsc.cache[tsc.start].Height()
|
||||||
@ -113,7 +113,7 @@ func (tsc *tipSetCache) get(height uint64) (*types.TipSet, error) {
|
|||||||
|
|
||||||
if height < tail.Height() {
|
if height < tail.Height() {
|
||||||
log.Warnf("tipSetCache.get: requested tipset not in cache, requesting from storage (h=%d; tail=%d)", height, tail.Height())
|
log.Warnf("tipSetCache.get: requested tipset not in cache, requesting from storage (h=%d; tail=%d)", height, tail.Height())
|
||||||
return tsc.storage(context.TODO(), height, tail)
|
return tsc.storage(context.TODO(), height, tail.Key())
|
||||||
}
|
}
|
||||||
|
|
||||||
return tsc.cache[normalModulo(tsc.start-int(headH-height), clen)], nil
|
return tsc.cache[normalModulo(tsc.start-int(headH-height), clen)], nil
|
||||||
|
@ -11,7 +11,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestTsCache(t *testing.T) {
|
func TestTsCache(t *testing.T) {
|
||||||
tsc := newTSCache(50, func(context.Context, uint64, *types.TipSet) (*types.TipSet, error) {
|
tsc := newTSCache(50, func(context.Context, uint64, types.TipSetKey) (*types.TipSet, error) {
|
||||||
t.Fatal("storage call")
|
t.Fatal("storage call")
|
||||||
return &types.TipSet{}, nil
|
return &types.TipSet{}, nil
|
||||||
})
|
})
|
||||||
@ -54,7 +54,7 @@ func TestTsCache(t *testing.T) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func TestTsCacheNulls(t *testing.T) {
|
func TestTsCacheNulls(t *testing.T) {
|
||||||
tsc := newTSCache(50, func(context.Context, uint64, *types.TipSet) (*types.TipSet, error) {
|
tsc := newTSCache(50, func(context.Context, uint64, types.TipSetKey) (*types.TipSet, error) {
|
||||||
t.Fatal("storage call")
|
t.Fatal("storage call")
|
||||||
return &types.TipSet{}, nil
|
return &types.TipSet{}, nil
|
||||||
})
|
})
|
||||||
|
@ -13,7 +13,7 @@ func (e *calledEvents) CheckMsg(ctx context.Context, smsg store.ChainMsg, hnd Ca
|
|||||||
msg := smsg.VMMessage()
|
msg := smsg.VMMessage()
|
||||||
|
|
||||||
return func(ts *types.TipSet) (done bool, more bool, err error) {
|
return func(ts *types.TipSet) (done bool, more bool, err error) {
|
||||||
fa, err := e.cs.StateGetActor(ctx, msg.From, ts)
|
fa, err := e.cs.StateGetActor(ctx, msg.From, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, true, err
|
return false, true, err
|
||||||
}
|
}
|
||||||
@ -23,7 +23,7 @@ func (e *calledEvents) CheckMsg(ctx context.Context, smsg store.ChainMsg, hnd Ca
|
|||||||
return false, true, nil
|
return false, true, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
rec, err := e.cs.StateGetReceipt(ctx, smsg.VMMessage().Cid(), ts)
|
rec, err := e.cs.StateGetReceipt(ctx, smsg.VMMessage().Cid(), ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, true, xerrors.Errorf("getting receipt in CheckMsg: %w", err)
|
return false, true, xerrors.Errorf("getting receipt in CheckMsg: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -419,13 +419,13 @@ func (cg *ChainGen) YieldRepo() (repo.Repo, error) {
|
|||||||
type MiningCheckAPI interface {
|
type MiningCheckAPI interface {
|
||||||
ChainGetRandomness(context.Context, types.TipSetKey, int64) ([]byte, error)
|
ChainGetRandomness(context.Context, types.TipSetKey, int64) ([]byte, error)
|
||||||
|
|
||||||
StateMinerPower(context.Context, address.Address, *types.TipSet) (api.MinerPower, error)
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (api.MinerPower, error)
|
||||||
|
|
||||||
StateMinerWorker(context.Context, address.Address, *types.TipSet) (address.Address, error)
|
StateMinerWorker(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
|
|
||||||
StateMinerSectorSize(context.Context, address.Address, *types.TipSet) (uint64, error)
|
StateMinerSectorSize(context.Context, address.Address, types.TipSetKey) (uint64, error)
|
||||||
|
|
||||||
StateMinerProvingSet(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
StateMinerProvingSet(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error)
|
||||||
|
|
||||||
WalletSign(context.Context, address.Address, []byte) (*types.Signature, error)
|
WalletSign(context.Context, address.Address, []byte) (*types.Signature, error)
|
||||||
}
|
}
|
||||||
@ -439,7 +439,11 @@ func (mca mca) ChainGetRandomness(ctx context.Context, pts types.TipSetKey, lb i
|
|||||||
return mca.sm.ChainStore().GetRandomness(ctx, pts.Cids(), int64(lb))
|
return mca.sm.ChainStore().GetRandomness(ctx, pts.Cids(), int64(lb))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mca mca) StateMinerPower(ctx context.Context, maddr address.Address, ts *types.TipSet) (api.MinerPower, error) {
|
func (mca mca) StateMinerPower(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (api.MinerPower, error) {
|
||||||
|
ts, err := mca.sm.ChainStore().LoadTipSet(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return api.MinerPower{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
mpow, tpow, err := stmgr.GetPower(ctx, mca.sm, ts, maddr)
|
mpow, tpow, err := stmgr.GetPower(ctx, mca.sm, ts, maddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.MinerPower{}, err
|
return api.MinerPower{}, err
|
||||||
@ -451,15 +455,27 @@ func (mca mca) StateMinerPower(ctx context.Context, maddr address.Address, ts *t
|
|||||||
}, err
|
}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mca mca) StateMinerWorker(ctx context.Context, maddr address.Address, ts *types.TipSet) (address.Address, error) {
|
func (mca mca) StateMinerWorker(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||||
|
ts, err := mca.sm.ChainStore().LoadTipSet(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return address.Undef, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerWorkerRaw(ctx, mca.sm, ts.ParentState(), maddr)
|
return stmgr.GetMinerWorkerRaw(ctx, mca.sm, ts.ParentState(), maddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mca mca) StateMinerSectorSize(ctx context.Context, maddr address.Address, ts *types.TipSet) (uint64, error) {
|
func (mca mca) StateMinerSectorSize(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (uint64, error) {
|
||||||
|
ts, err := mca.sm.ChainStore().LoadTipSet(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return 0, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerSectorSize(ctx, mca.sm, ts, maddr)
|
return stmgr.GetMinerSectorSize(ctx, mca.sm, ts, maddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (mca mca) StateMinerProvingSet(ctx context.Context, maddr address.Address, ts *types.TipSet) ([]*api.ChainSectorInfo, error) {
|
func (mca mca) StateMinerProvingSet(ctx context.Context, maddr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
|
ts, err := mca.sm.ChainStore().LoadTipSet(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerProvingSet(ctx, mca.sm, ts, maddr)
|
return stmgr.GetMinerProvingSet(ctx, mca.sm, ts, maddr)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -503,7 +519,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
|
|||||||
return nil, xerrors.Errorf("chain get randomness: %w", err)
|
return nil, xerrors.Errorf("chain get randomness: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mworker, err := a.StateMinerWorker(ctx, miner, ts)
|
mworker, err := a.StateMinerWorker(ctx, miner, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to get miner worker: %w", err)
|
return nil, xerrors.Errorf("failed to get miner worker: %w", err)
|
||||||
}
|
}
|
||||||
@ -513,7 +529,7 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
|
|||||||
return nil, xerrors.Errorf("failed to compute VRF: %w", err)
|
return nil, xerrors.Errorf("failed to compute VRF: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pset, err := a.StateMinerProvingSet(ctx, miner, ts)
|
pset, err := a.StateMinerProvingSet(ctx, miner, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to load proving set for miner: %w", err)
|
return nil, xerrors.Errorf("failed to load proving set for miner: %w", err)
|
||||||
}
|
}
|
||||||
@ -538,12 +554,12 @@ func IsRoundWinner(ctx context.Context, ts *types.TipSet, round int64, miner add
|
|||||||
return nil, xerrors.Errorf("failed to generate electionPoSt candidates: %w", err)
|
return nil, xerrors.Errorf("failed to generate electionPoSt candidates: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pow, err := a.StateMinerPower(ctx, miner, ts)
|
pow, err := a.StateMinerPower(ctx, miner, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to check power: %w", err)
|
return nil, xerrors.Errorf("failed to check power: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize, err := a.StateMinerSectorSize(ctx, miner, ts)
|
ssize, err := a.StateMinerSectorSize(ctx, miner, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to look up miners sector size: %w", err)
|
return nil, xerrors.Errorf("failed to look up miners sector size: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
func init() {
|
||||||
|
@ -95,7 +95,7 @@ func sendHeadNotifs(ctx context.Context, ps *pubsub.PubSub, topic string, chain
|
|||||||
case notif := <-notifs:
|
case notif := <-notifs:
|
||||||
n := notif[len(notif)-1]
|
n := notif[len(notif)-1]
|
||||||
|
|
||||||
w, err := chain.ChainTipSetWeight(ctx, n.Val)
|
w, err := chain.ChainTipSetWeight(ctx, n.Val.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,8 @@ import (
|
|||||||
. "github.com/filecoin-project/lotus/chain/stmgr"
|
. "github.com/filecoin-project/lotus/chain/stmgr"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/chain/vm"
|
"github.com/filecoin-project/lotus/chain/vm"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
|
@ -1021,3 +1021,11 @@ func NewChainRand(cs *ChainStore, blks []cid.Cid, bheight uint64) vm.Rand {
|
|||||||
func (cr *chainRand) GetRandomness(ctx context.Context, round int64) ([]byte, error) {
|
func (cr *chainRand) GetRandomness(ctx context.Context, round int64) ([]byte, error) {
|
||||||
return cr.cs.GetRandomness(ctx, cr.blks, round)
|
return cr.cs.GetRandomness(ctx, cr.blks, round)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (cs *ChainStore) GetTipSetFromKey(tsk types.TipSetKey) (*types.TipSet, error) {
|
||||||
|
if tsk.IsEmpty() {
|
||||||
|
return cs.GetHeaviestTipSet(), nil
|
||||||
|
} else {
|
||||||
|
return cs.LoadTipSet(tsk)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -4,8 +4,11 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
lru "github.com/hashicorp/golang-lru"
|
||||||
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
connmgr "github.com/libp2p/go-libp2p-core/connmgr"
|
connmgr "github.com/libp2p/go-libp2p-core/connmgr"
|
||||||
|
peer "github.com/libp2p/go-libp2p-peer"
|
||||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
@ -28,15 +31,9 @@ func HandleIncomingBlocks(ctx context.Context, bsub *pubsub.Subscription, s *cha
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
blk, err := types.DecodeBlockMsg(msg.GetData())
|
blk, ok := msg.ValidatorData.(*types.BlockMsg)
|
||||||
if err != nil {
|
if !ok {
|
||||||
log.Error("got invalid block over pubsub: ", err)
|
log.Warnf("pubsub block validator passed on wrong type: %#v", msg.ValidatorData)
|
||||||
continue
|
|
||||||
}
|
|
||||||
|
|
||||||
if len(blk.BlsMessages)+len(blk.SecpkMessages) > build.BlockMessageLimit {
|
|
||||||
log.Warnf("received block with too many messages over pubsub")
|
|
||||||
continue
|
|
||||||
}
|
}
|
||||||
|
|
||||||
go func() {
|
go func() {
|
||||||
@ -73,6 +70,89 @@ func HandleIncomingBlocks(ctx context.Context, bsub *pubsub.Subscription, s *cha
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type BlockValidator struct {
|
||||||
|
peers *lru.TwoQueueCache
|
||||||
|
|
||||||
|
killThresh int
|
||||||
|
|
||||||
|
recvBlocks *blockReceiptCache
|
||||||
|
|
||||||
|
blacklist func(peer.ID)
|
||||||
|
}
|
||||||
|
|
||||||
|
func NewBlockValidator(blacklist func(peer.ID)) *BlockValidator {
|
||||||
|
p, _ := lru.New2Q(4096)
|
||||||
|
return &BlockValidator{
|
||||||
|
peers: p,
|
||||||
|
killThresh: 5,
|
||||||
|
blacklist: blacklist,
|
||||||
|
recvBlocks: newBlockReceiptCache(),
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bv *BlockValidator) flagPeer(p peer.ID) {
|
||||||
|
v, ok := bv.peers.Get(p)
|
||||||
|
if !ok {
|
||||||
|
bv.peers.Add(p, int(1))
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
|
val := v.(int)
|
||||||
|
|
||||||
|
if val >= bv.killThresh {
|
||||||
|
bv.blacklist(p)
|
||||||
|
}
|
||||||
|
|
||||||
|
bv.peers.Add(p, v.(int)+1)
|
||||||
|
}
|
||||||
|
|
||||||
|
func (bv *BlockValidator) Validate(ctx context.Context, pid peer.ID, msg *pubsub.Message) bool {
|
||||||
|
blk, err := types.DecodeBlockMsg(msg.GetData())
|
||||||
|
if err != nil {
|
||||||
|
log.Error("got invalid block over pubsub: ", err)
|
||||||
|
bv.flagPeer(pid)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if len(blk.BlsMessages)+len(blk.SecpkMessages) > build.BlockMessageLimit {
|
||||||
|
log.Warnf("received block with too many messages over pubsub")
|
||||||
|
bv.flagPeer(pid)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
if bv.recvBlocks.add(blk.Header.Cid()) > 0 {
|
||||||
|
// TODO: once these changes propagate to the network, we can consider
|
||||||
|
// dropping peers who send us the same block multiple times
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.ValidatorData = blk
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
type blockReceiptCache struct {
|
||||||
|
blocks *lru.TwoQueueCache
|
||||||
|
}
|
||||||
|
|
||||||
|
func newBlockReceiptCache() *blockReceiptCache {
|
||||||
|
c, _ := lru.New2Q(8192)
|
||||||
|
|
||||||
|
return &blockReceiptCache{
|
||||||
|
blocks: c,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
func (brc *blockReceiptCache) add(bcid cid.Cid) int {
|
||||||
|
val, ok := brc.blocks.Get(bcid)
|
||||||
|
if !ok {
|
||||||
|
brc.blocks.Add(bcid, int(1))
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
|
||||||
|
brc.blocks.Add(bcid, val.(int)+1)
|
||||||
|
return val.(int)
|
||||||
|
}
|
||||||
|
|
||||||
func HandleIncomingMessages(ctx context.Context, mpool *messagepool.MessagePool, msub *pubsub.Subscription) {
|
func HandleIncomingMessages(ctx context.Context, mpool *messagepool.MessagePool, msub *pubsub.Subscription) {
|
||||||
for {
|
for {
|
||||||
msg, err := msub.Next(ctx)
|
msg, err := msub.Next(ctx)
|
||||||
@ -85,9 +165,9 @@ func HandleIncomingMessages(ctx context.Context, mpool *messagepool.MessagePool,
|
|||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
m, err := types.DecodeSignedMessage(msg.GetData())
|
m, ok := msg.ValidatorData.(*types.SignedMessage)
|
||||||
if err != nil {
|
if !ok {
|
||||||
log.Errorf("got incorrectly formatted Message: %s", err)
|
log.Errorf("message validator func passed on wrong type: %#v", msg.ValidatorData)
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -118,6 +118,10 @@ func (syncer *Syncer) InformNewHead(from peer.ID, fts *store.FullTipSet) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for _, b := range fts.Blocks {
|
for _, b := range fts.Blocks {
|
||||||
|
if reason, ok := syncer.bad.Has(b.Cid()); ok {
|
||||||
|
log.Warnf("InformNewHead called on block marked as bad: %s (reason: %s)", b.Cid(), reason)
|
||||||
|
return false
|
||||||
|
}
|
||||||
if err := syncer.ValidateMsgMeta(b); err != nil {
|
if err := syncer.ValidateMsgMeta(b); err != nil {
|
||||||
log.Warnf("invalid block received: %s", err)
|
log.Warnf("invalid block received: %s", err)
|
||||||
return false
|
return false
|
||||||
@ -447,7 +451,7 @@ func (syncer *Syncer) ValidateTipSet(ctx context.Context, fts *store.FullTipSet)
|
|||||||
for _, b := range fts.Blocks {
|
for _, b := range fts.Blocks {
|
||||||
if err := syncer.ValidateBlock(ctx, b); err != nil {
|
if err := syncer.ValidateBlock(ctx, b); err != nil {
|
||||||
if isPermanent(err) {
|
if isPermanent(err) {
|
||||||
syncer.bad.Add(b.Cid())
|
syncer.bad.Add(b.Cid(), err.Error())
|
||||||
}
|
}
|
||||||
return xerrors.Errorf("validating block %s: %w", b.Cid(), err)
|
return xerrors.Errorf("validating block %s: %w", b.Cid(), err)
|
||||||
}
|
}
|
||||||
@ -872,11 +876,11 @@ func (syncer *Syncer) collectHeaders(ctx context.Context, from *types.TipSet, to
|
|||||||
)
|
)
|
||||||
|
|
||||||
for _, pcid := range from.Parents().Cids() {
|
for _, pcid := range from.Parents().Cids() {
|
||||||
if syncer.bad.Has(pcid) {
|
if reason, ok := syncer.bad.Has(pcid); ok {
|
||||||
for _, b := range from.Cids() {
|
for _, b := range from.Cids() {
|
||||||
syncer.bad.Add(b)
|
syncer.bad.Add(b, fmt.Sprintf("linked to %s", pcid))
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("chain linked to block marked previously as bad (%s, %s)", from.Cids(), pcid)
|
return nil, xerrors.Errorf("chain linked to block marked previously as bad (%s, %s) (reason: %s)", from.Cids(), pcid, reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -894,12 +898,12 @@ func (syncer *Syncer) collectHeaders(ctx context.Context, from *types.TipSet, to
|
|||||||
loop:
|
loop:
|
||||||
for blockSet[len(blockSet)-1].Height() > untilHeight {
|
for blockSet[len(blockSet)-1].Height() > untilHeight {
|
||||||
for _, bc := range at.Cids() {
|
for _, bc := range at.Cids() {
|
||||||
if syncer.bad.Has(bc) {
|
if reason, ok := syncer.bad.Has(bc); ok {
|
||||||
for _, b := range acceptedBlocks {
|
for _, b := range acceptedBlocks {
|
||||||
syncer.bad.Add(b)
|
syncer.bad.Add(b, fmt.Sprintf("chain contained %s", bc))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("chain contained block marked previously as bad (%s, %s)", from.Cids(), bc)
|
return nil, xerrors.Errorf("chain contained block marked previously as bad (%s, %s) (reason: %s)", from.Cids(), bc, reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -942,12 +946,12 @@ loop:
|
|||||||
break loop
|
break loop
|
||||||
}
|
}
|
||||||
for _, bc := range b.Cids() {
|
for _, bc := range b.Cids() {
|
||||||
if syncer.bad.Has(bc) {
|
if reason, ok := syncer.bad.Has(bc); ok {
|
||||||
for _, b := range acceptedBlocks {
|
for _, b := range acceptedBlocks {
|
||||||
syncer.bad.Add(b)
|
syncer.bad.Add(b, fmt.Sprintf("chain contained %s", bc))
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("chain contained block marked previously as bad (%s, %s)", from.Cids(), bc)
|
return nil, xerrors.Errorf("chain contained block marked previously as bad (%s, %s) (reason: %s)", from.Cids(), bc, reason)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
blockSet = append(blockSet, b)
|
blockSet = append(blockSet, b)
|
||||||
@ -974,7 +978,7 @@ loop:
|
|||||||
// TODO: we're marking this block bad in the same way that we mark invalid blocks bad. Maybe distinguish?
|
// TODO: we're marking this block bad in the same way that we mark invalid blocks bad. Maybe distinguish?
|
||||||
log.Warn("adding forked chain to our bad tipset cache")
|
log.Warn("adding forked chain to our bad tipset cache")
|
||||||
for _, b := range from.Blocks() {
|
for _, b := range from.Blocks() {
|
||||||
syncer.bad.Add(b.Cid())
|
syncer.bad.Add(b.Cid(), "fork past finality")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil, xerrors.Errorf("failed to sync fork: %w", err)
|
return nil, xerrors.Errorf("failed to sync fork: %w", err)
|
||||||
@ -1191,5 +1195,9 @@ func (syncer *Syncer) State() []SyncerState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (syncer *Syncer) MarkBad(blk cid.Cid) {
|
func (syncer *Syncer) MarkBad(blk cid.Cid) {
|
||||||
syncer.bad.Add(blk)
|
syncer.bad.Add(blk, "manually marked bad")
|
||||||
|
}
|
||||||
|
|
||||||
|
func (syncer *Syncer) CheckBadBlockCache(blk cid.Cid) (string, bool) {
|
||||||
|
return syncer.bad.Has(blk)
|
||||||
}
|
}
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"math/big"
|
"math/big"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
|
||||||
|
|
||||||
block "github.com/ipfs/go-block-format"
|
block "github.com/ipfs/go-block-format"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/minio/sha256-simd"
|
"github.com/minio/sha256-simd"
|
||||||
@ -205,7 +203,11 @@ func IsTicketWinner(partialTicket []byte, ssizeI uint64, snum uint64, totpow Big
|
|||||||
}
|
}
|
||||||
|
|
||||||
func ElectionPostChallengeCount(sectors uint64, faults uint64) uint64 {
|
func ElectionPostChallengeCount(sectors uint64, faults uint64) uint64 {
|
||||||
return sectorbuilder.ElectionPostChallengeCount(sectors, faults)
|
if sectors-faults == 0 {
|
||||||
|
return 0
|
||||||
|
}
|
||||||
|
// ceil(sectors / SectorChallengeRatioDiv)
|
||||||
|
return (sectors-faults-1)/build.SectorChallengeRatioDiv + 1
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *Ticket) Equals(ot *Ticket) bool {
|
func (t *Ticket) Equals(ot *Ticket) bool {
|
||||||
|
@ -129,6 +129,9 @@ func (ts *TipSet) Cids() []cid.Cid {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (ts *TipSet) Key() TipSetKey {
|
func (ts *TipSet) Key() TipSetKey {
|
||||||
|
if ts == nil {
|
||||||
|
return EmptyTSK
|
||||||
|
}
|
||||||
return NewTipSetKey(ts.cids...)
|
return NewTipSetKey(ts.cids...)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -9,6 +9,8 @@ import (
|
|||||||
"github.com/multiformats/go-multihash"
|
"github.com/multiformats/go-multihash"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
var EmptyTSK = TipSetKey{}
|
||||||
|
|
||||||
// The length of a block header CID in bytes.
|
// The length of a block header CID in bytes.
|
||||||
var blockHeaderCIDLen int
|
var blockHeaderCIDLen int
|
||||||
|
|
||||||
@ -90,6 +92,10 @@ func (k *TipSetKey) UnmarshalJSON(b []byte) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (k TipSetKey) IsEmpty() bool {
|
||||||
|
return len(k.value) == 0
|
||||||
|
}
|
||||||
|
|
||||||
func encodeKey(cids []cid.Cid) []byte {
|
func encodeKey(cids []cid.Cid) []byte {
|
||||||
buffer := new(bytes.Buffer)
|
buffer := new(bytes.Buffer)
|
||||||
for _, c := range cids {
|
for _, c := range cids {
|
||||||
|
@ -3,10 +3,9 @@ package types
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
"github.com/filecoin-project/lotus/chain/actors/aerrors"
|
||||||
|
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
@ -46,14 +45,28 @@ type VMContext interface {
|
|||||||
Context() context.Context
|
Context() context.Context
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const CommitmentBytesLen = 32
|
||||||
|
|
||||||
|
type PublicSectorInfo struct {
|
||||||
|
SectorID uint64
|
||||||
|
CommR [CommitmentBytesLen]byte
|
||||||
|
}
|
||||||
|
|
||||||
|
type Candidate struct {
|
||||||
|
SectorID uint64
|
||||||
|
PartialTicket [32]byte
|
||||||
|
Ticket [32]byte
|
||||||
|
SectorChallengeIndex uint64
|
||||||
|
}
|
||||||
|
|
||||||
type VMSyscalls struct {
|
type VMSyscalls struct {
|
||||||
ValidatePoRep func(context.Context, address.Address, uint64, []byte, []byte, []byte, []byte, []byte, uint64) (bool, aerrors.ActorError)
|
ValidatePoRep func(context.Context, address.Address, uint64, []byte, []byte, []byte, []byte, []byte, uint64) (bool, aerrors.ActorError)
|
||||||
VerifyFallbackPost func(ctx context.Context,
|
VerifyFallbackPost func(ctx context.Context,
|
||||||
sectorSize uint64,
|
sectorSize uint64,
|
||||||
sectorInfo sectorbuilder.SortedPublicSectorInfo,
|
sectorInfo []PublicSectorInfo,
|
||||||
challengeSeed []byte,
|
challengeSeed []byte,
|
||||||
proof []byte,
|
proof []byte,
|
||||||
candidates []sectorbuilder.EPostCandidate,
|
candidates []Candidate,
|
||||||
proverID address.Address,
|
proverID address.Address,
|
||||||
faults uint64) (bool, error)
|
faults uint64) (bool, error)
|
||||||
}
|
}
|
||||||
|
@ -16,6 +16,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"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/lib/sigs/secp"
|
||||||
)
|
)
|
||||||
|
|
||||||
func TestMessageFactory(t *testing.T) {
|
func TestMessageFactory(t *testing.T) {
|
||||||
|
@ -2,6 +2,8 @@ package vm
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
ffi "github.com/filecoin-project/filecoin-ffi"
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
@ -24,6 +26,44 @@ func Syscalls(verifier sectorbuilder.Verifier) *types.VMSyscalls {
|
|||||||
|
|
||||||
return ok, nil
|
return ok, nil
|
||||||
},
|
},
|
||||||
VerifyFallbackPost: verifier.VerifyFallbackPost,
|
VerifyFallbackPost: func(ctx context.Context,
|
||||||
|
sectorSize uint64,
|
||||||
|
sectorInfo []types.PublicSectorInfo,
|
||||||
|
challengeSeed []byte,
|
||||||
|
proof []byte,
|
||||||
|
candidates []types.Candidate,
|
||||||
|
proverID address.Address,
|
||||||
|
faults uint64) (bool, error) {
|
||||||
|
|
||||||
|
sI := make([]ffi.PublicSectorInfo, len(sectorInfo))
|
||||||
|
for i, v := range sectorInfo {
|
||||||
|
sI[i] = ffi.PublicSectorInfo{
|
||||||
|
SectorID: v.SectorID,
|
||||||
|
CommR: v.CommR,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
cand := make([]sectorbuilder.EPostCandidate, len(candidates))
|
||||||
|
for i, v := range candidates {
|
||||||
|
cand[i] = sectorbuilder.EPostCandidate{
|
||||||
|
SectorID: v.SectorID,
|
||||||
|
PartialTicket: v.PartialTicket,
|
||||||
|
Ticket: v.Ticket,
|
||||||
|
SectorChallengeIndex: v.SectorChallengeIndex,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return verifier.VerifyFallbackPost(
|
||||||
|
ctx,
|
||||||
|
sectorSize,
|
||||||
|
sectorbuilder.NewSortedPublicSectorInfo(sI),
|
||||||
|
challengeSeed,
|
||||||
|
proof,
|
||||||
|
cand,
|
||||||
|
proverID,
|
||||||
|
faults,
|
||||||
|
)
|
||||||
|
|
||||||
|
},
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -7,6 +7,8 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
)
|
)
|
||||||
|
|
||||||
const HalvingPeriodEpochs = 6 * 365 * 24 * 60 * 2
|
const HalvingPeriodEpochs = 6 * 365 * 24 * 60 * 2
|
||||||
|
12
cli/chain.go
12
cli/chain.go
@ -250,7 +250,7 @@ var chainSetHeadCmd = &cli.Command{
|
|||||||
ts, err = api.ChainGetGenesis(ctx)
|
ts, err = api.ChainGetGenesis(ctx)
|
||||||
}
|
}
|
||||||
if ts == nil && cctx.IsSet("epoch") {
|
if ts == nil && cctx.IsSet("epoch") {
|
||||||
ts, err = api.ChainGetTipSetByHeight(ctx, cctx.Uint64("epoch"), nil)
|
ts, err = api.ChainGetTipSetByHeight(ctx, cctx.Uint64("epoch"), types.EmptyTSK)
|
||||||
}
|
}
|
||||||
if ts == nil {
|
if ts == nil {
|
||||||
ts, err = parseTipSet(api, ctx, cctx.Args().Slice())
|
ts, err = parseTipSet(api, ctx, cctx.Args().Slice())
|
||||||
@ -263,7 +263,7 @@ var chainSetHeadCmd = &cli.Command{
|
|||||||
return fmt.Errorf("must pass cids for tipset to set as head")
|
return fmt.Errorf("must pass cids for tipset to set as head")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := api.ChainSetHead(ctx, ts); err != nil {
|
if err := api.ChainSetHead(ctx, ts.Key()); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -313,7 +313,7 @@ var chainListCmd = &cli.Command{
|
|||||||
var head *types.TipSet
|
var head *types.TipSet
|
||||||
|
|
||||||
if cctx.IsSet("height") {
|
if cctx.IsSet("height") {
|
||||||
head, err = api.ChainGetTipSetByHeight(ctx, cctx.Uint64("height"), nil)
|
head, err = api.ChainGetTipSetByHeight(ctx, cctx.Uint64("height"), types.EmptyTSK)
|
||||||
} else {
|
} else {
|
||||||
head, err = api.ChainHead(ctx)
|
head, err = api.ChainHead(ctx)
|
||||||
}
|
}
|
||||||
@ -446,7 +446,7 @@ var chainBisectCmd = &cli.Command{
|
|||||||
|
|
||||||
subPath := cctx.Args().Get(2)
|
subPath := cctx.Args().Get(2)
|
||||||
|
|
||||||
highest, err := api.ChainGetTipSetByHeight(ctx, end, nil)
|
highest, err := api.ChainGetTipSetByHeight(ctx, end, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -460,7 +460,7 @@ var chainBisectCmd = &cli.Command{
|
|||||||
start = end
|
start = end
|
||||||
}
|
}
|
||||||
|
|
||||||
midTs, err := api.ChainGetTipSetByHeight(ctx, mid, highest)
|
midTs, err := api.ChainGetTipSetByHeight(ctx, mid, highest.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -542,7 +542,7 @@ var chainExportCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
stream, err := api.ChainExport(ctx, ts)
|
stream, err := api.ChainExport(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -295,7 +295,7 @@ var clientQueryAskCmd = &cli.Command{
|
|||||||
To: maddr,
|
To: maddr,
|
||||||
From: maddr,
|
From: maddr,
|
||||||
Method: actors.MAMethods.GetPeerID,
|
Method: actors.MAMethods.GetPeerID,
|
||||||
}, nil)
|
}, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to get peerID for miner: %w", err)
|
return xerrors.Errorf("failed to get peerID for miner: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -210,4 +210,5 @@ var Commands = []*cli.Command{
|
|||||||
syncCmd,
|
syncCmd,
|
||||||
versionCmd,
|
versionCmd,
|
||||||
walletCmd,
|
walletCmd,
|
||||||
|
logCmd,
|
||||||
}
|
}
|
||||||
|
101
cli/log.go
Normal file
101
cli/log.go
Normal file
@ -0,0 +1,101 @@
|
|||||||
|
package cli
|
||||||
|
|
||||||
|
import (
|
||||||
|
"fmt"
|
||||||
|
|
||||||
|
"golang.org/x/xerrors"
|
||||||
|
"gopkg.in/urfave/cli.v2"
|
||||||
|
)
|
||||||
|
|
||||||
|
var logCmd = &cli.Command{
|
||||||
|
Name: "log",
|
||||||
|
Usage: "Manage logging",
|
||||||
|
Subcommands: []*cli.Command{
|
||||||
|
logList,
|
||||||
|
logSetLevel,
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var logList = &cli.Command{
|
||||||
|
Name: "list",
|
||||||
|
Usage: "List log systems",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
systems, err := api.LogList(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, system := range systems {
|
||||||
|
fmt.Println(system)
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
|
var logSetLevel = &cli.Command{
|
||||||
|
Name: "set-level",
|
||||||
|
Usage: "Set log level",
|
||||||
|
ArgsUsage: "<level>",
|
||||||
|
Description: `Set the log level for logging systems:
|
||||||
|
|
||||||
|
The system flag can be specified multiple times.
|
||||||
|
|
||||||
|
eg) log set-level --system chain --system blocksync debug
|
||||||
|
|
||||||
|
Available Levels:
|
||||||
|
debug
|
||||||
|
info
|
||||||
|
warn
|
||||||
|
error
|
||||||
|
|
||||||
|
Environment Variables:
|
||||||
|
GOLOG_LOG_LEVEL - Default log level for all log systems
|
||||||
|
GOLOG_LOG_FMT - Change output log format (json, nocolor)
|
||||||
|
GOLOG_FILE - Write logs to file in addition to stderr
|
||||||
|
`,
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringSliceFlag{
|
||||||
|
Name: "system",
|
||||||
|
Usage: "limit to log system",
|
||||||
|
Value: &cli.StringSlice{},
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
if !cctx.Args().Present() {
|
||||||
|
return fmt.Errorf("level is required")
|
||||||
|
}
|
||||||
|
|
||||||
|
systems := cctx.StringSlice("system")
|
||||||
|
if len(systems) == 0 {
|
||||||
|
var err error
|
||||||
|
systems, err = api.LogList(ctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
for _, system := range systems {
|
||||||
|
if err := api.LogSetLevel(ctx, system, cctx.Args().First()); err != nil {
|
||||||
|
return xerrors.Errorf("setting log level on %s: %w", system, err)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
@ -33,7 +33,7 @@ var mpoolPending = &cli.Command{
|
|||||||
|
|
||||||
ctx := ReqContext(cctx)
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
msgs, err := api.MpoolPending(ctx, nil)
|
msgs, err := api.MpoolPending(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -103,7 +103,7 @@ var mpoolStat = &cli.Command{
|
|||||||
return xerrors.Errorf("getting chain head: %w", err)
|
return xerrors.Errorf("getting chain head: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs, err := api.MpoolPending(ctx, nil)
|
msgs, err := api.MpoolPending(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -122,7 +122,7 @@ var mpoolStat = &cli.Command{
|
|||||||
bkt.msgs[v.Message.Nonce] = v
|
bkt.msgs[v.Message.Nonce] = v
|
||||||
}
|
}
|
||||||
for a, bkt := range buckets {
|
for a, bkt := range buckets {
|
||||||
act, err := api.StateGetActor(ctx, a, ts)
|
act, err := api.StateGetActor(ctx, a, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
fmt.Printf("%s, err: %s\n", a, err)
|
fmt.Printf("%s, err: %s\n", a, err)
|
||||||
continue
|
continue
|
||||||
|
@ -176,7 +176,7 @@ var msigInspectCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
act, err := api.StateGetActor(ctx, maddr, nil)
|
act, err := api.StateGetActor(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
77
cli/state.go
77
cli/state.go
@ -48,6 +48,7 @@ var stateCmd = &cli.Command{
|
|||||||
stateComputeStateCmd,
|
stateComputeStateCmd,
|
||||||
stateCallCmd,
|
stateCallCmd,
|
||||||
stateGetDealSetCmd,
|
stateGetDealSetCmd,
|
||||||
|
stateWaitMsgCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,7 +116,7 @@ var statePowerCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
power, err := api.StateMinerPower(ctx, maddr, ts)
|
power, err := api.StateMinerPower(ctx, maddr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -159,7 +160,7 @@ var stateSectorsCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sectors, err := api.StateMinerSectors(ctx, maddr, ts)
|
sectors, err := api.StateMinerSectors(ctx, maddr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -198,7 +199,7 @@ var stateProvingSetCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sectors, err := api.StateMinerProvingSet(ctx, maddr, ts)
|
sectors, err := api.StateMinerProvingSet(ctx, maddr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -260,7 +261,7 @@ var stateReplaySetCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
res, err := api.StateReplay(ctx, ts, mcid)
|
res, err := api.StateReplay(ctx, ts.Key(), mcid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("replay call failed: %w", err)
|
return xerrors.Errorf("replay call failed: %w", err)
|
||||||
}
|
}
|
||||||
@ -294,7 +295,7 @@ var statePledgeCollateralCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
coll, err := api.StatePledgeCollateral(ctx, ts)
|
coll, err := api.StatePledgeCollateral(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -330,7 +331,7 @@ var stateGetDealSetCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
deal, err := api.StateMarketStorageDeal(ctx, dealid, ts)
|
deal, err := api.StateMarketStorageDeal(ctx, dealid, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -362,7 +363,7 @@ var stateListMinersCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
miners, err := api.StateListMiners(ctx, ts)
|
miners, err := api.StateListMiners(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -392,7 +393,7 @@ var stateListActorsCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
actors, err := api.StateListActors(ctx, ts)
|
actors, err := api.StateListActors(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -431,7 +432,7 @@ var stateGetActorCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
a, err := api.StateGetActor(ctx, addr, ts)
|
a, err := api.StateGetActor(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -472,7 +473,7 @@ var stateLookupIDCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
a, err := api.StateLookupID(ctx, addr, ts)
|
a, err := api.StateLookupID(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -509,7 +510,7 @@ var stateSectorSizeCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize, err := api.StateMinerSectorSize(ctx, addr, ts)
|
ssize, err := api.StateMinerSectorSize(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -545,12 +546,12 @@ var stateReadStateCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
act, err := api.StateGetActor(ctx, addr, ts)
|
act, err := api.StateGetActor(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
as, err := api.StateReadState(ctx, act, ts)
|
as, err := api.StateReadState(ctx, act, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -619,7 +620,7 @@ var stateListMessagesCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
msgs, err := api.StateListMessages(ctx, &types.Message{To: toa, From: froma}, ts, toh)
|
msgs, err := api.StateListMessages(ctx, &types.Message{To: toa, From: froma}, ts.Key(), toh)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -686,7 +687,7 @@ var stateComputeStateCmd = &cli.Command{
|
|||||||
|
|
||||||
var msgs []*types.Message
|
var msgs []*types.Message
|
||||||
if cctx.Bool("apply-mpool-messages") {
|
if cctx.Bool("apply-mpool-messages") {
|
||||||
pmsgs, err := api.MpoolPending(ctx, ts)
|
pmsgs, err := api.MpoolPending(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -701,7 +702,7 @@ var stateComputeStateCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
nstate, err := api.StateCompute(ctx, h, msgs, ts)
|
nstate, err := api.StateCompute(ctx, h, msgs, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -711,6 +712,46 @@ var stateComputeStateCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var stateWaitMsgCmd = &cli.Command{
|
||||||
|
Name: "wait-msg",
|
||||||
|
Usage: "Wait for a message to appear on chain",
|
||||||
|
Flags: []cli.Flag{
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "timeout",
|
||||||
|
Value: "10m",
|
||||||
|
},
|
||||||
|
},
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
if !cctx.Args().Present() {
|
||||||
|
return fmt.Errorf("must specify message cid to wait for")
|
||||||
|
}
|
||||||
|
|
||||||
|
api, closer, err := GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
msg, err := cid.Decode(cctx.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
mw, err := api.StateWaitMsg(ctx, msg)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Printf("message was executed in tipset: %s", mw.TipSet.Cids())
|
||||||
|
fmt.Printf("Exit Code: %d", mw.Receipt.ExitCode)
|
||||||
|
fmt.Printf("Gas Used: %s", mw.Receipt.GasUsed)
|
||||||
|
fmt.Printf("Return: %x", mw.Receipt.Return)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
var stateCallCmd = &cli.Command{
|
var stateCallCmd = &cli.Command{
|
||||||
Name: "call",
|
Name: "call",
|
||||||
Usage: "Invoke a method on an actor locally",
|
Usage: "Invoke a method on an actor locally",
|
||||||
@ -769,7 +810,7 @@ var stateCallCmd = &cli.Command{
|
|||||||
return fmt.Errorf("failed to parse 'value': %s", err)
|
return fmt.Errorf("failed to parse 'value': %s", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
act, err := api.StateGetActor(ctx, toa, ts)
|
act, err := api.StateGetActor(ctx, toa, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("failed to lookup target actor: %s", err)
|
return fmt.Errorf("failed to lookup target actor: %s", err)
|
||||||
}
|
}
|
||||||
@ -787,7 +828,7 @@ var stateCallCmd = &cli.Command{
|
|||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
Method: method,
|
Method: method,
|
||||||
Params: params,
|
Params: params,
|
||||||
}, ts)
|
}, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return fmt.Errorf("state call failed: %s", err)
|
return fmt.Errorf("state call failed: %s", err)
|
||||||
}
|
}
|
||||||
|
36
cli/sync.go
36
cli/sync.go
@ -20,6 +20,7 @@ var syncCmd = &cli.Command{
|
|||||||
syncStatusCmd,
|
syncStatusCmd,
|
||||||
syncWaitCmd,
|
syncWaitCmd,
|
||||||
syncMarkBadCmd,
|
syncMarkBadCmd,
|
||||||
|
syncCheckBadCmd,
|
||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -115,6 +116,41 @@ var syncMarkBadCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
|
var syncCheckBadCmd = &cli.Command{
|
||||||
|
Name: "check-bad",
|
||||||
|
Usage: "check if the given block was marked bad, and for what reason",
|
||||||
|
Action: func(cctx *cli.Context) error {
|
||||||
|
napi, closer, err := GetFullNodeAPI(cctx)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
defer closer()
|
||||||
|
ctx := ReqContext(cctx)
|
||||||
|
|
||||||
|
if !cctx.Args().Present() {
|
||||||
|
return fmt.Errorf("must specify block cid to check")
|
||||||
|
}
|
||||||
|
|
||||||
|
bcid, err := cid.Decode(cctx.Args().First())
|
||||||
|
if err != nil {
|
||||||
|
return fmt.Errorf("failed to decode input as a cid: %s", err)
|
||||||
|
}
|
||||||
|
|
||||||
|
reason, err := napi.SyncCheckBad(ctx, bcid)
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
if reason == "" {
|
||||||
|
fmt.Println("block was not marked as bad")
|
||||||
|
return nil
|
||||||
|
}
|
||||||
|
|
||||||
|
fmt.Println(reason)
|
||||||
|
return nil
|
||||||
|
},
|
||||||
|
}
|
||||||
|
|
||||||
func SyncWait(ctx context.Context, napi api.FullNode) error {
|
func SyncWait(ctx context.Context, napi api.FullNode) error {
|
||||||
for {
|
for {
|
||||||
state, err := napi.SyncState(ctx)
|
state, err := napi.SyncState(ctx)
|
||||||
|
@ -143,19 +143,19 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
|
|
||||||
if len(bh.Parents) == 0 { // genesis case
|
if len(bh.Parents) == 0 { // genesis case
|
||||||
ts, err := types.NewTipSet([]*types.BlockHeader{bh})
|
ts, err := types.NewTipSet([]*types.BlockHeader{bh})
|
||||||
aadrs, err := api.StateListActors(ctx, ts)
|
aadrs, err := api.StateListActors(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
par(50, aadrs, func(addr address.Address) {
|
par(50, aadrs, func(addr address.Address) {
|
||||||
act, err := api.StateGetActor(ctx, addr, ts)
|
act, err := api.StateGetActor(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ast, err := api.StateReadState(ctx, act, ts)
|
ast, err := api.StateReadState(ctx, act, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
@ -200,7 +200,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
ast, err := api.StateReadState(ctx, &act, ts)
|
ast, err := api.StateReadState(ctx, &act, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
@ -237,7 +237,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
}
|
}
|
||||||
|
|
||||||
par(50, kmaparr(addresses), func(addr address.Address) {
|
par(50, kmaparr(addresses), func(addr address.Address) {
|
||||||
raddr, err := api.StateLookupID(ctx, addr, nil)
|
raddr, err := api.StateLookupID(ctx, addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warn(err)
|
log.Warn(err)
|
||||||
return
|
return
|
||||||
@ -268,7 +268,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
par(50, kvmaparr(miners), func(it func() (minerKey, *minerInfo)) {
|
par(50, kvmaparr(miners), func(it func() (minerKey, *minerInfo)) {
|
||||||
k, info := it()
|
k, info := it()
|
||||||
|
|
||||||
sszs, err := api.StateMinerSectorCount(ctx, k.addr, nil)
|
sszs, err := api.StateMinerSectorCount(ctx, k.addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
@ -357,7 +357,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
log.Infof("Get deals")
|
log.Infof("Get deals")
|
||||||
|
|
||||||
// TODO: incremental, gather expired
|
// TODO: incremental, gather expired
|
||||||
deals, err := api.StateMarketDeals(ctx, ts)
|
deals, err := api.StateMarketDeals(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Error(err)
|
log.Error(err)
|
||||||
return
|
return
|
||||||
|
@ -207,7 +207,8 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
|
|
||||||
if owner.Protocol() != address.BLS {
|
if owner.Protocol() != address.BLS {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
w.Write([]byte("Miner address must use BLS"))
|
w.Write([]byte("Miner address must use BLS. A BLS address starts with the prefix 't3'."))
|
||||||
|
w.Write([]byte("Please create a BLS address by running \"lotus wallet new bls\" while connected to a Lotus node."))
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -238,7 +239,7 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
collateral, err := h.api.StatePledgeCollateral(r.Context(), nil)
|
collateral, err := h.api.StatePledgeCollateral(r.Context(), types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
w.Write([]byte(err.Error()))
|
w.Write([]byte(err.Error()))
|
||||||
|
@ -3,7 +3,7 @@ package main
|
|||||||
import (
|
import (
|
||||||
"os"
|
"os"
|
||||||
|
|
||||||
"github.com/coreos/go-systemd/dbus"
|
"github.com/coreos/go-systemd/v22/dbus"
|
||||||
)
|
)
|
||||||
|
|
||||||
func notifyHandler(n string, ch chan interface{}, sCh chan os.Signal) (string, error) {
|
func notifyHandler(n string, ch chan interface{}, sCh chan os.Signal) (string, error) {
|
||||||
|
@ -11,6 +11,9 @@ import (
|
|||||||
|
|
||||||
"gopkg.in/urfave/cli.v2"
|
"gopkg.in/urfave/cli.v2"
|
||||||
|
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||||
|
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||||
|
|
||||||
"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"
|
||||||
)
|
)
|
||||||
|
@ -38,14 +38,14 @@ var infoCmd = &cli.Command{
|
|||||||
fmt.Printf("Miner: %s\n", maddr)
|
fmt.Printf("Miner: %s\n", maddr)
|
||||||
|
|
||||||
// Sector size
|
// Sector size
|
||||||
sizeByte, err := api.StateMinerSectorSize(ctx, maddr, nil)
|
sizeByte, err := api.StateMinerSectorSize(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
fmt.Printf("Sector Size: %s\n", types.NewInt(sizeByte).SizeStr())
|
fmt.Printf("Sector Size: %s\n", types.NewInt(sizeByte).SizeStr())
|
||||||
|
|
||||||
pow, err := api.StateMinerPower(ctx, maddr, nil)
|
pow, err := api.StateMinerPower(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -53,11 +53,11 @@ var infoCmd = &cli.Command{
|
|||||||
percI := types.BigDiv(types.BigMul(pow.MinerPower, types.NewInt(1000000)), pow.TotalPower)
|
percI := types.BigDiv(types.BigMul(pow.MinerPower, types.NewInt(1000000)), pow.TotalPower)
|
||||||
fmt.Printf("Power: %s / %s (%0.4f%%)\n", pow.MinerPower.SizeStr(), pow.TotalPower.SizeStr(), float64(percI.Int64())/10000)
|
fmt.Printf("Power: %s / %s (%0.4f%%)\n", pow.MinerPower.SizeStr(), pow.TotalPower.SizeStr(), float64(percI.Int64())/10000)
|
||||||
|
|
||||||
secCounts, err := api.StateMinerSectorCount(ctx, maddr, nil)
|
secCounts, err := api.StateMinerSectorCount(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
faults, err := api.StateMinerFaults(ctx, maddr, nil)
|
faults, err := api.StateMinerFaults(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -88,7 +88,7 @@ var infoCmd = &cli.Command{
|
|||||||
fmt.Printf("\tCommit: %d\n", wstat.CommitWait)
|
fmt.Printf("\tCommit: %d\n", wstat.CommitWait)
|
||||||
fmt.Printf("\tUnseal: %d\n", wstat.UnsealWait)
|
fmt.Printf("\tUnseal: %d\n", wstat.UnsealWait)
|
||||||
|
|
||||||
eps, err := api.StateMinerElectionPeriodStart(ctx, maddr, nil)
|
eps, err := api.StateMinerElectionPeriodStart(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -34,6 +34,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/genesis"
|
"github.com/filecoin-project/lotus/genesis"
|
||||||
"github.com/filecoin-project/lotus/markets/utils"
|
"github.com/filecoin-project/lotus/markets/utils"
|
||||||
"github.com/filecoin-project/lotus/miner"
|
"github.com/filecoin-project/lotus/miner"
|
||||||
|
"github.com/filecoin-project/lotus/node/config"
|
||||||
"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"
|
||||||
@ -77,6 +78,10 @@ var initCmd = &cli.Command{
|
|||||||
Name: "pre-sealed-sectors",
|
Name: "pre-sealed-sectors",
|
||||||
Usage: "specify set of presealed sectors for starting as a genesis miner",
|
Usage: "specify set of presealed sectors for starting as a genesis miner",
|
||||||
},
|
},
|
||||||
|
&cli.StringFlag{
|
||||||
|
Name: "pre-sealed-metadata",
|
||||||
|
Usage: "specify the metadata file for the presealed sectors",
|
||||||
|
},
|
||||||
&cli.BoolFlag{
|
&cli.BoolFlag{
|
||||||
Name: "nosync",
|
Name: "nosync",
|
||||||
Usage: "don't check full-node sync status",
|
Usage: "don't check full-node sync status",
|
||||||
@ -220,13 +225,13 @@ var initCmd = &cli.Command{
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
func migratePreSealMeta(ctx context.Context, api lapi.FullNode, presealDir string, maddr address.Address, mds dtypes.MetadataDS) error {
|
func migratePreSealMeta(ctx context.Context, api lapi.FullNode, metadata string, maddr address.Address, mds dtypes.MetadataDS) error {
|
||||||
presealDir, err := homedir.Expand(presealDir)
|
metadata, err := homedir.Expand(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("expanding preseal dir: %w", err)
|
return xerrors.Errorf("expanding preseal dir: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
b, err := ioutil.ReadFile(filepath.Join(presealDir, "pre-seal-"+maddr.String()+".json"))
|
b, err := ioutil.ReadFile(metadata)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("reading preseal metadata: %w", err)
|
return xerrors.Errorf("reading preseal metadata: %w", err)
|
||||||
}
|
}
|
||||||
@ -318,7 +323,7 @@ func findMarketDealID(ctx context.Context, api lapi.FullNode, deal actors.Storag
|
|||||||
// TODO: find a better way
|
// TODO: find a better way
|
||||||
// (this is only used by genesis miners)
|
// (this is only used by genesis miners)
|
||||||
|
|
||||||
deals, err := api.StateMarketDeals(ctx, nil)
|
deals, err := api.StateMarketDeals(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, xerrors.Errorf("getting market deals: %w", err)
|
return 0, xerrors.Errorf("getting market deals: %w", err)
|
||||||
}
|
}
|
||||||
@ -368,7 +373,22 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode,
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
sbcfg, err := modules.SectorBuilderConfig(sectorbuilder.SimplePath(lr.Path()), 2, false, false)(mds, api)
|
c, err := lr.Config()
|
||||||
|
if err != nil {
|
||||||
|
return err
|
||||||
|
}
|
||||||
|
|
||||||
|
cfg, ok := c.(*config.StorageMiner)
|
||||||
|
if !ok {
|
||||||
|
return xerrors.Errorf("invalid config from repo, got: %T", c)
|
||||||
|
}
|
||||||
|
|
||||||
|
scfg := sectorbuilder.SimplePath(lr.Path())
|
||||||
|
if len(cfg.SectorBuilder.Storage) > 0 {
|
||||||
|
scfg = cfg.SectorBuilder.Storage
|
||||||
|
}
|
||||||
|
|
||||||
|
sbcfg, err := modules.SectorBuilderConfig(scfg, 2, false, false)(mds, api)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("getting genesis miner sector builder config: %w", err)
|
return xerrors.Errorf("getting genesis miner sector builder config: %w", err)
|
||||||
}
|
}
|
||||||
@ -395,20 +415,20 @@ func storageMinerInit(ctx context.Context, cctx *cli.Context, api lapi.FullNode,
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if pssb := cctx.String("pre-sealed-sectors"); pssb != "" {
|
return nil
|
||||||
pssb, err := homedir.Expand(pssb)
|
}
|
||||||
if err != nil {
|
|
||||||
return err
|
|
||||||
}
|
|
||||||
|
|
||||||
log.Infof("Importing pre-sealed sector metadata for %s", a)
|
if pssb := cctx.String("pre-sealed-metadata"); pssb != "" {
|
||||||
|
pssb, err := homedir.Expand(pssb)
|
||||||
if err := migratePreSealMeta(ctx, api, pssb, a, mds); err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("migrating presealed sector metadata: %w", err)
|
return err
|
||||||
}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
log.Infof("Importing pre-sealed sector metadata for %s", a)
|
||||||
|
|
||||||
|
if err := migratePreSealMeta(ctx, api, pssb, a, mds); err != nil {
|
||||||
|
return xerrors.Errorf("migrating presealed sector metadata: %w", err)
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := configureStorageMiner(ctx, api, a, peerid); err != nil {
|
if err := configureStorageMiner(ctx, api, a, peerid); err != nil {
|
||||||
@ -465,7 +485,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
|
|||||||
To: addr,
|
To: addr,
|
||||||
From: addr,
|
From: addr,
|
||||||
Method: actors.MAMethods.GetWorkerAddr,
|
Method: actors.MAMethods.GetWorkerAddr,
|
||||||
}, nil)
|
}, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to get worker address: %w", err)
|
return xerrors.Errorf("failed to get worker address: %w", err)
|
||||||
}
|
}
|
||||||
@ -538,7 +558,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
|
|||||||
return address.Undef, err
|
return address.Undef, err
|
||||||
}
|
}
|
||||||
|
|
||||||
collateral, err := api.StatePledgeCollateral(ctx, nil)
|
collateral, err := api.StatePledgeCollateral(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, err
|
return address.Undef, err
|
||||||
}
|
}
|
||||||
|
@ -2,6 +2,7 @@ package main
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"os"
|
"os"
|
||||||
"sort"
|
"sort"
|
||||||
"strconv"
|
"strconv"
|
||||||
@ -129,7 +130,7 @@ var sectorsListCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
pset, err := fullApi.StateMinerProvingSet(ctx, maddr, nil)
|
pset, err := fullApi.StateMinerProvingSet(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -138,7 +139,7 @@ var sectorsListCmd = &cli.Command{
|
|||||||
provingIDs[info.SectorID] = struct{}{}
|
provingIDs[info.SectorID] = struct{}{}
|
||||||
}
|
}
|
||||||
|
|
||||||
sset, err := fullApi.StateMinerSectors(ctx, maddr, nil)
|
sset, err := fullApi.StateMinerSectors(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -11,6 +11,7 @@ import (
|
|||||||
paramfetch "github.com/filecoin-project/go-paramfetch"
|
paramfetch "github.com/filecoin-project/go-paramfetch"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
blockstore "github.com/ipfs/go-ipfs-blockstore"
|
||||||
|
"github.com/mitchellh/go-homedir"
|
||||||
"github.com/multiformats/go-multiaddr"
|
"github.com/multiformats/go-multiaddr"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
"gopkg.in/urfave/cli.v2"
|
"gopkg.in/urfave/cli.v2"
|
||||||
@ -90,7 +91,15 @@ var DaemonCmd = &cli.Command{
|
|||||||
}
|
}
|
||||||
|
|
||||||
ctx := context.Background()
|
ctx := context.Background()
|
||||||
log.Infof("lotus repo: %s", cctx.String("repo"))
|
{
|
||||||
|
dir, err := homedir.Expand(cctx.String("repo"))
|
||||||
|
if err != nil {
|
||||||
|
log.Warnw("could not expand repo location", "error", err)
|
||||||
|
} else {
|
||||||
|
log.Infof("lotus repo: %s", dir)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
r, err := repo.NewFS(cctx.String("repo"))
|
r, err := repo.NewFS(cctx.String("repo"))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("opening fs repo: %w", err)
|
return xerrors.Errorf("opening fs repo: %w", err)
|
||||||
|
@ -30,7 +30,7 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
pending, err := api.MpoolPending(ctx, head)
|
pending, err := api.MpoolPending(ctx, head.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -52,7 +52,7 @@ func init() {
|
|||||||
From: addr,
|
From: addr,
|
||||||
To: addr,
|
To: addr,
|
||||||
Method: actors.MAMethods.GetWorkerAddr,
|
Method: actors.MAMethods.GetWorkerAddr,
|
||||||
}, head)
|
}, head.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to get miner worker addr: %w", err)
|
return xerrors.Errorf("failed to get miner worker addr: %w", err)
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ func init() {
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("chain get randomness: %w", err)
|
return xerrors.Errorf("chain get randomness: %w", err)
|
||||||
}
|
}
|
||||||
mworker, err := api.StateMinerWorker(ctx, addr, head)
|
mworker, err := api.StateMinerWorker(ctx, addr, head.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to get miner worker: %w", err)
|
return xerrors.Errorf("failed to get miner worker: %w", err)
|
||||||
}
|
}
|
||||||
@ -104,7 +104,7 @@ func init() {
|
|||||||
|
|
||||||
uts := head.MinTimestamp() + uint64(build.BlockDelay)
|
uts := head.MinTimestamp() + uint64(build.BlockDelay)
|
||||||
nheight := head.Height() + 1
|
nheight := head.Height() + 1
|
||||||
blk, err := api.MinerCreateBlock(ctx, addr, head, ticket, epostp, msgs, nheight, uts)
|
blk, err := api.MinerCreateBlock(ctx, addr, head.Key(), ticket, epostp, msgs, nheight, uts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("creating block: %w", err)
|
return xerrors.Errorf("creating block: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -160,6 +160,13 @@
|
|||||||
}
|
}
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"title": "FAQs",
|
||||||
|
"slug": "en+faqs",
|
||||||
|
"github": "en/faqs.md",
|
||||||
|
"value": null,
|
||||||
|
"posts": []
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"title": "Glossary",
|
"title": "Glossary",
|
||||||
"slug": "en+glossary",
|
"slug": "en+glossary",
|
||||||
|
134
documentation/en/faqs.md
Normal file
134
documentation/en/faqs.md
Normal file
@ -0,0 +1,134 @@
|
|||||||
|
# Frequently Asked Questions
|
||||||
|
|
||||||
|
Here are some FAQs concerning the Lotus implementation and participation in
|
||||||
|
Testnet.
|
||||||
|
For questions concerning the broader Filecoin project, please
|
||||||
|
go [here](https://filecoin.io/faqs/).
|
||||||
|
|
||||||
|
## Introduction to Lotus
|
||||||
|
|
||||||
|
### What is Lotus?
|
||||||
|
|
||||||
|
Lotus is an implementation of the **Filecoin Distributed Storage Network**, written in Go.
|
||||||
|
It is designed to be modular and interoperable with any other implementation of the Filecoin Protocol.
|
||||||
|
More information about Lotus can be found [here](https://lotu.sh/).
|
||||||
|
|
||||||
|
### What are the components of Lotus?
|
||||||
|
|
||||||
|
Lotus is composed of two separate pieces that can talk to each other:
|
||||||
|
|
||||||
|
The Lotus Node can sync the blockchain, validating all blocks, transfers, and deals
|
||||||
|
along the way. It can also facilitate the creation of new storage deals. If you are not
|
||||||
|
interested in providing your own storage to the network, and do not want to produce blocks
|
||||||
|
yourself, then the Lotus Node is all you need!
|
||||||
|
|
||||||
|
The Lotus Storage Miner does everything you need for the registration of storage, and the
|
||||||
|
production of new blocks. The Lotus Storage Miner communicates with the network
|
||||||
|
by talking to a Lotus Node over the JSON-RPC API.
|
||||||
|
|
||||||
|
## Setting up a Lotus Node
|
||||||
|
|
||||||
|
### How do I set up a Lotus Node?
|
||||||
|
|
||||||
|
Follow the instructions found [here](https://docs.lotu.sh/en+getting-started).
|
||||||
|
|
||||||
|
### Where can I get the latest version of Lotus?
|
||||||
|
|
||||||
|
Download the binary tagged as the `Latest Release` from the
|
||||||
|
[Lotus Github repo](https://github.com/filecoin-project/lotus/releases).
|
||||||
|
|
||||||
|
### What operating systems can Lotus run on?
|
||||||
|
|
||||||
|
Lotus can build and run on most Linux and MacOS systems with at least
|
||||||
|
8GB of RAM. Windows is not yet supported.
|
||||||
|
|
||||||
|
### How can I update to the latest version of Lotus?
|
||||||
|
|
||||||
|
To update Lotus, follow the instructions [here](https://lotu.sh/en+updating-lotus).
|
||||||
|
|
||||||
|
### How do I prepare a fresh installation of Lotus?
|
||||||
|
|
||||||
|
Stop the Lotus daemon, and delete all related files, including sealed and chain data by
|
||||||
|
running `rm ~/.lotus ~/.lotusstorage`.
|
||||||
|
|
||||||
|
Then, install Lotus afresh by following the instructions
|
||||||
|
found [here](https://docs.lotu.sh/en+getting-started).
|
||||||
|
|
||||||
|
## Interacting with a Lotus Node
|
||||||
|
|
||||||
|
### How can I communicate with a Lotus Node?
|
||||||
|
|
||||||
|
Lotus Nodes have a command-line interface, as well as a JSON-RPC API.
|
||||||
|
|
||||||
|
### What are the commands I can send using the command-line interface?
|
||||||
|
|
||||||
|
The command-line interface is self-documenting, try running `lotus --help` from the `lotus` home
|
||||||
|
directory for more.
|
||||||
|
|
||||||
|
### How can I send a request over the JSON-RPC API?
|
||||||
|
|
||||||
|
Information on how to send a `cURL` request to the JSON-RPC API can be found
|
||||||
|
[here](https://lotu.sh/en+api). A JavaScript client is under development.
|
||||||
|
|
||||||
|
### What are the requests I can send over the JSON-RPC API?
|
||||||
|
|
||||||
|
Please have a look at the
|
||||||
|
[source code](https://github.com/filecoin-project/lotus/blob/master/api/api_common.go)
|
||||||
|
for a list of methods supported by the JSON-RPC API.
|
||||||
|
## The Test Network
|
||||||
|
|
||||||
|
### What is Testnet?
|
||||||
|
|
||||||
|
Testnet is a live network of Lotus Nodes run by the
|
||||||
|
community for testing purposes.
|
||||||
|
It has 2 PiB of storage (and growing!) dedicated to it.
|
||||||
|
|
||||||
|
### Is FIL on the Testnet worth anything?
|
||||||
|
|
||||||
|
Nothing at all! Real-world incentives may be provided in a future phase of Testnet, but this is
|
||||||
|
yet to be confirmed.
|
||||||
|
|
||||||
|
### Will there be future phases of Testnet?
|
||||||
|
|
||||||
|
Yes, there will be at least one more phase of Testnet. We plan on introducing interoperable
|
||||||
|
[go-filecoin nodes](https://github.com/filecoin-project/go-filecoin#filecoin-go-filecoin)
|
||||||
|
in a future phase.
|
||||||
|
|
||||||
|
### How can I see the status of Testnet?
|
||||||
|
|
||||||
|
The [dashboard](https://stats.testnet.filecoin.io/) displays the status of the network as
|
||||||
|
well as a ton
|
||||||
|
of other metrics you might find interesting.
|
||||||
|
|
||||||
|
## Mining with a Lotus Node on Testnet
|
||||||
|
|
||||||
|
### How do I get started mining with Lotus?
|
||||||
|
|
||||||
|
Follow the instructions found [here](https://lotu.sh/en+mining).
|
||||||
|
|
||||||
|
### What are the minimum hardware requirements?
|
||||||
|
|
||||||
|
An example test configuration, and minimum hardware requirements can be found
|
||||||
|
[here](https://lotu.sh/en+hardware-mining).
|
||||||
|
|
||||||
|
Note that these might NOT be the minimum requirements for mining on Mainnet.
|
||||||
|
|
||||||
|
### What are some GPUs that have been tested?
|
||||||
|
|
||||||
|
A list of benchmarked GPUs can be found [here](https://lotu.sh/en+hardware-mining#benchmarked-gpus-7393).
|
||||||
|
|
||||||
|
## Advanced questions
|
||||||
|
|
||||||
|
### Is there a Docker image for lotus?
|
||||||
|
|
||||||
|
Community-contributed Docker and Docker Compose examples are available
|
||||||
|
[here](https://github.com/filecoin-project/lotus/tree/master/tools/dockers/docker-examples).
|
||||||
|
|
||||||
|
### How can I run two miners on the same machine?
|
||||||
|
|
||||||
|
You can do so by changing the storage path variable for the second miner, e.g.,
|
||||||
|
`LOTUS_STORAGE_PATH=~/.lotusstorage2`. You will also need to make sure that no ports collide.
|
||||||
|
|
||||||
|
### How do I setup my own local devnet?
|
||||||
|
|
||||||
|
Follow the instructions found [here](https://lotu.sh/en+setup-local-dev-net).
|
@ -36,7 +36,7 @@ In order to connect to the network, you need to be connected to at least 1 peer.
|
|||||||
|
|
||||||
## Chain sync
|
## Chain sync
|
||||||
|
|
||||||
While the daemon is running, the next requirement is to sync the chain. Run the command below to start the chain sync progress. To see current chain height, visit the [network stats page](http://stats.testnet.filecoin.io/).
|
While the daemon is running, the next requirement is to sync the chain. Run the command below to start the chain sync progress. To see current chain height, visit the [network stats page](https://stats.testnet.filecoin.io/).
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
lotus sync wait
|
lotus sync wait
|
||||||
@ -50,9 +50,11 @@ lotus sync wait
|
|||||||
Initialize a new wallet:
|
Initialize a new wallet:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
lotus wallet new
|
lotus wallet new
|
||||||
```
|
```
|
||||||
|
|
||||||
|
Sometimes your operating system may limit file name length to under 150 characters. You need to use a file system that supports long filenames.
|
||||||
|
|
||||||
Here is an example of the response:
|
Here is an example of the response:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
|
@ -26,7 +26,7 @@ Create the genesis block and start up the first node:
|
|||||||
Set up the genesis miner:
|
Set up the genesis miner:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
./lotus-storage-miner init --genesis-miner --actor=t0101 --sector-size=1024 --pre-sealed-sectors=~/.genesis-sectors --nosync
|
./lotus-storage-miner init --genesis-miner --actor=t0101 --sector-size=1024 --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t0101.json --nosync
|
||||||
```
|
```
|
||||||
|
|
||||||
Now, finally, start up the miner:
|
Now, finally, start up the miner:
|
||||||
|
@ -14,12 +14,18 @@ IPFS_GATEWAY="https://proof-parameters.s3.cn-south-1.jdcloud-oss.com/ipfs/"
|
|||||||
|
|
||||||
## Get started
|
## Get started
|
||||||
|
|
||||||
Please ensure that at least one **BLS address** in your wallet exists with the following command:
|
Please ensure that at least one **BLS address** (starts with `t3`) in your wallet exists with the following command:
|
||||||
|
|
||||||
```sh
|
```sh
|
||||||
lotus wallet list
|
lotus wallet list
|
||||||
```
|
```
|
||||||
|
|
||||||
|
If you do not have a bls address, create a new bls wallet:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
lotus wallet new bls
|
||||||
|
```
|
||||||
|
|
||||||
With your wallet address:
|
With your wallet address:
|
||||||
|
|
||||||
- Visit the [faucet](https://lotus-faucet.kittyhawk.wtf/miner.html)
|
- Visit the [faucet](https://lotus-faucet.kittyhawk.wtf/miner.html)
|
||||||
|
8
go.mod
8
go.mod
@ -8,7 +8,7 @@ require (
|
|||||||
github.com/GeertJohan/go.rice v1.0.0
|
github.com/GeertJohan/go.rice v1.0.0
|
||||||
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee
|
github.com/Gurpartap/async v0.0.0-20180927173644-4f7f499dd9ee
|
||||||
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
github.com/StackExchange/wmi v0.0.0-20190523213315-cbe66965904d // indirect
|
||||||
github.com/coreos/go-systemd v0.0.0-00010101000000-000000000000
|
github.com/coreos/go-systemd/v22 v22.0.0
|
||||||
github.com/docker/go-units v0.4.0
|
github.com/docker/go-units v0.4.0
|
||||||
github.com/filecoin-project/chain-validation v0.0.3
|
github.com/filecoin-project/chain-validation v0.0.3
|
||||||
github.com/filecoin-project/filecoin-ffi v0.0.0-20191219131535-bb699517a590
|
github.com/filecoin-project/filecoin-ffi v0.0.0-20191219131535-bb699517a590
|
||||||
@ -27,7 +27,7 @@ require (
|
|||||||
github.com/gorilla/mux v1.7.3
|
github.com/gorilla/mux v1.7.3
|
||||||
github.com/gorilla/websocket v1.4.1
|
github.com/gorilla/websocket v1.4.1
|
||||||
github.com/hashicorp/go-multierror v1.0.0
|
github.com/hashicorp/go-multierror v1.0.0
|
||||||
github.com/hashicorp/golang-lru v0.5.3
|
github.com/hashicorp/golang-lru v0.5.4
|
||||||
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e
|
github.com/influxdata/influxdb1-client v0.0.0-20190809212627-fc22c7df067e
|
||||||
github.com/ipfs/go-bitswap v0.1.8
|
github.com/ipfs/go-bitswap v0.1.8
|
||||||
github.com/ipfs/go-block-format v0.0.2
|
github.com/ipfs/go-block-format v0.0.2
|
||||||
@ -64,7 +64,7 @@ require (
|
|||||||
github.com/libp2p/go-libp2p-mplex v0.2.1
|
github.com/libp2p/go-libp2p-mplex v0.2.1
|
||||||
github.com/libp2p/go-libp2p-peer v0.2.0
|
github.com/libp2p/go-libp2p-peer v0.2.0
|
||||||
github.com/libp2p/go-libp2p-peerstore v0.1.4
|
github.com/libp2p/go-libp2p-peerstore v0.1.4
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.2.3
|
github.com/libp2p/go-libp2p-pubsub v0.2.6
|
||||||
github.com/libp2p/go-libp2p-quic-transport v0.1.1
|
github.com/libp2p/go-libp2p-quic-transport v0.1.1
|
||||||
github.com/libp2p/go-libp2p-record v0.1.1
|
github.com/libp2p/go-libp2p-record v0.1.1
|
||||||
github.com/libp2p/go-libp2p-routing-helpers v0.1.0
|
github.com/libp2p/go-libp2p-routing-helpers v0.1.0
|
||||||
@ -111,5 +111,3 @@ require (
|
|||||||
replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v1.18.0
|
replace github.com/golangci/golangci-lint => github.com/golangci/golangci-lint v1.18.0
|
||||||
|
|
||||||
replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi
|
replace github.com/filecoin-project/filecoin-ffi => ./extern/filecoin-ffi
|
||||||
|
|
||||||
replace github.com/coreos/go-systemd => github.com/coreos/go-systemd/v22 v22.0.0
|
|
||||||
|
16
go.sum
16
go.sum
@ -193,6 +193,8 @@ github.com/hashicorp/golang-lru v0.5.0/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ
|
|||||||
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
github.com/hashicorp/golang-lru v0.5.1/go.mod h1:/m3WP610KZHVQ1SGc6re/UDhFvYD7pJ4Ao+sR/qLZy8=
|
||||||
github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk=
|
github.com/hashicorp/golang-lru v0.5.3 h1:YPkqC67at8FYaadspW/6uE0COsBxS2656RLEr8Bppgk=
|
||||||
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
github.com/hashicorp/golang-lru v0.5.3/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.4 h1:YDjusn29QI/Das2iO9M0BHnIbxPeyuCHsjMW+lJfyTc=
|
||||||
|
github.com/hashicorp/golang-lru v0.5.4/go.mod h1:iADmTwqILo4mZ8BN3D2Q6+9jd8WM5uGBxy+E8yxSoD4=
|
||||||
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
github.com/hashicorp/hcl v1.0.0/go.mod h1:E5yfLk+7swimpb2L/Alb/PJmXilQ/rhwaUYs4T20WEQ=
|
||||||
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
github.com/hpcloud/tail v1.0.0 h1:nfCOvKYfkgYP8hkirhJocXT2+zOD8yUNjXaWfTlyFKI=
|
||||||
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
github.com/hpcloud/tail v1.0.0/go.mod h1:ab1qPbhIpdTxEkNHXyeSf5vhxWSCs/tWer42PpOxQnU=
|
||||||
@ -382,6 +384,10 @@ github.com/libp2p/go-flow-metrics v0.0.1 h1:0gxuFd2GuK7IIP5pKljLwps6TvcuYgvG7Atq
|
|||||||
github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8=
|
github.com/libp2p/go-flow-metrics v0.0.1/go.mod h1:Iv1GH0sG8DtYN3SVJ2eG221wMiNpZxBdp967ls1g+k8=
|
||||||
github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM=
|
github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM=
|
||||||
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
|
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
|
||||||
|
github.com/libp2p/go-flow-metrics v0.0.2 h1:U5TvqfoyR6GVRM+bC15Ux1ltar1kbj6Zw6xOVR02CZs=
|
||||||
|
github.com/libp2p/go-flow-metrics v0.0.2/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
|
||||||
|
github.com/libp2p/go-flow-metrics v0.0.3 h1:8tAs/hSdNvUiLgtlSy3mxwxWP4I9y/jlkPFT7epKdeM=
|
||||||
|
github.com/libp2p/go-flow-metrics v0.0.3/go.mod h1:HeoSNUrOJVK1jEpDqVEiUOIXqhbnS27omG0uWU5slZs=
|
||||||
github.com/libp2p/go-libp2p v0.0.30/go.mod h1:XWT8FGHlhptAv1+3V/+J5mEpzyui/5bvFsNuWYs611A=
|
github.com/libp2p/go-libp2p v0.0.30/go.mod h1:XWT8FGHlhptAv1+3V/+J5mEpzyui/5bvFsNuWYs611A=
|
||||||
github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM=
|
github.com/libp2p/go-libp2p v0.1.0/go.mod h1:6D/2OBauqLUoqcADOJpn9WbKqvaM07tDw68qHM0BxUM=
|
||||||
github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8=
|
github.com/libp2p/go-libp2p v0.1.1/go.mod h1:I00BRo1UuUSdpuc8Q2mN7yDF/oTUTRAX6JWpTiK9Rp8=
|
||||||
@ -417,6 +423,10 @@ github.com/libp2p/go-libp2p-core v0.2.4 h1:Et6ykkTwI6PU44tr8qUF9k43vP0aduMNniShA
|
|||||||
github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g=
|
github.com/libp2p/go-libp2p-core v0.2.4/go.mod h1:STh4fdfa5vDYr0/SzYYeqnt+E6KfEV5VxfIrm0bcI0g=
|
||||||
github.com/libp2p/go-libp2p-core v0.3.0 h1:F7PqduvrztDtFsAa/bcheQ3azmNo+Nq7m8hQY5GiUW8=
|
github.com/libp2p/go-libp2p-core v0.3.0 h1:F7PqduvrztDtFsAa/bcheQ3azmNo+Nq7m8hQY5GiUW8=
|
||||||
github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw=
|
github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw=
|
||||||
|
github.com/libp2p/go-libp2p-core v0.2.5 h1:iP1PIiIrlRrGbE1fYq2918yBc5NlCH3pFuIPSWU9hds=
|
||||||
|
github.com/libp2p/go-libp2p-core v0.2.5/go.mod h1:6+5zJmKhsf7yHn1RbmYDu08qDUpIUxGdqHuEZckmZOA=
|
||||||
|
github.com/libp2p/go-libp2p-core v0.3.0 h1:F7PqduvrztDtFsAa/bcheQ3azmNo+Nq7m8hQY5GiUW8=
|
||||||
|
github.com/libp2p/go-libp2p-core v0.3.0/go.mod h1:ACp3DmS3/N64c2jDzcV429ukDpicbL6+TrrxANBjPGw=
|
||||||
github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE=
|
github.com/libp2p/go-libp2p-crypto v0.0.1/go.mod h1:yJkNyDmO341d5wwXxDUGO0LykUVT72ImHNUqh5D/dBE=
|
||||||
github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I=
|
github.com/libp2p/go-libp2p-crypto v0.0.2/go.mod h1:eETI5OUfBnvARGOHrJz2eWNyTUxEGZnBxMcbUjfIj4I=
|
||||||
github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ=
|
github.com/libp2p/go-libp2p-crypto v0.1.0 h1:k9MFy+o2zGDNGsaoZl0MA3iZ75qXxr9OOoAZF+sD5OQ=
|
||||||
@ -472,6 +482,10 @@ github.com/libp2p/go-libp2p-protocol v0.1.0 h1:HdqhEyhg0ToCaxgMhnOmUO8snQtt/kQlc
|
|||||||
github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk=
|
github.com/libp2p/go-libp2p-protocol v0.1.0/go.mod h1:KQPHpAabB57XQxGrXCNvbL6UEXfQqUgC/1adR2Xtflk=
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.2.3 h1:qJRnRnM7Z4xnHb4i6EBb3DKQXRPgtFWlKP4AmfJudLQ=
|
github.com/libp2p/go-libp2p-pubsub v0.2.3 h1:qJRnRnM7Z4xnHb4i6EBb3DKQXRPgtFWlKP4AmfJudLQ=
|
||||||
github.com/libp2p/go-libp2p-pubsub v0.2.3/go.mod h1:Jscj3fk23R5mCrOwb625xjVs5ZEyTZcx/OlTwMDqU+g=
|
github.com/libp2p/go-libp2p-pubsub v0.2.3/go.mod h1:Jscj3fk23R5mCrOwb625xjVs5ZEyTZcx/OlTwMDqU+g=
|
||||||
|
github.com/libp2p/go-libp2p-pubsub v0.2.5 h1:tPKbkjAUI0xLGN3KKTKKy9TQEviVfrP++zJgH5Muke4=
|
||||||
|
github.com/libp2p/go-libp2p-pubsub v0.2.5/go.mod h1:9Q2RRq8ofXkoewORcyVlgUFDKLKw7BuYSlJVWRcVk3Y=
|
||||||
|
github.com/libp2p/go-libp2p-pubsub v0.2.6 h1:ypZaukCFrtD8cNeeb9nnWG4MD2Y1T0p22aQ+f7FKJig=
|
||||||
|
github.com/libp2p/go-libp2p-pubsub v0.2.6/go.mod h1:5jEp7R3ItQ0pgcEMrPZYE9DQTg/H3CTc7Mu1j2G4Y5o=
|
||||||
github.com/libp2p/go-libp2p-quic-transport v0.1.1 h1:MFMJzvsxIEDEVKzO89BnB/FgvMj9WI4GDGUW2ArDPUA=
|
github.com/libp2p/go-libp2p-quic-transport v0.1.1 h1:MFMJzvsxIEDEVKzO89BnB/FgvMj9WI4GDGUW2ArDPUA=
|
||||||
github.com/libp2p/go-libp2p-quic-transport v0.1.1/go.mod h1:wqG/jzhF3Pu2NrhJEvE+IE0NTHNXslOPn9JQzyCAxzU=
|
github.com/libp2p/go-libp2p-quic-transport v0.1.1/go.mod h1:wqG/jzhF3Pu2NrhJEvE+IE0NTHNXslOPn9JQzyCAxzU=
|
||||||
github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q=
|
github.com/libp2p/go-libp2p-record v0.0.1/go.mod h1:grzqg263Rug/sRex85QrDOLntdFAymLDLm7lxMgU79Q=
|
||||||
@ -632,6 +646,8 @@ github.com/multiformats/go-multistream v0.0.1/go.mod h1:fJTiDfXJVmItycydCnNx4+wS
|
|||||||
github.com/multiformats/go-multistream v0.0.4/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
|
github.com/multiformats/go-multistream v0.0.4/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
|
||||||
github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ=
|
github.com/multiformats/go-multistream v0.1.0 h1:UpO6jrsjqs46mqAK3n6wKRYFhugss9ArzbyUzU+4wkQ=
|
||||||
github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
|
github.com/multiformats/go-multistream v0.1.0/go.mod h1:fJTiDfXJVmItycydCnNx4+wSzZ5NwG2FEVAI30fiovg=
|
||||||
|
github.com/multiformats/go-multistream v0.1.1 h1:JlAdpIFhBhGRLxe9W6Om0w++Gd6KMWoFPZL/dEnm9nI=
|
||||||
|
github.com/multiformats/go-multistream v0.1.1/go.mod h1:KmHZ40hzVxiaiwlj3MEbYgK9JFk2/9UktWZAF54Du38=
|
||||||
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
github.com/multiformats/go-varint v0.0.1/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||||
github.com/multiformats/go-varint v0.0.2 h1:6sUvyh2YHpJCb8RZ6eYzj6iJQ4+chWYmyIHxszqlPTA=
|
github.com/multiformats/go-varint v0.0.2 h1:6sUvyh2YHpJCb8RZ6eYzj6iJQ4+chWYmyIHxszqlPTA=
|
||||||
github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
github.com/multiformats/go-varint v0.0.2/go.mod h1:3Ls8CIEsrijN6+B7PbrXRPxHRPuXSrVKRY101jdMZYE=
|
||||||
|
@ -142,7 +142,8 @@ func (api *api) SpawnStorage(fullNodeRepo string) (nodeInfo, error) {
|
|||||||
|
|
||||||
initArgs := []string{"init", "--nosync"}
|
initArgs := []string{"init", "--nosync"}
|
||||||
if fullNodeRepo == api.running[1].meta.Repo {
|
if fullNodeRepo == api.running[1].meta.Repo {
|
||||||
initArgs = []string{"init", "--actor=t0101", "--genesis-miner", "--pre-sealed-sectors=" + filepath.Join(fullNodeRepo, "preseal")}
|
presealPrefix := filepath.Join(fullNodeRepo, "preseal")
|
||||||
|
initArgs = []string{"init", "--actor=t0101", "--genesis-miner", "--pre-sealed-sectors=" + presealPrefix, "--pre-sealed-metadata=" + filepath.Join(presealPrefix, "pre-seal-t0101.json")}
|
||||||
}
|
}
|
||||||
|
|
||||||
id := atomic.AddInt32(&api.cmds, 1)
|
id := atomic.AddInt32(&api.cmds, 1)
|
||||||
|
@ -60,7 +60,7 @@ func (n *ClientNodeAdapter) ListStorageProviders(ctx context.Context) ([]*storag
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
addresses, err := n.StateListMiners(ctx, ts)
|
addresses, err := n.StateListMiners(ctx, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -68,17 +68,17 @@ func (n *ClientNodeAdapter) ListStorageProviders(ctx context.Context) ([]*storag
|
|||||||
var out []*storagemarket.StorageProviderInfo
|
var out []*storagemarket.StorageProviderInfo
|
||||||
|
|
||||||
for _, addr := range addresses {
|
for _, addr := range addresses {
|
||||||
workerAddr, err := n.StateMinerWorker(ctx, addr, ts)
|
workerAddr, err := n.StateMinerWorker(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
sectorSize, err := n.StateMinerSectorSize(ctx, addr, ts)
|
sectorSize, err := n.StateMinerSectorSize(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
peerId, err := n.StateMinerPeerID(ctx, addr, ts)
|
peerId, err := n.StateMinerPeerID(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -90,7 +90,7 @@ func (n *ClientNodeAdapter) ListStorageProviders(ctx context.Context) ([]*storag
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) ListClientDeals(ctx context.Context, addr address.Address) ([]storagemarket.StorageDeal, error) {
|
func (n *ClientNodeAdapter) ListClientDeals(ctx context.Context, addr address.Address) ([]storagemarket.StorageDeal, error) {
|
||||||
allDeals, err := n.StateMarketDeals(ctx, nil)
|
allDeals, err := n.StateMarketDeals(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -143,7 +143,7 @@ func (n *ClientNodeAdapter) EnsureFunds(ctx context.Context, addr address.Addres
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
||||||
bal, err := n.StateMarketBalance(ctx, addr, nil)
|
bal, err := n.StateMarketBalance(ctx, addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return storagemarket.Balance{}, err
|
return storagemarket.Balance{}, err
|
||||||
}
|
}
|
||||||
|
@ -50,7 +50,7 @@ func NewProviderNodeAdapter(dag dtypes.StagingDAG, secb *sectorblocks.SectorBloc
|
|||||||
func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemarket.MinerDeal) (storagemarket.DealID, cid.Cid, error) {
|
func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemarket.MinerDeal) (storagemarket.DealID, cid.Cid, error) {
|
||||||
log.Info("publishing deal")
|
log.Info("publishing deal")
|
||||||
|
|
||||||
worker, err := n.StateMinerWorker(ctx, deal.Proposal.Provider, nil)
|
worker, err := n.StateMinerWorker(ctx, deal.Proposal.Provider, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, cid.Undef, err
|
return 0, cid.Undef, err
|
||||||
}
|
}
|
||||||
@ -110,7 +110,7 @@ func (n *ProviderNodeAdapter) OnDealComplete(ctx context.Context, deal storagema
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) ListProviderDeals(ctx context.Context, addr address.Address) ([]storagemarket.StorageDeal, error) {
|
func (n *ProviderNodeAdapter) ListProviderDeals(ctx context.Context, addr address.Address) ([]storagemarket.StorageDeal, error) {
|
||||||
allDeals, err := n.StateMarketDeals(ctx, nil)
|
allDeals, err := n.StateMarketDeals(ctx, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -128,7 +128,7 @@ func (n *ProviderNodeAdapter) ListProviderDeals(ctx context.Context, addr addres
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) {
|
func (n *ProviderNodeAdapter) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) {
|
||||||
addr, err := n.StateMinerWorker(ctx, miner, nil)
|
addr, err := n.StateMinerWorker(ctx, miner, types.EmptyTSK)
|
||||||
return addr, err
|
return addr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,7 +176,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
func (n *ProviderNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
||||||
bal, err := n.StateMarketBalance(ctx, addr, nil)
|
bal, err := n.StateMarketBalance(ctx, addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return storagemarket.Balance{}, err
|
return storagemarket.Balance{}, err
|
||||||
}
|
}
|
||||||
@ -216,7 +216,7 @@ func (n *ProviderNodeAdapter) LocatePieceForDealWithinSector(ctx context.Context
|
|||||||
|
|
||||||
func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID uint64, cb storagemarket.DealSectorCommittedCallback) error {
|
func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID uint64, cb storagemarket.DealSectorCommittedCallback) error {
|
||||||
checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) {
|
checkFunc := func(ts *types.TipSet) (done bool, more bool, err error) {
|
||||||
sd, err := n.StateMarketStorageDeal(ctx, dealID, ts)
|
sd, err := n.StateMarketStorageDeal(ctx, dealID, ts.Key())
|
||||||
|
|
||||||
if err != nil {
|
if err != nil {
|
||||||
// TODO: This may be fine for some errors
|
// TODO: This may be fine for some errors
|
||||||
@ -243,7 +243,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
|
|||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
sd, err := n.StateMarketStorageDeal(ctx, dealID, ts)
|
sd, err := n.StateMarketStorageDeal(ctx, dealID, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
return false, xerrors.Errorf("failed to look up deal on chain: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -257,11 +257,11 @@ func (m *Miner) GetBestMiningCandidate(ctx context.Context) (*MiningBase, error)
|
|||||||
return m.lastWork, nil
|
return m.lastWork, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
btsw, err := m.api.ChainTipSetWeight(ctx, bts)
|
btsw, err := m.api.ChainTipSetWeight(ctx, bts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
ltsw, err := m.api.ChainTipSetWeight(ctx, m.lastWork.ts)
|
ltsw, err := m.api.ChainTipSetWeight(ctx, m.lastWork.ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -276,7 +276,7 @@ func (m *Miner) GetBestMiningCandidate(ctx context.Context) (*MiningBase, error)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) hasPower(ctx context.Context, addr address.Address, ts *types.TipSet) (bool, error) {
|
func (m *Miner) hasPower(ctx context.Context, addr address.Address, ts *types.TipSet) (bool, error) {
|
||||||
power, err := m.api.StateMinerPower(ctx, addr, ts)
|
power, err := m.api.StateMinerPower(ctx, addr, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
}
|
}
|
||||||
@ -316,7 +316,7 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
|
|||||||
}
|
}
|
||||||
|
|
||||||
// get pending messages early,
|
// get pending messages early,
|
||||||
pending, err := m.api.MpoolPending(context.TODO(), base.ts)
|
pending, err := m.api.MpoolPending(context.TODO(), base.ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed to get pending messages: %w", err)
|
return nil, xerrors.Errorf("failed to get pending messages: %w", err)
|
||||||
}
|
}
|
||||||
@ -341,7 +341,7 @@ func (m *Miner) mineOne(ctx context.Context, addr address.Address, base *MiningB
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) computeVRF(ctx context.Context, addr address.Address, input []byte) ([]byte, error) {
|
func (m *Miner) computeVRF(ctx context.Context, addr address.Address, input []byte) ([]byte, error) {
|
||||||
w, err := m.getMinerWorker(ctx, addr, nil)
|
w, err := m.getMinerWorker(ctx, addr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -349,12 +349,12 @@ func (m *Miner) computeVRF(ctx context.Context, addr address.Address, input []by
|
|||||||
return gen.ComputeVRF(ctx, m.api.WalletSign, w, addr, gen.DSepTicket, input)
|
return gen.ComputeVRF(ctx, m.api.WalletSign, w, addr, gen.DSepTicket, input)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m *Miner) getMinerWorker(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) {
|
func (m *Miner) getMinerWorker(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||||
ret, err := m.api.StateCall(ctx, &types.Message{
|
ret, err := m.api.StateCall(ctx, &types.Message{
|
||||||
From: addr,
|
From: addr,
|
||||||
To: addr,
|
To: addr,
|
||||||
Method: actors.MAMethods.GetWorkerAddr,
|
Method: actors.MAMethods.GetWorkerAddr,
|
||||||
}, ts)
|
}, tsk)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, xerrors.Errorf("failed to get miner worker addr: %w", err)
|
return address.Undef, xerrors.Errorf("failed to get miner worker addr: %w", err)
|
||||||
}
|
}
|
||||||
@ -401,10 +401,10 @@ func (m *Miner) createBlock(base *MiningBase, addr address.Address, ticket *type
|
|||||||
nheight := base.ts.Height() + base.nullRounds + 1
|
nheight := base.ts.Height() + base.nullRounds + 1
|
||||||
|
|
||||||
// why even return this? that api call could just submit it for us
|
// why even return this? that api call could just submit it for us
|
||||||
return m.api.MinerCreateBlock(context.TODO(), addr, base.ts, ticket, proof, msgs, nheight, uint64(uts))
|
return m.api.MinerCreateBlock(context.TODO(), addr, base.ts.Key(), ticket, proof, msgs, nheight, uint64(uts))
|
||||||
}
|
}
|
||||||
|
|
||||||
type ActorLookup func(context.Context, address.Address, *types.TipSet) (*types.Actor, error)
|
type ActorLookup func(context.Context, address.Address, types.TipSetKey) (*types.Actor, error)
|
||||||
|
|
||||||
func countFrom(msgs []*types.SignedMessage, from address.Address) (out int) {
|
func countFrom(msgs []*types.SignedMessage, from address.Address) (out int) {
|
||||||
for _, msg := range msgs {
|
for _, msg := range msgs {
|
||||||
@ -431,7 +431,7 @@ func SelectMessages(ctx context.Context, al ActorLookup, ts *types.TipSet, msgs
|
|||||||
from := msg.Message.From
|
from := msg.Message.From
|
||||||
|
|
||||||
if _, ok := inclNonces[from]; !ok {
|
if _, ok := inclNonces[from]; !ok {
|
||||||
act, err := al(ctx, from, ts)
|
act, err := al(ctx, from, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Warnf("failed to check message sender balance, skipping message: %+v", err)
|
log.Warnf("failed to check message sender balance, skipping message: %+v", err)
|
||||||
continue
|
continue
|
||||||
|
@ -33,7 +33,7 @@ func TestMessageFiltering(t *testing.T) {
|
|||||||
},
|
},
|
||||||
}
|
}
|
||||||
|
|
||||||
af := func(ctx context.Context, addr address.Address, ts *types.TipSet) (*types.Actor, error) {
|
af := func(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||||||
return actors[addr], nil
|
return actors[addr], nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -159,7 +159,7 @@ func libp2p() Option {
|
|||||||
Override(AddrsFactoryKey, lp2p.AddrsFactory(nil, nil)),
|
Override(AddrsFactoryKey, lp2p.AddrsFactory(nil, nil)),
|
||||||
Override(SmuxTransportKey, lp2p.SmuxTransport(true)),
|
Override(SmuxTransportKey, lp2p.SmuxTransport(true)),
|
||||||
Override(RelayKey, lp2p.Relay(true, false)),
|
Override(RelayKey, lp2p.Relay(true, false)),
|
||||||
Override(SecurityKey, lp2p.Security(true, false)),
|
Override(SecurityKey, lp2p.Security(true, true)),
|
||||||
|
|
||||||
Override(BaseRoutingKey, lp2p.BaseRouting),
|
Override(BaseRoutingKey, lp2p.BaseRouting),
|
||||||
Override(new(routing.Routing), lp2p.Routing),
|
Override(new(routing.Routing), lp2p.Routing),
|
||||||
|
@ -64,12 +64,12 @@ func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, addr address.Ad
|
|||||||
return nil, xerrors.Errorf("provided address doesn't exist in wallet")
|
return nil, xerrors.Errorf("provided address doesn't exist in wallet")
|
||||||
}
|
}
|
||||||
|
|
||||||
pid, err := a.StateMinerPeerID(ctx, miner, nil)
|
pid, err := a.StateMinerPeerID(ctx, miner, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed getting peer ID: %w", err)
|
return nil, xerrors.Errorf("failed getting peer ID: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
mw, err := a.StateMinerWorker(ctx, miner, nil)
|
mw, err := a.StateMinerWorker(ctx, miner, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("failed getting miner worker: %w", err)
|
return nil, xerrors.Errorf("failed getting miner worker: %w", err)
|
||||||
}
|
}
|
||||||
@ -269,7 +269,7 @@ func (a *API) ClientListImports(ctx context.Context) ([]api.Import, error) {
|
|||||||
|
|
||||||
func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path string) error {
|
func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path string) error {
|
||||||
if order.MinerPeerID == "" {
|
if order.MinerPeerID == "" {
|
||||||
pid, err := a.StateMinerPeerID(ctx, order.Miner, nil)
|
pid, err := a.StateMinerPeerID(ctx, order.Miner, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -3,6 +3,8 @@ package impl
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
logging "github.com/ipfs/go-log/v2"
|
||||||
|
|
||||||
"github.com/gbrlsnchs/jwt/v3"
|
"github.com/gbrlsnchs/jwt/v3"
|
||||||
"github.com/libp2p/go-libp2p-core/host"
|
"github.com/libp2p/go-libp2p-core/host"
|
||||||
"github.com/libp2p/go-libp2p-core/network"
|
"github.com/libp2p/go-libp2p-core/network"
|
||||||
@ -92,4 +94,12 @@ func (a *CommonAPI) Version(context.Context) (api.Version, error) {
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *CommonAPI) LogList(context.Context) ([]string, error) {
|
||||||
|
return logging.GetSubsystems(), nil
|
||||||
|
}
|
||||||
|
|
||||||
|
func (a *CommonAPI) LogSetLevel(ctx context.Context, subsystem, level string) error {
|
||||||
|
return logging.SetLogLevel(subsystem, level)
|
||||||
|
}
|
||||||
|
|
||||||
var _ api.Common = &CommonAPI{}
|
var _ api.Common = &CommonAPI{}
|
||||||
|
@ -157,7 +157,11 @@ func (a *ChainAPI) ChainGetParentReceipts(ctx context.Context, bcid cid.Cid) ([]
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ChainAPI) ChainGetTipSetByHeight(ctx context.Context, h uint64, ts *types.TipSet) (*types.TipSet, error) {
|
func (a *ChainAPI) ChainGetTipSetByHeight(ctx context.Context, h uint64, tsk types.TipSetKey) (*types.TipSet, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.Chain.GetTipsetByHeight(ctx, h, ts)
|
return a.Chain.GetTipsetByHeight(ctx, h, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -174,7 +178,11 @@ func (a *ChainAPI) ChainHasObj(ctx context.Context, obj cid.Cid) (bool, error) {
|
|||||||
return a.Chain.Blockstore().Has(obj)
|
return a.Chain.Blockstore().Has(obj)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ChainAPI) ChainSetHead(ctx context.Context, ts *types.TipSet) error {
|
func (a *ChainAPI) ChainSetHead(ctx context.Context, tsk types.TipSetKey) error {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.Chain.SetHead(ts)
|
return a.Chain.SetHead(ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -187,7 +195,11 @@ func (a *ChainAPI) ChainGetGenesis(ctx context.Context) (*types.TipSet, error) {
|
|||||||
return types.NewTipSet([]*types.BlockHeader{genb})
|
return types.NewTipSet([]*types.BlockHeader{genb})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ChainAPI) ChainTipSetWeight(ctx context.Context, ts *types.TipSet) (types.BigInt, error) {
|
func (a *ChainAPI) ChainTipSetWeight(ctx context.Context, tsk types.TipSetKey) (types.BigInt, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.Chain.Weight(ctx, ts)
|
return a.Chain.Weight(ctx, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -320,7 +332,11 @@ func (a *ChainAPI) ChainGetMessage(ctx context.Context, mc cid.Cid) (*types.Mess
|
|||||||
return cm.VMMessage(), nil
|
return cm.VMMessage(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *ChainAPI) ChainExport(ctx context.Context, ts *types.TipSet) (<-chan []byte, error) {
|
func (a *ChainAPI) ChainExport(ctx context.Context, tsk types.TipSetKey) (<-chan []byte, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
r, w := io.Pipe()
|
r, w := io.Pipe()
|
||||||
out := make(chan []byte)
|
out := make(chan []byte)
|
||||||
go func() {
|
go func() {
|
||||||
|
@ -24,7 +24,11 @@ type MpoolAPI struct {
|
|||||||
Mpool *messagepool.MessagePool
|
Mpool *messagepool.MessagePool
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *MpoolAPI) MpoolPending(ctx context.Context, ts *types.TipSet) ([]*types.SignedMessage, error) {
|
func (a *MpoolAPI) MpoolPending(ctx context.Context, tsk types.TipSetKey) ([]*types.SignedMessage, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
pending, mpts := a.Mpool.Pending()
|
pending, mpts := a.Mpool.Pending()
|
||||||
|
|
||||||
haveCids := map[cid.Cid]struct{}{}
|
haveCids := map[cid.Cid]struct{}{}
|
||||||
|
@ -41,15 +41,27 @@ type StateAPI struct {
|
|||||||
Chain *store.ChainStore
|
Chain *store.ChainStore
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerSectors(ctx context.Context, addr address.Address, ts *types.TipSet) ([]*api.ChainSectorInfo, error) {
|
func (a *StateAPI) StateMinerSectors(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerSectorSet(ctx, a.StateManager, ts, addr)
|
return stmgr.GetMinerSectorSet(ctx, a.StateManager, ts, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerProvingSet(ctx context.Context, addr address.Address, ts *types.TipSet) ([]*api.ChainSectorInfo, error) {
|
func (a *StateAPI) StateMinerProvingSet(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]*api.ChainSectorInfo, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerProvingSet(ctx, a.StateManager, ts, addr)
|
return stmgr.GetMinerProvingSet(ctx, a.StateManager, ts, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerPower(ctx context.Context, maddr address.Address, ts *types.TipSet) (api.MinerPower, error) {
|
func (a *StateAPI) StateMinerPower(ctx context.Context, maddr address.Address, tsk types.TipSetKey) (api.MinerPower, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return api.MinerPower{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
mpow, tpow, err := stmgr.GetPower(ctx, a.StateManager, ts, maddr)
|
mpow, tpow, err := stmgr.GetPower(ctx, a.StateManager, ts, maddr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return api.MinerPower{}, err
|
return api.MinerPower{}, err
|
||||||
@ -71,27 +83,52 @@ func (a *StateAPI) StateMinerPower(ctx context.Context, maddr address.Address, t
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerWorker(ctx context.Context, m address.Address, ts *types.TipSet) (address.Address, error) {
|
func (a *StateAPI) StateMinerWorker(ctx context.Context, m address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return address.Undef, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerWorker(ctx, a.StateManager, ts, m)
|
return stmgr.GetMinerWorker(ctx, a.StateManager, ts, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerPeerID(ctx context.Context, m address.Address, ts *types.TipSet) (peer.ID, error) {
|
func (a *StateAPI) StateMinerPeerID(ctx context.Context, m address.Address, tsk types.TipSetKey) (peer.ID, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return "", xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerPeerID(ctx, a.StateManager, ts, m)
|
return stmgr.GetMinerPeerID(ctx, a.StateManager, ts, m)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) {
|
func (a *StateAPI) StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return 0, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerElectionPeriodStart(ctx, a.StateManager, ts, actor)
|
return stmgr.GetMinerElectionPeriodStart(ctx, a.StateManager, ts, actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerSectorSize(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error) {
|
func (a *StateAPI) StateMinerSectorSize(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return 0, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerSectorSize(ctx, a.StateManager, ts, actor)
|
return stmgr.GetMinerSectorSize(ctx, a.StateManager, ts, actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerFaults(ctx context.Context, addr address.Address, ts *types.TipSet) ([]uint64, error) {
|
func (a *StateAPI) StateMinerFaults(ctx context.Context, addr address.Address, tsk types.TipSetKey) ([]uint64, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetMinerFaults(ctx, a.StateManager, ts, addr)
|
return stmgr.GetMinerFaults(ctx, a.StateManager, ts, addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StatePledgeCollateral(ctx context.Context, ts *types.TipSet) (types.BigInt, error) {
|
func (a *StateAPI) StatePledgeCollateral(ctx context.Context, tsk types.TipSetKey) (types.BigInt, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
|
|
||||||
param, err := actors.SerializeParams(&actors.PledgeCollateralParams{Size: types.NewInt(0)})
|
param, err := actors.SerializeParams(&actors.PledgeCollateralParams{Size: types.NewInt(0)})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return types.NewInt(0), err
|
return types.NewInt(0), err
|
||||||
@ -115,11 +152,19 @@ func (a *StateAPI) StatePledgeCollateral(ctx context.Context, ts *types.TipSet)
|
|||||||
return types.BigFromBytes(ret.Return), nil
|
return types.BigFromBytes(ret.Return), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, ts *types.TipSet) (*api.MethodCall, error) {
|
func (a *StateAPI) StateCall(ctx context.Context, msg *types.Message, tsk types.TipSetKey) (*api.MethodCall, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.StateManager.Call(ctx, msg, ts)
|
return a.StateManager.Call(ctx, msg, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateReplay(ctx context.Context, ts *types.TipSet, mc cid.Cid) (*api.ReplayResults, error) {
|
func (a *StateAPI) StateReplay(ctx context.Context, tsk types.TipSetKey, mc cid.Cid) (*api.ReplayResults, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
m, r, err := a.StateManager.Replay(ctx, ts, mc)
|
m, r, err := a.StateManager.Replay(ctx, ts, mc)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -152,7 +197,11 @@ func (a *StateAPI) stateForTs(ctx context.Context, ts *types.TipSet) (*state.Sta
|
|||||||
return state.LoadStateTree(cst, st)
|
return state.LoadStateTree(cst, st)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error) {
|
func (a *StateAPI) StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
state, err := a.stateForTs(ctx, ts)
|
state, err := a.stateForTs(ctx, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("computing tipset state failed: %w", err)
|
return nil, xerrors.Errorf("computing tipset state failed: %w", err)
|
||||||
@ -161,7 +210,11 @@ func (a *StateAPI) StateGetActor(ctx context.Context, actor address.Address, ts
|
|||||||
return state.GetActor(actor)
|
return state.GetActor(actor)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateLookupID(ctx context.Context, addr address.Address, ts *types.TipSet) (address.Address, error) {
|
func (a *StateAPI) StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return address.Undef, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
state, err := a.stateForTs(ctx, ts)
|
state, err := a.stateForTs(ctx, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return address.Undef, err
|
return address.Undef, err
|
||||||
@ -170,7 +223,11 @@ func (a *StateAPI) StateLookupID(ctx context.Context, addr address.Address, ts *
|
|||||||
return state.LookupID(addr)
|
return state.LookupID(addr)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateReadState(ctx context.Context, act *types.Actor, ts *types.TipSet) (*api.ActorState, error) {
|
func (a *StateAPI) StateReadState(ctx context.Context, act *types.Actor, tsk types.TipSetKey) (*api.ActorState, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
state, err := a.stateForTs(ctx, ts)
|
state, err := a.stateForTs(ctx, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -193,7 +250,11 @@ func (a *StateAPI) StateReadState(ctx context.Context, act *types.Actor, ts *typ
|
|||||||
}
|
}
|
||||||
|
|
||||||
// This is on StateAPI because miner.Miner requires this, and MinerAPI requires miner.Miner
|
// This is on StateAPI because miner.Miner requires this, and MinerAPI requires miner.Miner
|
||||||
func (a *StateAPI) MinerCreateBlock(ctx context.Context, addr address.Address, parents *types.TipSet, ticket *types.Ticket, proof *types.EPostProof, msgs []*types.SignedMessage, height, ts uint64) (*types.BlockMsg, error) {
|
func (a *StateAPI) MinerCreateBlock(ctx context.Context, addr address.Address, parentsTSK types.TipSetKey, ticket *types.Ticket, proof *types.EPostProof, msgs []*types.SignedMessage, height, ts uint64) (*types.BlockMsg, error) {
|
||||||
|
parents, err := a.Chain.GetTipSetFromKey(parentsTSK)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", parentsTSK, err)
|
||||||
|
}
|
||||||
fblk, err := gen.MinerCreateBlock(ctx, a.StateManager, a.Wallet, addr, parents, ticket, proof, msgs, height, ts)
|
fblk, err := gen.MinerCreateBlock(ctx, a.StateManager, a.Wallet, addr, parents, ticket, proof, msgs, height, ts)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -225,26 +286,46 @@ func (a *StateAPI) StateWaitMsg(ctx context.Context, msg cid.Cid) (*api.MsgWait,
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateGetReceipt(ctx context.Context, msg cid.Cid, ts *types.TipSet) (*types.MessageReceipt, error) {
|
func (a *StateAPI) StateGetReceipt(ctx context.Context, msg cid.Cid, tsk types.TipSetKey) (*types.MessageReceipt, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.StateManager.GetReceipt(ctx, msg, ts)
|
return a.StateManager.GetReceipt(ctx, msg, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateListMiners(ctx context.Context, ts *types.TipSet) ([]address.Address, error) {
|
func (a *StateAPI) StateListMiners(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.ListMinerActors(ctx, a.StateManager, ts)
|
return stmgr.ListMinerActors(ctx, a.StateManager, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateListActors(ctx context.Context, ts *types.TipSet) ([]address.Address, error) {
|
func (a *StateAPI) StateListActors(ctx context.Context, tsk types.TipSetKey) ([]address.Address, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.StateManager.ListAllActors(ctx, ts)
|
return a.StateManager.ListAllActors(ctx, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMarketBalance(ctx context.Context, addr address.Address, ts *types.TipSet) (actors.StorageParticipantBalance, error) {
|
func (a *StateAPI) StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (actors.StorageParticipantBalance, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return actors.StorageParticipantBalance{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return a.StateManager.MarketBalance(ctx, addr, ts)
|
return a.StateManager.MarketBalance(ctx, addr, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMarketParticipants(ctx context.Context, ts *types.TipSet) (map[string]actors.StorageParticipantBalance, error) {
|
func (a *StateAPI) StateMarketParticipants(ctx context.Context, tsk types.TipSetKey) (map[string]actors.StorageParticipantBalance, error) {
|
||||||
out := map[string]actors.StorageParticipantBalance{}
|
out := map[string]actors.StorageParticipantBalance{}
|
||||||
|
|
||||||
var state actors.StorageMarketState
|
var state actors.StorageMarketState
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
if _, err := a.StateManager.LoadActorState(ctx, actors.StorageMarketAddress, &state, ts); err != nil {
|
if _, err := a.StateManager.LoadActorState(ctx, actors.StorageMarketAddress, &state, ts); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -273,10 +354,14 @@ func (a *StateAPI) StateMarketParticipants(ctx context.Context, ts *types.TipSet
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMarketDeals(ctx context.Context, ts *types.TipSet) (map[string]actors.OnChainDeal, error) {
|
func (a *StateAPI) StateMarketDeals(ctx context.Context, tsk types.TipSetKey) (map[string]actors.OnChainDeal, error) {
|
||||||
out := map[string]actors.OnChainDeal{}
|
out := map[string]actors.OnChainDeal{}
|
||||||
|
|
||||||
var state actors.StorageMarketState
|
var state actors.StorageMarketState
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
if _, err := a.StateManager.LoadActorState(ctx, actors.StorageMarketAddress, &state, ts); err != nil {
|
if _, err := a.StateManager.LoadActorState(ctx, actors.StorageMarketAddress, &state, ts); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -300,7 +385,11 @@ func (a *StateAPI) StateMarketDeals(ctx context.Context, ts *types.TipSet) (map[
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMarketStorageDeal(ctx context.Context, dealId uint64, ts *types.TipSet) (*actors.OnChainDeal, error) {
|
func (a *StateAPI) StateMarketStorageDeal(ctx context.Context, dealId uint64, tsk types.TipSetKey) (*actors.OnChainDeal, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.GetStorageDeal(ctx, a.StateManager, dealId, ts)
|
return stmgr.GetStorageDeal(ctx, a.StateManager, dealId, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -355,11 +444,19 @@ func (a *StateAPI) StateChangedActors(ctx context.Context, old cid.Cid, new cid.
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateMinerSectorCount(ctx context.Context, addr address.Address, ts *types.TipSet) (api.MinerSectors, error) {
|
func (a *StateAPI) StateMinerSectorCount(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MinerSectors, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return api.MinerSectors{}, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.SectorSetSizes(ctx, a.StateManager, addr, ts)
|
return stmgr.SectorSetSizes(ctx, a.StateManager, addr, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateListMessages(ctx context.Context, match *types.Message, ts *types.TipSet, toheight uint64) ([]cid.Cid, error) {
|
func (a *StateAPI) StateListMessages(ctx context.Context, match *types.Message, tsk types.TipSetKey, toheight uint64) ([]cid.Cid, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
if ts == nil {
|
if ts == nil {
|
||||||
ts = a.Chain.GetHeaviestTipSet()
|
ts = a.Chain.GetHeaviestTipSet()
|
||||||
}
|
}
|
||||||
@ -408,13 +505,18 @@ func (a *StateAPI) StateListMessages(ctx context.Context, match *types.Message,
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) StateCompute(ctx context.Context, height uint64, msgs []*types.Message, ts *types.TipSet) (cid.Cid, error) {
|
func (a *StateAPI) StateCompute(ctx context.Context, height uint64, msgs []*types.Message, tsk types.TipSetKey) (cid.Cid, error) {
|
||||||
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
|
if err != nil {
|
||||||
|
return cid.Undef, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
|
}
|
||||||
return stmgr.ComputeState(ctx, a.StateManager, height, msgs, ts)
|
return stmgr.ComputeState(ctx, a.StateManager, height, msgs, ts)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *StateAPI) MsigGetAvailableBalance(ctx context.Context, addr address.Address, ts *types.TipSet) (types.BigInt, error) {
|
func (a *StateAPI) MsigGetAvailableBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (types.BigInt, error) {
|
||||||
if ts == nil {
|
ts, err := a.Chain.GetTipSetFromKey(tsk)
|
||||||
ts = a.Chain.GetHeaviestTipSet()
|
if err != nil {
|
||||||
|
return types.EmptyInt, xerrors.Errorf("loading tipset %s: %w", tsk, err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var st samsig.MultiSigActorState
|
var st samsig.MultiSigActorState
|
||||||
|
@ -88,3 +88,12 @@ func (a *SyncAPI) SyncMarkBad(ctx context.Context, bcid cid.Cid) error {
|
|||||||
a.Syncer.MarkBad(bcid)
|
a.Syncer.MarkBad(bcid)
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func (a *SyncAPI) SyncCheckBad(ctx context.Context, bcid cid.Cid) (string, error) {
|
||||||
|
reason, ok := a.Syncer.CheckBadBlockCache(bcid)
|
||||||
|
if !ok {
|
||||||
|
return "", nil
|
||||||
|
}
|
||||||
|
|
||||||
|
return reason, nil
|
||||||
|
}
|
||||||
|
@ -3,6 +3,7 @@ package impl
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"io"
|
"io"
|
||||||
"mime"
|
"mime"
|
||||||
"net/http"
|
"net/http"
|
||||||
@ -169,7 +170,7 @@ func (sm *StorageMinerAPI) ActorAddress(context.Context) (address.Address, error
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) ActorSectorSize(ctx context.Context, addr address.Address) (uint64, error) {
|
func (sm *StorageMinerAPI) ActorSectorSize(ctx context.Context, addr address.Address) (uint64, error) {
|
||||||
return sm.Full.StateMinerSectorSize(ctx, addr, nil)
|
return sm.Full.StateMinerSectorSize(ctx, addr, types.EmptyTSK)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) error {
|
func (sm *StorageMinerAPI) PledgeSector(ctx context.Context) error {
|
||||||
|
@ -3,10 +3,12 @@ package modules
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
"crypto/rand"
|
"crypto/rand"
|
||||||
"github.com/filecoin-project/lotus/api/apistruct"
|
"errors"
|
||||||
"io"
|
"io"
|
||||||
"io/ioutil"
|
"io/ioutil"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/lotus/api/apistruct"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/lib/addrutil"
|
"github.com/filecoin-project/lotus/lib/addrutil"
|
||||||
@ -38,7 +40,8 @@ type jwtPayload struct {
|
|||||||
|
|
||||||
func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, error) {
|
func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, error) {
|
||||||
key, err := keystore.Get(JWTSecretName)
|
key, err := keystore.Get(JWTSecretName)
|
||||||
if err != nil {
|
|
||||||
|
if errors.Is(err, types.ErrKeyInfoNotFound) {
|
||||||
log.Warn("Generating new API secret")
|
log.Warn("Generating new API secret")
|
||||||
|
|
||||||
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
sk, err := ioutil.ReadAll(io.LimitReader(rand.Reader, 32))
|
||||||
@ -68,6 +71,8 @@ func APISecret(keystore types.KeyStore, lr repo.LockedRepo) (*dtypes.APIAlg, err
|
|||||||
if err := lr.SetAPIToken(cliToken); err != nil {
|
if err := lr.SetAPIToken(cliToken); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
} else if err != nil {
|
||||||
|
return nil, xerrors.Errorf("could not get JWT Token: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
return (*dtypes.APIAlg)(jwt.NewHS256(key.PrivateKey)), nil
|
return (*dtypes.APIAlg)(jwt.NewHS256(key.PrivateKey)), nil
|
||||||
|
@ -47,7 +47,8 @@ func Host(mctx helpers.MetricsCtx, lc fx.Lifecycle, params P2PHostIn) (RawHost,
|
|||||||
libp2p.Peerstore(params.Peerstore),
|
libp2p.Peerstore(params.Peerstore),
|
||||||
libp2p.NoListenAddrs,
|
libp2p.NoListenAddrs,
|
||||||
libp2p.Ping(true),
|
libp2p.Ping(true),
|
||||||
libp2p.UserAgent("lotus-" + build.UserVersion)}
|
libp2p.UserAgent("lotus-" + build.UserVersion),
|
||||||
|
}
|
||||||
for _, o := range params.Opts {
|
for _, o := range params.Opts {
|
||||||
opts = append(opts, o...)
|
opts = append(opts, o...)
|
||||||
}
|
}
|
||||||
|
@ -15,7 +15,7 @@ func Security(enabled, preferTLS bool) interface{} {
|
|||||||
if !enabled {
|
if !enabled {
|
||||||
return func() (opts Libp2pOpts) {
|
return func() (opts Libp2pOpts) {
|
||||||
// TODO: shouldn't this be Errorf to guarantee visibility?
|
// TODO: shouldn't this be Errorf to guarantee visibility?
|
||||||
log.Warnf(`Your IPFS node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
|
log.Warnf(`Your lotus node has been configured to run WITHOUT ENCRYPTED CONNECTIONS.
|
||||||
You will not be able to connect to any nodes configured to use encrypted connections`)
|
You will not be able to connect to any nodes configured to use encrypted connections`)
|
||||||
opts.Opts = append(opts.Opts, libp2p.NoSecurity)
|
opts.Opts = append(opts.Opts, libp2p.NoSecurity)
|
||||||
return opts
|
return opts
|
||||||
|
@ -5,6 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/libp2p/go-libp2p-core/host"
|
"github.com/libp2p/go-libp2p-core/host"
|
||||||
inet "github.com/libp2p/go-libp2p-core/network"
|
inet "github.com/libp2p/go-libp2p-core/network"
|
||||||
|
peer "github.com/libp2p/go-libp2p-peer"
|
||||||
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
pubsub "github.com/libp2p/go-libp2p-pubsub"
|
||||||
"go.uber.org/fx"
|
"go.uber.org/fx"
|
||||||
|
|
||||||
@ -15,12 +16,16 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/blocksync"
|
"github.com/filecoin-project/lotus/chain/blocksync"
|
||||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||||
"github.com/filecoin-project/lotus/chain/sub"
|
"github.com/filecoin-project/lotus/chain/sub"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/node/hello"
|
"github.com/filecoin-project/lotus/node/hello"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/node/modules/helpers"
|
"github.com/filecoin-project/lotus/node/modules/helpers"
|
||||||
"github.com/filecoin-project/lotus/peermgr"
|
"github.com/filecoin-project/lotus/peermgr"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
const BlocksTopic = "/fil/blocks"
|
||||||
|
const MessagesTopic = "/fil/messages"
|
||||||
|
|
||||||
func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) {
|
func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) {
|
||||||
h.SetStreamHandler(hello.ProtocolID, svc.HandleStream)
|
h.SetStreamHandler(hello.ProtocolID, svc.HandleStream)
|
||||||
|
|
||||||
@ -45,25 +50,49 @@ func RunBlockSync(h host.Host, svc *blocksync.BlockSyncService) {
|
|||||||
h.SetStreamHandler(blocksync.BlockSyncProtocolID, svc.HandleStream)
|
h.SetStreamHandler(blocksync.BlockSyncProtocolID, svc.HandleStream)
|
||||||
}
|
}
|
||||||
|
|
||||||
func HandleIncomingBlocks(mctx helpers.MetricsCtx, lc fx.Lifecycle, pubsub *pubsub.PubSub, s *chain.Syncer, h host.Host) {
|
func HandleIncomingBlocks(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub.PubSub, s *chain.Syncer, h host.Host) {
|
||||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
blocksub, err := pubsub.Subscribe("/fil/blocks")
|
blocksub, err := ps.Subscribe(BlocksTopic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v := sub.NewBlockValidator(func(p peer.ID) {
|
||||||
|
ps.BlacklistPeer(p)
|
||||||
|
h.ConnManager().TagPeer(p, "badblock", -1000)
|
||||||
|
})
|
||||||
|
|
||||||
|
if err := ps.RegisterTopicValidator(BlocksTopic, v.Validate); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
go sub.HandleIncomingBlocks(ctx, blocksub, s, h.ConnManager())
|
go sub.HandleIncomingBlocks(ctx, blocksub, s, h.ConnManager())
|
||||||
}
|
}
|
||||||
|
|
||||||
func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, pubsub *pubsub.PubSub, mpool *messagepool.MessagePool) {
|
func HandleIncomingMessages(mctx helpers.MetricsCtx, lc fx.Lifecycle, ps *pubsub.PubSub, mpool *messagepool.MessagePool) {
|
||||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
msgsub, err := pubsub.Subscribe("/fil/messages")
|
msgsub, err := ps.Subscribe(MessagesTopic)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
panic(err)
|
panic(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
v := func(ctx context.Context, pid peer.ID, msg *pubsub.Message) bool {
|
||||||
|
m, err := types.DecodeSignedMessage(msg.GetData())
|
||||||
|
if err != nil {
|
||||||
|
log.Errorf("got incorrectly formatted Message: %s", err)
|
||||||
|
return false
|
||||||
|
}
|
||||||
|
|
||||||
|
msg.ValidatorData = m
|
||||||
|
return true
|
||||||
|
}
|
||||||
|
|
||||||
|
if err := ps.RegisterTopicValidator(MessagesTopic, v); err != nil {
|
||||||
|
panic(err)
|
||||||
|
}
|
||||||
|
|
||||||
go sub.HandleIncomingMessages(ctx, mpool, msgsub)
|
go sub.HandleIncomingMessages(ctx, mpool, msgsub)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -2,6 +2,7 @@ package modules
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"math"
|
"math"
|
||||||
"reflect"
|
"reflect"
|
||||||
|
|
||||||
@ -73,7 +74,7 @@ func SectorBuilderConfig(storage []fs.PathConfig, threads uint, noprecommit, noc
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize, err := api.StateMinerSectorSize(context.TODO(), minerAddr, nil)
|
ssize, err := api.StateMinerSectorSize(context.TODO(), minerAddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -112,7 +113,7 @@ func StorageMiner(mctx helpers.MetricsCtx, lc fx.Lifecycle, api api.FullNode, h
|
|||||||
|
|
||||||
ctx := helpers.LifecycleCtx(mctx, lc)
|
ctx := helpers.LifecycleCtx(mctx, lc)
|
||||||
|
|
||||||
worker, err := api.StateMinerWorker(ctx, maddr, nil)
|
worker, err := api.StateMinerWorker(ctx, maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
@ -346,7 +346,7 @@ func (fsr *fsLockedRepo) Get(name string) (types.KeyInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if fstat.Mode()&0077 != 0 {
|
if fstat.Mode()&0077 != 0 {
|
||||||
return types.KeyInfo{}, xerrors.Errorf(kstrPermissionMsg, name, err)
|
return types.KeyInfo{}, xerrors.Errorf(kstrPermissionMsg, name, fstat.Mode())
|
||||||
}
|
}
|
||||||
|
|
||||||
file, err := os.Open(keyPath)
|
file, err := os.Open(keyPath)
|
||||||
|
52
scripts/build-bundle.sh
Executable file
52
scripts/build-bundle.sh
Executable file
@ -0,0 +1,52 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -ex
|
||||||
|
|
||||||
|
ARCHS=(
|
||||||
|
"darwin"
|
||||||
|
"linux"
|
||||||
|
)
|
||||||
|
|
||||||
|
REQUIRED=(
|
||||||
|
"ipfs"
|
||||||
|
"sha512sum"
|
||||||
|
)
|
||||||
|
for REQUIRE in "${REQUIRED[@]}"
|
||||||
|
do
|
||||||
|
command -v "${REQUIRE}" >/dev/null 2>&1 || echo >&2 "'${REQUIRE}' must be installed"
|
||||||
|
done
|
||||||
|
|
||||||
|
mkdir bundle
|
||||||
|
pushd bundle
|
||||||
|
|
||||||
|
BINARIES=(
|
||||||
|
"lotus"
|
||||||
|
"lotus-storage-miner"
|
||||||
|
"lotus-seal-worker"
|
||||||
|
)
|
||||||
|
|
||||||
|
export IPFS_PATH=`mktemp -d`
|
||||||
|
ipfs init
|
||||||
|
ipfs daemon &
|
||||||
|
PID="$!"
|
||||||
|
trap "kill -9 ${PID}" EXIT
|
||||||
|
sleep 30
|
||||||
|
|
||||||
|
for ARCH in "${ARCHS[@]}"
|
||||||
|
do
|
||||||
|
mkdir -p "${ARCH}/lotus"
|
||||||
|
pushd "${ARCH}"
|
||||||
|
for BINARY in "${BINARIES[@]}"
|
||||||
|
do
|
||||||
|
cp "../../${ARCH}/${BINARY}" "lotus/"
|
||||||
|
chmod +x "lotus/${BINARY}"
|
||||||
|
done
|
||||||
|
|
||||||
|
tar -zcvf "../lotus_${CIRCLE_TAG}_${ARCH}-amd64.tar.gz" lotus
|
||||||
|
popd
|
||||||
|
rm -rf "${ARCH}"
|
||||||
|
|
||||||
|
sha512sum "lotus_${CIRCLE_TAG}_${ARCH}-amd64.tar.gz" | cut -d" " -f1 > "lotus_${CIRCLE_TAG}_${ARCH}-amd64.tar.gz.sha512"
|
||||||
|
|
||||||
|
ipfs add "lotus_${CIRCLE_TAG}_${ARCH}-amd64.tar.gz" | cut -d" " -f2 > "lotus_${CIRCLE_TAG}_${ARCH}-amd64.tar.gz.cid"
|
||||||
|
done
|
||||||
|
popd
|
@ -4,4 +4,4 @@ set -o xtrace
|
|||||||
|
|
||||||
export TRUST_PARAMS=1
|
export TRUST_PARAMS=1
|
||||||
|
|
||||||
go run -tags=debug ./cmd/lotus-storage-miner init --actor=t0101 --genesis-miner --pre-sealed-sectors=~/.genesis-sectors
|
go run -tags=debug ./cmd/lotus-storage-miner init --actor=t0101 --genesis-miner --pre-sealed-sectors=~/.genesis-sectors --pre-sealed-metadata=~/.genesis-sectors/pre-seal-t0101.json
|
||||||
|
@ -86,12 +86,12 @@ mdt0111=$(mktemp -d)
|
|||||||
mdt0222=$(mktemp -d)
|
mdt0222=$(mktemp -d)
|
||||||
mdt0333=$(mktemp -d)
|
mdt0333=$(mktemp -d)
|
||||||
|
|
||||||
env LOTUS_PATH="${ldt0111}" LOTUS_STORAGE_PATH="${mdt0111}" ./lotus-storage-miner init --genesis-miner --actor=t0111 --pre-sealed-sectors="${sdt0111}" --nosync=true --sector-size="${SECTOR_SIZE}" || true
|
env LOTUS_PATH="${ldt0111}" LOTUS_STORAGE_PATH="${mdt0111}" ./lotus-storage-miner init --genesis-miner --actor=t0111 --pre-sealed-sectors="${sdt0111}" --pre-sealed-metadata="${sdt0111}/pre-seal-t0111.json" --nosync=true --sector-size="${SECTOR_SIZE}" || true
|
||||||
env LOTUS_PATH="${ldt0111}" LOTUS_STORAGE_PATH="${mdt0111}" ./lotus-storage-miner run --nosync &
|
env LOTUS_PATH="${ldt0111}" LOTUS_STORAGE_PATH="${mdt0111}" ./lotus-storage-miner run --nosync &
|
||||||
mpid=$!
|
mpid=$!
|
||||||
|
|
||||||
env LOTUS_PATH="${ldt0222}" LOTUS_STORAGE_PATH="${mdt0222}" ./lotus-storage-miner init --actor=t0222 --pre-sealed-sectors="${sdt0222}" --nosync=true --sector-size="${SECTOR_SIZE}" || true
|
env LOTUS_PATH="${ldt0222}" LOTUS_STORAGE_PATH="${mdt0222}" ./lotus-storage-miner init --actor=t0222 --pre-sealed-sectors="${sdt0222}" --pre-sealed-metadata="${sdt0222}/pre-seal-t0222.json" --nosync=true --sector-size="${SECTOR_SIZE}" || true
|
||||||
env LOTUS_PATH="${ldt0333}" LOTUS_STORAGE_PATH="${mdt0333}" ./lotus-storage-miner init --actor=t0333 --pre-sealed-sectors="${sdt0333}" --nosync=true --sector-size="${SECTOR_SIZE}" || true
|
env LOTUS_PATH="${ldt0333}" LOTUS_STORAGE_PATH="${mdt0333}" ./lotus-storage-miner init --actor=t0333 --pre-sealed-sectors="${sdt0333}" --pre-sealed-metadata="${sdt0333}/pre-seal-t0333.json" --nosync=true --sector-size="${SECTOR_SIZE}" || true
|
||||||
|
|
||||||
kill $mpid
|
kill $mpid
|
||||||
wait $mpid
|
wait $mpid
|
||||||
|
94
scripts/publish-release.sh
Executable file
94
scripts/publish-release.sh
Executable file
@ -0,0 +1,94 @@
|
|||||||
|
#!/usr/bin/env bash
|
||||||
|
set -e
|
||||||
|
|
||||||
|
pushd bundle
|
||||||
|
|
||||||
|
# make sure we have a token set, api requests won't work otherwise
|
||||||
|
if [ -z "${GITHUB_TOKEN}" ]; then
|
||||||
|
echo "\${GITHUB_TOKEN} not set, publish failed"
|
||||||
|
exit 1
|
||||||
|
fi
|
||||||
|
|
||||||
|
REQUIRED=(
|
||||||
|
"jq"
|
||||||
|
"curl"
|
||||||
|
)
|
||||||
|
for REQUIRE in "${REQUIRED[@]}"
|
||||||
|
do
|
||||||
|
command -v "${REQUIRE}" >/dev/null 2>&1 || echo >&2 "'${REQUIRE}' must be installed"
|
||||||
|
done
|
||||||
|
|
||||||
|
#see if the release already exists by tag
|
||||||
|
RELEASE_RESPONSE=`
|
||||||
|
curl \
|
||||||
|
--header "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
"https://api.github.com/repos/${CIRCLE_PROJECT_USERNAME}/${CIRCLE_PROJECT_REPONAME}/releases/tags/${CIRCLE_TAG}"
|
||||||
|
`
|
||||||
|
RELEASE_ID=`echo "${RELEASE_RESPONSE}" | jq '.id'`
|
||||||
|
|
||||||
|
if [ "${RELEASE_ID}" = "null" ]; then
|
||||||
|
echo "creating release"
|
||||||
|
|
||||||
|
RELEASE_DATA="{
|
||||||
|
\"tag_name\": \"${CIRCLE_TAG}\",
|
||||||
|
\"target_commitish\": \"${CIRCLE_SHA1}\",
|
||||||
|
\"name\": \"${CIRCLE_TAG}\",
|
||||||
|
\"body\": \"\",
|
||||||
|
\"prerelease\": false
|
||||||
|
}"
|
||||||
|
|
||||||
|
# create it if it doesn't exist yet
|
||||||
|
RELEASE_RESPONSE=`
|
||||||
|
curl \
|
||||||
|
--request POST \
|
||||||
|
--header "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
--header "Content-Type: application/json" \
|
||||||
|
--data "${RELEASE_DATA}" \
|
||||||
|
"https://api.github.com/repos/$CIRCLE_PROJECT_USERNAME/${CIRCLE_PROJECT_REPONAME}/releases"
|
||||||
|
`
|
||||||
|
else
|
||||||
|
echo "release already exists"
|
||||||
|
fi
|
||||||
|
|
||||||
|
RELEASE_UPLOAD_URL=`echo "${RELEASE_RESPONSE}" | jq -r '.upload_url' | cut -d'{' -f1`
|
||||||
|
|
||||||
|
bundles=(
|
||||||
|
"lotus_${CIRCLE_TAG}_linux-amd64.tar.gz"
|
||||||
|
"lotus_${CIRCLE_TAG}_linux-amd64.tar.gz.cid"
|
||||||
|
"lotus_${CIRCLE_TAG}_linux-amd64.tar.gz.sha512"
|
||||||
|
"lotus_${CIRCLE_TAG}_darwin-amd64.tar.gz"
|
||||||
|
"lotus_${CIRCLE_TAG}_darwin-amd64.tar.gz.cid"
|
||||||
|
"lotus_${CIRCLE_TAG}_darwin-amd64.tar.gz.sha512"
|
||||||
|
)
|
||||||
|
for RELEASE_FILE in "${bundles[@]}"
|
||||||
|
do
|
||||||
|
echo "Uploading release bundle: ${RELEASE_FILE}"
|
||||||
|
curl \
|
||||||
|
--request POST \
|
||||||
|
--header "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
--header "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${RELEASE_FILE}" \
|
||||||
|
"$RELEASE_UPLOAD_URL?name=$(basename "${RELEASE_FILE}")"
|
||||||
|
|
||||||
|
echo "Release bundle uploaded: ${RELEASE_FILE}"
|
||||||
|
done
|
||||||
|
|
||||||
|
popd
|
||||||
|
|
||||||
|
miscellaneous=(
|
||||||
|
"README.md"
|
||||||
|
"LICENSE-MIT"
|
||||||
|
"LICENSE-APACHE"
|
||||||
|
)
|
||||||
|
for MISC in "${miscellaneous[@]}"
|
||||||
|
do
|
||||||
|
echo "Uploading release bundle: ${MISC}"
|
||||||
|
curl \
|
||||||
|
--request POST \
|
||||||
|
--header "Authorization: token ${GITHUB_TOKEN}" \
|
||||||
|
--header "Content-Type: application/octet-stream" \
|
||||||
|
--data-binary "@${MISC}" \
|
||||||
|
"$RELEASE_UPLOAD_URL?name=$(basename "${MISC}")"
|
||||||
|
|
||||||
|
echo "Release bundle uploaded: ${MISC}"
|
||||||
|
done
|
@ -92,7 +92,7 @@ func (s *FPoStScheduler) checkFaults(ctx context.Context, ssi sectorbuilder.Sort
|
|||||||
declaredFaults := map[uint64]struct{}{}
|
declaredFaults := map[uint64]struct{}{}
|
||||||
|
|
||||||
{
|
{
|
||||||
chainFaults, err := s.api.StateMinerFaults(ctx, s.actor, nil)
|
chainFaults, err := s.api.StateMinerFaults(ctx, s.actor, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("checking on-chain faults: %w", err)
|
return nil, xerrors.Errorf("checking on-chain faults: %w", err)
|
||||||
}
|
}
|
||||||
@ -195,7 +195,7 @@ func (s *FPoStScheduler) runPost(ctx context.Context, eps uint64, ts *types.TipS
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet) (sectorbuilder.SortedPublicSectorInfo, error) {
|
func (s *FPoStScheduler) sortedSectorInfo(ctx context.Context, ts *types.TipSet) (sectorbuilder.SortedPublicSectorInfo, error) {
|
||||||
sset, err := s.api.StateMinerProvingSet(ctx, s.actor, ts)
|
sset, err := s.api.StateMinerProvingSet(ctx, s.actor, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return sectorbuilder.SortedPublicSectorInfo{}, xerrors.Errorf("failed to get proving set for miner (tsH: %d): %w", ts.Height(), err)
|
return sectorbuilder.SortedPublicSectorInfo{}, xerrors.Errorf("failed to get proving set for miner (tsH: %d): %w", ts.Height(), err)
|
||||||
}
|
}
|
||||||
|
@ -162,7 +162,7 @@ func (s *FPoStScheduler) abortActivePoSt() {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *FPoStScheduler) shouldFallbackPost(ctx context.Context, ts *types.TipSet) (uint64, bool, error) {
|
func (s *FPoStScheduler) shouldFallbackPost(ctx context.Context, ts *types.TipSet) (uint64, bool, error) {
|
||||||
eps, err := s.api.StateMinerElectionPeriodStart(ctx, s.actor, ts)
|
eps, err := s.api.StateMinerElectionPeriodStart(ctx, s.actor, ts.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, false, xerrors.Errorf("getting ElectionPeriodStart: %w", err)
|
return 0, false, xerrors.Errorf("getting ElectionPeriodStart: %w", err)
|
||||||
}
|
}
|
||||||
|
@ -40,24 +40,24 @@ type Miner struct {
|
|||||||
|
|
||||||
type storageMinerApi interface {
|
type storageMinerApi interface {
|
||||||
// Call a read only method on actors (no interaction with the chain required)
|
// Call a read only method on actors (no interaction with the chain required)
|
||||||
StateCall(context.Context, *types.Message, *types.TipSet) (*api.MethodCall, error)
|
StateCall(context.Context, *types.Message, types.TipSetKey) (*api.MethodCall, error)
|
||||||
StateMinerWorker(context.Context, address.Address, *types.TipSet) (address.Address, error)
|
StateMinerWorker(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error)
|
StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error)
|
||||||
StateMinerSectors(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
StateMinerSectors(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error)
|
||||||
StateMinerProvingSet(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
StateMinerProvingSet(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error)
|
||||||
StateMinerSectorSize(context.Context, address.Address, *types.TipSet) (uint64, error)
|
StateMinerSectorSize(context.Context, address.Address, types.TipSetKey) (uint64, error)
|
||||||
StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually
|
StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually
|
||||||
StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error)
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
|
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
||||||
StateMarketStorageDeal(context.Context, uint64, *types.TipSet) (*actors.OnChainDeal, error)
|
StateMarketStorageDeal(context.Context, uint64, types.TipSetKey) (*actors.OnChainDeal, error)
|
||||||
StateMinerFaults(context.Context, address.Address, *types.TipSet) ([]uint64, error)
|
StateMinerFaults(context.Context, address.Address, types.TipSetKey) ([]uint64, error)
|
||||||
|
|
||||||
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error)
|
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error)
|
||||||
|
|
||||||
ChainHead(context.Context) (*types.TipSet, error)
|
ChainHead(context.Context) (*types.TipSet, error)
|
||||||
ChainNotify(context.Context) (<-chan []*store.HeadChange, error)
|
ChainNotify(context.Context) (<-chan []*store.HeadChange, error)
|
||||||
ChainGetRandomness(context.Context, types.TipSetKey, int64) ([]byte, error)
|
ChainGetRandomness(context.Context, types.TipSetKey, int64) ([]byte, error)
|
||||||
ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
|
ChainGetTipSetByHeight(context.Context, uint64, types.TipSetKey) (*types.TipSet, error)
|
||||||
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
||||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||||
|
|
||||||
|
@ -34,7 +34,7 @@ func checkPieces(ctx context.Context, si SectorInfo, api sealingApi) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
for i, piece := range si.Pieces {
|
for i, piece := range si.Pieces {
|
||||||
deal, err := api.StateMarketStorageDeal(ctx, piece.DealID, nil)
|
deal, err := api.StateMarketStorageDeal(ctx, piece.DealID, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ErrApi{xerrors.Errorf("getting deal %d for piece %d: %w", piece.DealID, i, err)}
|
return &ErrApi{xerrors.Errorf("getting deal %d for piece %d: %w", piece.DealID, i, err)}
|
||||||
}
|
}
|
||||||
@ -63,7 +63,7 @@ func checkSeal(ctx context.Context, maddr address.Address, si SectorInfo, api se
|
|||||||
return &ErrApi{xerrors.Errorf("getting chain head: %w", err)}
|
return &ErrApi{xerrors.Errorf("getting chain head: %w", err)}
|
||||||
}
|
}
|
||||||
|
|
||||||
ssize, err := api.StateMinerSectorSize(ctx, maddr, head)
|
ssize, err := api.StateMinerSectorSize(ctx, maddr, head.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ErrApi{err}
|
return &ErrApi{err}
|
||||||
}
|
}
|
||||||
@ -85,7 +85,7 @@ func checkSeal(ctx context.Context, maddr address.Address, si SectorInfo, api se
|
|||||||
Method: actors.SMAMethods.ComputeDataCommitment,
|
Method: actors.SMAMethods.ComputeDataCommitment,
|
||||||
Params: ccparams,
|
Params: ccparams,
|
||||||
}
|
}
|
||||||
r, err := api.StateCall(ctx, ccmt, nil)
|
r, err := api.StateCall(ctx, ccmt, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return &ErrApi{xerrors.Errorf("calling ComputeDataCommitment: %w", err)}
|
return &ErrApi{xerrors.Errorf("calling ComputeDataCommitment: %w", err)}
|
||||||
}
|
}
|
||||||
|
@ -29,23 +29,23 @@ type TicketFn func(context.Context) (*sectorbuilder.SealTicket, error)
|
|||||||
|
|
||||||
type sealingApi interface { // TODO: trim down
|
type sealingApi interface { // TODO: trim down
|
||||||
// Call a read only method on actors (no interaction with the chain required)
|
// Call a read only method on actors (no interaction with the chain required)
|
||||||
StateCall(context.Context, *types.Message, *types.TipSet) (*api.MethodCall, error)
|
StateCall(context.Context, *types.Message, types.TipSetKey) (*api.MethodCall, error)
|
||||||
StateMinerWorker(context.Context, address.Address, *types.TipSet) (address.Address, error)
|
StateMinerWorker(context.Context, address.Address, types.TipSetKey) (address.Address, error)
|
||||||
StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, ts *types.TipSet) (uint64, error)
|
StateMinerElectionPeriodStart(ctx context.Context, actor address.Address, tsk types.TipSetKey) (uint64, error)
|
||||||
StateMinerSectors(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
StateMinerSectors(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error)
|
||||||
StateMinerProvingSet(context.Context, address.Address, *types.TipSet) ([]*api.ChainSectorInfo, error)
|
StateMinerProvingSet(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error)
|
||||||
StateMinerSectorSize(context.Context, address.Address, *types.TipSet) (uint64, error)
|
StateMinerSectorSize(context.Context, address.Address, types.TipSetKey) (uint64, error)
|
||||||
StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually
|
StateWaitMsg(context.Context, cid.Cid) (*api.MsgWait, error) // TODO: removeme eventually
|
||||||
StateGetActor(ctx context.Context, actor address.Address, ts *types.TipSet) (*types.Actor, error)
|
StateGetActor(ctx context.Context, actor address.Address, tsk types.TipSetKey) (*types.Actor, error)
|
||||||
StateGetReceipt(context.Context, cid.Cid, *types.TipSet) (*types.MessageReceipt, error)
|
StateGetReceipt(context.Context, cid.Cid, types.TipSetKey) (*types.MessageReceipt, error)
|
||||||
StateMarketStorageDeal(context.Context, uint64, *types.TipSet) (*actors.OnChainDeal, error)
|
StateMarketStorageDeal(context.Context, uint64, types.TipSetKey) (*actors.OnChainDeal, error)
|
||||||
|
|
||||||
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error)
|
MpoolPushMessage(context.Context, *types.Message) (*types.SignedMessage, error)
|
||||||
|
|
||||||
ChainHead(context.Context) (*types.TipSet, error)
|
ChainHead(context.Context) (*types.TipSet, error)
|
||||||
ChainNotify(context.Context) (<-chan []*store.HeadChange, error)
|
ChainNotify(context.Context) (<-chan []*store.HeadChange, error)
|
||||||
ChainGetRandomness(context.Context, types.TipSetKey, int64) ([]byte, error)
|
ChainGetRandomness(context.Context, types.TipSetKey, int64) ([]byte, error)
|
||||||
ChainGetTipSetByHeight(context.Context, uint64, *types.TipSet) (*types.TipSet, error)
|
ChainGetTipSetByHeight(context.Context, uint64, types.TipSetKey) (*types.TipSet, error)
|
||||||
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
ChainGetBlockMessages(context.Context, cid.Cid) (*api.BlockMessages, error)
|
||||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||||
|
|
||||||
|
@ -3,6 +3,7 @@ package sealing
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"fmt"
|
"fmt"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
@ -29,7 +30,7 @@ func failedCooldown(ctx statemachine.Context, sector SectorInfo) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (m *Sealing) checkPreCommitted(ctx statemachine.Context, sector SectorInfo) (*actors.PreCommittedSector, bool) {
|
func (m *Sealing) checkPreCommitted(ctx statemachine.Context, sector SectorInfo) (*actors.PreCommittedSector, bool) {
|
||||||
act, err := m.api.StateGetActor(ctx.Context(), m.maddr, nil)
|
act, err := m.api.StateGetActor(ctx.Context(), m.maddr, types.EmptyTSK)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
log.Errorf("handleSealFailed(%d): temp error: %+v", sector.SectorID, err)
|
log.Errorf("handleSealFailed(%d): temp error: %+v", sector.SectorID, err)
|
||||||
return nil, true
|
return nil, true
|
||||||
|
@ -137,7 +137,7 @@ func RecordTipsetPoints(ctx context.Context, api api.FullNode, pl *PointList, ti
|
|||||||
}
|
}
|
||||||
|
|
||||||
func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointList, tipset *types.TipSet) error {
|
||||||
pc, err := api.StatePledgeCollateral(ctx, tipset)
|
pc, err := api.StatePledgeCollateral(ctx, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -159,7 +159,7 @@ func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointLis
|
|||||||
p = NewPoint("network.balance", netBalFilFloat)
|
p = NewPoint("network.balance", netBalFilFloat)
|
||||||
pl.AddPoint(p)
|
pl.AddPoint(p)
|
||||||
|
|
||||||
power, err := api.StateMinerPower(ctx, address.Address{}, tipset)
|
power, err := api.StateMinerPower(ctx, address.Address{}, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -167,9 +167,9 @@ func RecordTipsetStatePoints(ctx context.Context, api api.FullNode, pl *PointLis
|
|||||||
p = NewPoint("chain.power", power.TotalPower.Int64())
|
p = NewPoint("chain.power", power.TotalPower.Int64())
|
||||||
pl.AddPoint(p)
|
pl.AddPoint(p)
|
||||||
|
|
||||||
miners, err := api.StateListMiners(ctx, tipset)
|
miners, err := api.StateListMiners(ctx, tipset.Key())
|
||||||
for _, miner := range miners {
|
for _, miner := range miners {
|
||||||
power, err := api.StateMinerPower(ctx, miner, tipset)
|
power, err := api.StateMinerPower(ctx, miner, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -218,7 +218,7 @@ func RecordTipsetMessagesPoints(ctx context.Context, api api.FullNode, pl *Point
|
|||||||
p = NewPoint("chain.message_size", len(bs))
|
p = NewPoint("chain.message_size", len(bs))
|
||||||
pl.AddPoint(p)
|
pl.AddPoint(p)
|
||||||
|
|
||||||
actor, err := api.StateGetActor(ctx, msg.Message.To, tipset)
|
actor, err := api.StateGetActor(ctx, msg.Message.To, tipset.Key())
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user