Merge remote-tracking branch 'origin/master' into feat/v1-api

This commit is contained in:
Łukasz Magiera 2021-04-13 14:24:22 +02:00
commit e76935147f
67 changed files with 835 additions and 229 deletions

View File

@ -278,11 +278,41 @@ jobs:
- install-deps - install-deps
- prepare - prepare
- run: make calibnet - run: make calibnet
- run: mkdir linux-calibnet && mv lotus lotus-miner lotus-worker linux-calibnet - run: mkdir linux-calibrationnet && mv lotus lotus-miner lotus-worker linux-calibrationnet
- persist_to_workspace: - persist_to_workspace:
root: "." root: "."
paths: paths:
- linux-calibnet - linux-calibrationnet
build-ntwk-butterfly:
description: |
Compile lotus binaries for the butterfly network
parameters:
<<: *test-params
executor: << parameters.executor >>
steps:
- install-deps
- prepare
- run: make butterflynet
- run: mkdir linux-butterflynet && mv lotus lotus-miner lotus-worker linux-butterflynet
- persist_to_workspace:
root: "."
paths:
- linux-butterflynet
build-ntwk-nerpa:
description: |
Compile lotus binaries for the nerpa network
parameters:
<<: *test-params
executor: << parameters.executor >>
steps:
- install-deps
- prepare
- run: make nerpanet
- run: mkdir linux-nerpanet && mv lotus lotus-miner lotus-worker linux-nerpanet
- persist_to_workspace:
root: "."
paths:
- linux-nerpanet
build-lotus-soup: build-lotus-soup:
description: | description: |
Compile `lotus-soup` Testground test plan Compile `lotus-soup` Testground test plan
@ -608,7 +638,7 @@ jobs:
docker push $<<parameters.account-url>>/<<parameters.repo>>:${tag} docker push $<<parameters.account-url>>/<<parameters.repo>>:${tag}
done done
publish-packer: publish-packer-mainnet:
description: build and push AWS IAM and DigitalOcean droplet. description: build and push AWS IAM and DigitalOcean droplet.
executor: executor:
name: packer/default name: packer/default
@ -620,9 +650,42 @@ jobs:
- packer/build: - packer/build:
template: tools/packer/lotus.pkr.hcl template: tools/packer/lotus.pkr.hcl
args: "-var ci_workspace_bins=./linux -var lotus_network=mainnet -var git_tag=$CIRCLE_TAG" args: "-var ci_workspace_bins=./linux -var lotus_network=mainnet -var git_tag=$CIRCLE_TAG"
publish-packer-calibrationnet:
description: build and push AWS IAM and DigitalOcean droplet.
executor:
name: packer/default
packer-version: 1.6.6
steps:
- checkout
- attach_workspace:
at: "."
- packer/build: - packer/build:
template: tools/packer/lotus.pkr.hcl template: tools/packer/lotus.pkr.hcl
args: "-var ci_workspace_bins=./linux-calibnet -var lotus_network=calibrationnet -var git_tag=$CIRCLE_TAG" args: "-var ci_workspace_bins=./linux-calibrationnet -var lotus_network=calibrationnet -var git_tag=$CIRCLE_TAG"
publish-packer-butterflynet:
description: build and push AWS IAM and DigitalOcean droplet.
executor:
name: packer/default
packer-version: 1.6.6
steps:
- checkout
- attach_workspace:
at: "."
- packer/build:
template: tools/packer/lotus.pkr.hcl
args: "-var ci_workspace_bins=./linux-butterflynet -var lotus_network=butterflynet -var git_tag=$CIRCLE_TAG"
publish-packer-nerpanet:
description: build and push AWS IAM and DigitalOcean droplet.
executor:
name: packer/default
packer-version: 1.6.6
steps:
- checkout
- attach_workspace:
at: "."
- packer/build:
template: tools/packer/lotus.pkr.hcl
args: "-var ci_workspace_bins=./linux-nerpanet -var lotus_network=nerpanet -var git_tag=$CIRCLE_TAG"
workflows: workflows:
version: 2.1 version: 2.1
@ -683,8 +746,6 @@ workflows:
test-suite-name: conformance-bleeding-edge test-suite-name: conformance-bleeding-edge
packages: "./conformance" packages: "./conformance"
vectors-branch: master vectors-branch: master
- build-ntwk-calibration
- build-lotus-soup
- trigger-testplans: - trigger-testplans:
filters: filters:
branches: branches:
@ -698,6 +759,28 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+$/ - /^v\d+\.\d+\.\d+$/
- build-ntwk-calibration:
requires:
- test-short
filters:
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-ntwk-butterfly:
requires:
- test-short
filters:
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-ntwk-nerpa:
requires:
- test-short
filters:
tags:
only:
- /^v\d+\.\d+\.\d+$/
- build-lotus-soup
- build-macos: - build-macos:
requires: requires:
- test-short - test-short
@ -724,9 +807,18 @@ workflows:
path: . path: .
repo: lotus-dev repo: lotus-dev
tag: '${CIRCLE_SHA1:0:8}' tag: '${CIRCLE_SHA1:0:8}'
- publish-packer: - publish-packer-mainnet:
requires: requires:
- build-all - build-all
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-packer-calibrationnet:
requires:
- build-ntwk-calibration - build-ntwk-calibration
filters: filters:
branches: branches:
@ -735,4 +827,23 @@ workflows:
tags: tags:
only: only:
- /^v\d+\.\d+\.\d+$/ - /^v\d+\.\d+\.\d+$/
- publish-packer-butterflynet:
requires:
- build-ntwk-butterfly
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/
- publish-packer-nerpanet:
requires:
- build-ntwk-nerpa
filters:
branches:
ignore:
- /.*/
tags:
only:
- /^v\d+\.\d+\.\d+$/

65
.github/workflows/codeql-analysis.yml vendored Normal file
View File

@ -0,0 +1,65 @@
# For most projects, this workflow file will not need changing; you simply need
# to commit it to your repository.
#
# You may wish to alter this file to override the set of languages analyzed,
# or to provide custom queries or build logic.
#
# ******** NOTE ********
# We have attempted to detect the languages in your repository. Please check
# the `language` matrix defined below to confirm you have the correct set of
# supported CodeQL languages.
#
name: "CodeQL"
on:
push:
branches: [ master ]
pull_request:
# The branches below must be a subset of the branches above
branches: [ master ]
jobs:
analyze:
name: Analyze
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
language: [ 'go' ]
# CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python' ]
# Learn more:
# https://docs.github.com/en/free-pro-team@latest/github/finding-security-vulnerabilities-and-errors-in-your-code/configuring-code-scanning#changing-the-languages-that-are-analyzed
steps:
- name: Checkout repository
uses: actions/checkout@v2
# Initializes the CodeQL tools for scanning.
- name: Initialize CodeQL
uses: github/codeql-action/init@v1
with:
languages: ${{ matrix.language }}
# If you wish to specify custom queries, you can do so here or in a config file.
# By default, queries listed here will override any specified in a config file.
# Prefix the list here with "+" to use these queries and those in the config file.
# queries: ./path/to/local/query, your-org/your-repo/queries@main
# Autobuild attempts to build any compiled languages (C/C++, C#, or Java).
# If this step fails, then you should remove it and run the build manually (see below)
- name: Autobuild
uses: github/codeql-action/autobuild@v1
# Command-line programs to run using the OS shell.
# 📚 https://git.io/JvXDl
# ✏️ If the Autobuild fails above, remove it and uncomment the following three lines
# and modify them (or add more) to build your code if your project
# uses a compiled language
#- run: |
# make bootstrap
# make release
- name: Perform CodeQL Analysis
uses: github/codeql-action/analyze@v1

View File

