introduce v9 actors and nv17

This commit is contained in:
Aayush 2022-09-06 11:49:29 -04:00
parent 29fff4fb06
commit 0efca4d266
262 changed files with 3930 additions and 1370 deletions

View File

@ -18,8 +18,8 @@ import (
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin/v8/market"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
abinetwork "github.com/filecoin-project/go-state-types/network"

View File

@ -8,7 +8,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
apitypes "github.com/filecoin-project/lotus/api/types"

View File

@ -18,7 +18,7 @@ import (
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v8/market"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
abinetwork "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors/builtin"

View File

@ -8,13 +8,12 @@ import (
"math"
"sort"
cid "github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors"
abi "github.com/filecoin-project/go-state-types/abi"
market "github.com/filecoin-project/go-state-types/builtin/v8/market"
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
cid "github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
xerrors "golang.org/x/xerrors"
)
var _ = xerrors.Errorf

View File

@ -10,6 +10,25 @@ import (
reflect "reflect"
time "time"
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
retrievalmarket "github.com/filecoin-project/go-fil-markets/retrievalmarket"
auth "github.com/filecoin-project/go-jsonrpc/auth"
abi "github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big"
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
miner "github.com/filecoin-project/go-state-types/builtin/v9/miner"
crypto "github.com/filecoin-project/go-state-types/crypto"
dline "github.com/filecoin-project/go-state-types/dline"
network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api"
apitypes "github.com/filecoin-project/lotus/api/types"
miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
types "github.com/filecoin-project/lotus/chain/types"
alerting "github.com/filecoin-project/lotus/journal/alerting"
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
imports "github.com/filecoin-project/lotus/node/repo/imports"
gomock "github.com/golang/mock/gomock"
uuid "github.com/google/uuid"
blocks "github.com/ipfs/go-block-format"
@ -18,27 +37,6 @@ import (
network0 "github.com/libp2p/go-libp2p/core/network"
peer "github.com/libp2p/go-libp2p/core/peer"
protocol "github.com/libp2p/go-libp2p/core/protocol"
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
retrievalmarket "github.com/filecoin-project/go-fil-markets/retrievalmarket"
auth "github.com/filecoin-project/go-jsonrpc/auth"
abi "github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big"
miner "github.com/filecoin-project/go-state-types/builtin/v8/miner"
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
crypto "github.com/filecoin-project/go-state-types/crypto"
dline "github.com/filecoin-project/go-state-types/dline"
network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api"
apitypes "github.com/filecoin-project/lotus/api/types"
miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
types "github.com/filecoin-project/lotus/chain/types"
alerting "github.com/filecoin-project/lotus/journal/alerting"
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
imports "github.com/filecoin-project/lotus/node/repo/imports"
)
// MockFullNode is a mock of FullNode interface.

View File

@ -7,15 +7,6 @@ import (
"encoding/json"
"time"
"github.com/google/uuid"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/metrics"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
@ -24,13 +15,12 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-jsonrpc/auth"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
abinetwork "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/proof"
apitypes "github.com/filecoin-project/lotus/api/types"
"github.com/filecoin-project/lotus/chain/actors/builtin"
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -42,6 +32,14 @@ import (
"github.com/filecoin-project/lotus/storage/sealer/fsutil"
"github.com/filecoin-project/lotus/storage/sealer/sealtasks"
"github.com/filecoin-project/lotus/storage/sealer/storiface"
"github.com/google/uuid"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/metrics"
"github.com/libp2p/go-libp2p/core/network"
"github.com/libp2p/go-libp2p/core/peer"
"github.com/libp2p/go-libp2p/core/protocol"
"golang.org/x/xerrors"
)
var ErrNotSupported = xerrors.New("method not supported")

View File

@ -14,8 +14,8 @@ import (
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
abinetwork "github.com/filecoin-project/go-state-types/network"

View File

@ -8,7 +8,7 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/dline"
abinetwork "github.com/filecoin-project/go-state-types/network"

View File

@ -5,23 +5,17 @@ package v0api
import (
"context"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/peer"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline"
abinetwork "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/api"
apitypes "github.com/filecoin-project/lotus/api/types"
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -29,6 +23,10 @@ import (
marketevents "github.com/filecoin-project/lotus/markets/loggers"
"github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/lotus/node/repo/imports"
blocks "github.com/ipfs/go-block-format"
"github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p/core/peer"
"golang.org/x/xerrors"
)
var ErrNotSupported = xerrors.New("method not supported")

View File

@ -9,15 +9,6 @@ import (
reflect "reflect"
time "time"
gomock "github.com/golang/mock/gomock"
uuid "github.com/google/uuid"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
metrics "github.com/libp2p/go-libp2p/core/metrics"
network0 "github.com/libp2p/go-libp2p/core/network"
peer "github.com/libp2p/go-libp2p/core/peer"
protocol "github.com/libp2p/go-libp2p/core/protocol"
address "github.com/filecoin-project/go-address"
bitfield "github.com/filecoin-project/go-bitfield"
datatransfer "github.com/filecoin-project/go-data-transfer"
@ -26,12 +17,11 @@ import (
auth "github.com/filecoin-project/go-jsonrpc/auth"
abi "github.com/filecoin-project/go-state-types/abi"
big "github.com/filecoin-project/go-state-types/big"
miner "github.com/filecoin-project/go-state-types/builtin/v8/miner"
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
miner "github.com/filecoin-project/go-state-types/builtin/v9/miner"
crypto "github.com/filecoin-project/go-state-types/crypto"
dline "github.com/filecoin-project/go-state-types/dline"
network "github.com/filecoin-project/go-state-types/network"
api "github.com/filecoin-project/lotus/api"
apitypes "github.com/filecoin-project/lotus/api/types"
v0api "github.com/filecoin-project/lotus/api/v0api"
@ -41,6 +31,14 @@ import (
marketevents "github.com/filecoin-project/lotus/markets/loggers"
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
imports "github.com/filecoin-project/lotus/node/repo/imports"
gomock "github.com/golang/mock/gomock"
uuid "github.com/google/uuid"
blocks "github.com/ipfs/go-block-format"
cid "github.com/ipfs/go-cid"
metrics "github.com/libp2p/go-libp2p/core/metrics"
network0 "github.com/libp2p/go-libp2p/core/network"
peer "github.com/libp2p/go-libp2p/core/peer"
protocol "github.com/libp2p/go-libp2p/core/protocol"
)
// MockFullNode is a mock of FullNode interface.

View File

@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/api"

View File

@ -18,6 +18,8 @@ import (
"github.com/ipld/go-car"
"golang.org/x/xerrors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/blockstore"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
@ -28,14 +30,14 @@ var embeddedBuiltinActorReleases embed.FS
func init() {
if BundleOverrides == nil {
BundleOverrides = make(map[actors.Version]string)
BundleOverrides = make(map[actorstypes.Version]string)
}
for _, av := range actors.Versions {
path := os.Getenv(fmt.Sprintf("LOTUS_BUILTIN_ACTORS_V%d_BUNDLE", av))
if path == "" {
continue
}
BundleOverrides[actors.Version(av)] = path
BundleOverrides[actorstypes.Version(av)] = path
}
if err := loadManifests(NetworkBundle); err != nil {
panic(err)
@ -55,7 +57,7 @@ func UseNetworkBundle(netw string) error {
}
func loadManifests(netw string) error {
overridden := make(map[actors.Version]struct{})
overridden := make(map[actorstypes.Version]struct{})
var newMetadata []*BuiltinActorsMetadata
// First, prefer overrides.
for av, path := range BundleOverrides {
@ -94,7 +96,7 @@ func loadManifests(netw string) error {
type BuiltinActorsMetadata struct {
Network string
Version actors.Version
Version actorstypes.Version
ManifestCid cid.Cid
Actors map[string]cid.Cid
}
@ -182,7 +184,7 @@ func readEmbeddedBuiltinActorsMetadata(bundle string) ([]*BuiltinActorsMetadata,
}
bundles = append(bundles, &BuiltinActorsMetadata{
Network: name,
Version: actors.Version(version),
Version: actorstypes.Version(version),
ManifestCid: root,
Actors: actorCids,
})
@ -229,7 +231,7 @@ func readBundleManifest(r io.Reader) (cid.Cid, map[string]cid.Cid, error) {
}
// GetEmbeddedBuiltinActorsBundle returns the builtin-actors bundle for the given actors version.
func GetEmbeddedBuiltinActorsBundle(version actors.Version) ([]byte, bool) {
func GetEmbeddedBuiltinActorsBundle(version actorstypes.Version) ([]byte, bool) {
fi, err := embeddedBuiltinActorReleases.Open(fmt.Sprintf("actors/v%d.tar.zst", version))
if err != nil {
return nil, false

View File

@ -5,6 +5,8 @@ import (
"github.com/stretchr/testify/require"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors"
)
@ -19,16 +21,16 @@ func TestEmbeddedMetadata(t *testing.T) {
// Test that we're registering the manifest correctly.
func TestRegistration(t *testing.T) {
manifestCid, found := actors.GetManifest(actors.Version8)
manifestCid, found := actors.GetManifest(actorstypes.Version8)
require.True(t, found)
require.True(t, manifestCid.Defined())
for _, key := range actors.GetBuiltinActorsKeys() {
actorCid, found := actors.GetActorCodeID(actors.Version8, key)
actorCid, found := actors.GetActorCodeID(actorstypes.Version8, key)
require.True(t, found)
name, version, found := actors.GetActorMetaByCode(actorCid)
require.True(t, found)
require.Equal(t, actors.Version8, version)
require.Equal(t, actorstypes.Version8, version)
require.Equal(t, key, name)
}
}

View File

@ -10,9 +10,9 @@ import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
@ -20,7 +20,7 @@ const BootstrappersFile = ""
const GenesisFile = ""
var NetworkBundle = "devnet"
var BundleOverrides map[actors.Version]string
var BundleOverrides map[actorstypes.Version]string
const GenesisNetworkVersion = network.Version16
@ -56,6 +56,8 @@ var UpgradeOhSnapHeight = abi.ChainEpoch(-18)
var UpgradeSkyrHeight = abi.ChainEpoch(-19)
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
}
@ -107,6 +109,7 @@ func init() {
UpgradeChocolateHeight = getUpgradeHeight("LOTUS_CHOCOLATE_HEIGHT", UpgradeChocolateHeight)
UpgradeOhSnapHeight = getUpgradeHeight("LOTUS_OHSNAP_HEIGHT", UpgradeOhSnapHeight)
UpgradeSkyrHeight = getUpgradeHeight("LOTUS_SKYR_HEIGHT", UpgradeSkyrHeight)
UpgradeV17Height = getUpgradeHeight("LOTUS_V17_HEIGHT", UpgradeV17Height)
BuildType |= Build2k

View File

@ -8,10 +8,10 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
@ -19,10 +19,10 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
}
const GenesisNetworkVersion = network.Version15
const GenesisNetworkVersion = network.Version16
var NetworkBundle = "butterflynet"
var BundleOverrides map[actors.Version]string
var BundleOverrides map[actorstypes.Version]string
const BootstrappersFile = "butterflynet.pi"
const GenesisFile = "butterflynet.car"
@ -47,10 +47,9 @@ const UpgradeNorwegianHeight = -14
const UpgradeTurboHeight = -15
const UpgradeHyperdriveHeight = -16
const UpgradeChocolateHeight = -17
const UpgradeOhSnapHeight = -18
const UpgradeSkyrHeight = abi.ChainEpoch(50)
const UpgradeSkyrHeight = -19
const UpgradeV17Height = abi.ChainEpoch(99999999999999)
var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg512MiBV1,

View File

@ -8,10 +8,10 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
@ -22,7 +22,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
const GenesisNetworkVersion = network.Version0
var NetworkBundle = "calibrationnet"
var BundleOverrides map[actors.Version]string
var BundleOverrides map[actorstypes.Version]string
const BootstrappersFile = "calibnet.pi"
const GenesisFile = "calibnet.car"
@ -66,6 +66,8 @@ const UpgradeOhSnapHeight = 682006
// 2022-06-16T17:30:00Z
const UpgradeSkyrHeight = 1044660
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg32GiBV1,
abi.RegisteredSealProof_StackedDrg64GiBV1,

View File

@ -11,20 +11,20 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
var NetworkBundle = "caterpillarnet"
var BundleOverrides map[actors.Version]string
var BundleOverrides map[actorstypes.Version]string
const BootstrappersFile = "interopnet.pi"
const GenesisFile = "interopnet.car"
const GenesisNetworkVersion = network.Version15
const GenesisNetworkVersion = network.Version16
var UpgradeBreezeHeight = abi.ChainEpoch(-1)
@ -34,26 +34,22 @@ var UpgradeSmokeHeight = abi.ChainEpoch(-1)
var UpgradeIgnitionHeight = abi.ChainEpoch(-2)
var UpgradeRefuelHeight = abi.ChainEpoch(-3)
var UpgradeTapeHeight = abi.ChainEpoch(-4)
var UpgradeAssemblyHeight = abi.ChainEpoch(-5)
var UpgradeLiftoffHeight = abi.ChainEpoch(-6)
var UpgradeKumquatHeight = abi.ChainEpoch(-7)
var UpgradeCalicoHeight = abi.ChainEpoch(-9)
var UpgradePersianHeight = abi.ChainEpoch(-10)
var UpgradeOrangeHeight = abi.ChainEpoch(-11)
var UpgradeClausHeight = abi.ChainEpoch(-12)
var UpgradeTrustHeight = abi.ChainEpoch(-13)
var UpgradeNorwegianHeight = abi.ChainEpoch(-14)
var UpgradeTurboHeight = abi.ChainEpoch(-15)
var UpgradeHyperdriveHeight = abi.ChainEpoch(-16)
var UpgradeChocolateHeight = abi.ChainEpoch(-17)
var UpgradeOhSnapHeight = abi.ChainEpoch(-18)
var UpgradeSkyrHeight = abi.ChainEpoch(100)
var UpgradeSkyrHeight = abi.ChainEpoch(-19)
const UpgradeV17Height = abi.ChainEpoch(99999999999999)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
@ -107,6 +103,7 @@ func init() {
UpgradeChocolateHeight = getUpgradeHeight("LOTUS_CHOCOLATE_HEIGHT", UpgradeChocolateHeight)
UpgradeOhSnapHeight = getUpgradeHeight("LOTUS_OHSNAP_HEIGHT", UpgradeOhSnapHeight)
UpgradeSkyrHeight = getUpgradeHeight("LOTUS_SKYR_HEIGHT", UpgradeSkyrHeight)
UpgradeV17Height = getUpgradeHeight("LOTUS_V17_HEIGHT", UpgradeV17Height)
BuildType |= BuildInteropnet
SetAddressNetwork(address.Testnet)

View File

@ -9,10 +9,9 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
)
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
@ -23,7 +22,7 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
var NetworkBundle = "mainnet"
// NOTE: DO NOT change this unless you REALLY know what you're doing. This is consensus critical.
var BundleOverrides map[actors.Version]string
var BundleOverrides map[actorstypes.Version]string
const GenesisNetworkVersion = network.Version0
@ -77,7 +76,9 @@ const UpgradeChocolateHeight = 1231620
const UpgradeOhSnapHeight = 1594680
// 2022-07-06T14:00:00Z
var UpgradeSkyrHeight = abi.ChainEpoch(1960320)
const UpgradeSkyrHeight = 1960320
var UpgradeV17Height = abi.ChainEpoch(99999999999999)
var SupportedProofTypes = []abi.RegisteredSealProof{
abi.RegisteredSealProof_StackedDrg32GiBV1,
@ -92,8 +93,8 @@ func init() {
SetAddressNetwork(address.Mainnet)
}
if os.Getenv("LOTUS_DISABLE_SKYR") == "1" {
UpgradeSkyrHeight = math.MaxInt64
if os.Getenv("LOTUS_DISABLE_V17") == "1" {
UpgradeV17Height = math.MaxInt64
}
Devnet = false

View File

@ -33,7 +33,7 @@ const NewestNetworkVersion = network.Version{{.latestNetworkVersion}}
/* inline-gen start */
const NewestNetworkVersion = network.Version16
const NewestNetworkVersion = network.Version17
/* inline-gen end */

View File

@ -13,10 +13,10 @@ import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
)
@ -107,6 +107,7 @@ var (
UpgradeChocolateHeight abi.ChainEpoch = -16
UpgradeOhSnapHeight abi.ChainEpoch = -17
UpgradeSkyrHeight abi.ChainEpoch = -18
UpgradeV17Height abi.ChainEpoch = -19
DrandSchedule = map[abi.ChainEpoch]DrandEnum{
0: DrandMainnet,
@ -114,10 +115,10 @@ var (
GenesisNetworkVersion = network.Version0
NetworkBundle = "devnet"
BundleOverrides map[actors.Version]string
BundleOverrides map[actorstypes.Version]string
NewestNetworkVersion = network.Version15
ActorUpgradeNetworkVersion = network.Version15
NewestNetworkVersion = network.Version16
ActorUpgradeNetworkVersion = network.Version16
Devnet = true
ZeroAddress = MustParseAddress("f3yaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaby2smx7a")

View File

@ -4,6 +4,7 @@ import (
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
@ -14,10 +15,10 @@ import (
)
// GetActorCodeID looks up a builtin actor's code CID by actor version and canonical actor name.
func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
func GetActorCodeID(av actorstypes.Version, name string) (cid.Cid, bool) {
// Actors V8 and above
if av >= Version8 {
if av >= actorstypes.Version8 {
if cids, ok := GetActorCodeIDsFromManifest(av); ok {
c, ok := cids[name]
return c, ok
@ -30,275 +31,275 @@ func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
case AccountKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.AccountActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.AccountActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.AccountActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.AccountActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.AccountActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.AccountActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.AccountActorCodeID, true
}
case CronKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.CronActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.CronActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.CronActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.CronActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.CronActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.CronActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.CronActorCodeID, true
}
case InitKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.InitActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.InitActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.InitActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.InitActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.InitActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.InitActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.InitActorCodeID, true
}
case MarketKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.StorageMarketActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.StorageMarketActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.StorageMarketActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.StorageMarketActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.StorageMarketActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.StorageMarketActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.StorageMarketActorCodeID, true
}
case MinerKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.StorageMinerActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.StorageMinerActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.StorageMinerActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.StorageMinerActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.StorageMinerActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.StorageMinerActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.StorageMinerActorCodeID, true
}
case MultisigKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.MultisigActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.MultisigActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.MultisigActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.MultisigActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.MultisigActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.MultisigActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.MultisigActorCodeID, true
}
case PaychKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.PaymentChannelActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.PaymentChannelActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.PaymentChannelActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.PaymentChannelActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.PaymentChannelActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.PaymentChannelActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.PaymentChannelActorCodeID, true
}
case PowerKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.StoragePowerActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.StoragePowerActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.StoragePowerActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.StoragePowerActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.StoragePowerActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.StoragePowerActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.StoragePowerActorCodeID, true
}
case RewardKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.RewardActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.RewardActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.RewardActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.RewardActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.RewardActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.RewardActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.RewardActorCodeID, true
}
case SystemKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.SystemActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.SystemActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.SystemActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.SystemActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.SystemActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.SystemActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.SystemActorCodeID, true
}
case VerifregKey:
switch av {
case Version0:
case actorstypes.Version0:
return builtin0.VerifiedRegistryActorCodeID, true
case Version2:
case actorstypes.Version2:
return builtin2.VerifiedRegistryActorCodeID, true
case Version3:
case actorstypes.Version3:
return builtin3.VerifiedRegistryActorCodeID, true
case Version4:
case actorstypes.Version4:
return builtin4.VerifiedRegistryActorCodeID, true
case Version5:
case actorstypes.Version5:
return builtin5.VerifiedRegistryActorCodeID, true
case Version6:
case actorstypes.Version6:
return builtin6.VerifiedRegistryActorCodeID, true
case Version7:
case actorstypes.Version7:
return builtin7.VerifiedRegistryActorCodeID, true
}
}
@ -307,7 +308,7 @@ func GetActorCodeID(av Version, name string) (cid.Cid, bool) {
}
// GetActorCodeIDs looks up all builtin actor's code CIDs by actor version.
func GetActorCodeIDs(av Version) (map[string]cid.Cid, error) {
func GetActorCodeIDs(av actorstypes.Version) (map[string]cid.Cid, error) {
cids, ok := GetActorCodeIDsFromManifest(av)
if ok {
return cids, nil

View File

@ -44,6 +44,11 @@ func main() {
fmt.Println(err)
return
}
if err := generateRegistry("chain/actors/builtin/registry.go"); err != nil {
fmt.Println(err)
return
}
}
func generateAdapters() error {
@ -108,8 +113,9 @@ func generateState(actDir string) error {
var b bytes.Buffer
err := tpl.Execute(&b, map[string]interface{}{
"v": version,
"import": getVersionImports()[version],
"v": version,
"import": getVersionImports()[version],
"latestVersion": lotusactors.LatestVersion,
})
if err != nil {
return err
@ -139,8 +145,9 @@ func generateMessages(actDir string) error {
var b bytes.Buffer
err := tpl.Execute(&b, map[string]interface{}{
"v": version,
"import": getVersionImports()[version],
"v": version,
"import": getVersionImports()[version],
"latestVersion": lotusactors.LatestVersion,
})
if err != nil {
return err
@ -216,6 +223,36 @@ func generateBuiltin(builtinPath string) error {
return nil
}
func generateRegistry(registryPath string) error {
bf, err := ioutil.ReadFile(registryPath + ".template")
if err != nil {
if os.IsNotExist(err) {
return nil // skip
}
return xerrors.Errorf("loading builtin template file: %w", err)
}
tpl := template.Must(template.New("").Funcs(template.FuncMap{
"import": func(v int) string { return getVersionImports()[v] },
}).Parse(string(bf)))
var b bytes.Buffer
err = tpl.Execute(&b, map[string]interface{}{
"versions": lotusactors.Versions,
})
if err != nil {
return err
}
if err := ioutil.WriteFile(registryPath, b.Bytes(), 0666); err != nil {
return err
}
return nil
}
func getVersionImports() map[int]string {
versionImports := make(map[int]string, lotusactors.LatestVersion)
for _, v := range lotusactors.Versions {

View File

@ -1,25 +1,34 @@
package account
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
)
var Methods = builtin8.MethodsAccount
var Methods = builtin9.MethodsAccount
func Load(store adt.Store, act *types.Actor) (State, error) {
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
@ -29,9 +38,12 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
case actors.Version8:
case actorstypes.Version8:
return load8(store, act.Head)
case actorstypes.Version9:
return load9(store, act.Head)
}
}
@ -63,33 +75,36 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version, addr address.Address) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (State, error) {
switch av {
case actors.Version0:
case actorstypes.Version0:
return make0(store, addr)
case actors.Version2:
case actorstypes.Version2:
return make2(store, addr)
case actors.Version3:
case actorstypes.Version3:
return make3(store, addr)
case actors.Version4:
case actorstypes.Version4:
return make4(store, addr)
case actors.Version5:
case actorstypes.Version5:
return make5(store, addr)
case actors.Version6:
case actorstypes.Version6:
return make6(store, addr)
case actors.Version7:
case actorstypes.Version7:
return make7(store, addr)
case actors.Version8:
case actorstypes.Version8:
return make8(store, addr)
case actorstypes.Version9:
return make9(store, addr)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}

View File

@ -1,6 +1,7 @@
package account
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
@ -9,13 +10,13 @@ import (
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
{{range .versions}}
{{if (le . 7)}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
{{else}}
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
{{end}}
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
)
var Methods = builtin{{.latestVersion}}.MethodsAccount
@ -29,7 +30,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
{{range .versions}}
{{if (ge . 8)}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
{{end}}
@ -48,10 +49,10 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version, addr address.Address) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version, addr address.Address) (State, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return make{{.}}(store, addr)
{{end}}
}

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account0 "github.com/filecoin-project/specs-actors/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account0 "github.com/filecoin-project/specs-actors/actors/builtin/account"
)
var _ State = (*state0)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/account"
)
var _ State = (*state2)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/account"
)
var _ State = (*state3)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/account"
)
var _ State = (*state4)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/account"
)
var _ State = (*state5)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/account"
)
var _ State = (*state6)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/account"
)
var _ State = (*state7)(nil)

View File

@ -1,12 +1,12 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
"github.com/filecoin-project/lotus/chain/actors/adt"
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
)
var _ State = (*state8)(nil)

View File

@ -0,0 +1,40 @@
package account
import (
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
account9 "github.com/filecoin-project/go-state-types/builtin/v9/account"
)
var _ State = (*state9)(nil)
func load9(store adt.Store, root cid.Cid) (State, error) {
out := state9{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make9(store adt.Store, addr address.Address) (State, error) {
out := state9{store: store}
out.State = account9.State{Address: addr}
return &out, nil
}
type state9 struct {
account9.State
store adt.Store
}
func (s *state9) PubkeyAddress() (address.Address, error) {
return s.Address, nil
}
func (s *state9) GetState() interface{} {
return &s.State
}

View File

@ -3,24 +3,31 @@ package builtin
import (
"fmt"
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/builtin"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
"github.com/filecoin-project/go-state-types/proof"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
miner9 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
)
var SystemActorAddr = builtin.SystemActorAddr
@ -53,7 +60,7 @@ type PoStProof = proof.PoStProof
type FilterEstimate = smoothingtypes.FilterEstimate
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
return miner8.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
return miner9.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
}
func ActorNameByCode(c cid.Cid) string {
@ -84,9 +91,6 @@ func ActorNameByCode(c cid.Cid) string {
case builtin7.IsBuiltinActor(c):
return builtin7.ActorNameByCode(c)
case builtin8.IsBuiltinActor(c):
return builtin8.ActorNameByCode(c)
default:
return "<unknown>"
}

View File

@ -7,7 +7,9 @@ import (
"github.com/ipfs/go-cid"
{{range .versions}}
{{if (le . 7)}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
{{end}}
{{end}}
"github.com/filecoin-project/go-state-types/abi"
@ -60,8 +62,10 @@ func ActorNameByCode(c cid.Cid) string {
switch {
{{range .versions}}
{{if (le . 7)}}
case builtin{{.}}.IsBuiltinActor(c):
return builtin{{.}}.ActorNameByCode(c)
{{end}}
{{end}}
default:
return "<unknown>"

View File

@ -1,6 +1,7 @@
package cron
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"golang.org/x/xerrors"
@ -9,10 +10,9 @@ import (
{{range .versions}}
{{if (le . 7)}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
{{else}}
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
{{end}}
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -24,7 +24,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
{{range .versions}}
{{if (ge . 8)}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
{{end}}
@ -43,10 +43,10 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return make{{.}}(store)
{{end}}
}

View File

@ -1,20 +1,27 @@
package cron
import (
"golang.org/x/xerrors"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
"golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -25,9 +32,12 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
case actors.Version8:
case actorstypes.Version8:
return load8(store, act.Head)
case actorstypes.Version9:
return load9(store, act.Head)
}
}
@ -59,40 +69,43 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
switch av {
case actors.Version0:
case actorstypes.Version0:
return make0(store)
case actors.Version2:
case actorstypes.Version2:
return make2(store)
case actors.Version3:
case actorstypes.Version3:
return make3(store)
case actors.Version4:
case actorstypes.Version4:
return make4(store)
case actors.Version5:
case actorstypes.Version5:
return make5(store)
case actors.Version6:
case actorstypes.Version6:
return make6(store)
case actors.Version7:
case actorstypes.Version7:
return make7(store)
case actors.Version8:
case actorstypes.Version8:
return make8(store)
case actorstypes.Version9:
return make9(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
var (
Address = builtin8.CronActorAddr
Methods = builtin8.MethodsCron
Address = builtin9.CronActorAddr
Methods = builtin9.MethodsCron
)
type State interface {

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron"
)
var _ State = (*state0)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/cron"
)
var _ State = (*state2)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/cron"
)
var _ State = (*state3)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/cron"
)
var _ State = (*state4)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/cron"
)
var _ State = (*state5)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/cron"
)
var _ State = (*state6)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/cron"
)
var _ State = (*state7)(nil)

View File

@ -3,9 +3,9 @@ package cron
import (
"github.com/ipfs/go-cid"
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
)
var _ State = (*state8)(nil)

View File

@ -0,0 +1,35 @@
package cron
import (
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors/adt"
cron9 "github.com/filecoin-project/go-state-types/builtin/v9/cron"
)
var _ State = (*state9)(nil)
func load9(store adt.Store, root cid.Cid) (State, error) {
out := state9{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make9(store adt.Store) (State, error) {
out := state9{store: store}
out.State = *cron9.ConstructState(cron9.BuiltInEntries())
return &out, nil
}
type state9 struct {
cron9.State
store adt.Store
}
func (s *state9) GetState() interface{} {
return &s.State
}

View File

@ -1,6 +1,7 @@
package init
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
@ -15,10 +16,9 @@ import (
{{range .versions}}
{{if (le . 7)}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
{{else}}
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
{{end}}
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
)
var (
@ -35,7 +35,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
{{range .versions}}
{{if (ge . 8)}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
{{end}}
@ -54,10 +54,10 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version, networkName string) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version, networkName string) (State, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return make{{.}}(store, networkName)
{{end}}
}

View File

@ -1,30 +1,39 @@
package init
import (
"github.com/ipfs/go-cid"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/lotus/chain/actors"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/go-state-types/cbor"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
)
var (
Address = builtin8.InitActorAddr
Methods = builtin8.MethodsInit
Address = builtin9.InitActorAddr
Methods = builtin9.MethodsInit
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -35,9 +44,12 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
case actors.Version8:
case actorstypes.Version8:
return load8(store, act.Head)
case actorstypes.Version9:
return load9(store, act.Head)
}
}
@ -69,33 +81,36 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version, networkName string) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version, networkName string) (State, error) {
switch av {
case actors.Version0:
case actorstypes.Version0:
return make0(store, networkName)
case actors.Version2:
case actorstypes.Version2:
return make2(store, networkName)
case actors.Version3:
case actorstypes.Version3:
return make3(store, networkName)
case actors.Version4:
case actorstypes.Version4:
return make4(store, networkName)
case actors.Version5:
case actorstypes.Version5:
return make5(store, networkName)
case actors.Version6:
case actorstypes.Version6:
return make6(store, networkName)
case actors.Version7:
case actorstypes.Version7:
return make7(store, networkName)
case actors.Version8:
case actorstypes.Version8:
return make8(store, networkName)
case actorstypes.Version9:
return make9(store, networkName)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}

View File

@ -1,17 +1,17 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)

View File

@ -1,17 +1,17 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)

View File

@ -1,18 +1,19 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
)
var _ State = (*state3)(nil)

View File

@ -1,18 +1,19 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
)
var _ State = (*state4)(nil)

View File

@ -1,18 +1,19 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
)
var _ State = (*state5)(nil)

View File

@ -1,18 +1,19 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
)
var _ State = (*state6)(nil)

View File

@ -1,18 +1,19 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
)
var _ State = (*state7)(nil)

View File

@ -1,18 +1,18 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
)
var _ State = (*state8)(nil)

View File

@ -0,0 +1,113 @@
package init
import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/node/modules/dtypes"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
)
var _ State = (*state9)(nil)
func load9(store adt.Store, root cid.Cid) (State, error) {
out := state9{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make9(store adt.Store, networkName string) (State, error) {
out := state9{store: store}
s, err := init9.ConstructState(store, networkName)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state9 struct {
init9.State
store adt.Store
}
func (s *state9) ResolveAddress(address address.Address) (address.Address, bool, error) {
return s.State.ResolveAddress(s.store, address)
}
func (s *state9) MapAddressToNewID(address address.Address) (address.Address, error) {
return s.State.MapAddressToNewID(s.store, address)
}
func (s *state9) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
addrs, err := adt9.AsMap(s.store, s.State.AddressMap, builtin9.DefaultHamtBitwidth)
if err != nil {
return err
}
var actorID cbg.CborInt
return addrs.ForEach(&actorID, func(key string) error {
addr, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(abi.ActorID(actorID), addr)
})
}
func (s *state9) NetworkName() (dtypes.NetworkName, error) {
return dtypes.NetworkName(s.State.NetworkName), nil
}
func (s *state9) SetNetworkName(name string) error {
s.State.NetworkName = name
return nil
}
func (s *state9) SetNextID(id abi.ActorID) error {
s.State.NextID = id
return nil
}
func (s *state9) Remove(addrs ...address.Address) (err error) {
m, err := adt9.AsMap(s.store, s.State.AddressMap, builtin9.DefaultHamtBitwidth)
if err != nil {
return err
}
for _, addr := range addrs {
if err = m.Delete(abi.AddrKey(addr)); err != nil {
return xerrors.Errorf("failed to delete entry for address: %s; err: %w", addr, err)
}
}
amr, err := m.Root()
if err != nil {
return xerrors.Errorf("failed to get address map root: %w", err)
}
s.State.AddressMap = amr
return nil
}
func (s *state9) SetAddressMap(mcid cid.Cid) error {
s.State.AddressMap = mcid
return nil
}
func (s *state9) AddressMap() (adt.Map, error) {
return adt9.AsMap(s.store, s.State.AddressMap, builtin9.DefaultHamtBitwidth)
}
func (s *state9) GetState() interface{} {
return &s.State
}

View File

@ -1,7 +1,8 @@
package market
import (
"unicode/utf8"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"unicode/utf8"
"github.com/filecoin-project/go-state-types/network"
"golang.org/x/xerrors"
@ -12,23 +13,23 @@ import (
"github.com/filecoin-project/go-state-types/cbor"
cbg "github.com/whyrusleeping/cbor-gen"
market{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin{{import .latestVersion}}market"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
{{range .versions}}
{{if (le . 7)}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
{{else}}
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
{{end}}
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
)
var (
Address = builtin{{.latestVersion}}.StorageMarketActorAddr
Methods = builtin{{.latestVersion}}.MethodsMarket
Address = builtintypes.StorageMarketActorAddr
Methods = builtintypes.MethodsMarket
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -40,7 +41,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
{{range .versions}}
{{if (ge . 8)}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
{{end}}
@ -59,10 +60,10 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return make{{.}}(store)
{{end}}
}
@ -100,11 +101,11 @@ type DealStates interface {
}
type DealProposals interface {
ForEach(cb func(id abi.DealID, dp market{{.latestVersion}}.DealProposal) error) error
Get(id abi.DealID) (*market{{.latestVersion}}.DealProposal, bool, error)
ForEach(cb func(id abi.DealID, dp markettypes.DealProposal) error) error
Get(id abi.DealID) (*markettypes.DealProposal, bool, error)
array() adt.Array
decode(*cbg.Deferred) (*market{{.latestVersion}}.DealProposal, error)
decode(*cbg.Deferred) (*markettypes.DealProposal, error)
}
@ -115,23 +116,24 @@ type PublishStorageDealsReturn interface {
}
func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStorageDealsReturn, error) {
av, err := actors.VersionForNetwork(nv)
av, err := actorstypes.VersionForNetwork(nv)
if err != nil {
return nil, err
}
switch av {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return decodePublishStorageDealsReturn{{.}}(b)
{{end}}
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
type DealProposal = market{{.latestVersion}}.DealProposal
type DealProposal = markettypes.DealProposal
type DealLabel = markettypes.DealLabel
type DealState = market{{.latestVersion}}.DealState
type DealState = markettypes.DealState
type DealStateChanges struct {
Added []DealIDState
@ -158,7 +160,7 @@ type DealProposalChanges struct {
type ProposalIDState struct {
ID abi.DealID
Proposal market{{.latestVersion}}.DealProposal
Proposal markettypes.DealProposal
}
func EmptyDealState() *DealState {
@ -170,7 +172,7 @@ func EmptyDealState() *DealState {
}
// returns the earned fees and pending fees for a given deal
func GetDealFees(deal market{{.latestVersion}}.DealProposal, height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
func GetDealFees(deal markettypes.DealProposal, height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
@ -185,14 +187,14 @@ func GetDealFees(deal market{{.latestVersion}}.DealProposal, height abi.ChainEpo
return ef, big.Sub(tf, ef)
}
func IsDealActive(state market{{.latestVersion}}.DealState) bool {
func IsDealActive(state markettypes.DealState) bool {
return state.SectorStartEpoch > -1 && state.SlashEpoch == -1
}
func labelFromGoString(s string) (market{{.latestVersion}}.DealLabel, error) {
func labelFromGoString(s string) (markettypes.DealLabel, error) {
if utf8.ValidString(s) {
return market{{.latestVersion}}.NewLabelFromString(s)
return markettypes.NewLabelFromString(s)
} else {
return market{{.latestVersion}}.NewLabelFromBytes([]byte(s))
return markettypes.NewLabelFromBytes([]byte(s))
}
}

View File

@ -1,34 +1,44 @@
package market
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"unicode/utf8"
cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-state-types/network"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/network"
cbg "github.com/whyrusleeping/cbor-gen"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
)
var (
Address = builtin8.StorageMarketActorAddr
Methods = builtin8.MethodsMarket
Address = builtintypes.StorageMarketActorAddr
Methods = builtintypes.MethodsMarket
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -39,9 +49,12 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
case actors.Version8:
case actorstypes.Version8:
return load8(store, act.Head)
case actorstypes.Version9:
return load9(store, act.Head)
}
}
@ -73,33 +86,36 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version) (State, error) {
switch av {
case actors.Version0:
case actorstypes.Version0:
return make0(store)
case actors.Version2:
case actorstypes.Version2:
return make2(store)
case actors.Version3:
case actorstypes.Version3:
return make3(store)
case actors.Version4:
case actorstypes.Version4:
return make4(store)
case actors.Version5:
case actorstypes.Version5:
return make5(store)
case actors.Version6:
case actorstypes.Version6:
return make6(store)
case actors.Version7:
case actorstypes.Version7:
return make7(store)
case actors.Version8:
case actorstypes.Version8:
return make8(store)
case actorstypes.Version9:
return make9(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -135,11 +151,11 @@ type DealStates interface {
}
type DealProposals interface {
ForEach(cb func(id abi.DealID, dp market8.DealProposal) error) error
Get(id abi.DealID) (*market8.DealProposal, bool, error)
ForEach(cb func(id abi.DealID, dp markettypes.DealProposal) error) error
Get(id abi.DealID) (*markettypes.DealProposal, bool, error)
array() adt.Array
decode(*cbg.Deferred) (*market8.DealProposal, error)
decode(*cbg.Deferred) (*markettypes.DealProposal, error)
}
type PublishStorageDealsReturn interface {
@ -149,44 +165,48 @@ type PublishStorageDealsReturn interface {
}
func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStorageDealsReturn, error) {
av, err := actors.VersionForNetwork(nv)
av, err := actorstypes.VersionForNetwork(nv)
if err != nil {
return nil, err
}
switch av {
case actors.Version0:
case actorstypes.Version0:
return decodePublishStorageDealsReturn0(b)
case actors.Version2:
case actorstypes.Version2:
return decodePublishStorageDealsReturn2(b)
case actors.Version3:
case actorstypes.Version3:
return decodePublishStorageDealsReturn3(b)
case actors.Version4:
case actorstypes.Version4:
return decodePublishStorageDealsReturn4(b)
case actors.Version5:
case actorstypes.Version5:
return decodePublishStorageDealsReturn5(b)
case actors.Version6:
case actorstypes.Version6:
return decodePublishStorageDealsReturn6(b)
case actors.Version7:
case actorstypes.Version7:
return decodePublishStorageDealsReturn7(b)
case actors.Version8:
case actorstypes.Version8:
return decodePublishStorageDealsReturn8(b)
case actorstypes.Version9:
return decodePublishStorageDealsReturn9(b)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
type DealProposal = market8.DealProposal
type DealProposal = markettypes.DealProposal
type DealLabel = markettypes.DealLabel
type DealState = market8.DealState
type DealState = markettypes.DealState
type DealStateChanges struct {
Added []DealIDState
@ -213,7 +233,7 @@ type DealProposalChanges struct {
type ProposalIDState struct {
ID abi.DealID
Proposal market8.DealProposal
Proposal markettypes.DealProposal
}
func EmptyDealState() *DealState {
@ -225,7 +245,7 @@ func EmptyDealState() *DealState {
}
// returns the earned fees and pending fees for a given deal
func GetDealFees(deal market8.DealProposal, height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
func GetDealFees(deal markettypes.DealProposal, height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
@ -240,14 +260,14 @@ func GetDealFees(deal market8.DealProposal, height abi.ChainEpoch) (abi.TokenAmo
return ef, big.Sub(tf, ef)
}
func IsDealActive(state market8.DealState) bool {
func IsDealActive(state markettypes.DealState) bool {
return state.SectorStartEpoch > -1 && state.SlashEpoch == -1
}
func labelFromGoString(s string) (market8.DealLabel, error) {
func labelFromGoString(s string) (markettypes.DealLabel, error) {
if utf8.ValidString(s) {
return market8.NewLabelFromString(s)
return markettypes.NewLabelFromString(s)
} else {
return market8.NewLabelFromBytes([]byte(s))
return markettypes.NewLabelFromBytes([]byte(s))
}
}

View File

@ -22,6 +22,7 @@ import (
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
{{else}}
market{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}market"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
{{end}}
)
@ -258,12 +259,12 @@ func (s *dealProposals{{.v}}) array() adt.Array {
func fromV{{.v}}DealProposal(v{{.v}} market{{.v}}.DealProposal) (DealProposal, error) {
{{if (le .v 7)}}
label, err := labelFromGoString(v{{.v}}.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
{{else}}
label := v{{.v}}.Label
label, err := fromV{{.v}}Label(v{{.v}}.Label)
{{end}}
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v{{.v}}.PieceCID,
@ -283,6 +284,25 @@ func fromV{{.v}}DealProposal(v{{.v}} market{{.v}}.DealProposal) (DealProposal, e
}, nil
}
{{if (ge .v 8)}}
func fromV{{.v}}Label(v{{.v}} market{{.v}}.DealLabel) (DealLabel, error) {
if v{{.v}}.IsString() {
str, err := v{{.v}}.ToString()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err)
}
return markettypes.NewLabelFromString(str)
}
bs, err := v{{.v}}.ToBytes()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err)
}
return markettypes.NewLabelFromBytes(bs)
}
{{end}}
func (s *state{{.v}}) GetState() interface{} {
return &s.State

View File

@ -3,17 +3,17 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
)
var _ State = (*state0)(nil)
@ -241,6 +241,7 @@ func (s *dealProposals0) array() adt.Array {
func fromV0DealProposal(v0 market0.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v0.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,17 +3,17 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
)
var _ State = (*state2)(nil)
@ -241,6 +241,7 @@ func (s *dealProposals2) array() adt.Array {
func fromV2DealProposal(v2 market2.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v2.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,17 +3,17 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/market"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
)
var _ State = (*state3)(nil)
@ -236,6 +236,7 @@ func (s *dealProposals3) array() adt.Array {
func fromV3DealProposal(v3 market3.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v3.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,17 +3,17 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/market"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
)
var _ State = (*state4)(nil)
@ -236,6 +236,7 @@ func (s *dealProposals4) array() adt.Array {
func fromV4DealProposal(v4 market4.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v4.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,17 +3,17 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/market"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
)
var _ State = (*state5)(nil)
@ -236,6 +236,7 @@ func (s *dealProposals5) array() adt.Array {
func fromV5DealProposal(v5 market5.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v5.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,19 +3,20 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/market"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
)
var _ State = (*state6)(nil)
@ -238,6 +239,7 @@ func (s *dealProposals6) array() adt.Array {
func fromV6DealProposal(v6 market6.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v6.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,19 +3,20 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/market"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
)
var _ State = (*state7)(nil)
@ -238,6 +239,7 @@ func (s *dealProposals7) array() adt.Array {
func fromV7DealProposal(v7 market7.DealProposal) (DealProposal, error) {
label, err := labelFromGoString(v7.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}

View File

@ -3,19 +3,21 @@ package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-bitfield"
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
)
var _ State = (*state8)(nil)
@ -237,7 +239,11 @@ func (s *dealProposals8) array() adt.Array {
func fromV8DealProposal(v8 market8.DealProposal) (DealProposal, error) {
label := v8.Label
label, err := fromV8Label(v8.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v8.PieceCID,
@ -257,6 +263,22 @@ func fromV8DealProposal(v8 market8.DealProposal) (DealProposal, error) {
}, nil
}
func fromV8Label(v8 market8.DealLabel) (DealLabel, error) {
if v8.IsString() {
str, err := v8.ToString()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err)
}
return markettypes.NewLabelFromString(str)
}
bs, err := v8.ToBytes()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err)
}
return markettypes.NewLabelFromBytes(bs)
}
func (s *state8) GetState() interface{} {
return &s.State
}

View File

@ -0,0 +1,326 @@
package market
import (
"bytes"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rlepluslazy "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
markettypes "github.com/filecoin-project/go-state-types/builtin/v8/market"
adt9 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
market9 "github.com/filecoin-project/go-state-types/builtin/v9/market"
)
var _ State = (*state9)(nil)
func load9(store adt.Store, root cid.Cid) (State, error) {
out := state9{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make9(store adt.Store) (State, error) {
out := state9{store: store}
s, err := market9.ConstructState(store)
if err != nil {
return nil, err
}
out.State = *s
return &out, nil
}
type state9 struct {
market9.State
store adt.Store
}
func (s *state9) TotalLocked() (abi.TokenAmount, error) {
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
fml = types.BigAdd(fml, s.TotalClientStorageFee)
return fml, nil
}
func (s *state9) BalancesChanged(otherState State) (bool, error) {
otherState9, ok := otherState.(*state9)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.EscrowTable.Equals(otherState9.State.EscrowTable) || !s.State.LockedTable.Equals(otherState9.State.LockedTable), nil
}
func (s *state9) StatesChanged(otherState State) (bool, error) {
otherState9, ok := otherState.(*state9)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.States.Equals(otherState9.State.States), nil
}
func (s *state9) States() (DealStates, error) {
stateArray, err := adt9.AsArray(s.store, s.State.States, market9.StatesAmtBitwidth)
if err != nil {
return nil, err
}
return &dealStates9{stateArray}, nil
}
func (s *state9) ProposalsChanged(otherState State) (bool, error) {
otherState9, ok := otherState.(*state9)
if !ok {
// there's no way to compare different versions of the state, so let's
// just say that means the state of balances has changed
return true, nil
}
return !s.State.Proposals.Equals(otherState9.State.Proposals), nil
}
func (s *state9) Proposals() (DealProposals, error) {
proposalArray, err := adt9.AsArray(s.store, s.State.Proposals, market9.ProposalsAmtBitwidth)
if err != nil {
return nil, err
}
return &dealProposals9{proposalArray}, nil
}
func (s *state9) EscrowTable() (BalanceTable, error) {
bt, err := adt9.AsBalanceTable(s.store, s.State.EscrowTable)
if err != nil {
return nil, err
}
return &balanceTable9{bt}, nil
}
func (s *state9) LockedTable() (BalanceTable, error) {
bt, err := adt9.AsBalanceTable(s.store, s.State.LockedTable)
if err != nil {
return nil, err
}
return &balanceTable9{bt}, nil
}
func (s *state9) VerifyDealsForActivation(
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
) (weight, verifiedWeight abi.DealWeight, err error) {
w, vw, _, err := market9.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
return w, vw, err
}
func (s *state9) NextID() (abi.DealID, error) {
return s.State.NextID, nil
}
type balanceTable9 struct {
*adt9.BalanceTable
}
func (bt *balanceTable9) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
asMap := (*adt9.Map)(bt.BalanceTable)
var ta abi.TokenAmount
return asMap.ForEach(&ta, func(key string) error {
a, err := address.NewFromBytes([]byte(key))
if err != nil {
return err
}
return cb(a, ta)
})
}
type dealStates9 struct {
adt.Array
}
func (s *dealStates9) Get(dealID abi.DealID) (*DealState, bool, error) {
var deal9 market9.DealState
found, err := s.Array.Get(uint64(dealID), &deal9)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
deal := fromV9DealState(deal9)
return &deal, true, nil
}
func (s *dealStates9) ForEach(cb func(dealID abi.DealID, ds DealState) error) error {
var ds9 market9.DealState
return s.Array.ForEach(&ds9, func(idx int64) error {
return cb(abi.DealID(idx), fromV9DealState(ds9))
})
}
func (s *dealStates9) decode(val *cbg.Deferred) (*DealState, error) {
var ds9 market9.DealState
if err := ds9.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
ds := fromV9DealState(ds9)
return &ds, nil
}
func (s *dealStates9) array() adt.Array {
return s.Array
}
func fromV9DealState(v9 market9.DealState) DealState {
return (DealState)(v9)
}
type dealProposals9 struct {
adt.Array
}
func (s *dealProposals9) Get(dealID abi.DealID) (*DealProposal, bool, error) {
var proposal9 market9.DealProposal
found, err := s.Array.Get(uint64(dealID), &proposal9)
if err != nil {
return nil, false, err
}
if !found {
return nil, false, nil
}
proposal, err := fromV9DealProposal(proposal9)
if err != nil {
return nil, true, xerrors.Errorf("decoding proposal: %w", err)
}
return &proposal, true, nil
}
func (s *dealProposals9) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
var dp9 market9.DealProposal
return s.Array.ForEach(&dp9, func(idx int64) error {
dp, err := fromV9DealProposal(dp9)
if err != nil {
return xerrors.Errorf("decoding proposal: %w", err)
}
return cb(abi.DealID(idx), dp)
})
}
func (s *dealProposals9) decode(val *cbg.Deferred) (*DealProposal, error) {
var dp9 market9.DealProposal
if err := dp9.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
return nil, err
}
dp, err := fromV9DealProposal(dp9)
if err != nil {
return nil, err
}
return &dp, nil
}
func (s *dealProposals9) array() adt.Array {
return s.Array
}
func fromV9DealProposal(v9 market9.DealProposal) (DealProposal, error) {
label, err := fromV9Label(v9.Label)
if err != nil {
return DealProposal{}, xerrors.Errorf("error setting deal label: %w", err)
}
return DealProposal{
PieceCID: v9.PieceCID,
PieceSize: v9.PieceSize,
VerifiedDeal: v9.VerifiedDeal,
Client: v9.Client,
Provider: v9.Provider,
Label: label,
StartEpoch: v9.StartEpoch,
EndEpoch: v9.EndEpoch,
StoragePricePerEpoch: v9.StoragePricePerEpoch,
ProviderCollateral: v9.ProviderCollateral,
ClientCollateral: v9.ClientCollateral,
}, nil
}
func fromV9Label(v9 market9.DealLabel) (DealLabel, error) {
if v9.IsString() {
str, err := v9.ToString()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert string label to string: %w", err)
}
return markettypes.NewLabelFromString(str)
}
bs, err := v9.ToBytes()
if err != nil {
return markettypes.EmptyDealLabel, xerrors.Errorf("failed to convert bytes label to bytes: %w", err)
}
return markettypes.NewLabelFromBytes(bs)
}
func (s *state9) GetState() interface{} {
return &s.State
}
var _ PublishStorageDealsReturn = (*publishStorageDealsReturn9)(nil)
func decodePublishStorageDealsReturn9(b []byte) (PublishStorageDealsReturn, error) {
var retval market9.PublishStorageDealsReturn
if err := retval.UnmarshalCBOR(bytes.NewReader(b)); err != nil {
return nil, xerrors.Errorf("failed to unmarshal PublishStorageDealsReturn: %w", err)
}
return &publishStorageDealsReturn9{retval}, nil
}
type publishStorageDealsReturn9 struct {
market9.PublishStorageDealsReturn
}
func (r *publishStorageDealsReturn9) IsDealValid(index uint64) (bool, int, error) {
set, err := r.ValidDeals.IsSet(index)
if err != nil || !set {
return false, -1, err
}
maskBf, err := bitfield.NewFromIter(&rlepluslazy.RunSliceIterator{
Runs: []rlepluslazy.Run{rlepluslazy.Run{Val: true, Len: index}}})
if err != nil {
return false, -1, err
}
before, err := bitfield.IntersectBitField(maskBf, r.ValidDeals)
if err != nil {
return false, -1, err
}
outIdx, err := before.Count()
if err != nil {
return false, -1, err
}
return set, int(outIdx), nil
}
func (r *publishStorageDealsReturn9) DealIDs() ([]abi.DealID, error) {
return r.IDs, nil
}

View File

@ -1,6 +1,7 @@
package miner
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors"
@ -33,7 +34,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
{{range .versions}}
{{if (ge . 8)}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
{{end}}
@ -201,6 +202,7 @@ func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi
type MinerInfo = miner{{.latestVersion}}.MinerInfo
type WorkerKeyChange = miner{{.latestVersion}}.WorkerKeyChange
type SectorPreCommitOnChainInfo = miner{{.latestVersion}}.SectorPreCommitOnChainInfo
type WindowPostVerifyInfo = proof.WindowPoStVerifyInfo
type SectorExpiration struct {

View File

@ -1,28 +1,36 @@
package miner
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/proof"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
)
func Load(store adt.Store, act *types.Actor) (State, error) {
@ -33,9 +41,12 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
case actors.Version8:
case actorstypes.Version8:
return load8(store, act.Head)
case actorstypes.Version9:
return load9(store, act.Head)
}
}
@ -94,6 +105,9 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
case actors.Version8:
return make8(store)
case actors.Version9:
return make9(store)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -112,8 +126,8 @@ type State interface {
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
FindSector(abi.SectorNumber) (*SectorLocation, error)
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
GetPrecommittedSector(abi.SectorNumber) (*miner8.SectorPreCommitOnChainInfo, error)
ForEachPrecommittedSector(func(miner8.SectorPreCommitOnChainInfo) error) error
GetPrecommittedSector(abi.SectorNumber) (*miner9.SectorPreCommitOnChainInfo, error)
ForEachPrecommittedSector(func(miner9.SectorPreCommitOnChainInfo) error) error
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
NumLiveSectors() (uint64, error)
IsAllocated(abi.SectorNumber) (bool, error)
@ -142,7 +156,7 @@ type State interface {
sectors() (adt.Array, error)
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
precommits() (adt.Map, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (miner8.SectorPreCommitOnChainInfo, error)
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (miner9.SectorPreCommitOnChainInfo, error)
GetState() interface{}
}
@ -180,7 +194,7 @@ type Partition interface {
UnprovenSectors() (bitfield.BitField, error)
}
type SectorOnChainInfo = miner8.SectorOnChainInfo
type SectorOnChainInfo = miner9.SectorOnChainInfo
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
// We added support for the new proofs in network version 7, and removed support for the old
@ -235,8 +249,9 @@ func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi
}
}
type MinerInfo = miner8.MinerInfo
type WorkerKeyChange = miner8.WorkerKeyChange
type MinerInfo = miner9.MinerInfo
type WorkerKeyChange = miner9.WorkerKeyChange
type SectorPreCommitOnChainInfo = miner9.SectorPreCommitOnChainInfo
type WindowPostVerifyInfo = proof.WindowPoStVerifyInfo
type SectorExpiration struct {
@ -264,8 +279,8 @@ type SectorExtensions struct {
}
type PreCommitChanges struct {
Added []miner8.SectorPreCommitOnChainInfo
Removed []miner8.SectorPreCommitOnChainInfo
Added []miner9.SectorPreCommitOnChainInfo
Removed []miner9.SectorPreCommitOnChainInfo
}
type LockedFunds struct {

View File

@ -15,7 +15,7 @@ import (
"golang.org/x/xerrors"
"github.com/filecoin-project/lotus/chain/actors/adt"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/miner"
{{if (le .v 7)}}
{{if (ge .v 3)}}
@ -581,11 +581,17 @@ func fromV{{.v}}SectorOnChainInfo(v{{.v}} miner{{.v}}.SectorOnChainInfo) SectorO
func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v{{.v}}.Info),
Info: minertypes.SectorPreCommitInfo{
SealProof: v{{.v}}.Info.SealProof,
SectorNumber: v{{.v}}.Info.SectorNumber,
SealedCID: v{{.v}}.Info.SealedCID,
SealRandEpoch: v{{.v}}.Info.SealRandEpoch,
DealIDs: v{{.v}}.Info.DealIDs,
Expiration: v{{.v}}.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v{{.v}}.PreCommitDeposit,
PreCommitEpoch: v{{.v}}.PreCommitEpoch,
DealWeight: v{{.v}}.DealWeight,
VerifiedDealWeight: v{{.v}}.VerifiedDealWeight,
}
}

View File

@ -4,20 +4,21 @@ import (
"bytes"
"errors"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state0)(nil)
@ -511,11 +512,17 @@ func fromV0SectorOnChainInfo(v0 miner0.SectorOnChainInfo) SectorOnChainInfo {
func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v0.Info),
PreCommitDeposit: v0.PreCommitDeposit,
PreCommitEpoch: v0.PreCommitEpoch,
DealWeight: v0.DealWeight,
VerifiedDealWeight: v0.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v0.Info.SealProof,
SectorNumber: v0.Info.SectorNumber,
SealedCID: v0.Info.SealedCID,
SealRandEpoch: v0.Info.SealRandEpoch,
DealIDs: v0.Info.DealIDs,
Expiration: v0.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v0.PreCommitDeposit,
PreCommitEpoch: v0.PreCommitEpoch,
}
}

View File

@ -4,19 +4,19 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state2)(nil)
@ -542,11 +542,17 @@ func fromV2SectorOnChainInfo(v2 miner2.SectorOnChainInfo) SectorOnChainInfo {
func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v2.Info),
PreCommitDeposit: v2.PreCommitDeposit,
PreCommitEpoch: v2.PreCommitEpoch,
DealWeight: v2.DealWeight,
VerifiedDealWeight: v2.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v2.Info.SealProof,
SectorNumber: v2.Info.SectorNumber,
SealedCID: v2.Info.SealedCID,
SealRandEpoch: v2.Info.SealRandEpoch,
DealIDs: v2.Info.DealIDs,
Expiration: v2.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v2.PreCommitDeposit,
PreCommitEpoch: v2.PreCommitEpoch,
}
}

View File

@ -4,20 +4,21 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state3)(nil)
@ -542,11 +543,17 @@ func fromV3SectorOnChainInfo(v3 miner3.SectorOnChainInfo) SectorOnChainInfo {
func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v3.Info),
PreCommitDeposit: v3.PreCommitDeposit,
PreCommitEpoch: v3.PreCommitEpoch,
DealWeight: v3.DealWeight,
VerifiedDealWeight: v3.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v3.Info.SealProof,
SectorNumber: v3.Info.SectorNumber,
SealedCID: v3.Info.SealedCID,
SealRandEpoch: v3.Info.SealRandEpoch,
DealIDs: v3.Info.DealIDs,
Expiration: v3.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v3.PreCommitDeposit,
PreCommitEpoch: v3.PreCommitEpoch,
}
}

View File

@ -4,20 +4,21 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
miner4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/miner"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state4)(nil)
@ -542,11 +543,17 @@ func fromV4SectorOnChainInfo(v4 miner4.SectorOnChainInfo) SectorOnChainInfo {
func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v4.Info),
PreCommitDeposit: v4.PreCommitDeposit,
PreCommitEpoch: v4.PreCommitEpoch,
DealWeight: v4.DealWeight,
VerifiedDealWeight: v4.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v4.Info.SealProof,
SectorNumber: v4.Info.SectorNumber,
SealedCID: v4.Info.SealedCID,
SealRandEpoch: v4.Info.SealRandEpoch,
DealIDs: v4.Info.DealIDs,
Expiration: v4.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v4.PreCommitDeposit,
PreCommitEpoch: v4.PreCommitEpoch,
}
}

View File

@ -4,20 +4,21 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state5)(nil)
@ -542,11 +543,17 @@ func fromV5SectorOnChainInfo(v5 miner5.SectorOnChainInfo) SectorOnChainInfo {
func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v5.Info),
PreCommitDeposit: v5.PreCommitDeposit,
PreCommitEpoch: v5.PreCommitEpoch,
DealWeight: v5.DealWeight,
VerifiedDealWeight: v5.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v5.Info.SealProof,
SectorNumber: v5.Info.SectorNumber,
SealedCID: v5.Info.SealedCID,
SealRandEpoch: v5.Info.SealRandEpoch,
DealIDs: v5.Info.DealIDs,
Expiration: v5.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v5.PreCommitDeposit,
PreCommitEpoch: v5.PreCommitEpoch,
}
}

View File

@ -4,20 +4,21 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
miner6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/miner"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state6)(nil)
@ -542,11 +543,17 @@ func fromV6SectorOnChainInfo(v6 miner6.SectorOnChainInfo) SectorOnChainInfo {
func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v6.Info),
PreCommitDeposit: v6.PreCommitDeposit,
PreCommitEpoch: v6.PreCommitEpoch,
DealWeight: v6.DealWeight,
VerifiedDealWeight: v6.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v6.Info.SealProof,
SectorNumber: v6.Info.SectorNumber,
SealedCID: v6.Info.SealedCID,
SealRandEpoch: v6.Info.SealRandEpoch,
DealIDs: v6.Info.DealIDs,
Expiration: v6.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v6.PreCommitDeposit,
PreCommitEpoch: v6.PreCommitEpoch,
}
}

View File

@ -4,20 +4,21 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
"github.com/filecoin-project/go-state-types/dline"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state7)(nil)
@ -543,11 +544,17 @@ func fromV7SectorOnChainInfo(v7 miner7.SectorOnChainInfo) SectorOnChainInfo {
func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v7.Info),
PreCommitDeposit: v7.PreCommitDeposit,
PreCommitEpoch: v7.PreCommitEpoch,
DealWeight: v7.DealWeight,
VerifiedDealWeight: v7.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v7.Info.SealProof,
SectorNumber: v7.Info.SectorNumber,
SealedCID: v7.Info.SealedCID,
SealRandEpoch: v7.Info.SealRandEpoch,
DealIDs: v7.Info.DealIDs,
Expiration: v7.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v7.PreCommitDeposit,
PreCommitEpoch: v7.PreCommitEpoch,
}
}

View File

@ -4,20 +4,20 @@ import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
"github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state8)(nil)
@ -543,11 +543,17 @@ func fromV8SectorOnChainInfo(v8 miner8.SectorOnChainInfo) SectorOnChainInfo {
func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: (minertypes.SectorPreCommitInfo)(v8.Info),
PreCommitDeposit: v8.PreCommitDeposit,
PreCommitEpoch: v8.PreCommitEpoch,
DealWeight: v8.DealWeight,
VerifiedDealWeight: v8.VerifiedDealWeight,
Info: minertypes.SectorPreCommitInfo{
SealProof: v8.Info.SealProof,
SectorNumber: v8.Info.SectorNumber,
SealedCID: v8.Info.SealedCID,
SealRandEpoch: v8.Info.SealRandEpoch,
DealIDs: v8.Info.DealIDs,
Expiration: v8.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v8.PreCommitDeposit,
PreCommitEpoch: v8.PreCommitEpoch,
}
}

View File

@ -0,0 +1,562 @@
package miner
import (
"bytes"
"errors"
"github.com/filecoin-project/go-bitfield"
rle "github.com/filecoin-project/go-bitfield/rle"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/dline"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
minertypes "github.com/filecoin-project/go-state-types/builtin/v9/miner"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
miner9 "github.com/filecoin-project/go-state-types/builtin/v9/miner"
adt9 "github.com/filecoin-project/go-state-types/builtin/v9/util/adt"
)
var _ State = (*state9)(nil)
func load9(store adt.Store, root cid.Cid) (State, error) {
out := state9{store: store}
err := store.Get(store.Context(), root, &out)
if err != nil {
return nil, err
}
return &out, nil
}
func make9(store adt.Store) (State, error) {
out := state9{store: store}
out.State = miner9.State{}
return &out, nil
}
type state9 struct {
miner9.State
store adt.Store
}
type deadline9 struct {
miner9.Deadline
store adt.Store
}
type partition9 struct {
miner9.Partition
store adt.Store
}
func (s *state9) AvailableBalance(bal abi.TokenAmount) (available abi.TokenAmount, err error) {
defer func() {
if r := recover(); r != nil {
err = xerrors.Errorf("failed to get available balance: %w", r)
available = abi.NewTokenAmount(0)
}
}()
// this panics if the miner doesnt have enough funds to cover their locked pledge
available, err = s.GetAvailableBalance(bal)
return available, err
}
func (s *state9) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
return s.CheckVestedFunds(s.store, epoch)
}
func (s *state9) LockedFunds() (LockedFunds, error) {
return LockedFunds{
VestingFunds: s.State.LockedFunds,
InitialPledgeRequirement: s.State.InitialPledge,
PreCommitDeposits: s.State.PreCommitDeposits,
}, nil
}
func (s *state9) FeeDebt() (abi.TokenAmount, error) {
return s.State.FeeDebt, nil
}
func (s *state9) InitialPledge() (abi.TokenAmount, error) {
return s.State.InitialPledge, nil
}
func (s *state9) PreCommitDeposits() (abi.TokenAmount, error) {
return s.State.PreCommitDeposits, nil
}
func (s *state9) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
info, ok, err := s.State.GetSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV9SectorOnChainInfo(*info)
return &ret, nil
}
func (s *state9) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
if err != nil {
return nil, err
}
return &SectorLocation{
Deadline: dlIdx,
Partition: partIdx,
}, nil
}
func (s *state9) NumLiveSectors() (uint64, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return 0, err
}
var total uint64
if err := dls.ForEach(s.store, func(dlIdx uint64, dl *miner9.Deadline) error {
total += dl.LiveSectors
return nil
}); err != nil {
return 0, err
}
return total, nil
}
// GetSectorExpiration returns the effective expiration of the given sector.
//
// If the sector does not expire early, the Early expiration field is 0.
func (s *state9) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
// NOTE: this can be optimized significantly.
// 1. If the sector is non-faulty, it will expire on-time (can be
// learned from the sector info).
// 2. If it's faulty, it will expire early within the first 42 entries
// of the expiration queue.
stopErr := errors.New("stop")
out := SectorExpiration{}
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner9.Deadline) error {
partitions, err := dl.PartitionsArray(s.store)
if err != nil {
return err
}
quant := s.State.QuantSpecForDeadline(dlIdx)
var part miner9.Partition
return partitions.ForEach(&part, func(partIdx int64) error {
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
return err
} else if !found {
return nil
}
if found, err := part.Terminated.IsSet(uint64(num)); err != nil {
return err
} else if found {
// already terminated
return stopErr
}
q, err := miner9.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant, miner9.PartitionExpirationAmtBitwidth)
if err != nil {
return err
}
var exp miner9.ExpirationSet
return q.ForEach(&exp, func(epoch int64) error {
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
return err
} else if early {
out.Early = abi.ChainEpoch(epoch)
return nil
}
if onTime, err := exp.OnTimeSectors.IsSet(uint64(num)); err != nil {
return err
} else if onTime {
out.OnTime = abi.ChainEpoch(epoch)
return stopErr
}
return nil
})
})
})
if err == stopErr {
err = nil
}
if err != nil {
return nil, err
}
if out.Early == 0 && out.OnTime == 0 {
return nil, xerrors.Errorf("failed to find sector %d", num)
}
return &out, nil
}
func (s *state9) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
if !ok || err != nil {
return nil, err
}
ret := fromV9SectorPreCommitOnChainInfo(*info)
return &ret, nil
}
func (s *state9) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
precommitted, err := adt9.AsMap(s.store, s.State.PreCommittedSectors, builtin9.DefaultHamtBitwidth)
if err != nil {
return err
}
var info miner9.SectorPreCommitOnChainInfo
if err := precommitted.ForEach(&info, func(_ string) error {
return cb(fromV9SectorPreCommitOnChainInfo(info))
}); err != nil {
return err
}
return nil
}
func (s *state9) LoadSectors(snos *bitfield.BitField) ([]*SectorOnChainInfo, error) {
sectors, err := miner9.LoadSectors(s.store, s.State.Sectors)
if err != nil {
return nil, err
}
// If no sector numbers are specified, load all.
if snos == nil {
infos := make([]*SectorOnChainInfo, 0, sectors.Length())
var info9 miner9.SectorOnChainInfo
if err := sectors.ForEach(&info9, func(_ int64) error {
info := fromV9SectorOnChainInfo(info9)
infos = append(infos, &info)
return nil
}); err != nil {
return nil, err
}
return infos, nil
}
// Otherwise, load selected.
infos9, err := sectors.Load(*snos)
if err != nil {
return nil, err
}
infos := make([]*SectorOnChainInfo, len(infos9))
for i, info9 := range infos9 {
info := fromV9SectorOnChainInfo(*info9)
infos[i] = &info
}
return infos, nil
}
func (s *state9) loadAllocatedSectorNumbers() (bitfield.BitField, error) {
var allocatedSectors bitfield.BitField
err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors)
return allocatedSectors, err
}
func (s *state9) IsAllocated(num abi.SectorNumber) (bool, error) {
allocatedSectors, err := s.loadAllocatedSectorNumbers()
if err != nil {
return false, err
}
return allocatedSectors.IsSet(uint64(num))
}
func (s *state9) GetProvingPeriodStart() (abi.ChainEpoch, error) {
return s.State.ProvingPeriodStart, nil
}
func (s *state9) UnallocatedSectorNumbers(count int) ([]abi.SectorNumber, error) {
allocatedSectors, err := s.loadAllocatedSectorNumbers()
if err != nil {
return nil, err
}
allocatedRuns, err := allocatedSectors.RunIterator()
if err != nil {
return nil, err
}
unallocatedRuns, err := rle.Subtract(
&rle.RunSliceIterator{Runs: []rle.Run{{Val: true, Len: abi.MaxSectorNumber}}},
allocatedRuns,
)
if err != nil {
return nil, err
}
iter, err := rle.BitsFromRuns(unallocatedRuns)
if err != nil {
return nil, err
}
sectors := make([]abi.SectorNumber, 0, count)
for iter.HasNext() && len(sectors) < count {
nextNo, err := iter.Next()
if err != nil {
return nil, err
}
sectors = append(sectors, abi.SectorNumber(nextNo))
}
return sectors, nil
}
func (s *state9) GetAllocatedSectors() (*bitfield.BitField, error) {
var allocatedSectors bitfield.BitField
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
return nil, err
}
return &allocatedSectors, nil
}
func (s *state9) LoadDeadline(idx uint64) (Deadline, error) {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return nil, err
}
dl, err := dls.LoadDeadline(s.store, idx)
if err != nil {
return nil, err
}
return &deadline9{*dl, s.store}, nil
}
func (s *state9) ForEachDeadline(cb func(uint64, Deadline) error) error {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return err
}
return dls.ForEach(s.store, func(i uint64, dl *miner9.Deadline) error {
return cb(i, &deadline9{*dl, s.store})
})
}
func (s *state9) NumDeadlines() (uint64, error) {
return miner9.WPoStPeriodDeadlines, nil
}
func (s *state9) DeadlinesChanged(other State) (bool, error) {
other9, ok := other.(*state9)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Deadlines.Equals(other9.Deadlines), nil
}
func (s *state9) MinerInfoChanged(other State) (bool, error) {
other0, ok := other.(*state9)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !s.State.Info.Equals(other0.State.Info), nil
}
func (s *state9) Info() (MinerInfo, error) {
info, err := s.State.GetInfo(s.store)
if err != nil {
return MinerInfo{}, err
}
mi := MinerInfo{
Owner: info.Owner,
Worker: info.Worker,
ControlAddresses: info.ControlAddresses,
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
PeerId: info.PeerId,
Multiaddrs: info.Multiaddrs,
WindowPoStProofType: info.WindowPoStProofType,
SectorSize: info.SectorSize,
WindowPoStPartitionSectors: info.WindowPoStPartitionSectors,
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
}
return mi, nil
}
func (s *state9) DeadlineInfo(epoch abi.ChainEpoch) (*dline.Info, error) {
return s.State.RecordedDeadlineInfo(epoch), nil
}
func (s *state9) DeadlineCronActive() (bool, error) {
return s.State.DeadlineCronActive, nil
}
func (s *state9) sectors() (adt.Array, error) {
return adt9.AsArray(s.store, s.Sectors, miner9.SectorsAmtBitwidth)
}
func (s *state9) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
var si miner9.SectorOnChainInfo
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return SectorOnChainInfo{}, err
}
return fromV9SectorOnChainInfo(si), nil
}
func (s *state9) precommits() (adt.Map, error) {
return adt9.AsMap(s.store, s.PreCommittedSectors, builtin9.DefaultHamtBitwidth)
}
func (s *state9) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
var sp miner9.SectorPreCommitOnChainInfo
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil {
return minertypes.SectorPreCommitOnChainInfo{}, err
}
return fromV9SectorPreCommitOnChainInfo(sp), nil
}
func (s *state9) EraseAllUnproven() error {
dls, err := s.State.LoadDeadlines(s.store)
if err != nil {
return err
}
err = dls.ForEach(s.store, func(dindx uint64, dl *miner9.Deadline) error {
ps, err := dl.PartitionsArray(s.store)
if err != nil {
return err
}
var part miner9.Partition
err = ps.ForEach(&part, func(pindx int64) error {
_ = part.ActivateUnproven()
err = ps.Set(uint64(pindx), &part)
return nil
})
if err != nil {
return err
}
dl.Partitions, err = ps.Root()
if err != nil {
return err
}
return dls.UpdateDeadline(s.store, dindx, dl)
})
if err != nil {
return err
}
return s.State.SaveDeadlines(s.store, dls)
}
func (d *deadline9) LoadPartition(idx uint64) (Partition, error) {
p, err := d.Deadline.LoadPartition(d.store, idx)
if err != nil {
return nil, err
}
return &partition9{*p, d.store}, nil
}
func (d *deadline9) ForEachPartition(cb func(uint64, Partition) error) error {
ps, err := d.Deadline.PartitionsArray(d.store)
if err != nil {
return err
}
var part miner9.Partition
return ps.ForEach(&part, func(i int64) error {
return cb(uint64(i), &partition9{part, d.store})
})
}
func (d *deadline9) PartitionsChanged(other Deadline) (bool, error) {
other9, ok := other.(*deadline9)
if !ok {
// treat an upgrade as a change, always
return true, nil
}
return !d.Deadline.Partitions.Equals(other9.Deadline.Partitions), nil
}
func (d *deadline9) PartitionsPoSted() (bitfield.BitField, error) {
return d.Deadline.PartitionsPoSted, nil
}
func (d *deadline9) DisputableProofCount() (uint64, error) {
ops, err := d.OptimisticProofsSnapshotArray(d.store)
if err != nil {
return 0, err
}
return ops.Length(), nil
}
func (p *partition9) AllSectors() (bitfield.BitField, error) {
return p.Partition.Sectors, nil
}
func (p *partition9) FaultySectors() (bitfield.BitField, error) {
return p.Partition.Faults, nil
}
func (p *partition9) RecoveringSectors() (bitfield.BitField, error) {
return p.Partition.Recoveries, nil
}
func (p *partition9) UnprovenSectors() (bitfield.BitField, error) {
return p.Partition.Unproven, nil
}
func fromV9SectorOnChainInfo(v9 miner9.SectorOnChainInfo) SectorOnChainInfo {
info := SectorOnChainInfo{
SectorNumber: v9.SectorNumber,
SealProof: v9.SealProof,
SealedCID: v9.SealedCID,
DealIDs: v9.DealIDs,
Activation: v9.Activation,
Expiration: v9.Expiration,
DealWeight: v9.DealWeight,
VerifiedDealWeight: v9.VerifiedDealWeight,
InitialPledge: v9.InitialPledge,
ExpectedDayReward: v9.ExpectedDayReward,
ExpectedStoragePledge: v9.ExpectedStoragePledge,
SectorKeyCID: v9.SectorKeyCID,
}
return info
}
func fromV9SectorPreCommitOnChainInfo(v9 miner9.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
return minertypes.SectorPreCommitOnChainInfo{
Info: minertypes.SectorPreCommitInfo{
SealProof: v9.Info.SealProof,
SectorNumber: v9.Info.SectorNumber,
SealedCID: v9.Info.SealedCID,
SealRandEpoch: v9.Info.SealRandEpoch,
DealIDs: v9.Info.DealIDs,
Expiration: v9.Info.Expiration,
UnsealedCid: nil,
},
PreCommitDeposit: v9.PreCommitDeposit,
PreCommitEpoch: v9.PreCommitEpoch,
}
}
func (s *state9) GetState() interface{} {
return &s.State
}