@ -1,5 +1,24 @@
# Lotus changelog # Lotus changelog
# 1.6.0 / 2021-04-05
This is a mandatory release of Lotus that upgrades the network to version 11, which implements [FIP-0014](https://github.com/filecoin-project/FIPs/blob/master/FIPS/fip-0014.md). The network will upgrade at height 665280, which is 2021-04-12T22:00:00Z.
## v1 sector extension CLI
This release also expands the `lotus-miner sectors extend` CLI, with a new option that automatically extends all extensible v1 sectors. The option can be run using `lotus-miner sectors extend --v1-sectors`.
- The `tolerance` flag can be passed to indicate what durations aren't "worth" extending. It defaults to one week, which means that sectors whose current lifetime's are within one week of the maximum possible lifetime will not be extended.
- The `expiration-cutoff` flag can be passed to skip sectors whose expiration is past a certain point from the current head. It defaults to infinity (no cutoff), but if, say, 28800 was specified, then only sectors expiring in the next 10 days would be extended (2880 epochs in 1 day).
## Changes
- Util for miners to extend all v1 sectors (https://github.com/filecoin-project/lotus/pull/5924)
- Upgrade the butterfly network (https://github.com/filecoin-project/lotus/pull/5929)
- Introduce the v11 network upgrade (https://github.com/filecoin-project/lotus/pull/5904)
- Debug mode: Make upgrade heights controllable by an envvar (https://github.com/filecoin-project/lotus/pull/5919)
# 1.5.3 / 2021-03-24 # 1.5.3 / 2021-03-24
This is a patch release of Lotus that introduces small fixes to the Storage FSM. This is a patch release of Lotus that introduces small fixes to the Storage FSM.

View File

@ -1,25 +0,0 @@
package blockstore
import (
"context"
blockstore "github.com/ipfs/go-ipfs-blockstore"
)
type CacheOpts = blockstore.CacheOpts
func DefaultCacheOpts() CacheOpts {
return CacheOpts{
HasBloomFilterSize: 0,
HasBloomFilterHashes: 0,
HasARCCacheSize: 512 << 10,
}
}
func CachedBlockstore(ctx context.Context, bs Blockstore, opts CacheOpts) (Blockstore, error) {
cached, err := blockstore.CachedBlockstore(ctx, bs, opts)
if err != nil {
return nil, err
}
return WrapIDStore(cached), nil
}

View File

@ -1,2 +1,2 @@
/dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWQafkXgEWDgcVhZvF6KMhiC8ktdxjvmdQN8RarRXe9jCc /dns4/bootstrap-0.butterfly.fildev.network/tcp/1347/p2p/12D3KooWRkaF18SR3E6qL6dkGrozT8QJUV5VbhE9E7BZtPmHqdWJ
/dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWE7UmZ4DLk9WBdEJUSwuSCPiSqjoCv3wPeoe8Tq3yMa77 /dns4/bootstrap-1.butterfly.fildev.network/tcp/1347/p2p/12D3KooWJcJUc23WJjJHGSboGcU3t76z9Lb7CghrH2tiBiDCY4ux

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

View File

@ -3,6 +3,11 @@
package build package build
import ( import (
"os"
"strconv"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
) )
@ -10,24 +15,27 @@ import (
const BootstrappersFile = "" const BootstrappersFile = ""
const GenesisFile = "" const GenesisFile = ""
const UpgradeBreezeHeight = -1 var UpgradeBreezeHeight = abi.ChainEpoch(-1)
const BreezeGasTampingDuration = 0 const BreezeGasTampingDuration = 0
const UpgradeSmokeHeight = -1 var UpgradeSmokeHeight = abi.ChainEpoch(-1)
const UpgradeIgnitionHeight = -2 var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
const UpgradeRefuelHeight = -3 var UpgradeRefuelHeight = abi.ChainEpoch(-3)
const UpgradeTapeHeight = -4 var UpgradeTapeHeight = abi.ChainEpoch(-4)
const UpgradeActorsV2Height = 10 var UpgradeActorsV2Height = abi.ChainEpoch(10)
const UpgradeLiftoffHeight = -5 var UpgradeLiftoffHeight = abi.ChainEpoch(-5)
const UpgradeKumquatHeight = 15 var UpgradeKumquatHeight = abi.ChainEpoch(15)
const UpgradeCalicoHeight = 20 var UpgradeCalicoHeight = abi.ChainEpoch(20)
const UpgradePersianHeight = 25 var UpgradePersianHeight = abi.ChainEpoch(25)
const UpgradeOrangeHeight = 27 var UpgradeOrangeHeight = abi.ChainEpoch(27)
const UpgradeClausHeight = 30 var UpgradeClausHeight = abi.ChainEpoch(30)
const UpgradeActorsV3Height = 35 var UpgradeActorsV3Height = abi.ChainEpoch(35)
var UpgradeNorwegianHeight = abi.ChainEpoch(40)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet, 0: DrandMainnet,
@ -39,6 +47,35 @@ func init() {
policy.SetMinVerifiedDealSize(abi.NewStoragePower(256)) policy.SetMinVerifiedDealSize(abi.NewStoragePower(256))
policy.SetPreCommitChallengeDelay(abi.ChainEpoch(10)) policy.SetPreCommitChallengeDelay(abi.ChainEpoch(10))
getUpgradeHeight := func(ev string, def abi.ChainEpoch) abi.ChainEpoch {
hs, found := os.LookupEnv(ev)
if found {
h, err := strconv.Atoi(hs)
if err != nil {
log.Panicf("failed to parse %s env var", ev)
}
return abi.ChainEpoch(h)
}
return def
}
UpgradeBreezeHeight = getUpgradeHeight("LOTUS_BREEZE_HEIGHT", UpgradeBreezeHeight)
UpgradeSmokeHeight = getUpgradeHeight("LOTUS_SMOKE_HEIGHT", UpgradeSmokeHeight)
UpgradeIgnitionHeight = getUpgradeHeight("LOTUS_IGNITION_HEIGHT", UpgradeIgnitionHeight)
UpgradeRefuelHeight = getUpgradeHeight("LOTUS_REFUEL_HEIGHT", UpgradeRefuelHeight)
UpgradeTapeHeight = getUpgradeHeight("LOTUS_TAPE_HEIGHT", UpgradeTapeHeight)
UpgradeActorsV2Height = getUpgradeHeight("LOTUS_ACTORSV2_HEIGHT", UpgradeActorsV2Height)
UpgradeLiftoffHeight = getUpgradeHeight("LOTUS_LIFTOFF_HEIGHT", UpgradeLiftoffHeight)
UpgradeKumquatHeight = getUpgradeHeight("LOTUS_KUMQUAT_HEIGHT", UpgradeKumquatHeight)
UpgradeCalicoHeight = getUpgradeHeight("LOTUS_CALICO_HEIGHT", UpgradeCalicoHeight)
UpgradePersianHeight = getUpgradeHeight("LOTUS_PERSIAN_HEIGHT", UpgradePersianHeight)
UpgradeOrangeHeight = getUpgradeHeight("LOTUS_ORANGE_HEIGHT", UpgradeOrangeHeight)
UpgradeClausHeight = getUpgradeHeight("LOTUS_CLAUS_HEIGHT", UpgradeClausHeight)
UpgradeActorsV3Height = getUpgradeHeight("LOTUS_ACTORSV3_HEIGHT", UpgradeActorsV3Height)
UpgradeNorwegianHeight = getUpgradeHeight("LOTUS_NORWEGIAN_HEIGHT", UpgradeNorwegianHeight)
BuildType |= Build2k BuildType |= Build2k
} }
@ -56,3 +93,5 @@ const SlashablePowerDelay = 20
const InteractivePoRepConfidence = 6 const InteractivePoRepConfidence = 6
const BootstrapPeerThreshold = 1 const BootstrapPeerThreshold = 1
var WhitelistedBlock = cid.Undef

View File

@ -7,6 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/ipfs/go-cid"
) )
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
@ -32,6 +33,7 @@ const UpgradePersianHeight = 150
const UpgradeClausHeight = 180 const UpgradeClausHeight = 180
const UpgradeOrangeHeight = 210 const UpgradeOrangeHeight = 210
const UpgradeActorsV3Height = 240 const UpgradeActorsV3Height = 240
const UpgradeNorwegianHeight = UpgradeActorsV3Height + (builtin2.EpochsInHour * 12)
func init() { func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(2 << 30)) policy.SetConsensusMinerMinPower(abi.NewStoragePower(2 << 30))
@ -50,3 +52,5 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start // BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 2 const BootstrapPeerThreshold = 2
var WhitelistedBlock = cid.Undef

View File

@ -7,6 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/ipfs/go-cid"
) )
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
@ -40,6 +41,7 @@ const UpgradeClausHeight = 250
const UpgradeOrangeHeight = 300 const UpgradeOrangeHeight = 300
const UpgradeActorsV3Height = 600 const UpgradeActorsV3Height = 600
const UpgradeNorwegianHeight = 114000
func init() { func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(32 << 30)) policy.SetConsensusMinerMinPower(abi.NewStoragePower(32 << 30))
@ -61,3 +63,5 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start // BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 4 const BootstrapPeerThreshold = 4
var WhitelistedBlock = cid.Undef

View File

@ -56,6 +56,9 @@ const UpgradeClausHeight = 343200
// 2021-03-04T00:00:30Z // 2021-03-04T00:00:30Z
var UpgradeActorsV3Height = abi.ChainEpoch(550321) var UpgradeActorsV3Height = abi.ChainEpoch(550321)
// 2021-04-12T22:00:00Z
const UpgradeNorwegianHeight = 665280
func init() { func init() {
policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40)) policy.SetConsensusMinerMinPower(abi.NewStoragePower(10 << 40))
@ -78,3 +81,6 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start // BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 4 const BootstrapPeerThreshold = 4
// we skip checks on message validity in this block to sidestep the zero-bls signature
var WhitelistedBlock = MustParseCid("bafy2bzaceapyg2uyzk7vueh3xccxkuwbz3nxewjyguoxvhx77malc2lzn2ybi")

View File

@ -5,6 +5,7 @@ package build
import ( import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
@ -39,6 +40,7 @@ const UpgradeClausHeight = 250
const UpgradeOrangeHeight = 300 const UpgradeOrangeHeight = 300
const UpgradeActorsV3Height = 600 const UpgradeActorsV3Height = 600
const UpgradeNorwegianHeight = 999999
func init() { func init() {
// Minimum block production power is set to 4 TiB // Minimum block production power is set to 4 TiB
@ -70,3 +72,5 @@ const PropagationDelaySecs = uint64(6)
// BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start // BootstrapPeerThreshold is the minimum number peers we need to track for a sync worker to start
const BootstrapPeerThreshold = 4 const BootstrapPeerThreshold = 4
var WhitelistedBlock = cid.Undef

View File

@ -2,6 +2,7 @@ package build
import ( import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p-core/protocol"
@ -28,3 +29,12 @@ func MustParseAddress(addr string) address.Address {
return ret return ret
} }
func MustParseCid(c string) cid.Cid {
ret, err := cid.Decode(c)
if err != nil {
panic(err)
}
return ret
}

View File

@ -25,7 +25,7 @@ const UnixfsLinksPerLevel = 1024
// Consensus / Network // Consensus / Network
const AllowableClockDriftSecs = uint64(1) const AllowableClockDriftSecs = uint64(1)
const NewestNetworkVersion = network.Version9 const NewestNetworkVersion = network.Version11
const ActorUpgradeNetworkVersion = network.Version4 const ActorUpgradeNetworkVersion = network.Version4
// Epochs // Epochs

View File

@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
@ -81,29 +82,31 @@ var (
UpgradeBreezeHeight abi.ChainEpoch = -1 UpgradeBreezeHeight abi.ChainEpoch = -1
BreezeGasTampingDuration abi.ChainEpoch = 0 BreezeGasTampingDuration abi.ChainEpoch = 0
UpgradeSmokeHeight abi.ChainEpoch = -1 UpgradeSmokeHeight abi.ChainEpoch = -1
UpgradeIgnitionHeight abi.ChainEpoch = -2 UpgradeIgnitionHeight abi.ChainEpoch = -2
UpgradeRefuelHeight abi.ChainEpoch = -3 UpgradeRefuelHeight abi.ChainEpoch = -3
UpgradeTapeHeight abi.ChainEpoch = -4 UpgradeTapeHeight abi.ChainEpoch = -4
UpgradeActorsV2Height abi.ChainEpoch = 10 UpgradeActorsV2Height abi.ChainEpoch = 10
UpgradeLiftoffHeight abi.ChainEpoch = -5 UpgradeLiftoffHeight abi.ChainEpoch = -5
UpgradeKumquatHeight abi.ChainEpoch = -6 UpgradeKumquatHeight abi.ChainEpoch = -6
UpgradeCalicoHeight abi.ChainEpoch = -7 UpgradeCalicoHeight abi.ChainEpoch = -7
UpgradePersianHeight abi.ChainEpoch = -8 UpgradePersianHeight abi.ChainEpoch = -8
UpgradeOrangeHeight abi.ChainEpoch = -9 UpgradeOrangeHeight abi.ChainEpoch = -9
UpgradeClausHeight abi.ChainEpoch = -10 UpgradeClausHeight abi.ChainEpoch = -10
UpgradeActorsV3Height abi.ChainEpoch = -11 UpgradeActorsV3Height abi.ChainEpoch = -11
UpgradeNorwegianHeight abi.ChainEpoch = -12
DrandSchedule = map[abi.ChainEpoch]DrandEnum{ DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet, 0: DrandMainnet,
} }
NewestNetworkVersion = network.Version9 NewestNetworkVersion = network.Version11
ActorUpgradeNetworkVersion = network.Version4 ActorUpgradeNetworkVersion = network.Version4
Devnet = true Devnet = true
ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a") ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")
WhitelistedBlock = cid.Undef
BootstrappersFile = "" BootstrappersFile = ""
GenesisFile = "" GenesisFile = ""
) )

View File

@ -29,7 +29,7 @@ func buildType() string {
} }
// BuildVersion is the local build version, set by build system // BuildVersion is the local build version, set by build system
const BuildVersion = "1.7.0-dev" const BuildVersion = "1.7.1-dev"
func UserVersion() string { func UserVersion() string {
return BuildVersion + buildType() + CurrentCommit return BuildVersion + buildType() + CurrentCommit

View File

@ -50,6 +50,7 @@ var FaultDeclarationCutoff = miner0.FaultDeclarationCutoff
const MinSectorExpiration = miner0.MinSectorExpiration const MinSectorExpiration = miner0.MinSectorExpiration
// Not used / checked in v0 // Not used / checked in v0
// TODO: Abstract over network versions
var DeclarationsMax = miner2.DeclarationsMax var DeclarationsMax = miner2.DeclarationsMax
var AddressedSectorsMax = miner2.AddressedSectorsMax var AddressedSectorsMax = miner2.AddressedSectorsMax

View File

@ -133,7 +133,7 @@ func DealProviderCollateralBounds(
case actors.Version3: case actors.Version3:
return market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil) return market3.DealProviderCollateralBounds(size, verified, rawBytePower, qaPower, baselinePower, circulatingFil)
default: default:
panic("unsupported network version") panic("unsupported actors version")
} }
} }
@ -196,3 +196,38 @@ func GetDefaultSectorSize() abi.SectorSize {
return szs[0] return szs[0]
} }
func GetSectorMaxLifetime(proof abi.RegisteredSealProof, nwVer network.Version) abi.ChainEpoch {
if nwVer <= network.Version10 {
return builtin3.SealProofPoliciesV0[proof].SectorMaxLifetime
}
return builtin3.SealProofPoliciesV11[proof].SectorMaxLifetime
}
func GetAddressedSectorsMax(nwVer network.Version) int {
switch actors.VersionForNetwork(nwVer) {
case actors.Version0:
return miner0.AddressedSectorsMax
case actors.Version2:
return miner2.AddressedSectorsMax
case actors.Version3:
return miner3.AddressedSectorsMax
default:
panic("unsupported network version")
}
}
func GetDeclarationsMax(nwVer network.Version) int {
switch actors.VersionForNetwork(nwVer) {
case actors.Version0:
// TODO: Should we instead panic here since the concept doesn't exist yet?
return miner0.AddressedPartitionsMax
case actors.Version2:
return miner2.DeclarationsMax
case actors.Version3:
return miner3.DeclarationsMax
default:
panic("unsupported network version")
}
}

View File

@ -21,7 +21,7 @@ func VersionForNetwork(version network.Version) Version {
return Version0 return Version0
case network.Version4, network.Version5, network.Version6, network.Version7, network.Version8, network.Version9: case network.Version4, network.Version5, network.Version6, network.Version7, network.Version8, network.Version9:
return Version2 return Version2
case network.Version10: case network.Version10, network.Version11:
return Version3 return Version3
default: default:
panic(fmt.Sprintf("unsupported network version %d", version)) panic(fmt.Sprintf("unsupported network version %d", version))

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"

View File

@ -16,7 +16,7 @@ import (
"go.uber.org/zap/zapcore" "go.uber.org/zap/zapcore"
"golang.org/x/xerrors" "golang.org/x/xerrors"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
pubsub "github.com/libp2p/go-libp2p-pubsub" pubsub "github.com/libp2p/go-libp2p-pubsub"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"

View File

@ -16,7 +16,7 @@ import (
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"go.uber.org/fx" "go.uber.org/fx"
"golang.org/x/xerrors" "golang.org/x/xerrors"
) )

View File

@ -195,16 +195,6 @@ func CapGasFee(mff dtypes.DefaultMaxFeeFunc, msg *types.Message, sendSepc *api.M
maxFee = mf maxFee = mf
} }
if maxFee.Equals(big.Zero()) {
mf, err := mff()
if err != nil {
log.Errorf("failed to get default max gas fee: %+v", err)
mf = big.Zero()
}
maxFee = mf
}
gl := types.NewInt(uint64(msg.GasLimit)) gl := types.NewInt(uint64(msg.GasLimit))
totalFee := types.BigMul(msg.GasFeeCap, gl) totalFee := types.BigMul(msg.GasFeeCap, gl)

View File

@ -16,7 +16,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"

View File