View File

@ -1,6 +1,7 @@
package multisig
import (
actorstypes "github.com/filecoin-project/go-state-types/actors"
"fmt"
"github.com/minio/blake2b-simd"
@ -15,11 +16,11 @@ import (
{{range .versions}}
{{if (le . 7)}}
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
{{else}}
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
{{end}}
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
@ -34,7 +35,7 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
{{range .versions}}
{{if (ge . 8)}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return load{{.}}(store, act.Head)
{{end}}
{{end}}
@ -53,10 +54,10 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
switch av {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return make{{.}}(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
{{end}}
}
@ -83,12 +84,12 @@ type State interface {
type Transaction = msig{{.latestVersion}}.Transaction
var Methods = builtin{{.latestVersion}}.MethodsMultisig
var Methods = builtintypes.MethodsMultisig
func Message(version actors.Version, from address.Address) MessageBuilder {
func Message(version actorstypes.Version, from address.Address) MessageBuilder {
switch version {
{{range .versions}}
case actors.Version{{.}}:
case actorstypes.Version{{.}}:
return message{{.}}{{"{"}}{{if (ge . 2)}}message0{from}{{else}}from{{end}}}
{{end}} default:
panic(fmt.Sprintf("unsupported actors version: %d", version))

View File

@ -10,10 +10,12 @@ import (
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
multisig{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/multisig"
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
{{else}}
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
actorstypes "github.com/filecoin-project/go-state-types/actors"
multisig{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
init{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/init"
init{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin/v{{.latestVersion}}/init"
builtin{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin"
{{end}}
@ -68,13 +70,13 @@ func (m message{{.v}}) Create(
ConstructorParams: enc,
}
{{else}}
code, ok := actors.GetActorCodeID(actors.Version{{.v}}, actors.MultisigKey)
code, ok := actors.GetActorCodeID(actorstypes.Version{{.v}}, actors.MultisigKey)
if !ok {
return nil, xerrors.Errorf("failed to get multisig code ID")
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init8.ExecParams{
execParams := &init{{.latestVersion}}.ExecParams{
CodeCID: code,
ConstructorParams: enc,
}
@ -88,7 +90,7 @@ func (m message{{.v}}) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin{{.v}}.MethodsInit.Exec,
Method: builtin{{.latestVersion}}.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
multisig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
@ -66,7 +68,7 @@ func (m message0) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin0.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
@ -63,7 +65,7 @@ func (m message2) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin2.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
multisig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
@ -63,7 +65,7 @@ func (m message3) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin3.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
multisig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
@ -63,7 +65,7 @@ func (m message4) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin4.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
multisig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
@ -63,7 +65,7 @@ func (m message5) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin5.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
multisig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
@ -63,7 +65,7 @@ func (m message6) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin6.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,6 +5,8 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
multisig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
@ -63,7 +65,7 @@ func (m message7) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin7.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -5,9 +5,11 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
@ -49,13 +51,13 @@ func (m message8) Create(
return nil, actErr
}
code, ok := actors.GetActorCodeID(actors.Version8, actors.MultisigKey)
code, ok := actors.GetActorCodeID(actorstypes.Version8, actors.MultisigKey)
if !ok {
return nil, xerrors.Errorf("failed to get multisig code ID")
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init8.ExecParams{
execParams := &init9.ExecParams{
CodeCID: code,
ConstructorParams: enc,
}
@ -68,7 +70,7 @@ func (m message8) Create(
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin8.MethodsInit.Exec,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil

View File

@ -0,0 +1,77 @@
package multisig
import (
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
actorstypes "github.com/filecoin-project/go-state-types/actors"
builtin9 "github.com/filecoin-project/go-state-types/builtin"
multisig9 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
init9 "github.com/filecoin-project/go-state-types/builtin/v9/init"
"github.com/filecoin-project/lotus/chain/actors"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/types"
)
type message9 struct{ message0 }
func (m message9) Create(
signers []address.Address, threshold uint64,
unlockStart, unlockDuration abi.ChainEpoch,
initialAmount abi.TokenAmount,
) (*types.Message, error) {
lenAddrs := uint64(len(signers))
if lenAddrs < threshold {
return nil, xerrors.Errorf("cannot require signing of more addresses than provided for multisig")
}
if threshold == 0 {
threshold = lenAddrs
}
if m.from == address.Undef {
return nil, xerrors.Errorf("must provide source address")
}
// Set up constructor parameters for multisig
msigParams := &multisig9.ConstructorParams{
Signers: signers,
NumApprovalsThreshold: threshold,
UnlockDuration: unlockDuration,
StartEpoch: unlockStart,
}
enc, actErr := actors.SerializeParams(msigParams)
if actErr != nil {
return nil, actErr
}
code, ok := actors.GetActorCodeID(actorstypes.Version9, actors.MultisigKey)
if !ok {
return nil, xerrors.Errorf("failed to get multisig code ID")
}
// new actors are created by invoking 'exec' on the init actor with the constructor params
execParams := &init9.ExecParams{
CodeCID: code,
ConstructorParams: enc,
}
enc, actErr = actors.SerializeParams(execParams)
if actErr != nil {
return nil, actErr
}
return &types.Message{
To: init_.Address,
From: m.from,
Method: builtin9.MethodsInit.Exec,
Params: enc,
Value: initialAmount,
}, nil
}

View File

@ -2,6 +2,7 @@ package multisig
import (
"fmt"
actorstypes "github.com/filecoin-project/go-state-types/actors"
"github.com/minio/blake2b-simd"
cbg "github.com/whyrusleeping/cbor-gen"
@ -9,17 +10,26 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
builtin8 "github.com/filecoin-project/go-state-types/builtin"
msig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
"github.com/filecoin-project/go-state-types/cbor"
msig9 "github.com/filecoin-project/go-state-types/builtin/v9/multisig"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
builtintypes "github.com/filecoin-project/go-state-types/builtin"
"github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/types"
@ -33,9 +43,12 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
switch av {
case actors.Version8:
case actorstypes.Version8:
return load8(store, act.Head)
case actorstypes.Version9:
return load9(store, act.Head)
}
}
@ -67,33 +80,36 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
}
func MakeState(store adt.Store, av actors.Version, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
func MakeState(store adt.Store, av actorstypes.Version, signers []address.Address, threshold uint64, startEpoch abi.ChainEpoch, unlockDuration abi.ChainEpoch, initialBalance abi.TokenAmount) (State, error) {
switch av {
case actors.Version0:
case actorstypes.Version0:
return make0(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version2:
case actorstypes.Version2:
return make2(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version3:
case actorstypes.Version3:
return make3(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version4:
case actorstypes.Version4:
return make4(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version5:
case actorstypes.Version5:
return make5(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version6:
case actorstypes.Version6:
return make6(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version7:
case actorstypes.Version7:
return make7(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actors.Version8:
case actorstypes.Version8:
return make8(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
case actorstypes.Version9:
return make9(store, signers, threshold, startEpoch, unlockDuration, initialBalance)
}
return nil, xerrors.Errorf("unknown actor version %d", av)
}
@ -116,36 +132,39 @@ type State interface {
GetState() interface{}
}
type Transaction = msig8.Transaction
type Transaction = msig9.Transaction
var Methods = builtin8.MethodsMultisig
var Methods = builtintypes.MethodsMultisig
func Message(version actors.Version, from address.Address) MessageBuilder {
func Message(version actorstypes.Version, from address.Address) MessageBuilder {
switch version {
case actors.Version0:
case actorstypes.Version0:
return message0{from}
case actors.Version2:
case actorstypes.Version2:
return message2{message0{from}}
case actors.Version3:
case actorstypes.Version3:
return message3{message0{from}}
case actors.Version4:
case actorstypes.Version4:
return message4{message0{from}}
case actors.Version5:
case actorstypes.Version5:
return message5{message0{from}}
case actors.Version6:
case actorstypes.Version6:
return message6{message0{from}}
case actors.Version7:
case actorstypes.Version7:
return message7{message0{from}}
case actors.Version8:
case actorstypes.Version8:
return message8{message0{from}}
case actorstypes.Version9:
return message9{message0{from}}
default:
panic(fmt.Sprintf("unsupported actors version: %d", version))
}
@ -169,13 +188,13 @@ type MessageBuilder interface {
}
// this type is the same between v0 and v2
type ProposalHashData = msig8.ProposalHashData
type ProposeReturn = msig8.ProposeReturn
type ProposeParams = msig8.ProposeParams
type ApproveReturn = msig8.ApproveReturn
type ProposalHashData = msig9.ProposalHashData
type ProposeReturn = msig9.ProposeReturn
type ProposeParams = msig9.ProposeParams
type ApproveReturn = msig9.ApproveReturn
func txnParams(id uint64, data *ProposalHashData) ([]byte, error) {
params := msig8.TxnIDParams{ID: msig8.TxnID(id)}
params := msig9.TxnIDParams{ID: msig9.TxnID(id)}
if data != nil {
if data.Requester.Protocol() != address.ID {
return nil, xerrors.Errorf("proposer address must be an ID address, was %s", data.Requester)

View File

@ -4,16 +4,16 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state0)(nil)

View File

@ -4,16 +4,16 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state2)(nil)

View File

@ -4,17 +4,18 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state3)(nil)

View File

@ -4,17 +4,18 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state4)(nil)

View File

@ -4,17 +4,18 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state5)(nil)

View File

@ -4,17 +4,18 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state6)(nil)

View File

@ -4,17 +4,18 @@ import (
"bytes"
"encoding/binary"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
cbg "github.com/whyrusleeping/cbor-gen"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/adt"
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
"github.com/filecoin-project/lotus/chain/actors/adt"
)
var _ State = (*state7)(nil)

Some files were not shown because too many files have changed in this diff Show More