@ -186,6 +186,10 @@ func DefaultUpgradeSchedule() UpgradeSchedule {
StopWithin: 5, StopWithin: 5,
}}, }},
Expensive: true, Expensive: true,
}, {
Height: build.UpgradeNorwegianHeight,
Network: network.Version11,
Migration: nil,
}} }}
for _, u := range updates { for _, u := range updates {

View File

@ -9,7 +9,7 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
ipldcbor "github.com/ipfs/go-ipld-cbor" ipldcbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors" "golang.org/x/xerrors"

View File

@ -113,7 +113,7 @@ type ChainStore struct {
chainLocalBlockstore bstore.Blockstore chainLocalBlockstore bstore.Blockstore
heaviestLk sync.Mutex heaviestLk sync.RWMutex
heaviest *types.TipSet heaviest *types.TipSet
bestTips *pubsub.PubSub bestTips *pubsub.PubSub
@ -775,10 +775,11 @@ func ReorgOps(lts func(types.TipSetKey) (*types.TipSet, error), a, b *types.TipS
} }
// GetHeaviestTipSet returns the current heaviest tipset known (i.e. our head). // GetHeaviestTipSet returns the current heaviest tipset known (i.e. our head).
func (cs *ChainStore) GetHeaviestTipSet() *types.TipSet { func (cs *ChainStore) GetHeaviestTipSet() (ts *types.TipSet) {
cs.heaviestLk.Lock() cs.heaviestLk.RLock()
defer cs.heaviestLk.Unlock() ts = cs.heaviest
return cs.heaviest cs.heaviestLk.RUnlock()
return
} }
func (cs *ChainStore) AddToTipSetTracker(b *types.BlockHeader) error { func (cs *ChainStore) AddToTipSetTracker(b *types.BlockHeader) error {

View File

@ -751,6 +751,10 @@ func (syncer *Syncer) ValidateBlock(ctx context.Context, b *types.FullBlock, use
} }
msgsCheck := async.Err(func() error { msgsCheck := async.Err(func() error {
if b.Cid() == build.WhitelistedBlock {
return nil
}
if err := syncer.checkBlockMessages(ctx, b, baseTs); err != nil { if err := syncer.checkBlockMessages(ctx, b, baseTs); err != nil {
return xerrors.Errorf("block had invalid messages: %w", err) return xerrors.Errorf("block had invalid messages: %w", err)
} }

View File

@ -9,7 +9,7 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/query" "github.com/ipfs/go-datastore/query"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
ledgerfil "github.com/whyrusleeping/ledger-filecoin-go" ledgerfil "github.com/whyrusleeping/ledger-filecoin-go"
"golang.org/x/xerrors" "golang.org/x/xerrors"

View File

@ -302,8 +302,16 @@ var clientLocalCmd = &cli.Command{
} }
var clientDealCmd = &cli.Command{ var clientDealCmd = &cli.Command{
Name: "deal", Name: "deal",
Usage: "Initialize storage deal with a miner", Usage: "Initialize storage deal with a miner",
Description: `Make a deal with a miner.
dataCid comes from running 'lotus client import'.
miner is the address of the miner you wish to make a deal with.
price is measured in FIL/GB/Epoch. Miners usually don't accept a bid
lower than their advertised ask. You can check a miners listed price
with 'lotus client query-ask <miner address>'.
duration is how long the miner should store the data for, in blocks.
The minimum value is 518400 (6 months).`,
ArgsUsage: "[dataCid miner price duration]", ArgsUsage: "[dataCid miner price duration]",
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.StringFlag{ &cli.StringFlag{

View File

@ -132,9 +132,11 @@ var MpoolPending = &cli.Command{
}, },
} }
// Deprecated: MpoolClear is now available at `lotus-shed mpool clear`
var MpoolClear = &cli.Command{ var MpoolClear = &cli.Command{
Name: "clear", Name: "clear",
Usage: "Clear all pending messages from the mpool (USE WITH CARE)", Usage: "Clear all pending messages from the mpool (USE WITH CARE) (DEPRECATED)",
Hidden: true,
Flags: []cli.Flag{ Flags: []cli.Flag{
&cli.BoolFlag{ &cli.BoolFlag{
Name: "local", Name: "local",
@ -146,6 +148,7 @@ var MpoolClear = &cli.Command{
}, },
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
fmt.Println("DEPRECATED: This behavior is being moved to `lotus-shed mpool clear`")
api, closer, err := GetFullNodeAPI(cctx) api, closer, err := GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return err

View File

@ -1466,19 +1466,19 @@ func printReceiptReturn(ctx context.Context, api v0api.FullNode, m *types.Messag
} }
func printMsg(ctx context.Context, api v0api.FullNode, msg cid.Cid, mw *lapi.MsgLookup, m *types.Message) error { func printMsg(ctx context.Context, api v0api.FullNode, msg cid.Cid, mw *lapi.MsgLookup, m *types.Message) error {
if mw != nil { if mw == nil {
if mw.Message != msg {
fmt.Printf("Message was replaced: %s\n", mw.Message)
}
fmt.Printf("Executed in tipset: %s\n", mw.TipSet.Cids())
fmt.Printf("Exit Code: %d\n", mw.Receipt.ExitCode)
fmt.Printf("Gas Used: %d\n", mw.Receipt.GasUsed)
fmt.Printf("Return: %x\n", mw.Receipt.Return)
} else {
fmt.Println("message was not found on chain") fmt.Println("message was not found on chain")
return nil
} }
if mw.Message != msg {
fmt.Printf("Message was replaced: %s\n", mw.Message)
}
fmt.Printf("Executed in tipset: %s\n", mw.TipSet.Cids())
fmt.Printf("Exit Code: %d\n", mw.Receipt.ExitCode)
fmt.Printf("Gas Used: %d\n", mw.Receipt.GasUsed)
fmt.Printf("Return: %x\n", mw.Receipt.Return)
if err := printReceiptReturn(ctx, api, m, mw.Receipt); err != nil { if err := printReceiptReturn(ctx, api, m, mw.Receipt); err != nil {
return err return err
} }
@ -1746,7 +1746,7 @@ var StateCircSupplyCmd = &cli.Command{
var StateSectorCmd = &cli.Command{ var StateSectorCmd = &cli.Command{
Name: "sector", Name: "sector",
Usage: "Get miner sector info", Usage: "Get miner sector info",
ArgsUsage: "[miner address] [sector number]", ArgsUsage: "[minerAddress] [sectorNumber]",
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
api, closer, err := GetFullNodeAPI(cctx) api, closer, err := GetFullNodeAPI(cctx)
if err != nil { if err != nil {
@ -1757,7 +1757,7 @@ var StateSectorCmd = &cli.Command{
ctx := ReqContext(cctx) ctx := ReqContext(cctx)
if cctx.Args().Len() != 2 { if cctx.Args().Len() != 2 {
return xerrors.Errorf("expected 2 params") return xerrors.Errorf("expected 2 params: minerAddress and sectorNumber")
} }
ts, err := LoadTipSet(ctx, cctx, api) ts, err := LoadTipSet(ctx, cctx, api)

View File

@ -19,7 +19,7 @@ import (
"github.com/filecoin-project/lotus/lib/lotuslog" "github.com/filecoin-project/lotus/lib/lotuslog"
"github.com/filecoin-project/lotus/metrics" "github.com/filecoin-project/lotus/metrics"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"go.opencensus.io/stats/view" "go.opencensus.io/stats/view"
"github.com/gorilla/mux" "github.com/gorilla/mux"

View File

@ -11,7 +11,7 @@ import (
"github.com/filecoin-project/lotus/api/v0api" "github.com/filecoin-project/lotus/api/v0api"
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"github.com/filecoin-project/go-jsonrpc" "github.com/filecoin-project/go-jsonrpc"

View File

@ -13,7 +13,7 @@ import (
"github.com/docker/go-units" "github.com/docker/go-units"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
dsq "github.com/ipfs/go-datastore/query" dsq "github.com/ipfs/go-datastore/query"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/mitchellh/go-homedir" "github.com/mitchellh/go-homedir"
"github.com/polydawn/refmt/cbor" "github.com/polydawn/refmt/cbor"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"

View File

@ -8,7 +8,7 @@ import (
"contrib.go.opencensus.io/exporter/prometheus" "contrib.go.opencensus.io/exporter/prometheus"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"go.opencensus.io/stats" "go.opencensus.io/stats"
"go.opencensus.io/stats/view" "go.opencensus.io/stats/view"

View File

@ -15,6 +15,7 @@ var mpoolCmd = &cli.Command{
Flags: []cli.Flag{}, Flags: []cli.Flag{},
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
minerSelectMsgsCmd, minerSelectMsgsCmd,
mpoolClear,
}, },
} }
@ -66,3 +67,36 @@ var minerSelectMsgsCmd = &cli.Command{
return nil return nil
}, },
} }
var mpoolClear = &cli.Command{
Name: "clear",
Usage: "Clear all pending messages from the mpool (USE WITH CARE)",
Flags: []cli.Flag{
&cli.BoolFlag{
Name: "local",
Usage: "also clear local messages",
},
&cli.BoolFlag{
Name: "really-do-it",
Usage: "must be specified for the action to take effect",
},
},
Action: func(cctx *cli.Context) error {
api, closer, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer closer()
really := cctx.Bool("really-do-it")
if !really {
//nolint:golint
return fmt.Errorf("--really-do-it must be specified for this action to have an effect; you have been warned")
}
local := cctx.Bool("local")
ctx := lcli.ReqContext(cctx)
return api.MpoolClear(ctx, local)
},
}

View File

@ -5,6 +5,10 @@ import (
"fmt" "fmt"
"strconv" "strconv"
ffi "github.com/filecoin-project/filecoin-ffi"
lcli "github.com/filecoin-project/lotus/cli"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/lib/sigs"
@ -18,6 +22,76 @@ var signaturesCmd = &cli.Command{
Usage: "tools involving signatures", Usage: "tools involving signatures",
Subcommands: []*cli.Command{ Subcommands: []*cli.Command{
sigsVerifyVoteCmd, sigsVerifyVoteCmd,
sigsVerifyBlsMsgsCmd,
},
}
var sigsVerifyBlsMsgsCmd = &cli.Command{
Name: "verify-bls",
Description: "given a block, verifies the bls signature of the messages in the block",
Usage: "<blockCid>",
Action: func(cctx *cli.Context) error {
if cctx.Args().Len() != 1 {
return xerrors.Errorf("usage: <blockCid>")
}
api, closer, err := lcli.GetFullNodeAPI(cctx)
if err != nil {
return err
}
defer closer()
ctx := lcli.ReqContext(cctx)
bc, err := cid.Decode(cctx.Args().First())
if err != nil {
return err
}
b, err := api.ChainGetBlock(ctx, bc)
if err != nil {
return err
}
ms, err := api.ChainGetBlockMessages(ctx, bc)
if err != nil {
return err
}
var sigCids []cid.Cid // this is what we get for people not wanting the marshalcbor method on the cid type
var pubks [][]byte
for _, m := range ms.BlsMessages {
sigCids = append(sigCids, m.Cid())
if m.From.Protocol() != address.BLS {
return xerrors.Errorf("address must be BLS address")
}
pubks = append(pubks, m.From.Payload())
}
msgsS := make([]ffi.Message, len(sigCids))
pubksS := make([]ffi.PublicKey, len(sigCids))
for i := 0; i < len(sigCids); i++ {
msgsS[i] = sigCids[i].Bytes()
copy(pubksS[i][:], pubks[i][:ffi.PublicKeyBytes])
}
sigS := new(ffi.Signature)
copy(sigS[:], b.BLSAggregate.Data[:ffi.SignatureBytes])
if len(sigCids) == 0 {
return nil
}
valid := ffi.HashVerify(sigS, msgsS, pubksS)
if !valid {
return xerrors.New("bls aggregate signature failed to verify")
}
fmt.Println("BLS siggys valid!")
return nil
}, },
} }

View File

@ -53,8 +53,22 @@ var actorSetAddrsCmd = &cli.Command{
Usage: "set gas limit", Usage: "set gas limit",
Value: 0, Value: 0,
}, },
&cli.BoolFlag{
Name: "unset",
Usage: "unset address",
Value: false,
},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
args := cctx.Args().Slice()
unset := cctx.Bool("unset")
if len(args) == 0 && !unset {
return cli.ShowSubcommandHelp(cctx)
}
if len(args) > 0 && unset {
return fmt.Errorf("unset can only be used with no arguments")
}
nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx) nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil { if err != nil {
return err return err
@ -70,7 +84,7 @@ var actorSetAddrsCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
var addrs []abi.Multiaddrs var addrs []abi.Multiaddrs
for _, a := range cctx.Args().Slice() { for _, a := range args {
maddr, err := ma.NewMultiaddr(a) maddr, err := ma.NewMultiaddr(a)
if err != nil { if err != nil {
return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err) return fmt.Errorf("failed to parse %q as a multiaddr: %w", a, err)

View File

@ -90,7 +90,7 @@ func infoCmdAct(cctx *cli.Context) error {
fmt.Println() fmt.Println()
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("actor")) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return err return err
} }

View File

@ -106,15 +106,21 @@ func main() {
lcli.RunApp(app) lcli.RunApp(app)
} }
func getActorAddress(ctx context.Context, nodeAPI api.StorageMiner, overrideMaddr string) (maddr address.Address, err error) { func getActorAddress(ctx context.Context, cctx *cli.Context) (maddr address.Address, err error) {
if overrideMaddr != "" { if cctx.IsSet("actor") {
maddr, err = address.NewFromString(overrideMaddr) maddr, err = address.NewFromString(cctx.String("actor"))
if err != nil { if err != nil {
return maddr, err return maddr, err
} }
return return
} }
nodeAPI, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return address.Undef, err
}
defer closer()
maddr, err = nodeAPI.ActorAddress(ctx) maddr, err = nodeAPI.ActorAddress(ctx)
if err != nil { if err != nil {
return maddr, xerrors.Errorf("getting actor address: %w", err) return maddr, xerrors.Errorf("getting actor address: %w", err)

View File

@ -38,12 +38,6 @@ var provingFaultsCmd = &cli.Command{
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
color.NoColor = !cctx.Bool("color") color.NoColor = !cctx.Bool("color")
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, acloser, err := lcli.GetFullNodeAPI(cctx) api, acloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return err
@ -54,7 +48,7 @@ var provingFaultsCmd = &cli.Command{
stor := store.ActorStore(ctx, blockstore.NewAPIBlockstore(api)) stor := store.ActorStore(ctx, blockstore.NewAPIBlockstore(api))
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("actor")) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return err return err
} }
@ -98,12 +92,6 @@ var provingInfoCmd = &cli.Command{
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
color.NoColor = !cctx.Bool("color") color.NoColor = !cctx.Bool("color")
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, acloser, err := lcli.GetFullNodeAPI(cctx) api, acloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return err
@ -112,7 +100,7 @@ var provingInfoCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("actor")) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return err return err
} }
@ -211,12 +199,6 @@ var provingDeadlinesCmd = &cli.Command{
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
color.NoColor = !cctx.Bool("color") color.NoColor = !cctx.Bool("color")
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, acloser, err := lcli.GetFullNodeAPI(cctx) api, acloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return err
@ -225,7 +207,7 @@ var provingDeadlinesCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("actor")) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return err return err
} }
@ -301,12 +283,6 @@ var provingDeadlineInfoCmd = &cli.Command{
return xerrors.Errorf("could not parse deadline index: %w", err) return xerrors.Errorf("could not parse deadline index: %w", err)
} }
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, acloser, err := lcli.GetFullNodeAPI(cctx) api, acloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return err
@ -315,7 +291,7 @@ var provingDeadlineInfoCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
maddr, err := getActorAddress(ctx, nodeApi, cctx.String("actor")) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return err return err
} }

View File

@ -16,7 +16,7 @@ import (
"github.com/filecoin-project/go-bitfield" "github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
@ -422,16 +422,27 @@ var sectorsExtendCmd = &cli.Command{
&cli.Int64Flag{ &cli.Int64Flag{
Name: "new-expiration", Name: "new-expiration",
Usage: "new expiration epoch", Usage: "new expiration epoch",
Required: true, Required: false,
},
&cli.BoolFlag{
Name: "v1-sectors",
Usage: "renews all v1 sectors up to the maximum possible lifetime",
Required: false,
},
&cli.Int64Flag{
Name: "tolerance",
Value: 20160,
Usage: "when extending v1 sectors, don't try to extend sectors by fewer than this number of epochs",
Required: false,
},
&cli.Int64Flag{
Name: "expiration-cutoff",
Usage: "when extending v1 sectors, skip sectors whose current expiration is more than <cutoff> epochs from now (infinity if unspecified)",
Required: false,
}, },
&cli.StringFlag{}, &cli.StringFlag{},
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
nodeApi, closer, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer closer()
api, nCloser, err := lcli.GetFullNodeAPI(cctx) api, nCloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
@ -440,49 +451,160 @@ var sectorsExtendCmd = &cli.Command{
defer nCloser() defer nCloser()
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
if !cctx.Args().Present() {
return xerrors.Errorf("must pass at least one sector number")
}
maddr, err := nodeApi.ActorAddress(ctx) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return xerrors.Errorf("getting miner actor address: %w", err) return err
} }
sectors := map[miner.SectorLocation][]uint64{} var params []miner3.ExtendSectorExpirationParams
for i, s := range cctx.Args().Slice() { if cctx.Bool("v1-sectors") {
id, err := strconv.ParseUint(s, 10, 64)
head, err := api.ChainHead(ctx)
if err != nil { if err != nil {
return xerrors.Errorf("could not parse sector %d: %w", i, err) return err
} }
p, err := api.StateSectorPartition(ctx, maddr, abi.SectorNumber(id), types.EmptyTSK) nv, err := api.StateNetworkVersion(ctx, types.EmptyTSK)
if err != nil { if err != nil {
return xerrors.Errorf("getting sector location for sector %d: %w", id, err) return err
} }
if p == nil { extensions := map[miner.SectorLocation]map[abi.ChainEpoch][]uint64{}
return xerrors.Errorf("sector %d not found in any partition", id)
// are given durations within tolerance epochs
withinTolerance := func(a, b abi.ChainEpoch) bool {
diff := a - b
if diff < 0 {
diff = b - a
}
return diff <= abi.ChainEpoch(cctx.Int64("tolerance"))
} }
sectors[*p] = append(sectors[*p], id) sis, err := api.StateMinerActiveSectors(ctx, maddr, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("getting miner sector infos: %w", err)
}
for _, si := range sis {
if si.SealProof >= abi.RegisteredSealProof_StackedDrg2KiBV1_1 {
continue
}
if cctx.IsSet("expiration-cutoff") {
if si.Expiration > (head.Height() + abi.ChainEpoch(cctx.Int64("expiration-cutoff"))) {
continue
}
}
ml := policy.GetSectorMaxLifetime(si.SealProof, nv)
// if the sector's missing less than "tolerance" of its maximum possible lifetime, don't bother extending it
if withinTolerance(si.Expiration-si.Activation, ml) {
continue
}
// Set the new expiration to 48 hours less than the theoretical maximum lifetime
newExp := ml - (miner3.WPoStProvingPeriod * 2) + si.Activation
p, err := api.StateSectorPartition(ctx, maddr, si.SectorNumber, types.EmptyTSK)
if err != nil {
return xerrors.Errorf("getting sector location for sector %d: %w", si.SectorNumber, err)
}
if p == nil {
return xerrors.Errorf("sector %d not found in any partition", si.SectorNumber)
}
es, found := extensions[*p]
if !found {
ne := make(map[abi.ChainEpoch][]uint64)
ne[newExp] = []uint64{uint64(si.SectorNumber)}
extensions[*p] = ne
} else {
added := false
for exp := range es {
if withinTolerance(exp, newExp) {
es[exp] = append(es[exp], uint64(si.SectorNumber))
added = true
break
}
}
if !added {
es[newExp] = []uint64{uint64(si.SectorNumber)}
}
}
}
p := miner3.ExtendSectorExpirationParams{}
scount := 0
for l, exts := range extensions {
for newExp, numbers := range exts {
scount += len(numbers)
if scount > policy.GetAddressedSectorsMax(nv) || len(p.Extensions) == policy.GetDeclarationsMax(nv) {
params = append(params, p)
p = miner3.ExtendSectorExpirationParams{}
scount = len(numbers)
}
p.Extensions = append(p.Extensions, miner3.ExpirationExtension{
Deadline: l.Deadline,
Partition: l.Partition,
Sectors: bitfield.NewFromSet(numbers),
NewExpiration: newExp,
})
}
}
// if we have any sectors, then one last append is needed here
if scount != 0 {
params = append(params, p)
}
} else {
if !cctx.Args().Present() || !cctx.IsSet("new-expiration") {
return xerrors.Errorf("must pass at least one sector number and new expiration")
}
sectors := map[miner.SectorLocation][]uint64{}
for i, s := range cctx.Args().Slice() {
id, err := strconv.ParseUint(s, 10, 64)
if err != nil {
return xerrors.Errorf("could not parse sector %d: %w", i, err)
}
p, err := api.StateSectorPartition(ctx, maddr, abi.SectorNumber(id), types.EmptyTSK)
if err != nil {
return xerrors.Errorf("getting sector location for sector %d: %w", id, err)
}
if p == nil {
return xerrors.Errorf("sector %d not found in any partition", id)
}
sectors[*p] = append(sectors[*p], id)
}
p := miner3.ExtendSectorExpirationParams{}
for l, numbers := range sectors {
// TODO: Dedup with above loop
p.Extensions = append(p.Extensions, miner3.ExpirationExtension{
Deadline: l.Deadline,
Partition: l.Partition,
Sectors: bitfield.NewFromSet(numbers),
NewExpiration: abi.ChainEpoch(cctx.Int64("new-expiration")),
})
}
params = append(params, p)
} }
params := &miner0.ExtendSectorExpirationParams{} if len(params) == 0 {
for l, numbers := range sectors { fmt.Println("nothing to extend")
return nil
params.Extensions = append(params.Extensions, miner0.ExpirationExtension{
Deadline: l.Deadline,
Partition: l.Partition,
Sectors: bitfield.NewFromSet(numbers),
NewExpiration: abi.ChainEpoch(cctx.Int64("new-expiration")),
})
}
sp, err := actors.SerializeParams(params)
if err != nil {
return xerrors.Errorf("serializing params: %w", err)
} }
mi, err := api.StateMinerInfo(ctx, maddr, types.EmptyTSK) mi, err := api.StateMinerInfo(ctx, maddr, types.EmptyTSK)
@ -490,20 +612,27 @@ var sectorsExtendCmd = &cli.Command{
return xerrors.Errorf("getting miner info: %w", err) return xerrors.Errorf("getting miner info: %w", err)
} }
smsg, err := api.MpoolPushMessage(ctx, &types.Message{ for i := range params {
From: mi.Worker, sp, aerr := actors.SerializeParams(&params[i])
To: maddr, if aerr != nil {
Method: miner.Methods.ExtendSectorExpiration, return xerrors.Errorf("serializing params: %w", err)
}
Value: big.Zero(), smsg, err := api.MpoolPushMessage(ctx, &types.Message{
Params: sp, From: mi.Worker,
}, nil) To: maddr,
if err != nil { Method: miner.Methods.ExtendSectorExpiration,
return xerrors.Errorf("mpool push message: %w", err)
Value: big.Zero(),
Params: sp,
}, nil)
if err != nil {
return xerrors.Errorf("mpool push message: %w", err)
}
fmt.Println(smsg.Cid())
} }
fmt.Println(smsg.Cid())
return nil return nil
}, },
} }
@ -741,12 +870,6 @@ var sectorsCapacityCollateralCmd = &cli.Command{
}, },
Action: func(cctx *cli.Context) error { Action: func(cctx *cli.Context) error {
mApi, mCloser, err := lcli.GetStorageMinerAPI(cctx)
if err != nil {
return err
}
defer mCloser()
nApi, nCloser, err := lcli.GetFullNodeAPI(cctx) nApi, nCloser, err := lcli.GetFullNodeAPI(cctx)
if err != nil { if err != nil {
return err return err
@ -755,7 +878,7 @@ var sectorsCapacityCollateralCmd = &cli.Command{
ctx := lcli.ReqContext(cctx) ctx := lcli.ReqContext(cctx)
maddr, err := mApi.ActorAddress(ctx) maddr, err := getActorAddress(ctx, cctx)
if err != nil { if err != nil {
return err return err
} }

View File

@ -4517,7 +4517,7 @@ Inputs:
] ]
``` ```
Response: `9` Response: `11`
### StateReadState ### StateReadState
StateReadState returns the indicated actor's state. StateReadState returns the indicated actor's state.

2
extern/filecoin-ffi vendored

@ -1 +1 @@
Subproject commit b6e0b35fb49ed0fedb6a6a473b222e3b8a7d7f17 Subproject commit d82899449741ce190e950a3582ebe33806f018a9

View File

@ -21,7 +21,7 @@ import (
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/xerrors" "golang.org/x/xerrors"

View File

@ -16,7 +16,7 @@ import (
"github.com/google/uuid" "github.com/google/uuid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"

View File

@ -16,7 +16,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/specs-storage/storage"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"

View File

@ -184,6 +184,8 @@ func (i *Index) StorageReportHealth(ctx context.Context, id ID, report HealthRep
ent.fsi = report.Stat ent.fsi = report.Stat
if report.Err != "" { if report.Err != "" {
ent.heartbeatErr = errors.New(report.Err) ent.heartbeatErr = errors.New(report.Err)
} else {
ent.heartbeatErr = nil
} }
ent.lastHeartbeat = time.Now() ent.lastHeartbeat = time.Now()

View File

@ -114,7 +114,7 @@ func (p *path) stat(ls LocalStorage) (fsutil.FsStat, error) {
used, err = ls.DiskUsage(p) used, err = ls.DiskUsage(p)
} }
if err != nil { if err != nil {
log.Errorf("getting disk usage of '%s': %+v", p.sectorPath(id, fileType), err) log.Debugf("getting disk usage of '%s': %+v", p.sectorPath(id, fileType), err)
continue continue
} }

View File

@ -242,7 +242,15 @@ func (m *Sealing) plan(events []statemachine.Event, state *SectorInfo) (func(sta
p := fsmPlanners[state.State] p := fsmPlanners[state.State]
if p == nil { if p == nil {
return nil, 0, xerrors.Errorf("planner for state %s not found", state.State) if len(events) == 1 {
if _, ok := events[0].User.(globalMutator); ok {
p = planOne() // in case we're in a really weird state, allow restart / update state / remove
}
}
if p == nil {
return nil, 0, xerrors.Errorf("planner for state %s not found", state.State)
}
} }
processed, err := p(events, state) processed, err := p(events, state)

View File

@ -175,3 +175,38 @@ func TestPlannerList(t *testing.T) {
require.True(t, ok, "state %s", state) require.True(t, ok, "state %s", state)
} }
} }
func TestBrokenState(t *testing.T) {
var notif []struct{ before, after SectorInfo }
ma, _ := address.NewIDAddress(55151)
m := test{
s: &Sealing{
maddr: ma,
stats: SectorStats{
bySector: map[abi.SectorID]statSectorState{},
},
notifee: func(before, after SectorInfo) {
notif = append(notif, struct{ before, after SectorInfo }{before, after})
},
},
t: t,
state: &SectorInfo{State: "not a state"},
}
_, _, err := m.s.plan([]statemachine.Event{{User: SectorPacked{}}}, m.state)
require.Error(t, err)
require.Equal(m.t, m.state.State, SectorState("not a state"))
m.planSingle(SectorRemove{})
require.Equal(m.t, m.state.State, Removing)
expected := []SectorState{"not a state", "not a state", Removing}
for i, n := range notif {
if n.before.State != expected[i] {
t.Fatalf("expected before state: %s, got: %s", expected[i], n.before.State)
}
if n.after.State != expected[i+1] {
t.Fatalf("expected after state: %s, got: %s", expected[i+1], n.after.State)
}
}
}

9
go.mod
View File

@ -32,9 +32,9 @@ require (
github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2 github.com/filecoin-project/go-cbor-util v0.0.0-20191219014500-08c40a1e63a2
github.com/filecoin-project/go-commp-utils v0.1.0 github.com/filecoin-project/go-commp-utils v0.1.0
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03
github.com/filecoin-project/go-data-transfer v1.4.1 github.com/filecoin-project/go-data-transfer v1.4.3
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a
github.com/filecoin-project/go-fil-markets v1.2.4 github.com/filecoin-project/go-fil-markets v1.2.5
github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec github.com/filecoin-project/go-jsonrpc v0.1.4-0.20210217175800-45ea43ac2bec
github.com/filecoin-project/go-multistore v0.0.3 github.com/filecoin-project/go-multistore v0.0.3
github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20 github.com/filecoin-project/go-padreader v0.0.0-20200903213702-ed5fae088b20
@ -44,8 +44,8 @@ require (
github.com/filecoin-project/go-statestore v0.1.1 github.com/filecoin-project/go-statestore v0.1.1
github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b github.com/filecoin-project/go-storedcounter v0.0.0-20200421200003-1c99c62e8a5b
github.com/filecoin-project/specs-actors v0.9.13 github.com/filecoin-project/specs-actors v0.9.13
github.com/filecoin-project/specs-actors/v2 v2.3.4 github.com/filecoin-project/specs-actors/v2 v2.3.5-0.20210114162132-5b58b773f4fb
github.com/filecoin-project/specs-actors/v3 v3.0.3 github.com/filecoin-project/specs-actors/v3 v3.1.0
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506
github.com/filecoin-project/test-vectors/schema v0.0.5 github.com/filecoin-project/test-vectors/schema v0.0.5
github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1 github.com/gbrlsnchs/jwt/v3 v3.0.0-beta.1
@ -85,7 +85,6 @@ require (
github.com/ipfs/go-ipfs-util v0.0.2 github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-cbor v0.0.5 github.com/ipfs/go-ipld-cbor v0.0.5
github.com/ipfs/go-ipld-format v0.2.0 github.com/ipfs/go-ipld-format v0.2.0
github.com/ipfs/go-log v1.0.4
github.com/ipfs/go-log/v2 v2.1.2-0.20200626104915-0016c0b4b3e4 github.com/ipfs/go-log/v2 v2.1.2-0.20200626104915-0016c0b4b3e4
github.com/ipfs/go-merkledag v0.3.2 github.com/ipfs/go-merkledag v0.3.2
github.com/ipfs/go-metrics-interface v0.0.1 github.com/ipfs/go-metrics-interface v0.0.1

16
go.sum
View File

@ -265,16 +265,16 @@ github.com/filecoin-project/go-commp-utils v0.1.0/go.mod h1:6s95K91mCyHY51RPWECZ
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMXdBnCiXjfCYx/hLqFxccPoqsSveQFxVLvNxy9bus= github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03 h1:2pMXdBnCiXjfCYx/hLqFxccPoqsSveQFxVLvNxy9bus=
github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ= github.com/filecoin-project/go-crypto v0.0.0-20191218222705-effae4ea9f03/go.mod h1:+viYnvGtUTgJRdy6oaeF4MTFKAfatX071MPDPBL11EQ=
github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BSK9u3pB2aq30Y0KMsG+w9/ysyo= github.com/filecoin-project/go-data-transfer v1.0.1/go.mod h1:UxvfUAY9v3ub0a21BSK9u3pB2aq30Y0KMsG+w9/ysyo=
github.com/filecoin-project/go-data-transfer v1.4.1 h1:4GoMGEdMeDLqbKR74Q5ceZTN35nv+66JZERqQ+SjxWU= github.com/filecoin-project/go-data-transfer v1.4.3 h1:ECEw69NOfmEZ7XN1NSBvj3KTbbH2mIczQs+Z2w4bD7c=
github.com/filecoin-project/go-data-transfer v1.4.1/go.mod h1:n8kbDQXWrY1c4UgfMa9KERxNCWbOTDwdNhf2MpN9dpo= github.com/filecoin-project/go-data-transfer v1.4.3/go.mod h1:n8kbDQXWrY1c4UgfMa9KERxNCWbOTDwdNhf2MpN9dpo=
github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ= github.com/filecoin-project/go-ds-versioning v0.1.0 h1:y/X6UksYTsK8TLCI7rttCKEvl8btmWxyFMEeeWGUxIQ=
github.com/filecoin-project/go-ds-versioning v0.1.0/go.mod h1:mp16rb4i2QPmxBnmanUx8i/XANp+PFCCJWiAb+VW4/s= github.com/filecoin-project/go-ds-versioning v0.1.0/go.mod h1:mp16rb4i2QPmxBnmanUx8i/XANp+PFCCJWiAb+VW4/s=
github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-commcid v0.0.0-20200716160307-8f644712406f/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg= github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a h1:hyJ+pUm/4U4RdEZBlg6k8Ma4rDiuvqyGpoICXAxwsTg=
github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ= github.com/filecoin-project/go-fil-commcid v0.0.0-20201016201715-d41df56b4f6a/go.mod h1:Eaox7Hvus1JgPrL5+M3+h7aSPHc0cVqpSxA+TxIEpZQ=
github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c= github.com/filecoin-project/go-fil-markets v1.0.5-0.20201113164554-c5eba40d5335/go.mod h1:AJySOJC00JRWEZzRG2KsfUnqEf5ITXxeX09BE9N4f9c=
github.com/filecoin-project/go-fil-markets v1.2.4 h1:AcNMy/XGvSdv4GjuVoeqe67Q7OvppkSx1zWEGqVHixg= github.com/filecoin-project/go-fil-markets v1.2.5 h1:bQgtXbwxKyPxSEQoUI5EaTHJ0qfzyd5NosspuADCm6Y=
github.com/filecoin-project/go-fil-markets v1.2.4/go.mod h1:8WEpiMkwdvtHb5dXmRIWX4vz4XjkVlhxRdHJdouV1b0= github.com/filecoin-project/go-fil-markets v1.2.5/go.mod h1:7JIqNBmFvOyBzk/EiPYnweVdQnWhshixb5B9b1653Ag=
github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM= github.com/filecoin-project/go-hamt-ipld v0.1.5 h1:uoXrKbCQZ49OHpsTCkrThPNelC4W3LPEk0OrS/ytIBM=
github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24= github.com/filecoin-project/go-hamt-ipld v0.1.5/go.mod h1:6Is+ONR5Cd5R6XZoCse1CWaXZc0Hdb/JeX+EQCQzX24=
github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM= github.com/filecoin-project/go-hamt-ipld/v2 v2.0.0 h1:b3UDemBYN2HNfk3KOXNuxgTTxlWi3xVvbQP0IT38fvM=
@ -308,10 +308,10 @@ github.com/filecoin-project/specs-actors v0.9.13 h1:rUEOQouefi9fuVY/2HOroROJlZbO
github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao= github.com/filecoin-project/specs-actors v0.9.13/go.mod h1:TS1AW/7LbG+615j4NsjMK1qlpAwaFsG9w0V2tg2gSao=
github.com/filecoin-project/specs-actors/v2 v2.0.1/go.mod h1:v2NZVYinNIKA9acEMBm5wWXxqv5+frFEbekBFemYghY= github.com/filecoin-project/specs-actors/v2 v2.0.1/go.mod h1:v2NZVYinNIKA9acEMBm5wWXxqv5+frFEbekBFemYghY=
github.com/filecoin-project/specs-actors/v2 v2.3.2/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y= github.com/filecoin-project/specs-actors/v2 v2.3.2/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y=
github.com/filecoin-project/specs-actors/v2 v2.3.4 h1:NZK2oMCcA71wNsUzDBmLQyRMzcCnX9tDGvwZ53G67j8= github.com/filecoin-project/specs-actors/v2 v2.3.5-0.20210114162132-5b58b773f4fb h1:orr/sMzrDZUPAveRE+paBdu1kScIUO5zm+HYeh+VlhA=
github.com/filecoin-project/specs-actors/v2 v2.3.4/go.mod h1:UuJQLoTx/HPvvWeqlIFmC/ywlOLHNe8SNQ3OunFbu2Y= github.com/filecoin-project/specs-actors/v2 v2.3.5-0.20210114162132-5b58b773f4fb/go.mod h1:LljnY2Mn2homxZsmokJZCpRuhOPxfXhvcek5gWkmqAc=
github.com/filecoin-project/specs-actors/v3 v3.0.3 h1:bq9B1Jnq+Z0A+Yj3KnYhN3kcTpUyP6Umo3MZgai0BRE= github.com/filecoin-project/specs-actors/v3 v3.1.0 h1:s4qiPw8pgypqBGAy853u/zdZJ7K9cTZdM1rTiSonHrg=
github.com/filecoin-project/specs-actors/v3 v3.0.3/go.mod h1:oMcmEed6B7H/wHabM3RQphTIhq0ibAKsbpYs+bQ/uxQ= github.com/filecoin-project/specs-actors/v3 v3.1.0/go.mod h1:mpynccOLlIRy0QnR008BwYBwT9fen+sPR13MA1VmMww=
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506 h1:Ur/l2+6qN+lQiqjozWWc5p9UDaAMDZKTlDS98oRnlIw=
github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g= github.com/filecoin-project/specs-storage v0.1.1-0.20201105051918-5188d9774506/go.mod h1:nJRRM7Aa9XVvygr3W9k6xGF46RWzr2zxF/iGoAIfA/g=
github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg= github.com/filecoin-project/test-vectors/schema v0.0.5 h1:w3zHQhzM4pYxJDl21avXjOKBLF8egrvwUwjpT8TquDg=

View File

@ -5,7 +5,7 @@ import (
"strings" "strings"
"time" "time"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
) )
var log = logging.Logger("journal") var log = logging.Logger("journal")

View File

@ -8,7 +8,7 @@ import (
"strconv" "strconv"
"syscall" "syscall"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
) )
var log = logging.Logger("ulimit") var log = logging.Logger("ulimit")

View File

@ -18,7 +18,7 @@ import (
"github.com/filecoin-project/lotus/node/hello" "github.com/filecoin-project/lotus/node/hello"
"github.com/filecoin-project/lotus/system" "github.com/filecoin-project/lotus/system"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
ci "github.com/libp2p/go-libp2p-core/crypto" ci "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/host"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
@ -612,18 +612,21 @@ func Repo(r repo.Repo) Option {
If(cfg.Splitstore.HotStoreType == "badger", If(cfg.Splitstore.HotStoreType == "badger",
Override(new(dtypes.HotBlockstore), modules.BadgerHotBlockstore)), Override(new(dtypes.HotBlockstore), modules.BadgerHotBlockstore)),
Override(new(dtypes.SplitBlockstore), modules.SplitBlockstore(cfg)), Override(new(dtypes.SplitBlockstore), modules.SplitBlockstore(cfg)),
Override(new(dtypes.ChainBlockstore), modules.ChainSplitBlockstore), Override(new(dtypes.BasicChainBlockstore), modules.ChainSplitBlockstore),
Override(new(dtypes.StateBlockstore), modules.StateSplitBlockstore), Override(new(dtypes.BasicStateBlockstore), modules.StateSplitBlockstore),
Override(new(dtypes.BaseBlockstore), From(new(dtypes.SplitBlockstore))), Override(new(dtypes.BaseBlockstore), From(new(dtypes.SplitBlockstore))),
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.SplitBlockstore))), Override(new(dtypes.ExposedBlockstore), From(new(dtypes.SplitBlockstore))),
), ),
If(!cfg.EnableSplitstore, If(!cfg.EnableSplitstore,
Override(new(dtypes.ChainBlockstore), modules.ChainFlatBlockstore), Override(new(dtypes.BasicChainBlockstore), modules.ChainFlatBlockstore),
Override(new(dtypes.StateBlockstore), modules.StateFlatBlockstore), Override(new(dtypes.BasicStateBlockstore), modules.StateFlatBlockstore),
Override(new(dtypes.BaseBlockstore), From(new(dtypes.UniversalBlockstore))), Override(new(dtypes.BaseBlockstore), From(new(dtypes.UniversalBlockstore))),
Override(new(dtypes.ExposedBlockstore), From(new(dtypes.UniversalBlockstore))), Override(new(dtypes.ExposedBlockstore), From(new(dtypes.UniversalBlockstore))),
), ),
Override(new(dtypes.ChainBlockstore), From(new(dtypes.BasicChainBlockstore))),
Override(new(dtypes.StateBlockstore), From(new(dtypes.BasicStateBlockstore))),
If(os.Getenv("LOTUS_ENABLE_CHAINSTORE_FALLBACK") == "1", If(os.Getenv("LOTUS_ENABLE_CHAINSTORE_FALLBACK") == "1",
Override(new(dtypes.ChainBlockstore), modules.FallbackChainBlockstore), Override(new(dtypes.ChainBlockstore), modules.FallbackChainBlockstore),
Override(new(dtypes.StateBlockstore), modules.FallbackStateBlockstore), Override(new(dtypes.StateBlockstore), modules.FallbackStateBlockstore),

View File

@ -18,7 +18,7 @@ import (
offline "github.com/ipfs/go-ipfs-exchange-offline" offline "github.com/ipfs/go-ipfs-exchange-offline"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
ipld "github.com/ipfs/go-ipld-format" ipld "github.com/ipfs/go-ipld-format"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log/v2"
"github.com/ipfs/go-merkledag" "github.com/ipfs/go-merkledag"
"github.com/ipfs/go-path" "github.com/ipfs/go-path"
"github.com/ipfs/go-path/resolver" "github.com/ipfs/go-path/resolver"

View File

@ -94,11 +94,11 @@ func SplitBlockstore(cfg *config.Chainstore) func(lc fx.Lifecycle, r repo.Locked
} }
} }
func StateFlatBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.UniversalBlockstore) (dtypes.StateBlockstore, error) { func StateFlatBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.UniversalBlockstore) (dtypes.BasicStateBlockstore, error) {
return bs, nil return bs, nil
} }
func StateSplitBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.SplitBlockstore) (dtypes.StateBlockstore, error) { func StateSplitBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.SplitBlockstore) (dtypes.BasicStateBlockstore, error) {
return bs, nil return bs, nil
} }
@ -110,11 +110,11 @@ func ChainSplitBlockstore(_ fx.Lifecycle, _ helpers.MetricsCtx, bs dtypes.SplitB
return bs, nil return bs, nil
} }
func FallbackChainBlockstore(cbs dtypes.ChainBlockstore) dtypes.ChainBlockstore { func FallbackChainBlockstore(cbs dtypes.BasicChainBlockstore) dtypes.ChainBlockstore {
return &blockstore.FallbackStore{Blockstore: cbs} return &blockstore.FallbackStore{Blockstore: cbs}
} }
func FallbackStateBlockstore(sbs dtypes.StateBlockstore) dtypes.StateBlockstore { func FallbackStateBlockstore(sbs dtypes.BasicStateBlockstore) dtypes.StateBlockstore {
return &blockstore.FallbackStore{Blockstore: sbs} return &blockstore.FallbackStore{Blockstore: sbs}
} }

View File

@ -25,7 +25,6 @@ import (
smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network" smnet "github.com/filecoin-project/go-fil-markets/storagemarket/network"
"github.com/filecoin-project/go-multistore" "github.com/filecoin-project/go-multistore"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-storedcounter"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/ipfs/go-datastore/namespace" "github.com/ipfs/go-datastore/namespace"
"github.com/libp2p/go-libp2p-core/host" "github.com/libp2p/go-libp2p-core/host"
@ -210,8 +209,7 @@ func StorageClient(lc fx.Lifecycle, h host.Host, ibs dtypes.ClientBlockstore, md
func RetrievalClient(lc fx.Lifecycle, h host.Host, mds dtypes.ClientMultiDstore, dt dtypes.ClientDataTransfer, payAPI payapi.PaychAPI, resolver discovery.PeerResolver, ds dtypes.MetadataDS, chainAPI full.ChainAPI, stateAPI full.StateAPI, j journal.Journal) (retrievalmarket.RetrievalClient, error) { func RetrievalClient(lc fx.Lifecycle, h host.Host, mds dtypes.ClientMultiDstore, dt dtypes.ClientDataTransfer, payAPI payapi.PaychAPI, resolver discovery.PeerResolver, ds dtypes.MetadataDS, chainAPI full.ChainAPI, stateAPI full.StateAPI, j journal.Journal) (retrievalmarket.RetrievalClient, error) {
adapter := retrievaladapter.NewRetrievalClientNode(payAPI, chainAPI, stateAPI) adapter := retrievaladapter.NewRetrievalClientNode(payAPI, chainAPI, stateAPI)
network := rmnet.NewFromLibp2pHost(h) network := rmnet.NewFromLibp2pHost(h)
sc := storedcounter.New(ds, datastore.NewKey("/retr")) client, err := retrievalimpl.NewClient(network, mds, dt, adapter, resolver, namespace.Wrap(ds, datastore.NewKey("/retrievals/client")))
client, err := retrievalimpl.NewClient(network, mds, dt, adapter, resolver, namespace.Wrap(ds, datastore.NewKey("/retrievals/client")), sc)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -36,12 +36,20 @@ type (
// BaseBlockstore is something, coz DI // BaseBlockstore is something, coz DI
BaseBlockstore blockstore.Blockstore BaseBlockstore blockstore.Blockstore
// BasicChainBlockstore is like ChainBlockstore, but without the optional
// network fallback support
BasicChainBlockstore blockstore.Blockstore
// ChainBlockstore is a blockstore to store chain data (tipsets, blocks, // ChainBlockstore is a blockstore to store chain data (tipsets, blocks,
// messages). It is physically backed by the BareMonolithBlockstore, but it // messages). It is physically backed by the BareMonolithBlockstore, but it
// has a cache on top that is specially tuned for chain data access // has a cache on top that is specially tuned for chain data access
// patterns. // patterns.
ChainBlockstore blockstore.Blockstore ChainBlockstore blockstore.Blockstore
// BasicStateBlockstore is like StateBlockstore, but without the optional
// network fallback support
BasicStateBlockstore blockstore.Blockstore
// StateBlockstore is a blockstore to store state data (state tree). It is // StateBlockstore is a blockstore to store state data (state tree). It is
// physically backed by the BareMonolithBlockstore, but it has a cache on // physically backed by the BareMonolithBlockstore, but it has a cache on
// top that is specially tuned for state data access patterns. // top that is specially tuned for state data access patterns.

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# This script sets up an initial configuraiton for the lotus daemon and miner
# It will only run once.
GATE="$LOTUS_PATH"/date_initialized
# Don't init if already initialized.
if [ -f "GATE" ]; then
echo lotus already initialized.
exit 0
fi
# Not importing snapshot on butterflynet
#
# echo importing minimal snapshot
# lotus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car --halt-after-import
# Block future inits
date > "$GATE"

View File

@ -0,0 +1,20 @@
#!/usr/bin/env bash
# This script sets up an initial configuraiton for the lotus daemon and miner
# It will only run once.
GATE="$LOTUS_PATH"/date_initialized
# Don't init if already initialized.
if [ -f "GATE" ]; then
echo lotus already initialized.
exit 0
fi
# Not importing snapshot on nerpanet
#
# echo importing minimal snapshot
# lotus daemon --import-snapshot https://fil-chain-snapshots-fallback.s3.amazonaws.com/mainnet/minimal_finality_stateroots_latest.car --halt-after-import
# Block future inits
date > "$GATE"

View File

@ -60,7 +60,7 @@ systemctl daemon-reload
systemctl enable lotus-daemon systemctl enable lotus-daemon
# Setup firewall # Setup firewall
ufw enable yes | ufw enable
ufw default deny incoming ufw default deny incoming
ufw default allow outgoing ufw default allow outgoing
ufw allow ssh ufw allow ssh