port to v2 imports

This commit is contained in:
Steven Allen 2020-10-07 18:09:33 -07:00
parent 8cad245f80
commit 4e730b5ec8
79 changed files with 724 additions and 657 deletions

View File

@ -8,9 +8,6 @@ import (
"testing" "testing"
"time" "time"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -22,7 +19,9 @@ import (
"github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/actors/builtin/paych"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/events/state" "github.com/filecoin-project/lotus/chain/events/state"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -227,7 +226,7 @@ func TestPaymentChannels(t *testing.T, b APIBuilder, blocktime time.Duration) {
} }
// wait for the settlement period to pass before collecting // wait for the settlement period to pass before collecting
waitForBlocks(ctx, t, bm, paymentReceiver, receiverAddr, paych0.SettleDelay) waitForBlocks(ctx, t, bm, paymentReceiver, receiverAddr, policy.PaychSettleDelay)
creatorPreCollectBalance, err := paymentCreator.WalletBalance(ctx, createrAddr) creatorPreCollectBalance, err := paymentCreator.WalletBalance(ctx, createrAddr)
if err != nil { if err != nil {
@ -283,7 +282,7 @@ func waitForBlocks(ctx context.Context, t *testing.T, bm *BlockMiner, paymentRec
// Add a real block // Add a real block
m, err := paymentReceiver.MpoolPushMessage(ctx, &types.Message{ m, err := paymentReceiver.MpoolPushMessage(ctx, &types.Message{
To: builtin0.BurntFundsActorAddr, To: builtin.BurntFundsActorAddr,
From: receiverAddr, From: receiverAddr,
Value: types.NewInt(0), Value: types.NewInt(0),
}, nil) }, nil)

View File

@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
@ -57,6 +57,6 @@ func init() {
Devnet = false Devnet = false
} }
const BlockDelaySecs = uint64(builtin0.EpochDurationSeconds) const BlockDelaySecs = uint64(builtin2.EpochDurationSeconds)
const PropagationDelaySecs = uint64(6) const PropagationDelaySecs = uint64(6)

View File

@ -1,36 +1,13 @@
package build package build
import ( import (
"sort"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/libp2p/go-libp2p-core/protocol" "github.com/libp2p/go-libp2p-core/protocol"
"github.com/filecoin-project/go-state-types/abi"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
) )
func DefaultSectorSize() abi.SectorSize {
szs := make([]abi.SectorSize, 0, len(miner0.SupportedProofTypes))
for spt := range miner0.SupportedProofTypes {
ss, err := spt.SectorSize()
if err != nil {
panic(err)
}
szs = append(szs, ss)
}
sort.Slice(szs, func(i, j int) bool {
return szs[i] < szs[j]
})
return szs[0]
}
// Core network constants // Core network constants
func BlocksTopic(netName dtypes.NetworkName) string { return "/fil/blocks/" + string(netName) } func BlocksTopic(netName dtypes.NetworkName) string { return "/fil/blocks/" + string(netName) }

View File

@ -7,12 +7,12 @@ import (
"os" "os"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/abi" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy"
) )
// ///// // /////
@ -32,7 +32,7 @@ const ActorUpgradeNetworkVersion = network.Version4
const ForkLengthThreshold = Finality const ForkLengthThreshold = Finality
// Blocks (e) // Blocks (e)
var BlocksPerEpoch = uint64(builtin.ExpectedLeadersPerEpoch) var BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch)
// Epochs // Epochs
const Finality = policy.ChainFinality const Finality = policy.ChainFinality
@ -116,4 +116,4 @@ const PackingEfficiencyDenom = 5
// Actor consts // Actor consts
// TODO: Pull from actors when its made not private // TODO: Pull from actors when its made not private
var MinDealDuration = abi.ChainEpoch(180 * builtin.EpochsInDay) var MinDealDuration = abi.ChainEpoch(180 * builtin2.EpochsInDay)

View File

@ -12,7 +12,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/specs-actors/actors/builtin"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
) )
@ -21,14 +22,14 @@ var (
UnixfsChunkSize = uint64(1 << 20) UnixfsChunkSize = uint64(1 << 20)
UnixfsLinksPerLevel = 1024 UnixfsLinksPerLevel = 1024
BlocksPerEpoch = uint64(builtin.ExpectedLeadersPerEpoch) BlocksPerEpoch = uint64(builtin2.ExpectedLeadersPerEpoch)
BlockMessageLimit = 512 BlockMessageLimit = 512
BlockGasLimit = int64(100_000_000_000) BlockGasLimit = int64(100_000_000_000)
BlockGasTarget = int64(BlockGasLimit / 2) BlockGasTarget = int64(BlockGasLimit / 2)
BaseFeeMaxChangeDenom = int64(8) // 12.5% BaseFeeMaxChangeDenom = int64(8) // 12.5%
InitialBaseFee = int64(100e6) InitialBaseFee = int64(100e6)
MinimumBaseFee = int64(100) MinimumBaseFee = int64(100)
BlockDelaySecs = uint64(builtin.EpochDurationSeconds) BlockDelaySecs = uint64(builtin2.EpochDurationSeconds)
PropagationDelaySecs = uint64(6) PropagationDelaySecs = uint64(6)
AllowableClockDriftSecs = uint64(1) AllowableClockDriftSecs = uint64(1)
@ -72,7 +73,7 @@ var (
// Actor consts // Actor consts
// TODO: Pull from actors when its made not private // TODO: Pull from actors when its made not private
MinDealDuration = abi.ChainEpoch(180 * builtin.EpochsInDay) MinDealDuration = abi.ChainEpoch(180 * builtin2.EpochsInDay)
PackingEfficiencyNum int64 = 4 PackingEfficiencyNum int64 = 4
PackingEfficiencyDenom int64 = 5 PackingEfficiencyDenom int64 = 5

View File

@ -12,8 +12,9 @@ import (
typegen "github.com/whyrusleeping/cbor-gen" typegen "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/runtime"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
bstore "github.com/filecoin-project/lotus/lib/blockstore" bstore "github.com/filecoin-project/lotus/lib/blockstore"
) )
@ -22,24 +23,24 @@ func TestDiffAdtArray(t *testing.T) {
ctxstoreA := newContextStore() ctxstoreA := newContextStore()
ctxstoreB := newContextStore() ctxstoreB := newContextStore()
arrA := adt0.MakeEmptyArray(ctxstoreA) arrA := adt2.MakeEmptyArray(ctxstoreA)
arrB := adt0.MakeEmptyArray(ctxstoreB) arrB := adt2.MakeEmptyArray(ctxstoreB)
require.NoError(t, arrA.Set(0, runtime.CBORBytes([]byte{0}))) // delete require.NoError(t, arrA.Set(0, builtin2.CBORBytes([]byte{0}))) // delete
require.NoError(t, arrA.Set(1, runtime.CBORBytes([]byte{0}))) // modify require.NoError(t, arrA.Set(1, builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, arrB.Set(1, runtime.CBORBytes([]byte{1}))) require.NoError(t, arrB.Set(1, builtin2.CBORBytes([]byte{1})))
require.NoError(t, arrA.Set(2, runtime.CBORBytes([]byte{1}))) // delete require.NoError(t, arrA.Set(2, builtin2.CBORBytes([]byte{1}))) // delete
require.NoError(t, arrA.Set(3, runtime.CBORBytes([]byte{0}))) // noop require.NoError(t, arrA.Set(3, builtin2.CBORBytes([]byte{0}))) // noop
require.NoError(t, arrB.Set(3, runtime.CBORBytes([]byte{0}))) require.NoError(t, arrB.Set(3, builtin2.CBORBytes([]byte{0})))
require.NoError(t, arrA.Set(4, runtime.CBORBytes([]byte{0}))) // modify require.NoError(t, arrA.Set(4, builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, arrB.Set(4, runtime.CBORBytes([]byte{6}))) require.NoError(t, arrB.Set(4, builtin2.CBORBytes([]byte{6})))
require.NoError(t, arrB.Set(5, runtime.CBORBytes{8})) // add require.NoError(t, arrB.Set(5, builtin2.CBORBytes{8})) // add
require.NoError(t, arrB.Set(6, runtime.CBORBytes{9})) // add require.NoError(t, arrB.Set(6, builtin2.CBORBytes{9})) // add
changes := new(TestDiffArray) changes := new(TestDiffArray)
@ -76,24 +77,24 @@ func TestDiffAdtMap(t *testing.T) {
ctxstoreA := newContextStore() ctxstoreA := newContextStore()
ctxstoreB := newContextStore() ctxstoreB := newContextStore()
mapA := adt0.MakeEmptyMap(ctxstoreA) mapA := adt2.MakeEmptyMap(ctxstoreA)
mapB := adt0.MakeEmptyMap(ctxstoreB) mapB := adt2.MakeEmptyMap(ctxstoreB)
require.NoError(t, mapA.Put(abi.UIntKey(0), runtime.CBORBytes([]byte{0}))) // delete require.NoError(t, mapA.Put(abi.UIntKey(0), builtin2.CBORBytes([]byte{0}))) // delete
require.NoError(t, mapA.Put(abi.UIntKey(1), runtime.CBORBytes([]byte{0}))) // modify require.NoError(t, mapA.Put(abi.UIntKey(1), builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, mapB.Put(abi.UIntKey(1), runtime.CBORBytes([]byte{1}))) require.NoError(t, mapB.Put(abi.UIntKey(1), builtin2.CBORBytes([]byte{1})))
require.NoError(t, mapA.Put(abi.UIntKey(2), runtime.CBORBytes([]byte{1}))) // delete require.NoError(t, mapA.Put(abi.UIntKey(2), builtin2.CBORBytes([]byte{1}))) // delete
require.NoError(t, mapA.Put(abi.UIntKey(3), runtime.CBORBytes([]byte{0}))) // noop require.NoError(t, mapA.Put(abi.UIntKey(3), builtin2.CBORBytes([]byte{0}))) // noop
require.NoError(t, mapB.Put(abi.UIntKey(3), runtime.CBORBytes([]byte{0}))) require.NoError(t, mapB.Put(abi.UIntKey(3), builtin2.CBORBytes([]byte{0})))
require.NoError(t, mapA.Put(abi.UIntKey(4), runtime.CBORBytes([]byte{0}))) // modify require.NoError(t, mapA.Put(abi.UIntKey(4), builtin2.CBORBytes([]byte{0}))) // modify
require.NoError(t, mapB.Put(abi.UIntKey(4), runtime.CBORBytes([]byte{6}))) require.NoError(t, mapB.Put(abi.UIntKey(4), builtin2.CBORBytes([]byte{6})))
require.NoError(t, mapB.Put(abi.UIntKey(5), runtime.CBORBytes{8})) // add require.NoError(t, mapB.Put(abi.UIntKey(5), builtin2.CBORBytes{8})) // add
require.NoError(t, mapB.Put(abi.UIntKey(6), runtime.CBORBytes{9})) // add require.NoError(t, mapB.Put(abi.UIntKey(6), builtin2.CBORBytes{9})) // add
changes := new(TestDiffMap) changes := new(TestDiffMap)
@ -144,7 +145,7 @@ func (t *TestDiffMap) AsKey(key string) (abi.Keyer, error) {
} }
func (t *TestDiffMap) Add(key string, val *typegen.Deferred) error { func (t *TestDiffMap) Add(key string, val *typegen.Deferred) error {
v := new(runtime.CBORBytes) v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw)) err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil { if err != nil {
return err return err
@ -161,13 +162,13 @@ func (t *TestDiffMap) Add(key string, val *typegen.Deferred) error {
} }
func (t *TestDiffMap) Modify(key string, from, to *typegen.Deferred) error { func (t *TestDiffMap) Modify(key string, from, to *typegen.Deferred) error {
vFrom := new(runtime.CBORBytes) vFrom := new(builtin2.CBORBytes)
err := vFrom.UnmarshalCBOR(bytes.NewReader(from.Raw)) err := vFrom.UnmarshalCBOR(bytes.NewReader(from.Raw))
if err != nil { if err != nil {
return err return err
} }
vTo := new(runtime.CBORBytes) vTo := new(builtin2.CBORBytes)
err = vTo.UnmarshalCBOR(bytes.NewReader(to.Raw)) err = vTo.UnmarshalCBOR(bytes.NewReader(to.Raw))
if err != nil { if err != nil {
return err return err
@ -194,7 +195,7 @@ func (t *TestDiffMap) Modify(key string, from, to *typegen.Deferred) error {
} }
func (t *TestDiffMap) Remove(key string, val *typegen.Deferred) error { func (t *TestDiffMap) Remove(key string, val *typegen.Deferred) error {
v := new(runtime.CBORBytes) v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw)) err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil { if err != nil {
return err return err
@ -212,7 +213,7 @@ func (t *TestDiffMap) Remove(key string, val *typegen.Deferred) error {
type adtMapDiffResult struct { type adtMapDiffResult struct {
key uint64 key uint64
val runtime.CBORBytes val builtin2.CBORBytes
} }
type TestAdtMapDiffModified struct { type TestAdtMapDiffModified struct {
@ -222,7 +223,7 @@ type TestAdtMapDiffModified struct {
type adtArrayDiffResult struct { type adtArrayDiffResult struct {
key uint64 key uint64
val runtime.CBORBytes val builtin2.CBORBytes
} }
type TestDiffArray struct { type TestDiffArray struct {
@ -239,7 +240,7 @@ type TestAdtArrayDiffModified struct {
} }
func (t *TestDiffArray) Add(key uint64, val *typegen.Deferred) error { func (t *TestDiffArray) Add(key uint64, val *typegen.Deferred) error {
v := new(runtime.CBORBytes) v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw)) err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil { if err != nil {
return err return err
@ -252,13 +253,13 @@ func (t *TestDiffArray) Add(key uint64, val *typegen.Deferred) error {
} }
func (t *TestDiffArray) Modify(key uint64, from, to *typegen.Deferred) error { func (t *TestDiffArray) Modify(key uint64, from, to *typegen.Deferred) error {
vFrom := new(runtime.CBORBytes) vFrom := new(builtin2.CBORBytes)
err := vFrom.UnmarshalCBOR(bytes.NewReader(from.Raw)) err := vFrom.UnmarshalCBOR(bytes.NewReader(from.Raw))
if err != nil { if err != nil {
return err return err
} }
vTo := new(runtime.CBORBytes) vTo := new(builtin2.CBORBytes)
err = vTo.UnmarshalCBOR(bytes.NewReader(to.Raw)) err = vTo.UnmarshalCBOR(bytes.NewReader(to.Raw))
if err != nil { if err != nil {
return err return err
@ -280,7 +281,7 @@ func (t *TestDiffArray) Modify(key uint64, from, to *typegen.Deferred) error {
} }
func (t *TestDiffArray) Remove(key uint64, val *typegen.Deferred) error { func (t *TestDiffArray) Remove(key uint64, val *typegen.Deferred) error {
v := new(runtime.CBORBytes) v := new(builtin2.CBORBytes)
err := v.UnmarshalCBOR(bytes.NewReader(val.Raw)) err := v.UnmarshalCBOR(bytes.NewReader(val.Raw))
if err != nil { if err != nil {
return err return err

View File

@ -27,6 +27,16 @@ var SaftAddress = makeAddress("t0122")
var ReserveAddress = makeAddress("t090") var ReserveAddress = makeAddress("t090")
var RootVerifierAddress = makeAddress("t080") var RootVerifierAddress = makeAddress("t080")
var (
ExpectedLeadersPerEpoch = builtin0.ExpectedLeadersPerEpoch
)
const (
EpochDurationSeconds = builtin0.EpochDurationSeconds
EpochsInDay = builtin0.EpochsInDay
SecondsInDay = builtin0.SecondsInDay
)
// TODO: Why does actors have 2 different versions of this? // TODO: Why does actors have 2 different versions of this?
type SectorInfo = proof0.SectorInfo type SectorInfo = proof0.SectorInfo
type PoStProof = proof0.PoStProof type PoStProof = proof0.PoStProof

View File

@ -1,6 +1,8 @@
package policy package policy
import ( import (
"sort"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
@ -11,12 +13,14 @@ import (
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
) )
const ( const (
ChainFinality = miner0.ChainFinality ChainFinality = miner0.ChainFinality
SealRandomnessLookback = ChainFinality SealRandomnessLookback = ChainFinality
PaychSettleDelay = paych2.SettleDelay
) )
// SetSupportedProofTypes sets supported proof types, across all actor versions. // SetSupportedProofTypes sets supported proof types, across all actor versions.
@ -114,3 +118,35 @@ func GetWinningPoStSectorSetLookback(nwVer network.Version) abi.ChainEpoch {
return ChainFinality return ChainFinality
} }
func GetMaxSectorExpirationExtension() abi.ChainEpoch {
return miner0.MaxSectorExpirationExtension
}
// TODO: we'll probably need to abstract over this better in the future.
func GetMaxPoStPartitions(p abi.RegisteredPoStProof) (int, error) {
sectorsPerPart, err := builtin2.PoStProofWindowPoStPartitionSectors(p)
if err != nil {
return 0, err
}
return int(miner2.AddressedSectorsMax / sectorsPerPart), nil
}
func GetDefaultSectorSize() abi.SectorSize {
// supported proof types are the same across versions.
szs := make([]abi.SectorSize, 0, len(miner2.SupportedProofTypes))
for spt := range miner2.SupportedProofTypes {
ss, err := spt.SectorSize()
if err != nil {
panic(err)
}
szs = append(szs, ss)
}
sort.Slice(szs, func(i, j int) bool {
return szs[i] < szs[j]
})
return szs[0]
}

View File

@ -6,9 +6,13 @@ import (
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
) )
@ -42,9 +46,25 @@ func TestSupportedProofTypes(t *testing.T) {
func TestAssumptions(t *testing.T) { func TestAssumptions(t *testing.T) {
require.EqualValues(t, miner0.SupportedProofTypes, miner2.SupportedProofTypes) require.EqualValues(t, miner0.SupportedProofTypes, miner2.SupportedProofTypes)
require.Equal(t, miner0.PreCommitChallengeDelay, miner2.PreCommitChallengeDelay) require.Equal(t, miner0.PreCommitChallengeDelay, miner2.PreCommitChallengeDelay)
require.Equal(t, miner0.MaxSectorExpirationExtension, miner2.MaxSectorExpirationExtension)
require.Equal(t, miner0.ChainFinality, miner2.ChainFinality) require.Equal(t, miner0.ChainFinality, miner2.ChainFinality)
require.Equal(t, miner0.WPoStChallengeWindow, miner2.WPoStChallengeWindow) require.Equal(t, miner0.WPoStChallengeWindow, miner2.WPoStChallengeWindow)
require.Equal(t, miner0.WPoStProvingPeriod, miner2.WPoStProvingPeriod) require.Equal(t, miner0.WPoStProvingPeriod, miner2.WPoStProvingPeriod)
require.Equal(t, miner0.WPoStPeriodDeadlines, miner2.WPoStPeriodDeadlines) require.Equal(t, miner0.WPoStPeriodDeadlines, miner2.WPoStPeriodDeadlines)
require.Equal(t, miner0.AddressedSectorsMax, miner2.AddressedSectorsMax)
require.Equal(t, paych0.SettleDelay, paych2.SettleDelay)
require.True(t, verifreg0.MinVerifiedDealSize.Equals(verifreg2.MinVerifiedDealSize)) require.True(t, verifreg0.MinVerifiedDealSize.Equals(verifreg2.MinVerifiedDealSize))
} }
func TestPartitionSizes(t *testing.T) {
for p := range abi.PoStSealProofTypes {
sizeNew, err := builtin2.PoStProofWindowPoStPartitionSectors(p)
require.NoError(t, err)
sizeOld, err := builtin0.PoStProofWindowPoStPartitionSectors(p)
if err != nil {
// new proof type.
continue
}
require.Equal(t, sizeOld, sizeNew)
}
}

View File

@ -18,14 +18,14 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-actors/actors/util/adt"
tutils "github.com/filecoin-project/specs-actors/support/testing"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
bstore "github.com/filecoin-project/lotus/lib/blockstore" bstore "github.com/filecoin-project/lotus/lib/blockstore"
) )
@ -72,24 +72,24 @@ func (m mockAPI) setActor(tsk types.TipSetKey, act *types.Actor) {
func TestMarketPredicates(t *testing.T) { func TestMarketPredicates(t *testing.T) {
ctx := context.Background() ctx := context.Background()
bs := bstore.NewTemporarySync() bs := bstore.NewTemporarySync()
store := adt.WrapStore(ctx, cbornode.NewCborStore(bs)) store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs))
oldDeal1 := &market0.DealState{ oldDeal1 := &market2.DealState{
SectorStartEpoch: 1, SectorStartEpoch: 1,
LastUpdatedEpoch: 2, LastUpdatedEpoch: 2,
SlashEpoch: 0, SlashEpoch: 0,
} }
oldDeal2 := &market0.DealState{ oldDeal2 := &market2.DealState{
SectorStartEpoch: 4, SectorStartEpoch: 4,
LastUpdatedEpoch: 5, LastUpdatedEpoch: 5,
SlashEpoch: 0, SlashEpoch: 0,
} }
oldDeals := map[abi.DealID]*market0.DealState{ oldDeals := map[abi.DealID]*market2.DealState{
abi.DealID(1): oldDeal1, abi.DealID(1): oldDeal1,
abi.DealID(2): oldDeal2, abi.DealID(2): oldDeal2,
} }
oldProp1 := &market0.DealProposal{ oldProp1 := &market2.DealProposal{
PieceCID: dummyCid, PieceCID: dummyCid,
PieceSize: 0, PieceSize: 0,
VerifiedDeal: false, VerifiedDeal: false,
@ -101,7 +101,7 @@ func TestMarketPredicates(t *testing.T) {
ProviderCollateral: big.Zero(), ProviderCollateral: big.Zero(),
ClientCollateral: big.Zero(), ClientCollateral: big.Zero(),
} }
oldProp2 := &market0.DealProposal{ oldProp2 := &market2.DealProposal{
PieceCID: dummyCid, PieceCID: dummyCid,
PieceSize: 0, PieceSize: 0,
VerifiedDeal: false, VerifiedDeal: false,
@ -113,7 +113,7 @@ func TestMarketPredicates(t *testing.T) {
ProviderCollateral: big.Zero(), ProviderCollateral: big.Zero(),
ClientCollateral: big.Zero(), ClientCollateral: big.Zero(),
} }
oldProps := map[abi.DealID]*market0.DealProposal{ oldProps := map[abi.DealID]*market2.DealProposal{
abi.DealID(1): oldProp1, abi.DealID(1): oldProp1,
abi.DealID(2): oldProp2, abi.DealID(2): oldProp2,
} }
@ -127,7 +127,7 @@ func TestMarketPredicates(t *testing.T) {
oldStateC := createMarketState(ctx, t, store, oldDeals, oldProps, oldBalances) oldStateC := createMarketState(ctx, t, store, oldDeals, oldProps, oldBalances)
newDeal1 := &market0.DealState{ newDeal1 := &market2.DealState{
SectorStartEpoch: 1, SectorStartEpoch: 1,
LastUpdatedEpoch: 3, LastUpdatedEpoch: 3,
SlashEpoch: 0, SlashEpoch: 0,
@ -136,19 +136,19 @@ func TestMarketPredicates(t *testing.T) {
// deal 2 removed // deal 2 removed
// added // added
newDeal3 := &market0.DealState{ newDeal3 := &market2.DealState{
SectorStartEpoch: 1, SectorStartEpoch: 1,
LastUpdatedEpoch: 2, LastUpdatedEpoch: 2,
SlashEpoch: 3, SlashEpoch: 3,
} }
newDeals := map[abi.DealID]*market0.DealState{ newDeals := map[abi.DealID]*market2.DealState{
abi.DealID(1): newDeal1, abi.DealID(1): newDeal1,
// deal 2 was removed // deal 2 was removed
abi.DealID(3): newDeal3, abi.DealID(3): newDeal3,
} }
// added // added
newProp3 := &market0.DealProposal{ newProp3 := &market2.DealProposal{
PieceCID: dummyCid, PieceCID: dummyCid,
PieceSize: 0, PieceSize: 0,
VerifiedDeal: false, VerifiedDeal: false,
@ -160,7 +160,7 @@ func TestMarketPredicates(t *testing.T) {
ProviderCollateral: big.Zero(), ProviderCollateral: big.Zero(),
ClientCollateral: big.Zero(), ClientCollateral: big.Zero(),
} }
newProps := map[abi.DealID]*market0.DealProposal{ newProps := map[abi.DealID]*market2.DealProposal{
abi.DealID(1): oldProp1, // 1 was persisted abi.DealID(1): oldProp1, // 1 was persisted
// prop 2 was removed // prop 2 was removed
abi.DealID(3): newProp3, // new abi.DealID(3): newProp3, // new
@ -183,8 +183,8 @@ func TestMarketPredicates(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
api := newMockAPI(bs) api := newMockAPI(bs)
api.setActor(oldState.Key(), &types.Actor{Code: builtin0.StorageMarketActorCodeID, Head: oldStateC}) api.setActor(oldState.Key(), &types.Actor{Code: builtin2.StorageMarketActorCodeID, Head: oldStateC})
api.setActor(newState.Key(), &types.Actor{Code: builtin0.StorageMarketActorCodeID, Head: newStateC}) api.setActor(newState.Key(), &types.Actor{Code: builtin2.StorageMarketActorCodeID, Head: newStateC})
t.Run("deal ID predicate", func(t *testing.T) { t.Run("deal ID predicate", func(t *testing.T) {
preds := NewStatePredicates(api) preds := NewStatePredicates(api)
@ -243,7 +243,7 @@ func TestMarketPredicates(t *testing.T) {
marketCid, err := store.Put(ctx, marketState0) marketCid, err := store.Put(ctx, marketState0)
require.NoError(t, err) require.NoError(t, err)
marketState, err := market.Load(store, &types.Actor{ marketState, err := market.Load(store, &types.Actor{
Code: builtin0.StorageMarketActorCodeID, Code: builtin2.StorageMarketActorCodeID,
Head: marketCid, Head: marketCid,
}) })
require.NoError(t, err) require.NoError(t, err)
@ -356,7 +356,7 @@ func TestMarketPredicates(t *testing.T) {
marketCid, err := store.Put(ctx, marketState0) marketCid, err := store.Put(ctx, marketState0)
require.NoError(t, err) require.NoError(t, err)
marketState, err := market.Load(store, &types.Actor{ marketState, err := market.Load(store, &types.Actor{
Code: builtin0.StorageMarketActorCodeID, Code: builtin2.StorageMarketActorCodeID,
Head: marketCid, Head: marketCid,
}) })
require.NoError(t, err) require.NoError(t, err)
@ -370,7 +370,7 @@ func TestMarketPredicates(t *testing.T) {
func TestMinerSectorChange(t *testing.T) { func TestMinerSectorChange(t *testing.T) {
ctx := context.Background() ctx := context.Background()
bs := bstore.NewTemporarySync() bs := bstore.NewTemporarySync()
store := adt.WrapStore(ctx, cbornode.NewCborStore(bs)) store := adt2.WrapStore(ctx, cbornode.NewCborStore(bs))
nextID := uint64(0) nextID := uint64(0)
nextIDAddrF := func() address.Address { nextIDAddrF := func() address.Address {
@ -379,12 +379,12 @@ func TestMinerSectorChange(t *testing.T) {
} }
owner, worker := nextIDAddrF(), nextIDAddrF() owner, worker := nextIDAddrF(), nextIDAddrF()
si0 := newSectorOnChainInfo(0, tutils.MakeCID("0", &miner0.SealedCIDPrefix), big.NewInt(0), abi.ChainEpoch(0), abi.ChainEpoch(10)) si0 := newSectorOnChainInfo(0, tutils.MakeCID("0", &miner2.SealedCIDPrefix), big.NewInt(0), abi.ChainEpoch(0), abi.ChainEpoch(10))
si1 := newSectorOnChainInfo(1, tutils.MakeCID("1", &miner0.SealedCIDPrefix), big.NewInt(1), abi.ChainEpoch(1), abi.ChainEpoch(11)) si1 := newSectorOnChainInfo(1, tutils.MakeCID("1", &miner2.SealedCIDPrefix), big.NewInt(1), abi.ChainEpoch(1), abi.ChainEpoch(11))
si2 := newSectorOnChainInfo(2, tutils.MakeCID("2", &miner0.SealedCIDPrefix), big.NewInt(2), abi.ChainEpoch(2), abi.ChainEpoch(11)) si2 := newSectorOnChainInfo(2, tutils.MakeCID("2", &miner2.SealedCIDPrefix), big.NewInt(2), abi.ChainEpoch(2), abi.ChainEpoch(11))
oldMinerC := createMinerState(ctx, t, store, owner, worker, []miner.SectorOnChainInfo{si0, si1, si2}) oldMinerC := createMinerState(ctx, t, store, owner, worker, []miner.SectorOnChainInfo{si0, si1, si2})
si3 := newSectorOnChainInfo(3, tutils.MakeCID("3", &miner0.SealedCIDPrefix), big.NewInt(3), abi.ChainEpoch(3), abi.ChainEpoch(12)) si3 := newSectorOnChainInfo(3, tutils.MakeCID("3", &miner2.SealedCIDPrefix), big.NewInt(3), abi.ChainEpoch(3), abi.ChainEpoch(12))
// 0 delete // 0 delete
// 1 extend // 1 extend
// 2 same // 2 same
@ -400,8 +400,8 @@ func TestMinerSectorChange(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
api := newMockAPI(bs) api := newMockAPI(bs)
api.setActor(oldState.Key(), &types.Actor{Head: oldMinerC, Code: builtin0.StorageMinerActorCodeID}) api.setActor(oldState.Key(), &types.Actor{Head: oldMinerC, Code: builtin2.StorageMinerActorCodeID})
api.setActor(newState.Key(), &types.Actor{Head: newMinerC, Code: builtin0.StorageMinerActorCodeID}) api.setActor(newState.Key(), &types.Actor{Head: newMinerC, Code: builtin2.StorageMinerActorCodeID})
preds := NewStatePredicates(api) preds := NewStatePredicates(api)
@ -467,7 +467,7 @@ type balance struct {
locked abi.TokenAmount locked abi.TokenAmount
} }
func createMarketState(ctx context.Context, t *testing.T, store adt.Store, deals map[abi.DealID]*market0.DealState, props map[abi.DealID]*market0.DealProposal, balances map[address.Address]balance) cid.Cid { func createMarketState(ctx context.Context, t *testing.T, store adt2.Store, deals map[abi.DealID]*market2.DealState, props map[abi.DealID]*market2.DealProposal, balances map[address.Address]balance) cid.Cid {
dealRootCid := createDealAMT(ctx, t, store, deals) dealRootCid := createDealAMT(ctx, t, store, deals)
propRootCid := createProposalAMT(ctx, t, store, props) propRootCid := createProposalAMT(ctx, t, store, props)
balancesCids := createBalanceTable(ctx, t, store, balances) balancesCids := createBalanceTable(ctx, t, store, balances)
@ -482,16 +482,16 @@ func createMarketState(ctx context.Context, t *testing.T, store adt.Store, deals
return stateC return stateC
} }
func createEmptyMarketState(t *testing.T, store adt.Store) *market0.State { func createEmptyMarketState(t *testing.T, store adt2.Store) *market2.State {
emptyArrayCid, err := adt.MakeEmptyArray(store).Root() emptyArrayCid, err := adt2.MakeEmptyArray(store).Root()
require.NoError(t, err) require.NoError(t, err)
emptyMap, err := adt.MakeEmptyMap(store).Root() emptyMap, err := adt2.MakeEmptyMap(store).Root()
require.NoError(t, err) require.NoError(t, err)
return market0.ConstructState(emptyArrayCid, emptyMap, emptyMap) return market2.ConstructState(emptyArrayCid, emptyMap, emptyMap)
} }
func createDealAMT(ctx context.Context, t *testing.T, store adt.Store, deals map[abi.DealID]*market0.DealState) cid.Cid { func createDealAMT(ctx context.Context, t *testing.T, store adt2.Store, deals map[abi.DealID]*market2.DealState) cid.Cid {
root := adt.MakeEmptyArray(store) root := adt2.MakeEmptyArray(store)
for dealID, dealState := range deals { for dealID, dealState := range deals {
err := root.Set(uint64(dealID), dealState) err := root.Set(uint64(dealID), dealState)
require.NoError(t, err) require.NoError(t, err)
@ -501,8 +501,8 @@ func createDealAMT(ctx context.Context, t *testing.T, store adt.Store, deals map
return rootCid return rootCid
} }
func createProposalAMT(ctx context.Context, t *testing.T, store adt.Store, props map[abi.DealID]*market0.DealProposal) cid.Cid { func createProposalAMT(ctx context.Context, t *testing.T, store adt2.Store, props map[abi.DealID]*market2.DealProposal) cid.Cid {
root := adt.MakeEmptyArray(store) root := adt2.MakeEmptyArray(store)
for dealID, prop := range props { for dealID, prop := range props {
err := root.Set(uint64(dealID), prop) err := root.Set(uint64(dealID), prop)
require.NoError(t, err) require.NoError(t, err)
@ -512,16 +512,16 @@ func createProposalAMT(ctx context.Context, t *testing.T, store adt.Store, props
return rootCid return rootCid
} }
func createBalanceTable(ctx context.Context, t *testing.T, store adt.Store, balances map[address.Address]balance) [2]cid.Cid { func createBalanceTable(ctx context.Context, t *testing.T, store adt2.Store, balances map[address.Address]balance) [2]cid.Cid {
escrowMapRoot := adt.MakeEmptyMap(store) escrowMapRoot := adt2.MakeEmptyMap(store)
escrowMapRootCid, err := escrowMapRoot.Root() escrowMapRootCid, err := escrowMapRoot.Root()
require.NoError(t, err) require.NoError(t, err)
escrowRoot, err := adt.AsBalanceTable(store, escrowMapRootCid) escrowRoot, err := adt2.AsBalanceTable(store, escrowMapRootCid)
require.NoError(t, err) require.NoError(t, err)
lockedMapRoot := adt.MakeEmptyMap(store) lockedMapRoot := adt2.MakeEmptyMap(store)
lockedMapRootCid, err := lockedMapRoot.Root() lockedMapRootCid, err := lockedMapRoot.Root()
require.NoError(t, err) require.NoError(t, err)
lockedRoot, err := adt.AsBalanceTable(store, lockedMapRootCid) lockedRoot, err := adt2.AsBalanceTable(store, lockedMapRootCid)
require.NoError(t, err) require.NoError(t, err)
for addr, balance := range balances { for addr, balance := range balances {
@ -538,7 +538,7 @@ func createBalanceTable(ctx context.Context, t *testing.T, store adt.Store, bala
return [2]cid.Cid{escrowRootCid, lockedRootCid} return [2]cid.Cid{escrowRootCid, lockedRootCid}
} }
func createMinerState(ctx context.Context, t *testing.T, store adt.Store, owner, worker address.Address, sectors []miner.SectorOnChainInfo) cid.Cid { func createMinerState(ctx context.Context, t *testing.T, store adt2.Store, owner, worker address.Address, sectors []miner.SectorOnChainInfo) cid.Cid {
rootCid := createSectorsAMT(ctx, t, store, sectors) rootCid := createSectorsAMT(ctx, t, store, sectors)
state := createEmptyMinerState(ctx, t, store, owner, worker) state := createEmptyMinerState(ctx, t, store, owner, worker)
@ -549,20 +549,20 @@ func createMinerState(ctx context.Context, t *testing.T, store adt.Store, owner,
return stateC return stateC
} }
func createEmptyMinerState(ctx context.Context, t *testing.T, store adt.Store, owner, worker address.Address) *miner0.State { func createEmptyMinerState(ctx context.Context, t *testing.T, store adt2.Store, owner, worker address.Address) *miner2.State {
emptyArrayCid, err := adt.MakeEmptyArray(store).Root() emptyArrayCid, err := adt2.MakeEmptyArray(store).Root()
require.NoError(t, err) require.NoError(t, err)
emptyMap, err := adt.MakeEmptyMap(store).Root() emptyMap, err := adt2.MakeEmptyMap(store).Root()
require.NoError(t, err) require.NoError(t, err)
emptyDeadline, err := store.Put(store.Context(), miner0.ConstructDeadline(emptyArrayCid)) emptyDeadline, err := store.Put(store.Context(), miner2.ConstructDeadline(emptyArrayCid))
require.NoError(t, err) require.NoError(t, err)
emptyVestingFunds := miner0.ConstructVestingFunds() emptyVestingFunds := miner2.ConstructVestingFunds()
emptyVestingFundsCid, err := store.Put(store.Context(), emptyVestingFunds) emptyVestingFundsCid, err := store.Put(store.Context(), emptyVestingFunds)
require.NoError(t, err) require.NoError(t, err)
emptyDeadlines := miner0.ConstructDeadlines(emptyDeadline) emptyDeadlines := miner2.ConstructDeadlines(emptyDeadline)
emptyDeadlinesCid, err := store.Put(store.Context(), emptyDeadlines) emptyDeadlinesCid, err := store.Put(store.Context(), emptyDeadlines)
require.NoError(t, err) require.NoError(t, err)
@ -572,16 +572,30 @@ func createEmptyMinerState(ctx context.Context, t *testing.T, store adt.Store, o
emptyBitfieldCid, err := store.Put(store.Context(), emptyBitfield) emptyBitfieldCid, err := store.Put(store.Context(), emptyBitfield)
require.NoError(t, err) require.NoError(t, err)
state, err := miner0.ConstructState(minerInfo, 123, emptyBitfieldCid, emptyArrayCid, emptyMap, emptyDeadlinesCid, emptyVestingFundsCid) state, err := miner2.ConstructState(minerInfo, 123, 4, emptyBitfieldCid, emptyArrayCid, emptyMap, emptyDeadlinesCid, emptyVestingFundsCid)
require.NoError(t, err) require.NoError(t, err)
return state return state
} }
func createSectorsAMT(ctx context.Context, t *testing.T, store adt.Store, sectors []miner.SectorOnChainInfo) cid.Cid { func createSectorsAMT(ctx context.Context, t *testing.T, store adt2.Store, sectors []miner.SectorOnChainInfo) cid.Cid {
root := adt.MakeEmptyArray(store) root := adt2.MakeEmptyArray(store)
for _, sector := range sectors { for _, sector := range sectors {
sector := (miner0.SectorOnChainInfo)(sector) sector := miner2.SectorOnChainInfo{
SectorNumber: sector.SectorNumber,
SealProof: sector.SealProof,
SealedCID: sector.SealedCID,
DealIDs: sector.DealIDs,
Activation: sector.Activation,
Expiration: sector.Expiration,
DealWeight: sector.DealWeight,
VerifiedDealWeight: sector.VerifiedDealWeight,
InitialPledge: sector.InitialPledge,
ExpectedDayReward: sector.ExpectedDayReward,
ExpectedStoragePledge: sector.ExpectedStoragePledge,
ReplacedSectorAge: 0,
ReplacedDayReward: big.NewInt(0),
}
err := root.Set(uint64(sector.SectorNumber), &sector) err := root.Set(uint64(sector.SectorNumber), &sector)
require.NoError(t, err) require.NoError(t, err)
} }
@ -614,8 +628,8 @@ const (
) )
// returns a unique SectorPreCommitInfo with each invocation with SectorNumber set to `sectorNo`. // returns a unique SectorPreCommitInfo with each invocation with SectorNumber set to `sectorNo`.
func newSectorPreCommitInfo(sectorNo abi.SectorNumber, sealed cid.Cid, expiration abi.ChainEpoch) *miner0.SectorPreCommitInfo { func newSectorPreCommitInfo(sectorNo abi.SectorNumber, sealed cid.Cid, expiration abi.ChainEpoch) *miner2.SectorPreCommitInfo {
return &miner0.SectorPreCommitInfo{ return &miner2.SectorPreCommitInfo{
SealProof: abi.RegisteredSealProof_StackedDrg32GiBV1, SealProof: abi.RegisteredSealProof_StackedDrg32GiBV1,
SectorNumber: sectorNo, SectorNumber: sectorNo,
SealedCID: sealed, SealedCID: sealed,
@ -625,7 +639,7 @@ func newSectorPreCommitInfo(sectorNo abi.SectorNumber, sealed cid.Cid, expiratio
} }
} }
func dealEquality(expected market0.DealState, actual market.DealState) bool { func dealEquality(expected market2.DealState, actual market.DealState) bool {
return expected.LastUpdatedEpoch == actual.LastUpdatedEpoch && return expected.LastUpdatedEpoch == actual.LastUpdatedEpoch &&
expected.SectorStartEpoch == actual.SectorStartEpoch && expected.SectorStartEpoch == actual.SectorStartEpoch &&
expected.SlashEpoch == actual.SlashEpoch expected.SlashEpoch == actual.SlashEpoch

View File

@ -8,8 +8,7 @@ import (
"sync/atomic" "sync/atomic"
"time" "time"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/google/uuid"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
@ -50,7 +49,7 @@ const msgsPerBlock = 20
//nolint:deadcode,varcheck //nolint:deadcode,varcheck
var log = logging.Logger("gen") var log = logging.Logger("gen")
var ValidWpostForTesting = []proof.PoStProof{{ var ValidWpostForTesting = []proof2.PoStProof{{
ProofBytes: []byte("valid proof"), ProofBytes: []byte("valid proof"),
}} }}
@ -227,7 +226,7 @@ func NewGeneratorWithSectors(numSectors int) (*ChainGen, error) {
}, },
VerifregRootKey: DefaultVerifregRootkeyActor, VerifregRootKey: DefaultVerifregRootkeyActor,
RemainderAccount: DefaultRemainderAccountActor, RemainderAccount: DefaultRemainderAccountActor,
NetworkName: uuid.New().String(), NetworkName: "",
Timestamp: uint64(build.Clock.Now().Add(-500 * time.Duration(build.BlockDelaySecs) * time.Second).Unix()), Timestamp: uint64(build.Clock.Now().Add(-500 * time.Duration(build.BlockDelaySecs) * time.Second).Unix()),
} }
@ -467,7 +466,7 @@ func (cg *ChainGen) NextTipSetFromMinersWithMessages(base *types.TipSet, miners
func (cg *ChainGen) makeBlock(parents *types.TipSet, m address.Address, vrfticket *types.Ticket, func (cg *ChainGen) makeBlock(parents *types.TipSet, m address.Address, vrfticket *types.Ticket,
eticket *types.ElectionProof, bvals []types.BeaconEntry, height abi.ChainEpoch, eticket *types.ElectionProof, bvals []types.BeaconEntry, height abi.ChainEpoch,
wpost []proof.PoStProof, msgs []*types.SignedMessage) (*types.FullBlock, error) { wpost []proof2.PoStProof, msgs []*types.SignedMessage) (*types.FullBlock, error) {
var ts uint64 var ts uint64
if cg.Timestamper != nil { if cg.Timestamper != nil {
@ -605,7 +604,7 @@ func (mca mca) WalletSign(ctx context.Context, a address.Address, v []byte) (*cr
type WinningPoStProver interface { type WinningPoStProver interface {
GenerateCandidates(context.Context, abi.PoStRandomness, uint64) ([]uint64, error) GenerateCandidates(context.Context, abi.PoStRandomness, uint64) ([]uint64, error)
ComputeProof(context.Context, []proof.SectorInfo, abi.PoStRandomness) ([]proof.PoStProof, error) ComputeProof(context.Context, []proof2.SectorInfo, abi.PoStRandomness) ([]proof2.PoStProof, error)
} }
type wppProvider struct{} type wppProvider struct{}
@ -614,7 +613,7 @@ func (wpp *wppProvider) GenerateCandidates(ctx context.Context, _ abi.PoStRandom
return []uint64{0}, nil return []uint64{0}, nil
} }
func (wpp *wppProvider) ComputeProof(context.Context, []proof.SectorInfo, abi.PoStRandomness) ([]proof.PoStProof, error) { func (wpp *wppProvider) ComputeProof(context.Context, []proof2.SectorInfo, abi.PoStRandomness) ([]proof2.PoStProof, error) {
return ValidWpostForTesting, nil return ValidWpostForTesting, nil
} }
@ -681,15 +680,15 @@ type genFakeVerifier struct{}
var _ ffiwrapper.Verifier = (*genFakeVerifier)(nil) var _ ffiwrapper.Verifier = (*genFakeVerifier)(nil)
func (m genFakeVerifier) VerifySeal(svi proof.SealVerifyInfo) (bool, error) { func (m genFakeVerifier) VerifySeal(svi proof2.SealVerifyInfo) (bool, error) {
return true, nil return true, nil
} }
func (m genFakeVerifier) VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error) { func (m genFakeVerifier) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) {
panic("not supported") panic("not supported")
} }
func (m genFakeVerifier) VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error) { func (m genFakeVerifier) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) {
panic("not supported") panic("not supported")
} }

View File

@ -24,11 +24,12 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward" reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
"github.com/filecoin-project/specs-actors/actors/runtime" runtime2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
"github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/state"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
@ -47,7 +48,7 @@ func MinerAddress(genesisIndex uint64) address.Address {
} }
type fakedSigSyscalls struct { type fakedSigSyscalls struct {
runtime.Syscalls runtime2.Syscalls
} }
func (fss *fakedSigSyscalls) VerifySignature(signature crypto.Signature, signer address.Address, plaintext []byte) error { func (fss *fakedSigSyscalls) VerifySignature(signature crypto.Signature, signer address.Address, plaintext []byte) error {
@ -55,7 +56,7 @@ func (fss *fakedSigSyscalls) VerifySignature(signature crypto.Signature, signer
} }
func mkFakedSigSyscalls(base vm.SyscallBuilder) vm.SyscallBuilder { func mkFakedSigSyscalls(base vm.SyscallBuilder) vm.SyscallBuilder {
return func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime.Syscalls { return func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime2.Syscalls {
return &fakedSigSyscalls{ return &fakedSigSyscalls{
base(ctx, cstate, cst), base(ctx, cstate, cst),
} }
@ -114,7 +115,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
} }
params := mustEnc(constructorParams) params := mustEnc(constructorParams)
rval, err := doExecValue(ctx, vm, power.Address, m.Owner, m.PowerBalance, builtin.MethodsPower.CreateMiner, params) rval, err := doExecValue(ctx, vm, power.Address, m.Owner, m.PowerBalance, builtin0.MethodsPower.CreateMiner, params)
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err) return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
} }
@ -146,7 +147,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
if m.MarketBalance.GreaterThan(big.Zero()) { if m.MarketBalance.GreaterThan(big.Zero()) {
params := mustEnc(&minerInfos[i].maddr) params := mustEnc(&minerInfos[i].maddr)
_, err := doExecValue(ctx, vm, market.Address, m.Worker, m.MarketBalance, builtin.MethodsMarket.AddBalance, params) _, err := doExecValue(ctx, vm, market.Address, m.Worker, m.MarketBalance, builtin0.MethodsMarket.AddBalance, params)
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("failed to create genesis miner (add balance): %w", err) return cid.Undef, xerrors.Errorf("failed to create genesis miner (add balance): %w", err)
} }
@ -158,7 +159,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
publish := func(params *market.PublishStorageDealsParams) error { publish := func(params *market.PublishStorageDealsParams) error {
fmt.Printf("publishing %d storage deals on miner %s with worker %s\n", len(params.Deals), params.Deals[0].Proposal.Provider, m.Worker) fmt.Printf("publishing %d storage deals on miner %s with worker %s\n", len(params.Deals), params.Deals[0].Proposal.Provider, m.Worker)
ret, err := doExecValue(ctx, vm, market.Address, m.Worker, big.Zero(), builtin.MethodsMarket.PublishStorageDeals, mustEnc(params)) ret, err := doExecValue(ctx, vm, market.Address, m.Worker, big.Zero(), builtin0.MethodsMarket.PublishStorageDeals, mustEnc(params))
if err != nil { if err != nil {
return xerrors.Errorf("failed to create genesis miner (publish deals): %w", err) return xerrors.Errorf("failed to create genesis miner (publish deals): %w", err)
} }
@ -290,17 +291,17 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
pledge = big.Add(pcd, pledge) pledge = big.Add(pcd, pledge)
fmt.Println(types.FIL(pledge)) fmt.Println(types.FIL(pledge))
_, err = doExecValue(ctx, vm, minerInfos[i].maddr, m.Worker, pledge, builtin.MethodsMiner.PreCommitSector, mustEnc(params)) _, err = doExecValue(ctx, vm, minerInfos[i].maddr, m.Worker, pledge, builtin0.MethodsMiner.PreCommitSector, mustEnc(params))
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err) return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
} }
// Commit one-by-one, otherwise pledge math tends to explode // Commit one-by-one, otherwise pledge math tends to explode
confirmParams := &builtin.ConfirmSectorProofsParams{ confirmParams := &builtin0.ConfirmSectorProofsParams{
Sectors: []abi.SectorNumber{preseal.SectorID}, Sectors: []abi.SectorNumber{preseal.SectorID},
} }
_, err = doExecValue(ctx, vm, minerInfos[i].maddr, power.Address, big.Zero(), builtin.MethodsMiner.ConfirmSectorProofsValid, mustEnc(confirmParams)) _, err = doExecValue(ctx, vm, minerInfos[i].maddr, power.Address, big.Zero(), builtin0.MethodsMiner.ConfirmSectorProofsValid, mustEnc(confirmParams))
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err) return cid.Undef, xerrors.Errorf("failed to confirm presealed sectors: %w", err)
} }
@ -349,7 +350,7 @@ func (fr *fakeRand) GetBeaconRandomness(ctx context.Context, personalization cry
} }
func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*power0.CurrentTotalPowerReturn, error) { func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*power0.CurrentTotalPowerReturn, error) {
pwret, err := doExecValue(ctx, vm, power.Address, maddr, big.Zero(), builtin.MethodsPower.CurrentTotalPower, nil) pwret, err := doExecValue(ctx, vm, power.Address, maddr, big.Zero(), builtin0.MethodsPower.CurrentTotalPower, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }
@ -373,7 +374,7 @@ func dealWeight(ctx context.Context, vm *vm.VM, maddr address.Address, dealIDs [
market.Address, market.Address,
maddr, maddr,
abi.NewTokenAmount(0), abi.NewTokenAmount(0),
builtin.MethodsMarket.VerifyDealsForActivation, builtin0.MethodsMarket.VerifyDealsForActivation,
mustEnc(params), mustEnc(params),
) )
if err != nil { if err != nil {
@ -387,7 +388,7 @@ func dealWeight(ctx context.Context, vm *vm.VM, maddr address.Address, dealIDs [
} }
func currentEpochBlockReward(ctx context.Context, vm *vm.VM, maddr address.Address) (*reward0.ThisEpochRewardReturn, error) { func currentEpochBlockReward(ctx context.Context, vm *vm.VM, maddr address.Address) (*reward0.ThisEpochRewardReturn, error) {
rwret, err := doExecValue(ctx, vm, reward.Address, maddr, big.Zero(), builtin.MethodsReward.ThisEpochReward, nil) rwret, err := doExecValue(ctx, vm, reward.Address, maddr, big.Zero(), builtin0.MethodsReward.ThisEpochReward, nil)
if err != nil { if err != nil {
return nil, err return nil, err
} }

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/specs-actors/actors/util/adt" blockadt "github.com/filecoin-project/specs-actors/actors/util/adt"
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
@ -181,8 +181,8 @@ func aggregateSignatures(sigs []crypto.Signature) (*crypto.Signature, error) {
}, nil }, nil
} }
func toArray(store adt.Store, cids []cid.Cid) (cid.Cid, error) { func toArray(store blockadt.Store, cids []cid.Cid) (cid.Cid, error) {
arr := adt.MakeEmptyArray(store) arr := blockadt.MakeEmptyArray(store)
for i, c := range cids { for i, c := range cids {
oc := cbg.CborCid(c) oc := cbg.CborCid(c)
if err := arr.Set(uint64(i), &oc); err != nil { if err := arr.Set(uint64(i), &oc); err != nil {

View File

@ -8,7 +8,7 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"go.uber.org/fx" "go.uber.org/fx"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
@ -156,7 +156,7 @@ func (fm *FundMgr) EnsureAvailable(ctx context.Context, addr, wallet address.Add
To: market.Address, To: market.Address,
From: wallet, From: wallet,
Value: toAdd, Value: toAdd,
Method: builtin.MethodsMarket.AddBalance, Method: builtin2.MethodsMarket.AddBalance,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {

View File

@ -12,8 +12,8 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
tutils "github.com/filecoin-project/specs-actors/support/testing" tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
@ -51,7 +51,7 @@ func addFundsMsg(toAdd abi.TokenAmount, addr address.Address, wallet address.Add
To: market.Address, To: market.Address,
From: wallet, From: wallet,
Value: toAdd, Value: toAdd,
Method: builtin.MethodsMarket.AddBalance, Method: builtin2.MethodsMarket.AddBalance,
Params: params, Params: params,
} }
} }

View File

@ -8,16 +8,18 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log/v2"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/messagepool/gasguess" "github.com/filecoin-project/lotus/chain/messagepool/gasguess"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/types/mock" "github.com/filecoin-project/lotus/chain/types/mock"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
_ "github.com/filecoin-project/lotus/lib/sigs/bls" _ "github.com/filecoin-project/lotus/lib/sigs/bls"
_ "github.com/filecoin-project/lotus/lib/sigs/secp" _ "github.com/filecoin-project/lotus/lib/sigs/secp"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log/v2"
) )
func init() { func init() {
@ -142,7 +144,7 @@ func (tma *testMpoolAPI) GetActorAfter(addr address.Address, ts *types.TipSet) (
} }
return &types.Actor{ return &types.Actor{
Code: builtin.StorageMarketActorCodeID, Code: builtin2.StorageMarketActorCodeID,
Nonce: nonce, Nonce: nonce,
Balance: balance, Balance: balance,
}, nil }, nil
@ -449,7 +451,7 @@ func TestLoadLocal(t *testing.T) {
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
msgs := make(map[cid.Cid]struct{}) msgs := make(map[cid.Cid]struct{})
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1)) m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
@ -521,7 +523,7 @@ func TestClearAll(t *testing.T) {
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1)) m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
_, err := mp.Push(m) _, err := mp.Push(m)
@ -576,7 +578,7 @@ func TestClearNonLocal(t *testing.T) {
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
for i := 0; i < 10; i++ { for i := 0; i < 10; i++ {
m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1)) m := makeTestMessage(w1, a1, a2, uint64(i), gasLimit, uint64(i+1))
_, err := mp.Push(m) _, err := mp.Push(m)
@ -642,7 +644,7 @@ func TestUpdates(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL

View File

@ -5,11 +5,13 @@ import (
"testing" "testing"
"time" "time"
"github.com/ipfs/go-datastore"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/chain/messagepool/gasguess" "github.com/filecoin-project/lotus/chain/messagepool/gasguess"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/ipfs/go-datastore"
) )
func TestRepubMessages(t *testing.T) { func TestRepubMessages(t *testing.T) {
@ -48,7 +50,7 @@ func TestRepubMessages(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL

View File

@ -13,17 +13,18 @@ import (
"sort" "sort"
"testing" "testing"
"github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
logging "github.com/ipfs/go-log" logging "github.com/ipfs/go-log"
"github.com/filecoin-project/go-address" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/messagepool/gasguess" "github.com/filecoin-project/lotus/chain/messagepool/gasguess"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/types/mock" "github.com/filecoin-project/lotus/chain/types/mock"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
_ "github.com/filecoin-project/lotus/lib/sigs/bls" _ "github.com/filecoin-project/lotus/lib/sigs/bls"
@ -94,7 +95,7 @@ func TestMessageChains(t *testing.T) {
block := tma.nextBlock() block := tma.nextBlock()
ts := mock.TipSet(block) ts := mock.TipSet(block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
@ -332,7 +333,7 @@ func TestMessageChainSkipping(t *testing.T) {
block := tma.nextBlock() block := tma.nextBlock()
ts := mock.TipSet(block) ts := mock.TipSet(block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
baseFee := types.NewInt(0) baseFee := types.NewInt(0)
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
@ -409,7 +410,7 @@ func TestBasicMessageSelection(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -553,7 +554,7 @@ func TestMessageSelectionTrimming(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -616,7 +617,7 @@ func TestPriorityMessageSelection(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -695,7 +696,7 @@ func TestPriorityMessageSelection2(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -764,7 +765,7 @@ func TestPriorityMessageSelection3(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -861,7 +862,7 @@ func TestOptimalMessageSelection1(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -928,7 +929,7 @@ func TestOptimalMessageSelection2(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
tma.setBalance(a1, 1) // in FIL tma.setBalance(a1, 1) // in FIL
tma.setBalance(a2, 1) // in FIL tma.setBalance(a2, 1) // in FIL
@ -1006,7 +1007,7 @@ func TestOptimalMessageSelection3(t *testing.T) {
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
for _, a := range actors { for _, a := range actors {
tma.setBalance(a, 1) // in FIL tma.setBalance(a, 1) // in FIL
@ -1086,7 +1087,7 @@ func testCompetitiveMessageSelection(t *testing.T, rng *rand.Rand, getPremium fu
ts := mock.TipSet(block) ts := mock.TipSet(block)
tma.applyBlock(t, block) tma.applyBlock(t, block)
gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin.StorageMarketActorCodeID, M: 2}] gasLimit := gasguess.Costs[gasguess.CostKey{Code: builtin2.StorageMarketActorCodeID, M: 2}]
baseFee := types.NewInt(0) baseFee := types.NewInt(0)
for _, a := range actors { for _, a := range actors {

View File

@ -10,7 +10,7 @@ import (
address "github.com/filecoin-project/go-address" address "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -18,7 +18,7 @@ import (
func BenchmarkStateTreeSet(b *testing.B) { func BenchmarkStateTreeSet(b *testing.B) {
cst := cbor.NewMemCborStore() cst := cbor.NewMemCborStore()
st, err := NewStateTree(cst, VersionForNetwork(build.NewestNetworkVersion)) st, err := NewStateTree(cst, types.StateTreeVersion1)
if err != nil { if err != nil {
b.Fatal(err) b.Fatal(err)
} }
@ -33,8 +33,8 @@ func BenchmarkStateTreeSet(b *testing.B) {
} }
err = st.SetActor(a, &types.Actor{ err = st.SetActor(a, &types.Actor{
Balance: types.NewInt(1258812523), Balance: types.NewInt(1258812523),
Code: builtin.StorageMinerActorCodeID, Code: builtin2.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID, Head: builtin2.AccountActorCodeID,
Nonce: uint64(i), Nonce: uint64(i),
}) })
if err != nil { if err != nil {
@ -60,8 +60,8 @@ func BenchmarkStateTreeSetFlush(b *testing.B) {
} }
err = st.SetActor(a, &types.Actor{ err = st.SetActor(a, &types.Actor{
Balance: types.NewInt(1258812523), Balance: types.NewInt(1258812523),
Code: builtin.StorageMinerActorCodeID, Code: builtin2.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID, Head: builtin2.AccountActorCodeID,
Nonce: uint64(i), Nonce: uint64(i),
}) })
if err != nil { if err != nil {
@ -183,8 +183,8 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
} }
err = st.SetActor(a, &types.Actor{ err = st.SetActor(a, &types.Actor{
Balance: types.NewInt(1258812523 + uint64(i)), Balance: types.NewInt(1258812523 + uint64(i)),
Code: builtin.StorageMinerActorCodeID, Code: builtin2.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID, Head: builtin2.AccountActorCodeID,
Nonce: uint64(i), Nonce: uint64(i),
}) })
if err != nil { if err != nil {
@ -226,8 +226,8 @@ func TestSetCache(t *testing.T) {
act := &types.Actor{ act := &types.Actor{
Balance: types.NewInt(0), Balance: types.NewInt(0),
Code: builtin.StorageMinerActorCodeID, Code: builtin2.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID, Head: builtin2.AccountActorCodeID,
Nonce: 0, Nonce: 0,
} }
@ -270,7 +270,7 @@ func TestSnapshots(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if err := st.SetActor(addrs[0], &types.Actor{Code: builtin.AccountActorCodeID, Head: builtin.AccountActorCodeID, Balance: types.NewInt(55)}); err != nil { if err := st.SetActor(addrs[0], &types.Actor{Code: builtin2.AccountActorCodeID, Head: builtin2.AccountActorCodeID, Balance: types.NewInt(55)}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -279,7 +279,7 @@ func TestSnapshots(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if err := st.SetActor(addrs[1], &types.Actor{Code: builtin.AccountActorCodeID, Head: builtin.AccountActorCodeID, Balance: types.NewInt(77)}); err != nil { if err := st.SetActor(addrs[1], &types.Actor{Code: builtin2.AccountActorCodeID, Head: builtin2.AccountActorCodeID, Balance: types.NewInt(77)}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -290,7 +290,7 @@ func TestSnapshots(t *testing.T) {
} }
// more operations in top level call... // more operations in top level call...
if err := st.SetActor(addrs[2], &types.Actor{Code: builtin.AccountActorCodeID, Head: builtin.AccountActorCodeID, Balance: types.NewInt(123)}); err != nil { if err := st.SetActor(addrs[2], &types.Actor{Code: builtin2.AccountActorCodeID, Head: builtin2.AccountActorCodeID, Balance: types.NewInt(123)}); err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -299,7 +299,7 @@ func TestSnapshots(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
if err := st.SetActor(addrs[3], &types.Actor{Code: builtin.AccountActorCodeID, Head: builtin.AccountActorCodeID, Balance: types.NewInt(5)}); err != nil { if err := st.SetActor(addrs[3], &types.Actor{Code: builtin2.AccountActorCodeID, Head: builtin2.AccountActorCodeID, Balance: types.NewInt(5)}); err != nil {
t.Fatal(err) t.Fatal(err)
} }

View File

@ -543,17 +543,17 @@ func UpgradeIgnition(ctx context.Context, sm *StateManager, cb ExecCallback, roo
return cid.Undef, xerrors.Errorf("second split address: %w", err) return cid.Undef, xerrors.Errorf("second split address: %w", err)
} }
err = resetGenesisMsigs(ctx, sm, store, tree, build.UpgradeLiftoffHeight) err = resetGenesisMsigs0(ctx, sm, store, tree, build.UpgradeLiftoffHeight)
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("resetting genesis msig start epochs: %w", err) return cid.Undef, xerrors.Errorf("resetting genesis msig start epochs: %w", err)
} }
err = splitGenesisMultisig(ctx, cb, split1, store, tree, 50, epoch) err = splitGenesisMultisig0(ctx, cb, split1, store, tree, 50, epoch)
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("splitting first msig: %w", err) return cid.Undef, xerrors.Errorf("splitting first msig: %w", err)
} }
err = splitGenesisMultisig(ctx, cb, split2, store, tree, 50, epoch) err = splitGenesisMultisig0(ctx, cb, split2, store, tree, 50, epoch)
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("splitting second msig: %w", err) return cid.Undef, xerrors.Errorf("splitting second msig: %w", err)
} }
@ -574,17 +574,17 @@ func UpgradeRefuel(ctx context.Context, sm *StateManager, cb ExecCallback, root
return cid.Undef, xerrors.Errorf("getting state tree: %w", err) return cid.Undef, xerrors.Errorf("getting state tree: %w", err)
} }
err = resetMultisigVesting(ctx, store, tree, builtin.SaftAddress, 0, 0, big.Zero()) err = resetMultisigVesting0(ctx, store, tree, builtin.SaftAddress, 0, 0, big.Zero())
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("tweaking msig vesting: %w", err) return cid.Undef, xerrors.Errorf("tweaking msig vesting: %w", err)
} }
err = resetMultisigVesting(ctx, store, tree, builtin.ReserveAddress, 0, 0, big.Zero()) err = resetMultisigVesting0(ctx, store, tree, builtin.ReserveAddress, 0, 0, big.Zero())
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("tweaking msig vesting: %w", err) return cid.Undef, xerrors.Errorf("tweaking msig vesting: %w", err)
} }
err = resetMultisigVesting(ctx, store, tree, builtin.RootVerifierAddress, 0, 0, big.Zero()) err = resetMultisigVesting0(ctx, store, tree, builtin.RootVerifierAddress, 0, 0, big.Zero())
if err != nil { if err != nil {
return cid.Undef, xerrors.Errorf("tweaking msig vesting: %w", err) return cid.Undef, xerrors.Errorf("tweaking msig vesting: %w", err)
} }
@ -679,7 +679,7 @@ func setNetworkName(ctx context.Context, store adt.Store, tree *state.StateTree,
return nil return nil
} }
func splitGenesisMultisig(ctx context.Context, cb ExecCallback, addr address.Address, store adt0.Store, tree *state.StateTree, portions uint64, epoch abi.ChainEpoch) error { func splitGenesisMultisig0(ctx context.Context, cb ExecCallback, addr address.Address, store adt0.Store, tree *state.StateTree, portions uint64, epoch abi.ChainEpoch) error {
if portions < 1 { if portions < 1 {
return xerrors.Errorf("cannot split into 0 portions") return xerrors.Errorf("cannot split into 0 portions")
} }
@ -835,7 +835,7 @@ func makeKeyAddr(splitAddr address.Address, count uint64) (address.Address, erro
} }
// TODO: After the Liftoff epoch, refactor this to use resetMultisigVesting // TODO: After the Liftoff epoch, refactor this to use resetMultisigVesting
func resetGenesisMsigs(ctx context.Context, sm *StateManager, store adt0.Store, tree *state.StateTree, startEpoch abi.ChainEpoch) error { func resetGenesisMsigs0(ctx context.Context, sm *StateManager, store adt0.Store, tree *state.StateTree, startEpoch abi.ChainEpoch) error {
gb, err := sm.cs.GetGenesis() gb, err := sm.cs.GetGenesis()
if err != nil { if err != nil {
return xerrors.Errorf("getting genesis block: %w", err) return xerrors.Errorf("getting genesis block: %w", err)
@ -885,7 +885,7 @@ func resetGenesisMsigs(ctx context.Context, sm *StateManager, store adt0.Store,
return nil return nil
} }
func resetMultisigVesting(ctx context.Context, store adt0.Store, tree *state.StateTree, addr address.Address, startEpoch abi.ChainEpoch, duration abi.ChainEpoch, balance abi.TokenAmount) error { func resetMultisigVesting0(ctx context.Context, store adt0.Store, tree *state.StateTree, addr address.Address, startEpoch abi.ChainEpoch, duration abi.ChainEpoch, balance abi.TokenAmount) error {
act, err := tree.GetActor(addr) act, err := tree.GetActor(addr)
if err != nil { if err != nil {
return xerrors.Errorf("getting actor: %w", err) return xerrors.Errorf("getting actor: %w", err)

View File

@ -16,9 +16,10 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/specs-actors/actors/builtin"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/runtime" init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
rt2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
@ -45,7 +46,7 @@ type testActor struct {
} }
// must use existing actor that an account is allowed to exec. // must use existing actor that an account is allowed to exec.
func (testActor) Code() cid.Cid { return builtin.PaymentChannelActorCodeID } func (testActor) Code() cid.Cid { return builtin2.PaymentChannelActorCodeID }
func (testActor) State() cbor.Er { return new(testActorState) } func (testActor) State() cbor.Er { return new(testActorState) }
type testActorState struct { type testActorState struct {
@ -75,7 +76,7 @@ func (ta testActor) Exports() []interface{} {
} }
} }
func (ta *testActor) Constructor(rt runtime.Runtime, params *abi.EmptyValue) *abi.EmptyValue { func (ta *testActor) Constructor(rt rt2.Runtime, params *abi.EmptyValue) *abi.EmptyValue {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
rt.StateCreate(&testActorState{11}) rt.StateCreate(&testActorState{11})
//fmt.Println("NEW ACTOR ADDRESS IS: ", rt.Receiver()) //fmt.Println("NEW ACTOR ADDRESS IS: ", rt.Receiver())
@ -83,7 +84,7 @@ func (ta *testActor) Constructor(rt runtime.Runtime, params *abi.EmptyValue) *ab
return abi.Empty return abi.Empty
} }
func (ta *testActor) TestMethod(rt runtime.Runtime, params *abi.EmptyValue) *abi.EmptyValue { func (ta *testActor) TestMethod(rt rt2.Runtime, params *abi.EmptyValue) *abi.EmptyValue {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
var st testActorState var st testActorState
rt.StateReadonly(&st) rt.StateReadonly(&st)
@ -175,7 +176,7 @@ func TestForkHeightTriggers(t *testing.T) {
var msgs []*types.SignedMessage var msgs []*types.SignedMessage
enc, err := actors.SerializeParams(&init0.ExecParams{CodeCID: (testActor{}).Code()}) enc, err := actors.SerializeParams(&init2.ExecParams{CodeCID: (testActor{}).Code()})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -183,7 +184,7 @@ func TestForkHeightTriggers(t *testing.T) {
m := &types.Message{ m := &types.Message{
From: cg.Banker(), From: cg.Banker(),
To: lotusinit.Address, To: lotusinit.Address,
Method: builtin.MethodsInit.Exec, Method: builtin2.MethodsInit.Exec,
Params: enc, Params: enc,
GasLimit: types.TestGasLimit, GasLimit: types.TestGasLimit,
} }
@ -273,7 +274,7 @@ func TestForkRefuseCall(t *testing.T) {
cg.SetStateManager(sm) cg.SetStateManager(sm)
enc, err := actors.SerializeParams(&init0.ExecParams{CodeCID: (testActor{}).Code()}) enc, err := actors.SerializeParams(&init2.ExecParams{CodeCID: (testActor{}).Code()})
if err != nil { if err != nil {
t.Fatal(err) t.Fatal(err)
} }
@ -281,7 +282,7 @@ func TestForkRefuseCall(t *testing.T) {
m := &types.Message{ m := &types.Message{
From: cg.Banker(), From: cg.Banker(),
To: lotusinit.Address, To: lotusinit.Address,
Method: builtin.MethodsInit.Exec, Method: builtin2.MethodsInit.Exec,
Params: enc, Params: enc,
GasLimit: types.TestGasLimit, GasLimit: types.TestGasLimit,
Value: types.NewInt(0), Value: types.NewInt(0),

View File

@ -6,16 +6,6 @@ import (
"fmt" "fmt"
"sync" "sync"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
_init "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
@ -28,15 +18,24 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
// Used for genesis.
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
_init "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig" "github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/actors/builtin/paych"
"github.com/filecoin-project/lotus/chain/actors/builtin/power" "github.com/filecoin-project/lotus/chain/actors/builtin/power"
"github.com/filecoin-project/lotus/chain/actors/builtin/reward" "github.com/filecoin-project/lotus/chain/actors/builtin/reward"
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
"github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/state"
"github.com/filecoin-project/lotus/chain/store" "github.com/filecoin-project/lotus/chain/store"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -254,14 +253,14 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
runCron := func(epoch abi.ChainEpoch) error { runCron := func(epoch abi.ChainEpoch) error {
cronMsg := &types.Message{ cronMsg := &types.Message{
To: builtin0.CronActorAddr, To: builtin2.CronActorAddr,
From: builtin0.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: uint64(epoch), Nonce: uint64(epoch),
Value: types.NewInt(0), Value: types.NewInt(0),
GasFeeCap: types.NewInt(0), GasFeeCap: types.NewInt(0),
GasPremium: types.NewInt(0), GasPremium: types.NewInt(0),
GasLimit: build.BlockGasLimit * 10000, // Make super sure this is never too little GasLimit: build.BlockGasLimit * 10000, // Make super sure this is never too little
Method: builtin0.MethodsCron.EpochTick, Method: builtin2.MethodsCron.EpochTick,
Params: nil, Params: nil,
} }
ret, err := vmi.ApplyImplicitMessage(ctx, cronMsg) ret, err := vmi.ApplyImplicitMessage(ctx, cronMsg)
@ -350,14 +349,14 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
} }
rwMsg := &types.Message{ rwMsg := &types.Message{
From: builtin0.SystemActorAddr, From: builtin2.SystemActorAddr,
To: reward.Address, To: reward.Address,
Nonce: uint64(epoch), Nonce: uint64(epoch),
Value: types.NewInt(0), Value: types.NewInt(0),
GasFeeCap: types.NewInt(0), GasFeeCap: types.NewInt(0),
GasPremium: types.NewInt(0), GasPremium: types.NewInt(0),
GasLimit: 1 << 30, GasLimit: 1 << 30,
Method: builtin0.MethodsReward.AwardBlockReward, Method: builtin2.MethodsReward.AwardBlockReward,
Params: params, Params: params,
} }
ret, actErr := vmi.ApplyImplicitMessage(ctx, rwMsg) ret, actErr := vmi.ApplyImplicitMessage(ctx, rwMsg)
@ -974,7 +973,7 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
} else if builtin.IsAccountActor(act.Code) { } else if builtin.IsAccountActor(act.Code) {
// should exclude burnt funds actor and "remainder account actor" // should exclude burnt funds actor and "remainder account actor"
// should only ever be "faucet" accounts in testnets // should only ever be "faucet" accounts in testnets
if kaddr == builtin0.BurntFundsActorAddr { if kaddr == builtin2.BurntFundsActorAddr {
return nil return nil
} }
@ -1052,24 +1051,24 @@ func (sm *StateManager) setupPreIgnitionGenesisActorsTestnet(ctx context.Context
totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount) totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount)
// 6 months // 6 months
sixMonths := abi.ChainEpoch(183 * builtin0.EpochsInDay) sixMonths := abi.ChainEpoch(183 * builtin2.EpochsInDay)
totalsByEpoch[sixMonths] = big.NewInt(49_929_341) totalsByEpoch[sixMonths] = big.NewInt(49_929_341)
totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700)) totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700))
// 1 year // 1 year
oneYear := abi.ChainEpoch(365 * builtin0.EpochsInDay) oneYear := abi.ChainEpoch(365 * builtin2.EpochsInDay)
totalsByEpoch[oneYear] = big.NewInt(22_421_712) totalsByEpoch[oneYear] = big.NewInt(22_421_712)
// 2 years // 2 years
twoYears := abi.ChainEpoch(2 * 365 * builtin0.EpochsInDay) twoYears := abi.ChainEpoch(2 * 365 * builtin2.EpochsInDay)
totalsByEpoch[twoYears] = big.NewInt(7_223_364) totalsByEpoch[twoYears] = big.NewInt(7_223_364)
// 3 years // 3 years
threeYears := abi.ChainEpoch(3 * 365 * builtin0.EpochsInDay) threeYears := abi.ChainEpoch(3 * 365 * builtin2.EpochsInDay)
totalsByEpoch[threeYears] = big.NewInt(87_637_883) totalsByEpoch[threeYears] = big.NewInt(87_637_883)
// 6 years // 6 years
sixYears := abi.ChainEpoch(6 * 365 * builtin0.EpochsInDay) sixYears := abi.ChainEpoch(6 * 365 * builtin2.EpochsInDay)
totalsByEpoch[sixYears] = big.NewInt(100_000_000) totalsByEpoch[sixYears] = big.NewInt(100_000_000)
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000)) totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
@ -1129,24 +1128,24 @@ func (sm *StateManager) setupPostIgnitionGenesisActors(ctx context.Context) erro
totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount) totalsByEpoch := make(map[abi.ChainEpoch]abi.TokenAmount)
// 6 months // 6 months
sixMonths := abi.ChainEpoch(183 * builtin0.EpochsInDay) sixMonths := abi.ChainEpoch(183 * builtin2.EpochsInDay)
totalsByEpoch[sixMonths] = big.NewInt(49_929_341) totalsByEpoch[sixMonths] = big.NewInt(49_929_341)
totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700)) totalsByEpoch[sixMonths] = big.Add(totalsByEpoch[sixMonths], big.NewInt(32_787_700))
// 1 year // 1 year
oneYear := abi.ChainEpoch(365 * builtin0.EpochsInDay) oneYear := abi.ChainEpoch(365 * builtin2.EpochsInDay)
totalsByEpoch[oneYear] = big.NewInt(22_421_712) totalsByEpoch[oneYear] = big.NewInt(22_421_712)
// 2 years // 2 years
twoYears := abi.ChainEpoch(2 * 365 * builtin0.EpochsInDay) twoYears := abi.ChainEpoch(2 * 365 * builtin2.EpochsInDay)
totalsByEpoch[twoYears] = big.NewInt(7_223_364) totalsByEpoch[twoYears] = big.NewInt(7_223_364)
// 3 years // 3 years
threeYears := abi.ChainEpoch(3 * 365 * builtin0.EpochsInDay) threeYears := abi.ChainEpoch(3 * 365 * builtin2.EpochsInDay)
totalsByEpoch[threeYears] = big.NewInt(87_637_883) totalsByEpoch[threeYears] = big.NewInt(87_637_883)
// 6 years // 6 years
sixYears := abi.ChainEpoch(6 * 365 * builtin0.EpochsInDay) sixYears := abi.ChainEpoch(6 * 365 * builtin2.EpochsInDay)
totalsByEpoch[sixYears] = big.NewInt(100_000_000) totalsByEpoch[sixYears] = big.NewInt(100_000_000)
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000)) totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
@ -1280,7 +1279,7 @@ func (sm *StateManager) GetFilLocked(ctx context.Context, st *state.StateTree) (
} }
func GetFilBurnt(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) { func GetFilBurnt(ctx context.Context, st *state.StateTree) (abi.TokenAmount, error) {
burnt, err := st.GetActor(builtin0.BurntFundsActorAddr) burnt, err := st.GetActor(builtin2.BurntFundsActorAddr)
if err != nil { if err != nil {
return big.Zero(), xerrors.Errorf("failed to load burnt actor: %w", err) return big.Zero(), xerrors.Errorf("failed to load burnt actor: %w", err)
} }

View File

@ -12,6 +12,7 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
@ -26,7 +27,6 @@ import (
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported" exported0 "github.com/filecoin-project/specs-actors/actors/builtin/exported"
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported" exported2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/exported"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
@ -159,7 +159,7 @@ func GetMinerSectorSet(ctx context.Context, sm *StateManager, ts *types.TipSet,
return mas.LoadSectors(snos) return mas.LoadSectors(snos)
} }
func GetSectorsForWinningPoSt(ctx context.Context, pv ffiwrapper.Verifier, sm *StateManager, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]proof0.SectorInfo, error) { func GetSectorsForWinningPoSt(ctx context.Context, pv ffiwrapper.Verifier, sm *StateManager, st cid.Cid, maddr address.Address, rand abi.PoStRandomness) ([]builtin.SectorInfo, error) {
act, err := sm.LoadActorRaw(ctx, maddr, st) act, err := sm.LoadActorRaw(ctx, maddr, st)
if err != nil { if err != nil {
return nil, xerrors.Errorf("failed to load miner actor: %w", err) return nil, xerrors.Errorf("failed to load miner actor: %w", err)
@ -244,9 +244,9 @@ func GetSectorsForWinningPoSt(ctx context.Context, pv ffiwrapper.Verifier, sm *S
return nil, xerrors.Errorf("loading proving sectors: %w", err) return nil, xerrors.Errorf("loading proving sectors: %w", err)
} }
out := make([]proof0.SectorInfo, len(sectors)) out := make([]builtin.SectorInfo, len(sectors))
for i, sinfo := range sectors { for i, sinfo := range sectors {
out[i] = proof0.SectorInfo{ out[i] = builtin.SectorInfo{
SealProof: spt, SealProof: spt,
SectorNumber: sinfo.SectorNumber, SectorNumber: sinfo.SectorNumber,
SealedCID: sinfo.SealedCID, SealedCID: sinfo.SealedCID,

View File

@ -19,12 +19,12 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin" blockadt "github.com/filecoin-project/specs-actors/actors/util/adt"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/adt" "github.com/filecoin-project/lotus/chain/actors/adt"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/vm" "github.com/filecoin-project/lotus/chain/vm"
"github.com/filecoin-project/lotus/journal" "github.com/filecoin-project/lotus/journal"
bstore "github.com/filecoin-project/lotus/lib/blockstore" bstore "github.com/filecoin-project/lotus/lib/blockstore"
@ -815,7 +815,7 @@ func (cs *ChainStore) GetSignedMessage(c cid.Cid) (*types.SignedMessage, error)
func (cs *ChainStore) readAMTCids(root cid.Cid) ([]cid.Cid, error) { func (cs *ChainStore) readAMTCids(root cid.Cid) ([]cid.Cid, error) {
ctx := context.TODO() ctx := context.TODO()
// block headers use adt0, for now. // block headers use adt0, for now.
a, err := adt0.AsArray(cs.Store(ctx), root) a, err := blockadt.AsArray(cs.Store(ctx), root)
if err != nil { if err != nil {
return nil, xerrors.Errorf("amt load: %w", err) return nil, xerrors.Errorf("amt load: %w", err)
} }
@ -1009,7 +1009,7 @@ func (cs *ChainStore) MessagesForBlock(b *types.BlockHeader) ([]*types.Message,
func (cs *ChainStore) GetParentReceipt(b *types.BlockHeader, i int) (*types.MessageReceipt, error) { func (cs *ChainStore) GetParentReceipt(b *types.BlockHeader, i int) (*types.MessageReceipt, error) {
ctx := context.TODO() ctx := context.TODO()
// block headers use adt0, for now. // block headers use adt0, for now.
a, err := adt0.AsArray(cs.Store(ctx), b.ParentMessageReceipts) a, err := blockadt.AsArray(cs.Store(ctx), b.ParentMessageReceipts)
if err != nil { if err != nil {
return nil, xerrors.Errorf("amt load: %w", err) return nil, xerrors.Errorf("amt load: %w", err)
} }

View File

@ -23,7 +23,7 @@ import (
"go.opencensus.io/stats" "go.opencensus.io/stats"
"go.opencensus.io/tag" "go.opencensus.io/tag"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" blockadt "github.com/filecoin-project/specs-actors/actors/util/adt"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain" "github.com/filecoin-project/lotus/chain"
@ -391,9 +391,9 @@ func (bv *BlockValidator) isChainNearSynced() bool {
func (bv *BlockValidator) validateMsgMeta(ctx context.Context, msg *types.BlockMsg) error { func (bv *BlockValidator) validateMsgMeta(ctx context.Context, msg *types.BlockMsg) error {
// TODO there has to be a simpler way to do this without the blockstore dance // TODO there has to be a simpler way to do this without the blockstore dance
// block headers use adt0 // block headers use adt0
store := adt0.WrapStore(ctx, cbor.NewCborStore(blockstore.NewTemporary())) store := blockadt.WrapStore(ctx, cbor.NewCborStore(blockstore.NewTemporary()))
bmArr := adt0.MakeEmptyArray(store) bmArr := blockadt.MakeEmptyArray(store)
smArr := adt0.MakeEmptyArray(store) smArr := blockadt.MakeEmptyArray(store)
for i, m := range msg.BlsMessages { for i, m := range msg.BlsMessages {
c := cbg.CborCid(m) c := cbg.CborCid(m)

View File

@ -15,8 +15,6 @@ import (
"github.com/filecoin-project/lotus/node/modules/dtypes" "github.com/filecoin-project/lotus/node/modules/dtypes"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/Gurpartap/async" "github.com/Gurpartap/async"
"github.com/hashicorp/go-multierror" "github.com/hashicorp/go-multierror"
blocks "github.com/ipfs/go-block-format" blocks "github.com/ipfs/go-block-format"
@ -37,7 +35,11 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
blst "github.com/supranational/blst/bindings/go" blst "github.com/supranational/blst/bindings/go"
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt" // named msgarray here to make it clear that these are the types used by
// messages, regardless of specs-actors version.
blockadt "github.com/filecoin-project/specs-actors/actors/util/adt"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -463,9 +465,9 @@ func zipTipSetAndMessages(bs cbor.IpldStore, ts *types.TipSet, allbmsgs []*types
// of both types (BLS and Secpk). // of both types (BLS and Secpk).
func computeMsgMeta(bs cbor.IpldStore, bmsgCids, smsgCids []cid.Cid) (cid.Cid, error) { func computeMsgMeta(bs cbor.IpldStore, bmsgCids, smsgCids []cid.Cid) (cid.Cid, error) {
// block headers use adt0 // block headers use adt0
store := adt0.WrapStore(context.TODO(), bs) store := blockadt.WrapStore(context.TODO(), bs)
bmArr := adt0.MakeEmptyArray(store) bmArr := blockadt.MakeEmptyArray(store)
smArr := adt0.MakeEmptyArray(store) smArr := blockadt.MakeEmptyArray(store)
for i, m := range bmsgCids { for i, m := range bmsgCids {
c := cbg.CborCid(m) c := cbg.CborCid(m)
@ -1015,7 +1017,7 @@ func (syncer *Syncer) VerifyWinningPoStProof(ctx context.Context, h *types.Block
return xerrors.Errorf("getting winning post sector set: %w", err) return xerrors.Errorf("getting winning post sector set: %w", err)
} }
ok, err := ffiwrapper.ProofVerifier.VerifyWinningPoSt(ctx, proof.WinningPoStVerifyInfo{ ok, err := ffiwrapper.ProofVerifier.VerifyWinningPoSt(ctx, proof2.WinningPoStVerifyInfo{
Randomness: rand, Randomness: rand,
Proofs: h.WinPoStProof, Proofs: h.WinPoStProof,
ChallengedSectors: sectors, ChallengedSectors: sectors,
@ -1110,9 +1112,9 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
// Validate message arrays in a temporary blockstore. // Validate message arrays in a temporary blockstore.
tmpbs := bstore.NewTemporary() tmpbs := bstore.NewTemporary()
tmpstore := adt0.WrapStore(ctx, cbor.NewCborStore(tmpbs)) tmpstore := blockadt.WrapStore(ctx, cbor.NewCborStore(tmpbs))
bmArr := adt0.MakeEmptyArray(tmpstore) bmArr := blockadt.MakeEmptyArray(tmpstore)
for i, m := range b.BlsMessages { for i, m := range b.BlsMessages {
if err := checkMsg(m); err != nil { if err := checkMsg(m); err != nil {
return xerrors.Errorf("block had invalid bls message at index %d: %w", i, err) return xerrors.Errorf("block had invalid bls message at index %d: %w", i, err)
@ -1129,7 +1131,7 @@ func (syncer *Syncer) checkBlockMessages(ctx context.Context, b *types.FullBlock
} }
} }
smArr := adt0.MakeEmptyArray(tmpstore) smArr := blockadt.MakeEmptyArray(tmpstore)
for i, m := range b.SecpkMessages { for i, m := range b.SecpkMessages {
if err := checkMsg(m); err != nil { if err := checkMsg(m); err != nil {
return xerrors.Errorf("block had invalid secpk message at index %d: %w", i, err) return xerrors.Errorf("block had invalid secpk message at index %d: %w", i, err)

View File

@ -7,8 +7,6 @@ import (
"testing" "testing"
"time" "time"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
@ -20,6 +18,8 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
@ -469,8 +469,8 @@ func (wpp badWpp) GenerateCandidates(context.Context, abi.PoStRandomness, uint64
return []uint64{1}, nil return []uint64{1}, nil
} }
func (wpp badWpp) ComputeProof(context.Context, []proof.SectorInfo, abi.PoStRandomness) ([]proof.PoStProof, error) { func (wpp badWpp) ComputeProof(context.Context, []proof2.SectorInfo, abi.PoStRandomness) ([]proof2.PoStProof, error) {
return []proof.PoStProof{ return []proof2.PoStProof{
{ {
PoStProof: abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, PoStProof: abi.RegisteredPoStProof_StackedDrgWinning2KiBV1,
ProofBytes: []byte("evil"), ProofBytes: []byte("evil"),

View File

@ -4,7 +4,7 @@ import (
"bytes" "bytes"
"math/big" "math/big"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/minio/blake2b-simd" "github.com/minio/blake2b-simd"
@ -55,7 +55,7 @@ type BlockHeader struct {
BeaconEntries []BeaconEntry // 3 BeaconEntries []BeaconEntry // 3
WinPoStProof []proof.PoStProof // 4 WinPoStProof []proof2.PoStProof // 4
Parents []cid.Cid // 5 Parents []cid.Cid // 5

View File

@ -7,7 +7,7 @@ import (
"reflect" "reflect"
"testing" "testing"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
cid "github.com/ipfs/go-cid" cid "github.com/ipfs/go-cid"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
@ -82,7 +82,7 @@ func TestInteropBH(t *testing.T) {
t.Fatal(err) t.Fatal(err)
} }
posts := []proof.PoStProof{ posts := []proof2.PoStProof{
{PoStProof: abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, ProofBytes: []byte{0x07}}, {PoStProof: abi.RegisteredPoStProof_StackedDrgWinning2KiBV1, ProofBytes: []byte{0x07}},
} }

View File

@ -9,13 +9,15 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/specs-actors/actors/builtin"
// we can't import the actors shims from this package due to cyclic imports.
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
func TestEqualCall(t *testing.T) { func TestEqualCall(t *testing.T) {
m1 := &Message{ m1 := &Message{
To: builtin.StoragePowerActorAddr, To: builtin2.StoragePowerActorAddr,
From: builtin.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: 34, Nonce: 34,
Value: big.Zero(), Value: big.Zero(),
@ -28,8 +30,8 @@ func TestEqualCall(t *testing.T) {
} }
m2 := &Message{ m2 := &Message{
To: builtin.StoragePowerActorAddr, To: builtin2.StoragePowerActorAddr,
From: builtin.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: 34, Nonce: 34,
Value: big.Zero(), Value: big.Zero(),
@ -42,8 +44,8 @@ func TestEqualCall(t *testing.T) {
} }
m3 := &Message{ m3 := &Message{
To: builtin.StoragePowerActorAddr, To: builtin2.StoragePowerActorAddr,
From: builtin.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: 34, Nonce: 34,
Value: big.Zero(), Value: big.Zero(),
@ -56,8 +58,8 @@ func TestEqualCall(t *testing.T) {
} }
m4 := &Message{ m4 := &Message{
To: builtin.StoragePowerActorAddr, To: builtin2.StoragePowerActorAddr,
From: builtin.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: 34, Nonce: 34,
Value: big.Zero(), Value: big.Zero(),
@ -76,8 +78,8 @@ func TestEqualCall(t *testing.T) {
func TestMessageJson(t *testing.T) { func TestMessageJson(t *testing.T) {
m := &Message{ m := &Message{
To: builtin.StoragePowerActorAddr, To: builtin2.StoragePowerActorAddr,
From: builtin.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: 34, Nonce: 34,
Value: big.Zero(), Value: big.Zero(),
@ -105,8 +107,8 @@ func TestMessageJson(t *testing.T) {
func TestSignedMessageJson(t *testing.T) { func TestSignedMessageJson(t *testing.T) {
m := Message{ m := Message{
To: builtin.StoragePowerActorAddr, To: builtin2.StoragePowerActorAddr,
From: builtin.SystemActorAddr, From: builtin2.SystemActorAddr,
Nonce: 34, Nonce: 34,
Value: big.Zero(), Value: big.Zero(),

View File

@ -3,13 +3,13 @@ package vm
import ( import (
"fmt" "fmt"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" vmr2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
addr "github.com/filecoin-project/go-address" addr "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
vmr "github.com/filecoin-project/specs-actors/actors/runtime"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
) )
@ -78,8 +78,8 @@ type Pricelist interface {
OnVerifySignature(sigType crypto.SigType, planTextSize int) (GasCharge, error) OnVerifySignature(sigType crypto.SigType, planTextSize int) (GasCharge, error)
OnHashing(dataSize int) GasCharge OnHashing(dataSize int) GasCharge
OnComputeUnsealedSectorCid(proofType abi.RegisteredSealProof, pieces []abi.PieceInfo) GasCharge OnComputeUnsealedSectorCid(proofType abi.RegisteredSealProof, pieces []abi.PieceInfo) GasCharge
OnVerifySeal(info proof.SealVerifyInfo) GasCharge OnVerifySeal(info proof2.SealVerifyInfo) GasCharge
OnVerifyPost(info proof.WindowPoStVerifyInfo) GasCharge OnVerifyPost(info proof2.WindowPoStVerifyInfo) GasCharge
OnVerifyConsensusFault() GasCharge OnVerifyConsensusFault() GasCharge
} }
@ -150,7 +150,7 @@ func PricelistByEpoch(epoch abi.ChainEpoch) Pricelist {
} }
type pricedSyscalls struct { type pricedSyscalls struct {
under vmr.Syscalls under vmr2.Syscalls
pl Pricelist pl Pricelist
chargeGas func(GasCharge) chargeGas func(GasCharge)
} }
@ -184,7 +184,7 @@ func (ps pricedSyscalls) ComputeUnsealedSectorCID(reg abi.RegisteredSealProof, p
} }
// Verifies a sector seal proof. // Verifies a sector seal proof.
func (ps pricedSyscalls) VerifySeal(vi proof.SealVerifyInfo) error { func (ps pricedSyscalls) VerifySeal(vi proof2.SealVerifyInfo) error {
ps.chargeGas(ps.pl.OnVerifySeal(vi)) ps.chargeGas(ps.pl.OnVerifySeal(vi))
defer ps.chargeGas(gasOnActorExec) defer ps.chargeGas(gasOnActorExec)
@ -192,7 +192,7 @@ func (ps pricedSyscalls) VerifySeal(vi proof.SealVerifyInfo) error {
} }
// Verifies a proof of spacetime. // Verifies a proof of spacetime.
func (ps pricedSyscalls) VerifyPoSt(vi proof.WindowPoStVerifyInfo) error { func (ps pricedSyscalls) VerifyPoSt(vi proof2.WindowPoStVerifyInfo) error {
ps.chargeGas(ps.pl.OnVerifyPost(vi)) ps.chargeGas(ps.pl.OnVerifyPost(vi))
defer ps.chargeGas(gasOnActorExec) defer ps.chargeGas(gasOnActorExec)
@ -209,14 +209,14 @@ func (ps pricedSyscalls) VerifyPoSt(vi proof.WindowPoStVerifyInfo) error {
// the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the // the "parent grinding fault", in which case it must be the sibling of h1 (same parent tipset) and one of the
// blocks in the parent of h2 (i.e. h2's grandparent). // blocks in the parent of h2 (i.e. h2's grandparent).
// Returns nil and an error if the headers don't prove a fault. // Returns nil and an error if the headers don't prove a fault.
func (ps pricedSyscalls) VerifyConsensusFault(h1 []byte, h2 []byte, extra []byte) (*vmr.ConsensusFault, error) { func (ps pricedSyscalls) VerifyConsensusFault(h1 []byte, h2 []byte, extra []byte) (*vmr2.ConsensusFault, error) {
ps.chargeGas(ps.pl.OnVerifyConsensusFault()) ps.chargeGas(ps.pl.OnVerifyConsensusFault())
defer ps.chargeGas(gasOnActorExec) defer ps.chargeGas(gasOnActorExec)
return ps.under.VerifyConsensusFault(h1, h2, extra) return ps.under.VerifyConsensusFault(h1, h2, extra)
} }
func (ps pricedSyscalls) BatchVerifySeals(inp map[address.Address][]proof.SealVerifyInfo) (map[address.Address][]bool, error) { func (ps pricedSyscalls) BatchVerifySeals(inp map[address.Address][]proof2.SealVerifyInfo) (map[address.Address][]bool, error) {
count := int64(0) count := int64(0)
for _, svis := range inp { for _, svis := range inp {
count += int64(len(svis)) count += int64(len(svis))

View File

@ -3,12 +3,12 @@ package vm
import ( import (
"fmt" "fmt"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
) )
type scalingCost struct { type scalingCost struct {
@ -112,14 +112,14 @@ func (pl *pricelistV0) OnMethodInvocation(value abi.TokenAmount, methodNum abi.M
if big.Cmp(value, abi.NewTokenAmount(0)) != 0 { if big.Cmp(value, abi.NewTokenAmount(0)) != 0 {
ret += pl.sendTransferFunds ret += pl.sendTransferFunds
if methodNum == builtin0.MethodSend { if methodNum == builtin2.MethodSend {
// transfer only // transfer only
ret += pl.sendTransferOnlyPremium ret += pl.sendTransferOnlyPremium
} }
extra += "t" extra += "t"
} }
if methodNum != builtin0.MethodSend { if methodNum != builtin2.MethodSend {
extra += "i" extra += "i"
// running actors is cheaper becase we hand over to actors // running actors is cheaper becase we hand over to actors
ret += pl.sendInvokeMethod ret += pl.sendInvokeMethod
@ -175,14 +175,14 @@ func (pl *pricelistV0) OnComputeUnsealedSectorCid(proofType abi.RegisteredSealPr
} }
// OnVerifySeal // OnVerifySeal
func (pl *pricelistV0) OnVerifySeal(info proof.SealVerifyInfo) GasCharge { func (pl *pricelistV0) OnVerifySeal(info proof2.SealVerifyInfo) GasCharge {
// TODO: this needs more cost tunning, check with @lotus // TODO: this needs more cost tunning, check with @lotus
// this is not used // this is not used
return newGasCharge("OnVerifySeal", pl.verifySealBase, 0) return newGasCharge("OnVerifySeal", pl.verifySealBase, 0)
} }
// OnVerifyPost // OnVerifyPost
func (pl *pricelistV0) OnVerifyPost(info proof.WindowPoStVerifyInfo) GasCharge { func (pl *pricelistV0) OnVerifyPost(info proof2.WindowPoStVerifyInfo) GasCharge {
sectorSize := "unknown" sectorSize := "unknown"
var proofType abi.RegisteredPoStProof var proofType abi.RegisteredPoStProof

View File

@ -5,16 +5,17 @@ import (
"io" "io"
"testing" "testing"
"github.com/filecoin-project/go-state-types/abi"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
"github.com/stretchr/testify/assert" "github.com/stretchr/testify/assert"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
"github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
runtime2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/aerrors"
"github.com/filecoin-project/specs-actors/actors/runtime"
) )
type basicContract struct{} type basicContract struct{}
@ -61,17 +62,17 @@ func (b basicContract) Exports() []interface{} {
} }
} }
func (basicContract) InvokeSomething0(rt runtime.Runtime, params *basicParams) *abi.EmptyValue { func (basicContract) InvokeSomething0(rt runtime2.Runtime, params *basicParams) *abi.EmptyValue {
rt.Abortf(exitcode.ExitCode(params.B), "params.B") rt.Abortf(exitcode.ExitCode(params.B), "params.B")
return nil return nil
} }
func (basicContract) BadParam(rt runtime.Runtime, params *basicParams) *abi.EmptyValue { func (basicContract) BadParam(rt runtime2.Runtime, params *basicParams) *abi.EmptyValue {
rt.Abortf(255, "bad params") rt.Abortf(255, "bad params")
return nil return nil
} }
func (basicContract) InvokeSomething10(rt runtime.Runtime, params *basicParams) *abi.EmptyValue { func (basicContract) InvokeSomething10(rt runtime2.Runtime, params *basicParams) *abi.EmptyValue {
rt.Abortf(exitcode.ExitCode(params.B+10), "params.B") rt.Abortf(exitcode.ExitCode(params.B+10), "params.B")
return nil return nil
} }

View File

@ -15,6 +15,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/lotus/chain/actors/aerrors" "github.com/filecoin-project/lotus/chain/actors/aerrors"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
) )
@ -56,7 +57,7 @@ func TryCreateAccountActor(rt *Runtime, addr address.Address) (*types.Actor, add
} }
// call constructor on account // call constructor on account
_, aerr = rt.internalSend(builtin0.SystemActorAddr, addrID, builtin0.MethodsAccount.Constructor, big.Zero(), p) _, aerr = rt.internalSend(builtin.SystemActorAddr, addrID, builtin2.MethodsAccount.Constructor, big.Zero(), p)
if aerr != nil { if aerr != nil {
return nil, address.Undef, aerrors.Wrap(aerr, "failed to invoke account constructor") return nil, address.Undef, aerrors.Wrap(aerr, "failed to invoke account constructor")
} }

View File

@ -53,8 +53,8 @@ func (m *Message) ValueReceived() abi.TokenAmount {
var EnableGasTracing = false var EnableGasTracing = false
type Runtime struct { type Runtime struct {
rt0.Message rt2.Message
rt0.Syscalls rt2.Syscalls
ctx context.Context ctx context.Context

View File

@ -7,8 +7,6 @@ import (
goruntime "runtime" goruntime "runtime"
"sync" "sync"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
@ -23,7 +21,9 @@ import (
"github.com/filecoin-project/lotus/chain/state" "github.com/filecoin-project/lotus/chain/state"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/lib/sigs" "github.com/filecoin-project/lotus/lib/sigs"
"github.com/filecoin-project/specs-actors/actors/runtime"
runtime2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
) )
@ -34,10 +34,10 @@ func init() {
// Actual type is defined in chain/types/vmcontext.go because the VMContext interface is there // Actual type is defined in chain/types/vmcontext.go because the VMContext interface is there
type SyscallBuilder func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime.Syscalls type SyscallBuilder func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime2.Syscalls
func Syscalls(verifier ffiwrapper.Verifier) SyscallBuilder { func Syscalls(verifier ffiwrapper.Verifier) SyscallBuilder {
return func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime.Syscalls { return func(ctx context.Context, cstate *state.StateTree, cst cbor.IpldStore) runtime2.Syscalls {
return &syscallShim{ return &syscallShim{
ctx: ctx, ctx: ctx,
@ -79,7 +79,7 @@ func (ss *syscallShim) HashBlake2b(data []byte) [32]byte {
// Checks validity of the submitted consensus fault with the two block headers needed to prove the fault // Checks validity of the submitted consensus fault with the two block headers needed to prove the fault
// and an optional extra one to check common ancestry (as needed). // and an optional extra one to check common ancestry (as needed).
// Note that the blocks are ordered: the method requires a.Epoch() <= b.Epoch(). // Note that the blocks are ordered: the method requires a.Epoch() <= b.Epoch().
func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.ConsensusFault, error) { func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime2.ConsensusFault, error) {
// Note that block syntax is not validated. Any validly signed block will be accepted pursuant to the below conditions. // Note that block syntax is not validated. Any validly signed block will be accepted pursuant to the below conditions.
// Whether or not it could ever have been accepted in a chain is not checked/does not matter here. // Whether or not it could ever have been accepted in a chain is not checked/does not matter here.
// for that reason when checking block parent relationships, rather than instantiating a Tipset to do so // for that reason when checking block parent relationships, rather than instantiating a Tipset to do so
@ -115,14 +115,14 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.Consen
} }
// (2) check for the consensus faults themselves // (2) check for the consensus faults themselves
var consensusFault *runtime.ConsensusFault var consensusFault *runtime2.ConsensusFault
// (a) double-fork mining fault // (a) double-fork mining fault
if blockA.Height == blockB.Height { if blockA.Height == blockB.Height {
consensusFault = &runtime.ConsensusFault{ consensusFault = &runtime2.ConsensusFault{
Target: blockA.Miner, Target: blockA.Miner,
Epoch: blockB.Height, Epoch: blockB.Height,
Type: runtime.ConsensusFaultDoubleForkMining, Type: runtime2.ConsensusFaultDoubleForkMining,
} }
} }
@ -130,10 +130,10 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.Consen
// strictly speaking no need to compare heights based on double fork mining check above, // strictly speaking no need to compare heights based on double fork mining check above,
// but at same height this would be a different fault. // but at same height this would be a different fault.
if types.CidArrsEqual(blockA.Parents, blockB.Parents) && blockA.Height != blockB.Height { if types.CidArrsEqual(blockA.Parents, blockB.Parents) && blockA.Height != blockB.Height {
consensusFault = &runtime.ConsensusFault{ consensusFault = &runtime2.ConsensusFault{
Target: blockA.Miner, Target: blockA.Miner,
Epoch: blockB.Height, Epoch: blockB.Height,
Type: runtime.ConsensusFaultTimeOffsetMining, Type: runtime2.ConsensusFaultTimeOffsetMining,
} }
} }
@ -153,10 +153,10 @@ func (ss *syscallShim) VerifyConsensusFault(a, b, extra []byte) (*runtime.Consen
if types.CidArrsEqual(blockA.Parents, blockC.Parents) && blockA.Height == blockC.Height && if types.CidArrsEqual(blockA.Parents, blockC.Parents) && blockA.Height == blockC.Height &&
types.CidArrsContains(blockB.Parents, blockC.Cid()) && !types.CidArrsContains(blockB.Parents, blockA.Cid()) { types.CidArrsContains(blockB.Parents, blockC.Cid()) && !types.CidArrsContains(blockB.Parents, blockA.Cid()) {
consensusFault = &runtime.ConsensusFault{ consensusFault = &runtime2.ConsensusFault{
Target: blockA.Miner, Target: blockA.Miner,
Epoch: blockB.Height, Epoch: blockB.Height,
Type: runtime.ConsensusFaultParentGrinding, Type: runtime2.ConsensusFaultParentGrinding,
} }
} }
} }
@ -215,7 +215,7 @@ func (ss *syscallShim) VerifyBlockSig(blk *types.BlockHeader) error {
return nil return nil
} }
func (ss *syscallShim) VerifyPoSt(proof proof.WindowPoStVerifyInfo) error { func (ss *syscallShim) VerifyPoSt(proof proof2.WindowPoStVerifyInfo) error {
ok, err := ss.verifier.VerifyWindowPoSt(context.TODO(), proof) ok, err := ss.verifier.VerifyWindowPoSt(context.TODO(), proof)
if err != nil { if err != nil {
return err return err
@ -226,7 +226,7 @@ func (ss *syscallShim) VerifyPoSt(proof proof.WindowPoStVerifyInfo) error {
return nil return nil
} }
func (ss *syscallShim) VerifySeal(info proof.SealVerifyInfo) error { func (ss *syscallShim) VerifySeal(info proof2.SealVerifyInfo) error {
//_, span := trace.StartSpan(ctx, "ValidatePoRep") //_, span := trace.StartSpan(ctx, "ValidatePoRep")
//defer span.End() //defer span.End()
@ -266,7 +266,7 @@ func (ss *syscallShim) VerifySignature(sig crypto.Signature, addr address.Addres
var BatchSealVerifyParallelism = goruntime.NumCPU() var BatchSealVerifyParallelism = goruntime.NumCPU()
func (ss *syscallShim) BatchVerifySeals(inp map[address.Address][]proof.SealVerifyInfo) (map[address.Address][]bool, error) { func (ss *syscallShim) BatchVerifySeals(inp map[address.Address][]proof2.SealVerifyInfo) (map[address.Address][]bool, error) {
out := make(map[address.Address][]bool) out := make(map[address.Address][]bool)
sema := make(chan struct{}, BatchSealVerifyParallelism) sema := make(chan struct{}, BatchSealVerifyParallelism)
@ -278,7 +278,7 @@ func (ss *syscallShim) BatchVerifySeals(inp map[address.Address][]proof.SealVeri
for i, s := range seals { for i, s := range seals {
wg.Add(1) wg.Add(1)
go func(ma address.Address, ix int, svi proof.SealVerifyInfo, res []bool) { go func(ma address.Address, ix int, svi proof2.SealVerifyInfo, res []bool) {
defer wg.Done() defer wg.Done()
sema <- struct{}{} sema <- struct{}{}

View File

@ -24,7 +24,6 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
datatransfer "github.com/filecoin-project/go-data-transfer" datatransfer "github.com/filecoin-project/go-data-transfer"
"github.com/filecoin-project/go-fil-markets/retrievalmarket" "github.com/filecoin-project/go-fil-markets/retrievalmarket"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/ipfs/go-cidutil/cidenc" "github.com/ipfs/go-cidutil/cidenc"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
@ -41,6 +40,7 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/market" "github.com/filecoin-project/lotus/chain/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/lib/tablewriter" "github.com/filecoin-project/lotus/lib/tablewriter"

View File

@ -28,8 +28,8 @@ import (
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init" init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -167,7 +167,7 @@ var msigCreateCmd = &cli.Command{
// get address of newly created miner // get address of newly created miner
var execreturn init0.ExecReturn var execreturn init2.ExecReturn
if err := execreturn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil { if err := execreturn.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
return err return err
} }
@ -427,7 +427,7 @@ var msigProposeCmd = &cli.Command{
return fmt.Errorf("proposal returned exit %d", wait.Receipt.ExitCode) return fmt.Errorf("proposal returned exit %d", wait.Receipt.ExitCode)
} }
var retval msig0.ProposeReturn var retval msig2.ProposeReturn
if err := retval.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil { if err := retval.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
return fmt.Errorf("failed to unmarshal propose return value: %w", err) return fmt.Errorf("failed to unmarshal propose return value: %w", err)
} }
@ -1160,7 +1160,7 @@ var msigLockProposeCmd = &cli.Command{
from = defaddr from = defaddr
} }
params, actErr := actors.SerializeParams(&msig0.LockBalanceParams{ params, actErr := actors.SerializeParams(&msig2.LockBalanceParams{
StartEpoch: abi.ChainEpoch(start), StartEpoch: abi.ChainEpoch(start),
UnlockDuration: abi.ChainEpoch(duration), UnlockDuration: abi.ChainEpoch(duration),
Amount: abi.NewTokenAmount(amount.Int64()), Amount: abi.NewTokenAmount(amount.Int64()),
@ -1257,7 +1257,7 @@ var msigLockApproveCmd = &cli.Command{
from = defaddr from = defaddr
} }
params, actErr := actors.SerializeParams(&msig0.LockBalanceParams{ params, actErr := actors.SerializeParams(&msig2.LockBalanceParams{
StartEpoch: abi.ChainEpoch(start), StartEpoch: abi.ChainEpoch(start),
UnlockDuration: abi.ChainEpoch(duration), UnlockDuration: abi.ChainEpoch(duration),
Amount: abi.NewTokenAmount(amount.Int64()), Amount: abi.NewTokenAmount(amount.Int64()),
@ -1349,7 +1349,7 @@ var msigLockCancelCmd = &cli.Command{
from = defaddr from = defaddr
} }
params, actErr := actors.SerializeParams(&msig0.LockBalanceParams{ params, actErr := actors.SerializeParams(&msig2.LockBalanceParams{
StartEpoch: abi.ChainEpoch(start), StartEpoch: abi.ChainEpoch(start),
UnlockDuration: abi.ChainEpoch(duration), UnlockDuration: abi.ChainEpoch(duration),
Amount: abi.NewTokenAmount(amount.Int64()), Amount: abi.NewTokenAmount(amount.Int64()),
@ -1488,7 +1488,7 @@ var msigProposeThresholdCmd = &cli.Command{
from = defaddr from = defaddr
} }
params, actErr := actors.SerializeParams(&msig0.ChangeNumApprovalsThresholdParams{ params, actErr := actors.SerializeParams(&msig2.ChangeNumApprovalsThresholdParams{
NewThreshold: newM, NewThreshold: newM,
}) })

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/minio/blake2b-simd" "github.com/minio/blake2b-simd"
cbg "github.com/whyrusleeping/cbor-gen" cbg "github.com/whyrusleeping/cbor-gen"
@ -78,15 +78,16 @@ func (cv cachingVerifier) withCache(execute func() (bool, error), param cbg.CBOR
} }
} }
func (cv *cachingVerifier) VerifySeal(svi proof.SealVerifyInfo) (bool, error) { func (cv *cachingVerifier) VerifySeal(svi proof2.SealVerifyInfo) (bool, error) {
return cv.withCache(func() (bool, error) { return cv.withCache(func() (bool, error) {
return cv.backend.VerifySeal(svi) return cv.backend.VerifySeal(svi)
}, &svi) }, &svi)
} }
func (cv *cachingVerifier) VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error) {
func (cv *cachingVerifier) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) {
return cv.backend.VerifyWinningPoSt(ctx, info) return cv.backend.VerifyWinningPoSt(ctx, info)
} }
func (cv *cachingVerifier) VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error) { func (cv *cachingVerifier) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) {
return cv.withCache(func() (bool, error) { return cv.withCache(func() (bool, error) {
return cv.backend.VerifyWindowPoSt(ctx, info) return cv.backend.VerifyWindowPoSt(ctx, info)
}, &info) }, &info)

View File

@ -11,7 +11,7 @@ import (
"path/filepath" "path/filepath"
"time" "time"
saproof "github.com/filecoin-project/specs-actors/actors/runtime/proof" saproof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/docker/go-units" "github.com/docker/go-units"
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
@ -237,7 +237,7 @@ var sealBenchCmd = &cli.Command{
} }
var sealTimings []SealingResult var sealTimings []SealingResult
var sealedSectors []saproof.SectorInfo var sealedSectors []saproof2.SectorInfo
if robench == "" { if robench == "" {
var err error var err error
@ -280,7 +280,7 @@ var sealBenchCmd = &cli.Command{
} }
for _, s := range genm.Sectors { for _, s := range genm.Sectors {
sealedSectors = append(sealedSectors, saproof.SectorInfo{ sealedSectors = append(sealedSectors, saproof2.SectorInfo{
SealedCID: s.CommR, SealedCID: s.CommR,
SectorNumber: s.SectorID, SectorNumber: s.SectorID,
SealProof: s.ProofType, SealProof: s.ProofType,
@ -305,7 +305,7 @@ var sealBenchCmd = &cli.Command{
return err return err
} }
candidates := make([]saproof.SectorInfo, len(fcandidates)) candidates := make([]saproof2.SectorInfo, len(fcandidates))
for i, fcandidate := range fcandidates { for i, fcandidate := range fcandidates {
candidates[i] = sealedSectors[fcandidate] candidates[i] = sealedSectors[fcandidate]
} }
@ -328,7 +328,7 @@ var sealBenchCmd = &cli.Command{
winnningpost2 := time.Now() winnningpost2 := time.Now()
pvi1 := saproof.WinningPoStVerifyInfo{ pvi1 := saproof2.WinningPoStVerifyInfo{
Randomness: abi.PoStRandomness(challenge[:]), Randomness: abi.PoStRandomness(challenge[:]),
Proofs: proof1, Proofs: proof1,
ChallengedSectors: candidates, ChallengedSectors: candidates,
@ -344,7 +344,7 @@ var sealBenchCmd = &cli.Command{
verifyWinningPost1 := time.Now() verifyWinningPost1 := time.Now()
pvi2 := saproof.WinningPoStVerifyInfo{ pvi2 := saproof2.WinningPoStVerifyInfo{
Randomness: abi.PoStRandomness(challenge[:]), Randomness: abi.PoStRandomness(challenge[:]),
Proofs: proof2, Proofs: proof2,
ChallengedSectors: candidates, ChallengedSectors: candidates,
@ -376,7 +376,7 @@ var sealBenchCmd = &cli.Command{
windowpost2 := time.Now() windowpost2 := time.Now()
wpvi1 := saproof.WindowPoStVerifyInfo{ wpvi1 := saproof2.WindowPoStVerifyInfo{
Randomness: challenge[:], Randomness: challenge[:],
Proofs: wproof1, Proofs: wproof1,
ChallengedSectors: sealedSectors, ChallengedSectors: sealedSectors,
@ -392,7 +392,7 @@ var sealBenchCmd = &cli.Command{
verifyWindowpost1 := time.Now() verifyWindowpost1 := time.Now()
wpvi2 := saproof.WindowPoStVerifyInfo{ wpvi2 := saproof2.WindowPoStVerifyInfo{
Randomness: challenge[:], Randomness: challenge[:],
Proofs: wproof2, Proofs: wproof2,
ChallengedSectors: sealedSectors, ChallengedSectors: sealedSectors,
@ -464,10 +464,10 @@ type ParCfg struct {
Commit int Commit int
} }
func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par ParCfg, mid abi.ActorID, sectorSize abi.SectorSize, ticketPreimage []byte, saveC2inp string, skipc2, skipunseal bool) ([]SealingResult, []saproof.SectorInfo, error) { func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par ParCfg, mid abi.ActorID, sectorSize abi.SectorSize, ticketPreimage []byte, saveC2inp string, skipc2, skipunseal bool) ([]SealingResult, []saproof2.SectorInfo, error) {
var pieces []abi.PieceInfo var pieces []abi.PieceInfo
sealTimings := make([]SealingResult, numSectors) sealTimings := make([]SealingResult, numSectors)
sealedSectors := make([]saproof.SectorInfo, numSectors) sealedSectors := make([]saproof2.SectorInfo, numSectors)
preCommit2Sema := make(chan struct{}, par.PreCommit2) preCommit2Sema := make(chan struct{}, par.PreCommit2)
commitSema := make(chan struct{}, par.Commit) commitSema := make(chan struct{}, par.Commit)
@ -537,7 +537,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
precommit2 := time.Now() precommit2 := time.Now()
<-preCommit2Sema <-preCommit2Sema
sealedSectors[ix] = saproof.SectorInfo{ sealedSectors[ix] = saproof2.SectorInfo{
SealProof: sb.SealProofType(), SealProof: sb.SealProofType(),
SectorNumber: i, SectorNumber: i,
SealedCID: cids.Sealed, SealedCID: cids.Sealed,
@ -589,7 +589,7 @@ func runSeals(sb *ffiwrapper.Sealer, sbfs *basicfs.Provider, numSectors int, par
<-commitSema <-commitSema
if !skipc2 { if !skipc2 {
svi := saproof.SealVerifyInfo{ svi := saproof2.SealVerifyInfo{
SectorID: abi.SectorID{Miner: mid, Number: i}, SectorID: abi.SectorID{Miner: mid, Number: i},
SealedCID: cids.Sealed, SealedCID: cids.Sealed,
SealProof: sb.SealProofType(), SealProof: sb.SealProofType(),

View File

@ -15,7 +15,7 @@ import (
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -134,10 +134,10 @@ func (p *Processor) Start(ctx context.Context) {
log.Fatalw("Failed to collect actor changes", "error", err) log.Fatalw("Failed to collect actor changes", "error", err)
} }
log.Infow("Collected Actor Changes", log.Infow("Collected Actor Changes",
"MarketChanges", len(actorChanges[builtin.StorageMarketActorCodeID]), "MarketChanges", len(actorChanges[builtin2.StorageMarketActorCodeID]),
"MinerChanges", len(actorChanges[builtin.StorageMinerActorCodeID]), "MinerChanges", len(actorChanges[builtin2.StorageMinerActorCodeID]),
"RewardChanges", len(actorChanges[builtin.RewardActorCodeID]), "RewardChanges", len(actorChanges[builtin2.RewardActorCodeID]),
"AccountChanges", len(actorChanges[builtin.AccountActorCodeID]), "AccountChanges", len(actorChanges[builtin2.AccountActorCodeID]),
"nullRounds", len(nullRounds)) "nullRounds", len(nullRounds))
grp := sync.WaitGroup{} grp := sync.WaitGroup{}
@ -145,7 +145,7 @@ func (p *Processor) Start(ctx context.Context) {
grp.Add(1) grp.Add(1)
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleMarketChanges(ctx, actorChanges[builtin.StorageMarketActorCodeID]); err != nil { if err := p.HandleMarketChanges(ctx, actorChanges[builtin2.StorageMarketActorCodeID]); err != nil {
log.Errorf("Failed to handle market changes: %w", err) log.Errorf("Failed to handle market changes: %w", err)
return return
} }
@ -154,7 +154,7 @@ func (p *Processor) Start(ctx context.Context) {
grp.Add(1) grp.Add(1)
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleMinerChanges(ctx, actorChanges[builtin.StorageMinerActorCodeID]); err != nil { if err := p.HandleMinerChanges(ctx, actorChanges[builtin2.StorageMinerActorCodeID]); err != nil {
log.Errorf("Failed to handle miner changes: %w", err) log.Errorf("Failed to handle miner changes: %w", err)
return return
} }
@ -163,7 +163,7 @@ func (p *Processor) Start(ctx context.Context) {
grp.Add(1) grp.Add(1)
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandleRewardChanges(ctx, actorChanges[builtin.RewardActorCodeID], nullRounds); err != nil { if err := p.HandleRewardChanges(ctx, actorChanges[builtin2.RewardActorCodeID], nullRounds); err != nil {
log.Errorf("Failed to handle reward changes: %w", err) log.Errorf("Failed to handle reward changes: %w", err)
return return
} }
@ -172,7 +172,7 @@ func (p *Processor) Start(ctx context.Context) {
grp.Add(1) grp.Add(1)
go func() { go func() {
defer grp.Done() defer grp.Done()
if err := p.HandlePowerChanges(ctx, actorChanges[builtin.StoragePowerActorCodeID]); err != nil { if err := p.HandlePowerChanges(ctx, actorChanges[builtin2.StoragePowerActorCodeID]); err != nil {
log.Errorf("Failed to handle power actor changes: %w", err) log.Errorf("Failed to handle power actor changes: %w", err)
return return
} }

View File

@ -12,8 +12,8 @@ import (
"github.com/filecoin-project/lotus/cli" "github.com/filecoin-project/lotus/cli"
clitest "github.com/filecoin-project/lotus/cli/test" clitest "github.com/filecoin-project/lotus/cli/test"
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init" init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
"github.com/filecoin-project/specs-actors/actors/builtin/multisig" multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -101,7 +101,7 @@ func TestEndToEndWalletMsig(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
var execReturn init0.ExecReturn var execReturn init2.ExecReturn
err = execReturn.UnmarshalCBOR(bytes.NewReader(res.Receipt.Return)) err = execReturn.UnmarshalCBOR(bytes.NewReader(res.Receipt.Return))
require.NoError(t, err) require.NoError(t, err)
@ -121,7 +121,7 @@ func TestEndToEndWalletMsig(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
var proposeReturn multisig.ProposeReturn var proposeReturn multisig2.ProposeReturn
err = proposeReturn.UnmarshalCBOR(bytes.NewReader(res.Receipt.Return)) err = proposeReturn.UnmarshalCBOR(bytes.NewReader(res.Receipt.Return))
require.NoError(t, err) require.NoError(t, err)
@ -135,7 +135,7 @@ func TestEndToEndWalletMsig(t *testing.T) {
require.NoError(t, err) require.NoError(t, err)
require.EqualValues(t, 0, res.Receipt.ExitCode) require.EqualValues(t, 0, res.Receipt.ExitCode)
var approveReturn multisig.ApproveReturn var approveReturn multisig2.ApproveReturn
err = approveReturn.UnmarshalCBOR(bytes.NewReader(res.Receipt.Return)) err = approveReturn.UnmarshalCBOR(bytes.NewReader(res.Receipt.Return))
require.NoError(t, err) require.NoError(t, err)
require.True(t, approveReturn.Applied) require.True(t, approveReturn.Applied)

View File

@ -16,9 +16,8 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin" "github.com/filecoin-project/lotus/chain/actors/builtin"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
@ -871,7 +870,7 @@ func (r *refunder) processTipsetStorageMarketActor(ctx context.Context, tipset *
var messageMethod string var messageMethod string
switch m.Method { switch m.Method {
case builtin0.MethodsMarket.PublishStorageDeals: case builtin2.MethodsMarket.PublishStorageDeals:
if !r.publishStorageDealsEnabled { if !r.publishStorageDealsEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }
@ -898,7 +897,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
var messageMethod string var messageMethod string
switch m.Method { switch m.Method {
case builtin0.MethodsMiner.SubmitWindowedPoSt: case builtin2.MethodsMiner.SubmitWindowedPoSt:
if !r.windowedPoStEnabled { if !r.windowedPoStEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }
@ -911,7 +910,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
} }
refundValue = types.BigMul(types.NewInt(uint64(recp.GasUsed)), tipset.Blocks()[0].ParentBaseFee) refundValue = types.BigMul(types.NewInt(uint64(recp.GasUsed)), tipset.Blocks()[0].ParentBaseFee)
case builtin0.MethodsMiner.ProveCommitSector: case builtin2.MethodsMiner.ProveCommitSector:
if !r.proveCommitEnabled { if !r.proveCommitEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }
@ -930,7 +929,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
var sn abi.SectorNumber var sn abi.SectorNumber
var proveCommitSector miner0.ProveCommitSectorParams var proveCommitSector miner2.ProveCommitSectorParams
if err := proveCommitSector.UnmarshalCBOR(bytes.NewBuffer(m.Params)); err != nil { if err := proveCommitSector.UnmarshalCBOR(bytes.NewBuffer(m.Params)); err != nil {
log.Warnw("failed to decode provecommit params", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To) log.Warnw("failed to decode provecommit params", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To)
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
@ -967,7 +966,7 @@ func (r *refunder) processTipsetStorageMinerActor(ctx context.Context, tipset *t
if r.refundPercent > 0 { if r.refundPercent > 0 {
refundValue = types.BigMul(types.BigDiv(refundValue, types.NewInt(100)), types.NewInt(uint64(r.refundPercent))) refundValue = types.BigMul(types.BigDiv(refundValue, types.NewInt(100)), types.NewInt(uint64(r.refundPercent)))
} }
case builtin0.MethodsMiner.PreCommitSector: case builtin2.MethodsMiner.PreCommitSector:
if !r.preCommitEnabled { if !r.preCommitEnabled {
return false, messageMethod, types.NewInt(0), nil return false, messageMethod, types.NewInt(0), nil
} }

View File

@ -22,7 +22,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/extern/sector-storage/zerocomm" "github.com/filecoin-project/lotus/extern/sector-storage/zerocomm"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
@ -252,7 +253,7 @@ func WriteGenesisMiner(maddr address.Address, sbroot string, gm *genesis.Miner,
func createDeals(m *genesis.Miner, k *wallet.Key, maddr address.Address, ssize abi.SectorSize) error { func createDeals(m *genesis.Miner, k *wallet.Key, maddr address.Address, ssize abi.SectorSize) error {
for i, sector := range m.Sectors { for i, sector := range m.Sectors {
proposal := &market.DealProposal{ proposal := &market2.DealProposal{
PieceCID: sector.CommD, PieceCID: sector.CommD,
PieceSize: abi.PaddedPieceSize(ssize), PieceSize: abi.PaddedPieceSize(ssize),
Client: k.Address, Client: k.Address,

View File

@ -14,7 +14,7 @@ import (
"go.opencensus.io/stats/view" "go.opencensus.io/stats/view"
"go.opencensus.io/tag" "go.opencensus.io/tag"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
@ -145,7 +145,7 @@ var mpoolStatsCmd = &cli.Command{
seen: time.Now(), seen: time.Now(),
} }
if u.Message.Message.Method == builtin0.MethodsMiner.SubmitWindowedPoSt { if u.Message.Message.Method == builtin2.MethodsMiner.SubmitWindowedPoSt {
miner, err := isMiner(u.Message.Message.To) miner, err := isMiner(u.Message.Message.To)
if err != nil { if err != nil {

View File

@ -4,7 +4,7 @@ import (
"encoding/hex" "encoding/hex"
"fmt" "fmt"
saproof "github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
@ -84,7 +84,7 @@ var verifySealProofCmd = &cli.Command{
snum := abi.SectorNumber(cctx.Uint64("sector-id")) snum := abi.SectorNumber(cctx.Uint64("sector-id"))
ok, err := ffi.VerifySeal(saproof.SealVerifyInfo{ ok, err := ffi.VerifySeal(proof2.SealVerifyInfo{
SectorID: abi.SectorID{ SectorID: abi.SectorID{
Miner: abi.ActorID(mid), Miner: abi.ActorID(mid),
Number: snum, Number: snum,

View File

@ -12,7 +12,7 @@ import (
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner" miner0 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/urfave/cli/v2" "github.com/urfave/cli/v2"
) )
@ -106,7 +106,7 @@ var terminateSectorCmd = &cli.Command{
smsg, err := nodeApi.MpoolPushMessage(ctx, &types.Message{ smsg, err := nodeApi.MpoolPushMessage(ctx, &types.Message{
From: mi.Owner, From: mi.Owner,
To: maddr, To: maddr,
Method: builtin.MethodsMiner.TerminateSectors, Method: builtin2.MethodsMiner.TerminateSectors,
Value: big.Zero(), Value: big.Zero(),
Params: sp, Params: sp,

View File

@ -11,8 +11,8 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg" verifreg2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/verifreg"
"github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/apibstore"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -63,7 +63,7 @@ var verifRegAddVerifierCmd = &cli.Command{
} }
// TODO: ActorUpgrade: Abstract // TODO: ActorUpgrade: Abstract
params, err := actors.SerializeParams(&verifreg0.AddVerifierParams{Address: verifier, Allowance: allowance}) params, err := actors.SerializeParams(&verifreg2.AddVerifierParams{Address: verifier, Allowance: allowance})
if err != nil { if err != nil {
return err return err
} }
@ -80,7 +80,7 @@ var verifRegAddVerifierCmd = &cli.Command{
return err return err
} }
smsg, err := api.MsigPropose(ctx, vrk, verifreg.Address, big.Zero(), sender, uint64(builtin0.MethodsVerifiedRegistry.AddVerifier), params) smsg, err := api.MsigPropose(ctx, vrk, verifreg.Address, big.Zero(), sender, uint64(builtin2.MethodsVerifiedRegistry.AddVerifier), params)
if err != nil { if err != nil {
return err return err
} }
@ -136,7 +136,7 @@ var verifRegVerifyClientCmd = &cli.Command{
return err return err
} }
params, err := actors.SerializeParams(&verifreg0.AddVerifiedClientParams{Address: target, Allowance: allowance}) params, err := actors.SerializeParams(&verifreg2.AddVerifiedClientParams{Address: target, Allowance: allowance})
if err != nil { if err != nil {
return err return err
} }
@ -151,7 +151,7 @@ var verifRegVerifyClientCmd = &cli.Command{
msg := &types.Message{ msg := &types.Message{
To: verifreg.Address, To: verifreg.Address,
From: fromk, From: fromk,
Method: builtin0.MethodsVerifiedRegistry.AddVerifiedClient, Method: builtin2.MethodsVerifiedRegistry.AddVerifiedClient,
Params: params, Params: params,
} }

View File

@ -11,7 +11,6 @@ import (
cbor "github.com/ipfs/go-ipld-cbor" cbor "github.com/ipfs/go-ipld-cbor"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/fatih/color" "github.com/fatih/color"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
@ -23,8 +22,8 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -98,7 +97,7 @@ var actorSetAddrsCmd = &cli.Command{
return err return err
} }
params, err := actors.SerializeParams(&miner0.ChangeMultiaddrsParams{NewMultiaddrs: addrs}) params, err := actors.SerializeParams(&miner2.ChangeMultiaddrsParams{NewMultiaddrs: addrs})
if err != nil { if err != nil {
return err return err
} }
@ -110,7 +109,7 @@ var actorSetAddrsCmd = &cli.Command{
From: minfo.Worker, From: minfo.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
GasLimit: gasLimit, GasLimit: gasLimit,
Method: builtin.MethodsMiner.ChangeMultiaddrs, Method: builtin2.MethodsMiner.ChangeMultiaddrs,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -163,7 +162,7 @@ var actorSetPeeridCmd = &cli.Command{
return err return err
} }
params, err := actors.SerializeParams(&miner0.ChangePeerIDParams{NewID: abi.PeerID(pid)}) params, err := actors.SerializeParams(&miner2.ChangePeerIDParams{NewID: abi.PeerID(pid)})
if err != nil { if err != nil {
return err return err
} }
@ -175,7 +174,7 @@ var actorSetPeeridCmd = &cli.Command{
From: minfo.Worker, From: minfo.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
GasLimit: gasLimit, GasLimit: gasLimit,
Method: builtin.MethodsMiner.ChangePeerID, Method: builtin2.MethodsMiner.ChangePeerID,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -236,7 +235,7 @@ var actorWithdrawCmd = &cli.Command{
} }
} }
params, err := actors.SerializeParams(&miner0.WithdrawBalanceParams{ params, err := actors.SerializeParams(&miner2.WithdrawBalanceParams{
AmountRequested: amount, // Default to attempting to withdraw all the extra funds in the miner actor AmountRequested: amount, // Default to attempting to withdraw all the extra funds in the miner actor
}) })
if err != nil { if err != nil {
@ -247,7 +246,7 @@ var actorWithdrawCmd = &cli.Command{
To: maddr, To: maddr,
From: mi.Owner, From: mi.Owner,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin.MethodsMiner.WithdrawBalance, Method: builtin2.MethodsMiner.WithdrawBalance,
Params: params, Params: params,
}, nil) }, nil)
if err != nil { if err != nil {
@ -560,7 +559,7 @@ var actorControlSet = &cli.Command{
return nil return nil
} }
cwp := &miner0.ChangeWorkerAddressParams{ cwp := &miner2.ChangeWorkerAddressParams{
NewWorker: mi.Worker, NewWorker: mi.Worker,
NewControlAddrs: toSet, NewControlAddrs: toSet,
} }
@ -573,7 +572,7 @@ var actorControlSet = &cli.Command{
smsg, err := api.MpoolPushMessage(ctx, &types.Message{ smsg, err := api.MpoolPushMessage(ctx, &types.Message{
From: mi.Owner, From: mi.Owner,
To: maddr, To: maddr,
Method: builtin.MethodsMiner.ChangeWorkerAddress, Method: builtin2.MethodsMiner.ChangeWorkerAddress,
Value: big.Zero(), Value: big.Zero(),
Params: sp, Params: sp,

View File

@ -31,14 +31,16 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/lotus/extern/sector-storage/stores" "github.com/filecoin-project/lotus/extern/sector-storage/stores"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power" power2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/power"
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/gen/slashfilter"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
@ -82,7 +84,7 @@ var initCmd = &cli.Command{
&cli.StringFlag{ &cli.StringFlag{
Name: "sector-size", Name: "sector-size",
Usage: "specify sector size to use", Usage: "specify sector size to use",
Value: units.BytesSize(float64(build.DefaultSectorSize())), Value: units.BytesSize(float64(policy.GetDefaultSectorSize())),
}, },
&cli.StringSliceFlag{ &cli.StringSliceFlag{
Name: "pre-sealed-sectors", Name: "pre-sealed-sectors",
@ -375,7 +377,7 @@ func migratePreSealMeta(ctx context.Context, api lapi.FullNode, metadata string,
return mds.Put(datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size]) return mds.Put(datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size])
} }
func findMarketDealID(ctx context.Context, api lapi.FullNode, deal market0.DealProposal) (abi.DealID, error) { func findMarketDealID(ctx context.Context, api lapi.FullNode, deal market2.DealProposal) (abi.DealID, error) {
// TODO: find a better way // TODO: find a better way
// (this is only used by genesis miners) // (this is only used by genesis miners)
@ -568,7 +570,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
return xerrors.Errorf("getWorkerAddr returned bad address: %w", err) return xerrors.Errorf("getWorkerAddr returned bad address: %w", err)
} }
enc, err := actors.SerializeParams(&miner0.ChangePeerIDParams{NewID: abi.PeerID(peerid)}) enc, err := actors.SerializeParams(&miner2.ChangePeerIDParams{NewID: abi.PeerID(peerid)})
if err != nil { if err != nil {
return err return err
} }
@ -576,7 +578,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
msg := &types.Message{ msg := &types.Message{
To: addr, To: addr,
From: mi.Worker, From: mi.Worker,
Method: builtin0.MethodsMiner.ChangePeerID, Method: builtin2.MethodsMiner.ChangePeerID,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
GasPremium: gasPrice, GasPremium: gasPrice,
@ -635,7 +637,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
return address.Undef, err return address.Undef, err
} }
params, err := actors.SerializeParams(&power0.CreateMinerParams{ params, err := actors.SerializeParams(&power2.CreateMinerParams{
Owner: owner, Owner: owner,
Worker: worker, Worker: worker,
SealProofType: spt, SealProofType: spt,
@ -655,11 +657,11 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
} }
createStorageMinerMsg := &types.Message{ createStorageMinerMsg := &types.Message{
To: builtin0.StoragePowerActorAddr, To: power.Address,
From: sender, From: sender,
Value: big.Zero(), Value: big.Zero(),
Method: builtin0.MethodsPower.CreateMiner, Method: builtin2.MethodsPower.CreateMiner,
Params: params, Params: params,
GasLimit: 0, GasLimit: 0,
@ -683,7 +685,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
return address.Undef, xerrors.Errorf("create miner failed: exit code %d", mw.Receipt.ExitCode) return address.Undef, xerrors.Errorf("create miner failed: exit code %d", mw.Receipt.ExitCode)
} }
var retval power0.CreateMinerReturn var retval power2.CreateMinerReturn
if err := retval.UnmarshalCBOR(bytes.NewReader(mw.Receipt.Return)); err != nil { if err := retval.UnmarshalCBOR(bytes.NewReader(mw.Receipt.Return)); err != nil {
return address.Undef, err return address.Undef, err
} }

View File

@ -15,10 +15,9 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/lib/tablewriter" "github.com/filecoin-project/lotus/lib/tablewriter"
@ -463,7 +462,7 @@ var sectorsCapacityCollateralCmd = &cli.Command{
Expiration: abi.ChainEpoch(cctx.Uint64("expiration")), Expiration: abi.ChainEpoch(cctx.Uint64("expiration")),
} }
if pci.Expiration == 0 { if pci.Expiration == 0 {
pci.Expiration = miner0.MaxSectorExpirationExtension pci.Expiration = policy.GetMaxSectorExpirationExtension()
} }
pc, err := nApi.StateMinerInitialPledgeCollateral(ctx, maddr, pci, types.EmptyTSK) pc, err := nApi.StateMinerInitialPledgeCollateral(ctx, maddr, pci, types.EmptyTSK)
if err != nil { if err != nil {

View File

@ -14,6 +14,7 @@ import (
"github.com/fatih/color" "github.com/fatih/color"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin"
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init" init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
"github.com/filecoin-project/lotus/chain/actors/builtin/reward" "github.com/filecoin-project/lotus/chain/actors/builtin/reward"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -21,8 +22,6 @@ import (
lcli "github.com/filecoin-project/lotus/cli" lcli "github.com/filecoin-project/lotus/cli"
"github.com/filecoin-project/lotus/conformance" "github.com/filecoin-project/lotus/conformance"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/test-vectors/schema" "github.com/filecoin-project/test-vectors/schema"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"

View File

@ -6,9 +6,10 @@ import (
"github.com/filecoin-project/go-state-types/cbor" "github.com/filecoin-project/go-state-types/cbor"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-state-types/rt" "github.com/filecoin-project/go-state-types/rt"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/runtime"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
runtime2 "github.com/filecoin-project/specs-actors/v2/actors/runtime"
) )
//go:generate go run ./gen //go:generate go run ./gen
@ -55,7 +56,7 @@ const (
const ( const (
_ = 0 // skip zero iota value; first usage of iota gets 1. _ = 0 // skip zero iota value; first usage of iota gets 1.
MethodCallerValidation = builtin.MethodConstructor + iota MethodCallerValidation = builtin2.MethodConstructor + iota
MethodCreateActor MethodCreateActor
MethodResolveAddress MethodResolveAddress
// MethodDeleteActor is the identifier for the method that deletes this actor. // MethodDeleteActor is the identifier for the method that deletes this actor.
@ -76,15 +77,15 @@ const (
// Exports defines the methods this actor exposes publicly. // Exports defines the methods this actor exposes publicly.
func (a Actor) Exports() []interface{} { func (a Actor) Exports() []interface{} {
return []interface{}{ return []interface{}{
builtin.MethodConstructor: a.Constructor, builtin2.MethodConstructor: a.Constructor,
MethodCallerValidation: a.CallerValidation, MethodCallerValidation: a.CallerValidation,
MethodCreateActor: a.CreateActor, MethodCreateActor: a.CreateActor,
MethodResolveAddress: a.ResolveAddress, MethodResolveAddress: a.ResolveAddress,
MethodDeleteActor: a.DeleteActor, MethodDeleteActor: a.DeleteActor,
MethodSend: a.Send, MethodSend: a.Send,
MethodMutateState: a.MutateState, MethodMutateState: a.MutateState,
MethodAbortWith: a.AbortWith, MethodAbortWith: a.AbortWith,
MethodInspectRuntime: a.InspectRuntime, MethodInspectRuntime: a.InspectRuntime,
} }
} }
@ -104,19 +105,19 @@ type SendArgs struct {
// SendReturn is the return values for the Send method. // SendReturn is the return values for the Send method.
type SendReturn struct { type SendReturn struct {
Return runtime.CBORBytes Return builtin2.CBORBytes
Code exitcode.ExitCode Code exitcode.ExitCode
} }
// Send requests for this actor to send a message to an actor with the // Send requests for this actor to send a message to an actor with the
// passed parameters. // passed parameters.
func (a Actor) Send(rt runtime.Runtime, args *SendArgs) *SendReturn { func (a Actor) Send(rt runtime2.Runtime, args *SendArgs) *SendReturn {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
var out runtime.CBORBytes var out builtin2.CBORBytes
code := rt.Send( code := rt.Send(
args.To, args.To,
args.Method, args.Method,
runtime.CBORBytes(args.Params), builtin2.CBORBytes(args.Params),
args.Value, args.Value,
&out, &out,
) )
@ -127,7 +128,7 @@ func (a Actor) Send(rt runtime.Runtime, args *SendArgs) *SendReturn {
} }
// Constructor will panic because the Chaos actor is a singleton. // Constructor will panic because the Chaos actor is a singleton.
func (a Actor) Constructor(_ runtime.Runtime, _ *abi.EmptyValue) *abi.EmptyValue { func (a Actor) Constructor(_ runtime2.Runtime, _ *abi.EmptyValue) *abi.EmptyValue {
panic("constructor should not be called; the Chaos actor is a singleton actor") panic("constructor should not be called; the Chaos actor is a singleton actor")
} }
@ -144,7 +145,7 @@ type CallerValidationArgs struct {
// CallerValidationBranchTwice validates twice. // CallerValidationBranchTwice validates twice.
// CallerValidationBranchIsAddress validates caller against CallerValidationArgs.Addrs. // CallerValidationBranchIsAddress validates caller against CallerValidationArgs.Addrs.
// CallerValidationBranchIsType validates caller against CallerValidationArgs.Types. // CallerValidationBranchIsType validates caller against CallerValidationArgs.Types.
func (a Actor) CallerValidation(rt runtime.Runtime, args *CallerValidationArgs) *abi.EmptyValue { func (a Actor) CallerValidation(rt runtime2.Runtime, args *CallerValidationArgs) *abi.EmptyValue {
switch args.Branch { switch args.Branch {
case CallerValidationBranchNone: case CallerValidationBranchNone:
case CallerValidationBranchTwice: case CallerValidationBranchTwice:
@ -174,7 +175,7 @@ type CreateActorArgs struct {
} }
// CreateActor creates an actor with the supplied CID and Address. // CreateActor creates an actor with the supplied CID and Address.
func (a Actor) CreateActor(rt runtime.Runtime, args *CreateActorArgs) *abi.EmptyValue { func (a Actor) CreateActor(rt runtime2.Runtime, args *CreateActorArgs) *abi.EmptyValue {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
var ( var (
@ -199,7 +200,7 @@ type ResolveAddressResponse struct {
Success bool Success bool
} }
func (a Actor) ResolveAddress(rt runtime.Runtime, args *address.Address) *ResolveAddressResponse { func (a Actor) ResolveAddress(rt runtime2.Runtime, args *address.Address) *ResolveAddressResponse {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
resolvedAddr, ok := rt.ResolveAddress(*args) resolvedAddr, ok := rt.ResolveAddress(*args)
@ -212,7 +213,7 @@ func (a Actor) ResolveAddress(rt runtime.Runtime, args *address.Address) *Resolv
// DeleteActor deletes the executing actor from the state tree, transferring any // DeleteActor deletes the executing actor from the state tree, transferring any
// balance to beneficiary. // balance to beneficiary.
func (a Actor) DeleteActor(rt runtime.Runtime, beneficiary *address.Address) *abi.EmptyValue { func (a Actor) DeleteActor(rt runtime2.Runtime, beneficiary *address.Address) *abi.EmptyValue {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
rt.DeleteActor(*beneficiary) rt.DeleteActor(*beneficiary)
return nil return nil
@ -226,7 +227,7 @@ type MutateStateArgs struct {
} }
// MutateState attempts to mutate a state value in the actor. // MutateState attempts to mutate a state value in the actor.
func (a Actor) MutateState(rt runtime.Runtime, args *MutateStateArgs) *abi.EmptyValue { func (a Actor) MutateState(rt runtime2.Runtime, args *MutateStateArgs) *abi.EmptyValue {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
var st State var st State
switch args.Branch { switch args.Branch {
@ -257,7 +258,7 @@ type AbortWithArgs struct {
} }
// AbortWith simply causes a panic with the passed exit code. // AbortWith simply causes a panic with the passed exit code.
func (a Actor) AbortWith(rt runtime.Runtime, args *AbortWithArgs) *abi.EmptyValue { func (a Actor) AbortWith(rt runtime2.Runtime, args *AbortWithArgs) *abi.EmptyValue {
if args.Uncontrolled { // uncontrolled abort: directly panic if args.Uncontrolled { // uncontrolled abort: directly panic
panic(args.Message) panic(args.Message)
} else { } else {
@ -277,7 +278,7 @@ type InspectRuntimeReturn struct {
} }
// InspectRuntime returns a copy of the serializable values available in the Runtime. // InspectRuntime returns a copy of the serializable values available in the Runtime.
func (a Actor) InspectRuntime(rt runtime.Runtime, _ *abi.EmptyValue) *InspectRuntimeReturn { func (a Actor) InspectRuntime(rt runtime2.Runtime, _ *abi.EmptyValue) *InspectRuntimeReturn {
rt.ValidateImmediateCallerAcceptAny() rt.ValidateImmediateCallerAcceptAny()
var st State var st State
rt.StateReadonly(&st) rt.StateReadonly(&st)

View File

@ -7,15 +7,16 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/support/mock"
atesting "github.com/filecoin-project/specs-actors/support/testing"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
mock2 "github.com/filecoin-project/specs-actors/v2/support/mock"
atesting2 "github.com/filecoin-project/specs-actors/v2/support/testing"
) )
func TestSingleton(t *testing.T) { func TestSingleton(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -28,8 +29,8 @@ func TestSingleton(t *testing.T) {
} }
func TestCallerValidationNone(t *testing.T) { func TestCallerValidationNone(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -39,19 +40,19 @@ func TestCallerValidationNone(t *testing.T) {
} }
func TestCallerValidationIs(t *testing.T) { func TestCallerValidationIs(t *testing.T) {
caller := atesting.NewIDAddr(t, 100) caller := atesting2.NewIDAddr(t, 100)
receiver := atesting.NewIDAddr(t, 101) receiver := atesting2.NewIDAddr(t, 101)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
rt.SetCaller(caller, builtin.AccountActorCodeID) rt.SetCaller(caller, builtin2.AccountActorCodeID)
var a Actor var a Actor
caddrs := []address.Address{atesting.NewIDAddr(t, 101)} caddrs := []address.Address{atesting2.NewIDAddr(t, 101)}
rt.ExpectValidateCallerAddr(caddrs...) rt.ExpectValidateCallerAddr(caddrs...)
// FIXME: https://github.com/filecoin-project/specs-actors/pull/1155 // fixed in: https://github.com/filecoin-project/specs-actors/pull/1155
rt.ExpectAbort(exitcode.ErrForbidden, func() { rt.ExpectAbort(exitcode.SysErrForbidden, func() {
rt.Call(a.CallerValidation, &CallerValidationArgs{ rt.Call(a.CallerValidation, &CallerValidationArgs{
Branch: CallerValidationBranchIsAddress, Branch: CallerValidationBranchIsAddress,
Addrs: caddrs, Addrs: caddrs,
@ -68,35 +69,34 @@ func TestCallerValidationIs(t *testing.T) {
} }
func TestCallerValidationType(t *testing.T) { func TestCallerValidationType(t *testing.T) {
caller := atesting.NewIDAddr(t, 100) caller := atesting2.NewIDAddr(t, 100)
receiver := atesting.NewIDAddr(t, 101) receiver := atesting2.NewIDAddr(t, 101)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
rt.SetCaller(caller, builtin.AccountActorCodeID) rt.SetCaller(caller, builtin2.AccountActorCodeID)
var a Actor var a Actor
rt.ExpectValidateCallerType(builtin.CronActorCodeID) rt.ExpectValidateCallerType(builtin2.CronActorCodeID)
// FIXME: https://github.com/filecoin-project/specs-actors/pull/1155 rt.ExpectAbort(exitcode.SysErrForbidden, func() {
rt.ExpectAbort(exitcode.ErrForbidden, func() {
rt.Call(a.CallerValidation, &CallerValidationArgs{ rt.Call(a.CallerValidation, &CallerValidationArgs{
Branch: CallerValidationBranchIsType, Branch: CallerValidationBranchIsType,
Types: []cid.Cid{builtin.CronActorCodeID}, Types: []cid.Cid{builtin2.CronActorCodeID},
}) })
}) })
rt.Verify() rt.Verify()
rt.ExpectValidateCallerType(builtin.AccountActorCodeID) rt.ExpectValidateCallerType(builtin2.AccountActorCodeID)
rt.Call(a.CallerValidation, &CallerValidationArgs{ rt.Call(a.CallerValidation, &CallerValidationArgs{
Branch: CallerValidationBranchIsType, Branch: CallerValidationBranchIsType,
Types: []cid.Cid{builtin.AccountActorCodeID}, Types: []cid.Cid{builtin2.AccountActorCodeID},
}) })
rt.Verify() rt.Verify()
} }
func TestCallerValidationInvalidBranch(t *testing.T) { func TestCallerValidationInvalidBranch(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -108,9 +108,9 @@ func TestCallerValidationInvalidBranch(t *testing.T) {
} }
func TestDeleteActor(t *testing.T) { func TestDeleteActor(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
beneficiary := atesting.NewIDAddr(t, 101) beneficiary := atesting2.NewIDAddr(t, 101)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -122,8 +122,8 @@ func TestDeleteActor(t *testing.T) {
} }
func TestMutateStateInTransaction(t *testing.T) { func TestMutateStateInTransaction(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -148,8 +148,8 @@ func TestMutateStateInTransaction(t *testing.T) {
} }
func TestMutateStateAfterTransaction(t *testing.T) { func TestMutateStateAfterTransaction(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -175,8 +175,8 @@ func TestMutateStateAfterTransaction(t *testing.T) {
} }
func TestMutateStateReadonly(t *testing.T) { func TestMutateStateReadonly(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -201,8 +201,8 @@ func TestMutateStateReadonly(t *testing.T) {
} }
func TestMutateStateInvalidBranch(t *testing.T) { func TestMutateStateInvalidBranch(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -215,8 +215,8 @@ func TestMutateStateInvalidBranch(t *testing.T) {
} }
func TestAbortWith(t *testing.T) { func TestAbortWith(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -233,8 +233,8 @@ func TestAbortWith(t *testing.T) {
} }
func TestAbortWithUncontrolled(t *testing.T) { func TestAbortWithUncontrolled(t *testing.T) {
receiver := atesting.NewIDAddr(t, 100) receiver := atesting2.NewIDAddr(t, 100)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
var a Actor var a Actor
@ -250,12 +250,12 @@ func TestAbortWithUncontrolled(t *testing.T) {
} }
func TestInspectRuntime(t *testing.T) { func TestInspectRuntime(t *testing.T) {
caller := atesting.NewIDAddr(t, 100) caller := atesting2.NewIDAddr(t, 100)
receiver := atesting.NewIDAddr(t, 101) receiver := atesting2.NewIDAddr(t, 101)
builder := mock.NewBuilder(context.Background(), receiver) builder := mock2.NewBuilder(context.Background(), receiver)
rt := builder.Build(t) rt := builder.Build(t)
rt.SetCaller(caller, builtin.AccountActorCodeID) rt.SetCaller(caller, builtin2.AccountActorCodeID)
rt.StateCreate(&State{}) rt.StateCreate(&State{})
var a Actor var a Actor

View File

@ -587,7 +587,7 @@ func (t *SendReturn) MarshalCBOR(w io.Writer) error {
scratch := make([]byte, 9) scratch := make([]byte, 9)
// t.Return (runtime.CBORBytes) (slice) // t.Return (builtin.CBORBytes) (slice)
if len(t.Return) > cbg.ByteArrayMaxLen { if len(t.Return) > cbg.ByteArrayMaxLen {
return xerrors.Errorf("Byte array in field t.Return was too long") return xerrors.Errorf("Byte array in field t.Return was too long")
} }
@ -631,7 +631,7 @@ func (t *SendReturn) UnmarshalCBOR(r io.Reader) error {
return fmt.Errorf("cbor input had wrong number of fields") return fmt.Errorf("cbor input had wrong number of fields")
} }
// t.Return (runtime.CBORBytes) (slice) // t.Return (builtin.CBORBytes) (slice)
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch) maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
if err != nil { if err != nil {

View File

@ -15,7 +15,7 @@ import (
"testing" "testing"
"time" "time"
saproof "github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -93,7 +93,7 @@ func (s *seal) commit(t *testing.T, sb *Sealer, done func()) {
t.Fatalf("%+v", err) t.Fatalf("%+v", err)
} }
ok, err := ProofVerifier.VerifySeal(saproof.SealVerifyInfo{ ok, err := ProofVerifier.VerifySeal(proof2.SealVerifyInfo{
SectorID: s.id, SectorID: s.id,
SealedCID: s.cids.Sealed, SealedCID: s.cids.Sealed,
SealProof: sealProofType, SealProof: sealProofType,
@ -171,9 +171,9 @@ func (s *seal) unseal(t *testing.T, sb *Sealer, sp *basicfs.Provider, si abi.Sec
func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) { func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) {
randomness := abi.PoStRandomness{0, 9, 2, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 7} randomness := abi.PoStRandomness{0, 9, 2, 7, 6, 5, 4, 3, 2, 1, 0, 9, 8, 7, 6, 45, 3, 2, 1, 0, 9, 8, 7, 6, 5, 4, 3, 2, 1, 0, 9, 7}
sis := make([]saproof.SectorInfo, len(seals)) sis := make([]proof2.SectorInfo, len(seals))
for i, s := range seals { for i, s := range seals {
sis[i] = saproof.SectorInfo{ sis[i] = proof2.SectorInfo{
SealProof: sealProofType, SealProof: sealProofType,
SectorNumber: s.id.Number, SectorNumber: s.id.Number,
SealedCID: s.cids.Sealed, SealedCID: s.cids.Sealed,
@ -191,7 +191,7 @@ func post(t *testing.T, sealer *Sealer, skipped []abi.SectorID, seals ...seal) {
t.Fatalf("%+v", err) t.Fatalf("%+v", err)
} }
ok, err := ProofVerifier.VerifyWindowPoSt(context.TODO(), saproof.WindowPoStVerifyInfo{ ok, err := ProofVerifier.VerifyWindowPoSt(context.TODO(), proof2.WindowPoStVerifyInfo{
Randomness: randomness, Randomness: randomness,
Proofs: proofs, Proofs: proofs,
ChallengedSectors: sis, ChallengedSectors: sis,

View File

@ -4,7 +4,7 @@ import (
"context" "context"
"io" "io"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
@ -35,9 +35,9 @@ type Storage interface {
} }
type Verifier interface { type Verifier interface {
VerifySeal(proof.SealVerifyInfo) (bool, error) VerifySeal(proof2.SealVerifyInfo) (bool, error)
VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error)
VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error)
GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error) GenerateWinningPoStSectorChallenge(context.Context, abi.RegisteredPoStProof, abi.ActorID, abi.PoStRandomness, uint64) ([]uint64, error)
} }

View File

@ -5,7 +5,7 @@ package ffiwrapper
import ( import (
"context" "context"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -18,7 +18,7 @@ import (
"go.opencensus.io/trace" "go.opencensus.io/trace"
) )
func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.SectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error) { func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) ([]proof2.PoStProof, error) {
randomness[31] &= 0x3f randomness[31] &= 0x3f
privsectors, skipped, done, err := sb.pubSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWinningPoStProof) // TODO: FAULTS? privsectors, skipped, done, err := sb.pubSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWinningPoStProof) // TODO: FAULTS?
if err != nil { if err != nil {
@ -32,7 +32,7 @@ func (sb *Sealer) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID,
return ffi.GenerateWinningPoSt(minerID, privsectors, randomness) return ffi.GenerateWinningPoSt(minerID, privsectors, randomness)
} }
func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.SectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) { func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) ([]proof2.PoStProof, []abi.SectorID, error) {
randomness[31] &= 0x3f randomness[31] &= 0x3f
privsectors, skipped, done, err := sb.pubSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWindowPoStProof) privsectors, skipped, done, err := sb.pubSectorToPriv(ctx, minerID, sectorInfo, nil, abi.RegisteredSealProof.RegisteredWindowPoStProof)
if err != nil { if err != nil {
@ -57,7 +57,7 @@ func (sb *Sealer) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, s
return proof, faultyIDs, err return proof, faultyIDs, err
} }
func (sb *Sealer) pubSectorToPriv(ctx context.Context, mid abi.ActorID, sectorInfo []proof.SectorInfo, faults []abi.SectorNumber, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error)) (ffi.SortedPrivateSectorInfo, []abi.SectorID, func(), error) { func (sb *Sealer) pubSectorToPriv(ctx context.Context, mid abi.ActorID, sectorInfo []proof2.SectorInfo, faults []abi.SectorNumber, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error)) (ffi.SortedPrivateSectorInfo, []abi.SectorID, func(), error) {
fmap := map[abi.SectorNumber]struct{}{} fmap := map[abi.SectorNumber]struct{}{}
for _, fault := range faults { for _, fault := range faults {
fmap[fault] = struct{}{} fmap[fault] = struct{}{}
@ -110,11 +110,11 @@ type proofVerifier struct{}
var ProofVerifier = proofVerifier{} var ProofVerifier = proofVerifier{}
func (proofVerifier) VerifySeal(info proof.SealVerifyInfo) (bool, error) { func (proofVerifier) VerifySeal(info proof2.SealVerifyInfo) (bool, error) {
return ffi.VerifySeal(info) return ffi.VerifySeal(info)
} }
func (proofVerifier) VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error) { func (proofVerifier) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) {
info.Randomness[31] &= 0x3f info.Randomness[31] &= 0x3f
_, span := trace.StartSpan(ctx, "VerifyWinningPoSt") _, span := trace.StartSpan(ctx, "VerifyWinningPoSt")
defer span.End() defer span.End()
@ -122,7 +122,7 @@ func (proofVerifier) VerifyWinningPoSt(ctx context.Context, info proof.WinningPo
return ffi.VerifyWinningPoSt(info) return ffi.VerifyWinningPoSt(info)
} }
func (proofVerifier) VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error) { func (proofVerifier) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) {
info.Randomness[31] &= 0x3f info.Randomness[31] &= 0x3f
_, span := trace.StartSpan(ctx, "VerifyWindowPoSt") _, span := trace.StartSpan(ctx, "VerifyWindowPoSt")
defer span.End() defer span.End()

View File

@ -9,7 +9,7 @@ import (
"math/rand" "math/rand"
"sync" "sync"
"github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
commcid "github.com/filecoin-project/go-fil-commcid" commcid "github.com/filecoin-project/go-fil-commcid"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
@ -280,12 +280,12 @@ func AddOpFinish(ctx context.Context) (context.Context, func()) {
} }
} }
func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.SectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, error) { func (mgr *SectorMgr) GenerateWinningPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) ([]proof2.PoStProof, error) {
return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWinningPoStProof, randomness), nil return generateFakePoSt(sectorInfo, abi.RegisteredSealProof.RegisteredWinningPoStProof, randomness), nil
} }
func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof.SectorInfo, randomness abi.PoStRandomness) ([]proof.PoStProof, []abi.SectorID, error) { func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorID, sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) ([]proof2.PoStProof, []abi.SectorID, error) {
si := make([]proof.SectorInfo, 0, len(sectorInfo)) si := make([]proof2.SectorInfo, 0, len(sectorInfo))
var skipped []abi.SectorID var skipped []abi.SectorID
var err error var err error
@ -313,7 +313,7 @@ func (mgr *SectorMgr) GenerateWindowPoSt(ctx context.Context, minerID abi.ActorI
return generateFakePoSt(si, abi.RegisteredSealProof.RegisteredWindowPoStProof, randomness), skipped, nil return generateFakePoSt(si, abi.RegisteredSealProof.RegisteredWindowPoStProof, randomness), skipped, nil
} }
func generateFakePoStProof(sectorInfo []proof.SectorInfo, randomness abi.PoStRandomness) []byte { func generateFakePoStProof(sectorInfo []proof2.SectorInfo, randomness abi.PoStRandomness) []byte {
hasher := sha256.New() hasher := sha256.New()
_, _ = hasher.Write(randomness) _, _ = hasher.Write(randomness)
for _, info := range sectorInfo { for _, info := range sectorInfo {
@ -326,13 +326,13 @@ func generateFakePoStProof(sectorInfo []proof.SectorInfo, randomness abi.PoStRan
} }
func generateFakePoSt(sectorInfo []proof.SectorInfo, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error), randomness abi.PoStRandomness) []proof.PoStProof { func generateFakePoSt(sectorInfo []proof2.SectorInfo, rpt func(abi.RegisteredSealProof) (abi.RegisteredPoStProof, error), randomness abi.PoStRandomness) []proof2.PoStProof {
wp, err := rpt(sectorInfo[0].SealProof) wp, err := rpt(sectorInfo[0].SealProof)
if err != nil { if err != nil {
panic(err) panic(err)
} }
return []proof.PoStProof{ return []proof2.PoStProof{
{ {
PoStProof: wp, PoStProof: wp,
ProofBytes: generateFakePoStProof(sectorInfo, randomness), ProofBytes: generateFakePoStProof(sectorInfo, randomness),
@ -406,7 +406,7 @@ func (mgr *SectorMgr) CheckProvable(ctx context.Context, spt abi.RegisteredSealP
return bad, nil return bad, nil
} }
func (m mockVerif) VerifySeal(svi proof.SealVerifyInfo) (bool, error) { func (m mockVerif) VerifySeal(svi proof2.SealVerifyInfo) (bool, error) {
if len(svi.Proof) != 1920 { if len(svi.Proof) != 1920 {
return false, nil return false, nil
} }
@ -421,11 +421,11 @@ func (m mockVerif) VerifySeal(svi proof.SealVerifyInfo) (bool, error) {
return true, nil return true, nil
} }
func (m mockVerif) VerifyWinningPoSt(ctx context.Context, info proof.WinningPoStVerifyInfo) (bool, error) { func (m mockVerif) VerifyWinningPoSt(ctx context.Context, info proof2.WinningPoStVerifyInfo) (bool, error) {
return true, nil return true, nil
} }
func (m mockVerif) VerifyWindowPoSt(ctx context.Context, info proof.WindowPoStVerifyInfo) (bool, error) { func (m mockVerif) VerifyWindowPoSt(ctx context.Context, info proof2.WindowPoStVerifyInfo) (bool, error) {
if len(info.Proofs) != 1 { if len(info.Proofs) != 1 {
return false, xerrors.Errorf("expected 1 proof entry") return false, xerrors.Errorf("expected 1 proof entry")
} }

View File

@ -7,7 +7,7 @@ import (
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy" "github.com/filecoin-project/lotus/chain/actors/policy"
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"golang.org/x/xerrors" "golang.org/x/xerrors"
@ -179,7 +179,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
log.Warn("on-chain sealed CID doesn't match!") log.Warn("on-chain sealed CID doesn't match!")
} }
ok, err := m.verif.VerifySeal(proof0.SealVerifyInfo{ ok, err := m.verif.VerifySeal(proof2.SealVerifyInfo{
SectorID: m.minerSector(si.SectorNumber), SectorID: m.minerSector(si.SectorNumber),
SealedCID: pci.Info.SealedCID, SealedCID: pci.Info.SealedCID,
SealProof: spt, SealProof: spt,

View File

@ -15,8 +15,9 @@ import (
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
"github.com/filecoin-project/go-statemachine" "github.com/filecoin-project/go-statemachine"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/specs-storage/storage"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
var DealSectorPriority = 1024 var DealSectorPriority = 1024
@ -220,7 +221,7 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
deposit := big.Max(depositMinimum, collateral) deposit := big.Max(depositMinimum, collateral)
log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit) log.Infof("submitting precommit for sector %d (deposit: %s): ", sector.SectorNumber, deposit)
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.PreCommitSector, deposit, m.feeCfg.MaxPreCommitGasFee, enc.Bytes()) mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin2.MethodsMiner.PreCommitSector, deposit, m.feeCfg.MaxPreCommitGasFee, enc.Bytes())
if err != nil { if err != nil {
if params.ReplaceCapacity { if params.ReplaceCapacity {
m.remarkForUpgrade(params.ReplaceSectorNumber) m.remarkForUpgrade(params.ReplaceSectorNumber)
@ -401,7 +402,7 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
} }
// TODO: check seed / ticket / deals are up to date // TODO: check seed / ticket / deals are up to date
mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin.MethodsMiner.ProveCommitSector, collateral, m.feeCfg.MaxCommitGasFee, enc.Bytes()) mcid, err := m.api.SendMsg(ctx.Context(), waddr, m.maddr, builtin2.MethodsMiner.ProveCommitSector, collateral, m.feeCfg.MaxCommitGasFee, enc.Bytes())
if err != nil { if err != nil {
return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)}) return ctx.Send(SectorCommitFailed{xerrors.Errorf("pushing message to mpool: %w", err)})
} }

View File

@ -9,9 +9,9 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
"github.com/filecoin-project/specs-storage/storage" "github.com/filecoin-project/specs-storage/storage"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
"github.com/filecoin-project/lotus/extern/storage-sealing/sealiface" "github.com/filecoin-project/lotus/extern/storage-sealing/sealiface"
) )
@ -82,7 +82,7 @@ type SectorInfo struct {
CommR *cid.Cid CommR *cid.Cid
Proof []byte Proof []byte
PreCommitInfo *miner0.SectorPreCommitInfo PreCommitInfo *miner.SectorPreCommitInfo
PreCommitDeposit big.Int PreCommitDeposit big.Int
PreCommitMessage *cid.Cid PreCommitMessage *cid.Cid
PreCommitTipSet TipSetToken PreCommitTipSet TipSetToken

View File

@ -8,7 +8,7 @@ import (
cborutil "github.com/filecoin-project/go-cbor-util" cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
) )
func TestSectorInfoSelialization(t *testing.T) { func TestSectorInfoSelialization(t *testing.T) {
@ -22,7 +22,7 @@ func TestSectorInfoSelialization(t *testing.T) {
}, },
} }
dummyCid := builtin.AccountActorCodeID dummyCid := builtin2.AccountActorCodeID
si := &SectorInfo{ si := &SectorInfo{
State: "stateful", State: "stateful",

View File

@ -5,9 +5,10 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/specs-actors/actors/builtin/market"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
) )
type ActorType string type ActorType string
@ -21,7 +22,7 @@ type PreSeal struct {
CommR cid.Cid CommR cid.Cid
CommD cid.Cid CommD cid.Cid
SectorID abi.SectorNumber SectorID abi.SectorNumber
Deal market.DealProposal Deal market2.DealProposal
ProofType abi.RegisteredSealProof ProofType abi.RegisteredSealProof
} }

View File

@ -6,20 +6,20 @@ import (
"bytes" "bytes"
"context" "context"
"golang.org/x/xerrors"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
cborutil "github.com/filecoin-project/go-cbor-util" cborutil "github.com/filecoin-project/go-cbor-util"
"github.com/ipfs/go-cid"
"golang.org/x/xerrors"
"github.com/filecoin-project/go-fil-markets/shared" "github.com/filecoin-project/go-fil-markets/shared"
"github.com/filecoin-project/go-fil-markets/storagemarket" "github.com/filecoin-project/go-fil-markets/storagemarket"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -103,10 +103,10 @@ func (c *ClientNodeAdapter) VerifySignature(ctx context.Context, sig crypto.Sign
func (c *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) (cid.Cid, error) { func (c *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address, amount abi.TokenAmount) (cid.Cid, error) {
// (Provider Node API) // (Provider Node API)
smsg, err := c.MpoolPushMessage(ctx, &types.Message{ smsg, err := c.MpoolPushMessage(ctx, &types.Message{
To: miner0.StorageMarketActorAddr, To: miner2.StorageMarketActorAddr,
From: addr, From: addr,
Value: amount, Value: amount,
Method: miner0.MethodsMarket.AddBalance, Method: miner2.MethodsMarket.AddBalance,
}, nil) }, nil)
if err != nil { if err != nil {
return cid.Undef, err return cid.Undef, err
@ -157,15 +157,15 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s", pubmsg.From, deal.Proposal.Provider) return 0, xerrors.Errorf("deal wasn't published by storage provider: from=%s, provider=%s", pubmsg.From, deal.Proposal.Provider)
} }
if pubmsg.To != miner0.StorageMarketActorAddr { if pubmsg.To != miner2.StorageMarketActorAddr {
return 0, xerrors.Errorf("deal publish message wasn't set to StorageMarket actor (to=%s)", pubmsg.To) return 0, xerrors.Errorf("deal publish message wasn't set to StorageMarket actor (to=%s)", pubmsg.To)
} }
if pubmsg.Method != miner0.MethodsMarket.PublishStorageDeals { if pubmsg.Method != miner2.MethodsMarket.PublishStorageDeals {
return 0, xerrors.Errorf("deal publish message called incorrect method (method=%s)", pubmsg.Method) return 0, xerrors.Errorf("deal publish message called incorrect method (method=%s)", pubmsg.Method)
} }
var params market0.PublishStorageDealsParams var params market2.PublishStorageDealsParams
if err := params.UnmarshalCBOR(bytes.NewReader(pubmsg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(pubmsg.Params)); err != nil {
return 0, err return 0, err
} }
@ -197,7 +197,7 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
return 0, xerrors.Errorf("deal publish failed: exit=%d", ret.ExitCode) return 0, xerrors.Errorf("deal publish failed: exit=%d", ret.ExitCode)
} }
var res market0.PublishStorageDealsReturn var res market2.PublishStorageDealsReturn
if err := res.UnmarshalCBOR(bytes.NewReader(ret.Return)); err != nil { if err := res.UnmarshalCBOR(bytes.NewReader(ret.Return)); err != nil {
return 0, err return 0, err
} }
@ -275,7 +275,7 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
} }
switch msg.Method { switch msg.Method {
case miner0.MethodsMiner.PreCommitSector: case miner2.MethodsMiner.PreCommitSector:
var params miner.SectorPreCommitInfo var params miner.SectorPreCommitInfo
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return true, false, xerrors.Errorf("unmarshal pre commit: %w", err) return true, false, xerrors.Errorf("unmarshal pre commit: %w", err)
@ -290,7 +290,7 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
} }
return true, false, nil return true, false, nil
case miner0.MethodsMiner.ProveCommitSector: case miner2.MethodsMiner.ProveCommitSector:
var params miner.ProveCommitSectorParams var params miner.ProveCommitSectorParams
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return true, false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err) return true, false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)
@ -412,7 +412,7 @@ func (c *ClientNodeAdapter) OnDealExpiredOrSlashed(ctx context.Context, dealID a
return nil return nil
} }
func (c *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Address, proposal market0.DealProposal) (*market0.ClientDealProposal, error) { func (c *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Address, proposal market2.DealProposal) (*market2.ClientDealProposal, error) {
// TODO: output spec signed proposal // TODO: output spec signed proposal
buf, err := cborutil.Dump(&proposal) buf, err := cborutil.Dump(&proposal)
if err != nil { if err != nil {
@ -431,7 +431,7 @@ func (c *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Add
return nil, err return nil, err
} }
return &market0.ClientDealProposal{ return &market2.ClientDealProposal{
Proposal: proposal, Proposal: proposal,
ClientSignature: *sig, ClientSignature: *sig,
}, nil }, nil

View File

@ -12,8 +12,8 @@ import (
logging "github.com/ipfs/go-log/v2" logging "github.com/ipfs/go-log/v2"
"golang.org/x/xerrors" "golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-fil-markets/shared" "github.com/filecoin-project/go-fil-markets/shared"
@ -79,8 +79,8 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
return cid.Undef, err return cid.Undef, err
} }
params, err := actors.SerializeParams(&market0.PublishStorageDealsParams{ params, err := actors.SerializeParams(&market2.PublishStorageDealsParams{
Deals: []market0.ClientDealProposal{deal.ClientDealProposal}, Deals: []market2.ClientDealProposal{deal.ClientDealProposal},
}) })
if err != nil { if err != nil {
@ -92,7 +92,7 @@ func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemark
To: market.Address, To: market.Address,
From: mi.Worker, From: mi.Worker,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin0.MethodsMarket.PublishStorageDeals, Method: builtin2.MethodsMarket.PublishStorageDeals,
Params: params, Params: params,
}, n.publishSpec) }, n.publishSpec)
if err != nil { if err != nil {
@ -192,7 +192,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
To: market.Address, To: market.Address,
From: addr, From: addr,
Value: amount, Value: amount,
Method: builtin0.MethodsMarket.AddBalance, Method: builtin2.MethodsMarket.AddBalance,
}, n.addBalanceSpec) }, n.addBalanceSpec)
if err != nil { if err != nil {
return cid.Undef, err return cid.Undef, err
@ -314,7 +314,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
switch msg.Method { switch msg.Method {
case builtin0.MethodsMiner.PreCommitSector: case builtin2.MethodsMiner.PreCommitSector:
var params miner.SectorPreCommitInfo var params miner.SectorPreCommitInfo
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return true, false, xerrors.Errorf("unmarshal pre commit: %w", err) return true, false, xerrors.Errorf("unmarshal pre commit: %w", err)
@ -329,7 +329,7 @@ func (n *ProviderNodeAdapter) OnDealSectorCommitted(ctx context.Context, provide
} }
return true, false, nil return true, false, nil
case builtin0.MethodsMiner.ProveCommitSector: case builtin2.MethodsMiner.ProveCommitSector:
var params miner.ProveCommitSectorParams var params miner.ProveCommitSectorParams
if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil { if err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)); err != nil {
return true, false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err) return true, false, xerrors.Errorf("failed to unmarshal prove commit sector params: %w", err)

View File

@ -9,7 +9,7 @@ import (
"sync" "sync"
"time" "time"
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/gen/slashfilter"
@ -492,7 +492,7 @@ func (m *Miner) computeTicket(ctx context.Context, brand *types.BeaconEntry, bas
} }
func (m *Miner) createBlock(base *MiningBase, addr address.Address, ticket *types.Ticket, func (m *Miner) createBlock(base *MiningBase, addr address.Address, ticket *types.Ticket,
eproof *types.ElectionProof, bvals []types.BeaconEntry, wpostProof []proof0.PoStProof, msgs []*types.SignedMessage) (*types.BlockMsg, error) { eproof *types.ElectionProof, bvals []types.BeaconEntry, wpostProof []proof2.PoStProof, msgs []*types.SignedMessage) (*types.BlockMsg, error) {
uts := base.TipSet.MinTimestamp() + build.BlockDelaySecs*(uint64(base.NullRounds)+1) uts := base.TipSet.MinTimestamp() + build.BlockDelaySecs*(uint64(base.NullRounds)+1)
nheight := base.TipSet.Height() + base.NullRounds + 1 nheight := base.TipSet.Height() + base.NullRounds + 1

View File

@ -16,7 +16,7 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/exitcode" "github.com/filecoin-project/go-state-types/exitcode"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -259,7 +259,7 @@ func gasEstimateGasLimit(
if !builtin.IsPaymentChannelActor(act.Code) { if !builtin.IsPaymentChannelActor(act.Code) {
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }
if msgIn.Method != builtin0.MethodsPaych.Collect { if msgIn.Method != builtin2.MethodsPaych.Collect {
return res.MsgRct.GasUsed, nil return res.MsgRct.GasUsed, nil
} }

View File

@ -12,8 +12,8 @@ import (
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig" "github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
"github.com/filecoin-project/lotus/chain/types" "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"
multisig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig" multisig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
"go.uber.org/fx" "go.uber.org/fx"
@ -85,7 +85,7 @@ func (a *MsigAPI) MsigAddPropose(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.AddSigner), enc) return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.AddSigner), enc)
} }
func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (cid.Cid, error) { func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, newAdd address.Address, inc bool) (cid.Cid, error) {
@ -94,7 +94,7 @@ func (a *MsigAPI) MsigAddApprove(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.AddSigner), enc) return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.AddSigner), enc)
} }
func (a *MsigAPI) MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (cid.Cid, error) { func (a *MsigAPI) MsigAddCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, newAdd address.Address, inc bool) (cid.Cid, error) {
@ -103,7 +103,7 @@ func (a *MsigAPI) MsigAddCancel(ctx context.Context, msig address.Address, src a
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.AddSigner), enc) return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.AddSigner), enc)
} }
func (a *MsigAPI) MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigSwapPropose(ctx context.Context, msig address.Address, src address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
@ -112,7 +112,7 @@ func (a *MsigAPI) MsigSwapPropose(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.SwapSigner), enc) return a.MsigPropose(ctx, msig, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.SwapSigner), enc)
} }
func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src address.Address, txID uint64, proposer address.Address, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
@ -121,7 +121,7 @@ func (a *MsigAPI) MsigSwapApprove(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.SwapSigner), enc) return a.MsigApproveTxnHash(ctx, msig, txID, proposer, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.SwapSigner), enc)
} }
func (a *MsigAPI) MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigSwapCancel(ctx context.Context, msig address.Address, src address.Address, txID uint64, oldAdd address.Address, newAdd address.Address) (cid.Cid, error) {
@ -130,7 +130,7 @@ func (a *MsigAPI) MsigSwapCancel(ctx context.Context, msig address.Address, src
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin0.MethodsMultisig.SwapSigner), enc) return a.MsigCancel(ctx, msig, txID, msig, big.Zero(), src, uint64(builtin2.MethodsMultisig.SwapSigner), enc)
} }
func (a *MsigAPI) MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) { func (a *MsigAPI) MsigApprove(ctx context.Context, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) {
@ -151,7 +151,7 @@ func (a *MsigAPI) MsigRemoveSigner(ctx context.Context, msig address.Address, pr
return cid.Undef, actErr return cid.Undef, actErr
} }
return a.MsigPropose(ctx, msig, msig, types.NewInt(0), proposer, uint64(builtin0.MethodsMultisig.RemoveSigner), enc) return a.MsigPropose(ctx, msig, msig, types.NewInt(0), proposer, uint64(builtin2.MethodsMultisig.RemoveSigner), enc)
} }
func (a *MsigAPI) msigApproveOrCancelSimple(ctx context.Context, operation api.MsigProposeResponse, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) { func (a *MsigAPI) msigApproveOrCancelSimple(ctx context.Context, operation api.MsigProposeResponse, msig address.Address, txID uint64, src address.Address) (cid.Cid, error) {
@ -242,7 +242,7 @@ func (a *MsigAPI) msigApproveOrCancelTxnHash(ctx context.Context, operation api.
} }
func serializeAddParams(new address.Address, inc bool) ([]byte, error) { func serializeAddParams(new address.Address, inc bool) ([]byte, error) {
enc, actErr := actors.SerializeParams(&multisig0.AddSignerParams{ enc, actErr := actors.SerializeParams(&multisig2.AddSignerParams{
Signer: new, Signer: new,
Increase: inc, Increase: inc,
}) })
@ -254,7 +254,7 @@ func serializeAddParams(new address.Address, inc bool) ([]byte, error) {
} }
func serializeSwapParams(old address.Address, new address.Address) ([]byte, error) { func serializeSwapParams(old address.Address, new address.Address) ([]byte, error) {
enc, actErr := actors.SerializeParams(&multisig0.SwapSignerParams{ enc, actErr := actors.SerializeParams(&multisig2.SwapSignerParams{
From: old, From: old,
To: new, To: new,
}) })
@ -266,7 +266,7 @@ func serializeSwapParams(old address.Address, new address.Address) ([]byte, erro
} }
func serializeRemoveParams(rem address.Address, dec bool) ([]byte, error) { func serializeRemoveParams(rem address.Address, dec bool) ([]byte, error) {
enc, actErr := actors.SerializeParams(&multisig0.RemoveSignerParams{ enc, actErr := actors.SerializeParams(&multisig2.RemoveSignerParams{
Signer: rem, Signer: rem,
Decrease: dec, Decrease: dec,
}) })

View File

@ -44,7 +44,6 @@ import (
paramfetch "github.com/filecoin-project/go-paramfetch" paramfetch "github.com/filecoin-project/go-paramfetch"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-storedcounter" "github.com/filecoin-project/go-storedcounter"
"github.com/filecoin-project/specs-actors/actors/builtin"
sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage" sectorstorage "github.com/filecoin-project/lotus/extern/sector-storage"
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
@ -56,6 +55,7 @@ import (
lapi "github.com/filecoin-project/lotus/api" lapi "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
"github.com/filecoin-project/lotus/chain/gen/slashfilter" "github.com/filecoin-project/lotus/chain/gen/slashfilter"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"

View File

@ -24,6 +24,7 @@ import (
"github.com/filecoin-project/lotus/api/test" "github.com/filecoin-project/lotus/api/test"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis" genesis2 "github.com/filecoin-project/lotus/chain/gen/genesis"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -33,14 +34,14 @@ import (
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper" "github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
"github.com/filecoin-project/lotus/extern/sector-storage/mock" "github.com/filecoin-project/lotus/extern/sector-storage/mock"
"github.com/filecoin-project/lotus/genesis" "github.com/filecoin-project/lotus/genesis"
miner2 "github.com/filecoin-project/lotus/miner" lotusminer "github.com/filecoin-project/lotus/miner"
"github.com/filecoin-project/lotus/node" "github.com/filecoin-project/lotus/node"
"github.com/filecoin-project/lotus/node/modules" "github.com/filecoin-project/lotus/node/modules"
testing2 "github.com/filecoin-project/lotus/node/modules/testing" testing2 "github.com/filecoin-project/lotus/node/modules/testing"
"github.com/filecoin-project/lotus/node/repo" "github.com/filecoin-project/lotus/node/repo"
"github.com/filecoin-project/lotus/storage/mockstorage" "github.com/filecoin-project/lotus/storage/mockstorage"
"github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
"github.com/ipfs/go-datastore" "github.com/ipfs/go-datastore"
"github.com/libp2p/go-libp2p-core/crypto" "github.com/libp2p/go-libp2p-core/crypto"
"github.com/libp2p/go-libp2p-core/peer" "github.com/libp2p/go-libp2p-core/peer"
@ -86,13 +87,13 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
peerid, err := peer.IDFromPrivateKey(pk) peerid, err := peer.IDFromPrivateKey(pk)
require.NoError(t, err) require.NoError(t, err)
enc, err := actors.SerializeParams(&miner0.ChangePeerIDParams{NewID: abi.PeerID(peerid)}) enc, err := actors.SerializeParams(&miner2.ChangePeerIDParams{NewID: abi.PeerID(peerid)})
require.NoError(t, err) require.NoError(t, err)
msg := &types.Message{ msg := &types.Message{
To: act, To: act,
From: waddr, From: waddr,
Method: builtin.MethodsMiner.ChangePeerID, Method: builtin2.MethodsMiner.ChangePeerID,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }
@ -103,7 +104,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
// start node // start node
var minerapi api.StorageMiner var minerapi api.StorageMiner
mineBlock := make(chan miner2.MineReq) mineBlock := make(chan lotusminer.MineReq)
stop, err := node.New(ctx, stop, err := node.New(ctx,
node.StorageMiner(&minerapi), node.StorageMiner(&minerapi),
node.Online(), node.Online(),
@ -113,7 +114,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
node.MockHost(mn), node.MockHost(mn),
node.Override(new(api.FullNode), tnd), node.Override(new(api.FullNode), tnd),
node.Override(new(*miner2.Miner), miner2.NewTestMiner(mineBlock, act)), node.Override(new(*lotusminer.Miner), lotusminer.NewTestMiner(mineBlock, act)),
opts, opts,
) )
@ -129,7 +130,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
err = minerapi.NetConnect(ctx, remoteAddrs) err = minerapi.NetConnect(ctx, remoteAddrs)
require.NoError(t, err)*/ require.NoError(t, err)*/
mineOne := func(ctx context.Context, req miner2.MineReq) error { mineOne := func(ctx context.Context, req lotusminer.MineReq) error {
select { select {
case mineBlock <- req: case mineBlock <- req:
return nil return nil
@ -444,7 +445,7 @@ func mockSbBuilderOpts(t *testing.T, fullOpts []test.FullNodeOpts, storage []tes
storers[i] = CreateTestStorageNode(ctx, t, genms[i].Worker, maddrs[i], pidKeys[i], f, mn, node.Options( storers[i] = CreateTestStorageNode(ctx, t, genms[i].Worker, maddrs[i], pidKeys[i], f, mn, node.Options(
node.Override(new(sectorstorage.SectorManager), func() (sectorstorage.SectorManager, error) { node.Override(new(sectorstorage.SectorManager), func() (sectorstorage.SectorManager, error) {
return mock.NewMockSectorMgr(build.DefaultSectorSize(), sectors), nil return mock.NewMockSectorMgr(policy.GetDefaultSectorSize(), sectors), nil
}), }),
node.Override(new(ffiwrapper.Verifier), mock.MockVerifier), node.Override(new(ffiwrapper.Verifier), mock.MockVerifier),
node.Unset(new(*sectorstorage.Manager)), node.Unset(new(*sectorstorage.Manager)),

View File

@ -14,9 +14,9 @@ import (
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/specs-actors/actors/builtin" "github.com/filecoin-project/specs-actors/v2/actors/builtin"
tutils "github.com/filecoin-project/specs-actors/support/testing"
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych" paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych" "github.com/filecoin-project/lotus/chain/actors/builtin/paych"
@ -237,7 +237,7 @@ func TestCreateVoucher(t *testing.T) {
// Create a voucher in lane 1 // Create a voucher in lane 1
voucherLane1Amt := big.NewInt(5) voucherLane1Amt := big.NewInt(5)
voucher := paych2.SignedVoucher{ voucher := paych.SignedVoucher{
Lane: 1, Lane: 1,
Amount: voucherLane1Amt, Amount: voucherLane1Amt,
} }
@ -252,7 +252,7 @@ func TestCreateVoucher(t *testing.T) {
// Create a voucher in lane 1 again, with a higher amount // Create a voucher in lane 1 again, with a higher amount
voucherLane1Amt = big.NewInt(8) voucherLane1Amt = big.NewInt(8)
voucher = paych2.SignedVoucher{ voucher = paych.SignedVoucher{
Lane: 1, Lane: 1,
Amount: voucherLane1Amt, Amount: voucherLane1Amt,
} }
@ -267,7 +267,7 @@ func TestCreateVoucher(t *testing.T) {
// Create a voucher in lane 2 that covers all the remaining funds // Create a voucher in lane 2 that covers all the remaining funds
// in the channel // in the channel
voucherLane2Amt := big.Sub(s.amt, voucherLane1Amt) voucherLane2Amt := big.Sub(s.amt, voucherLane1Amt)
voucher = paych2.SignedVoucher{ voucher = paych.SignedVoucher{
Lane: 2, Lane: 2,
Amount: voucherLane2Amt, Amount: voucherLane2Amt,
} }
@ -281,7 +281,7 @@ func TestCreateVoucher(t *testing.T) {
// Create a voucher in lane 2 that exceeds the remaining funds in the // Create a voucher in lane 2 that exceeds the remaining funds in the
// channel // channel
voucherLane2Amt = big.Add(voucherLane2Amt, big.NewInt(1)) voucherLane2Amt = big.Add(voucherLane2Amt, big.NewInt(1))
voucher = paych2.SignedVoucher{ voucher = paych.SignedVoucher{
Lane: 2, Lane: 2,
Amount: voucherLane2Amt, Amount: voucherLane2Amt,
} }

View File

@ -4,19 +4,19 @@ import (
"context" "context"
"testing" "testing"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
paychmock "github.com/filecoin-project/lotus/chain/actors/builtin/paych/mock"
"github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/specs-actors/actors/builtin"
tutils "github.com/filecoin-project/specs-actors/support/testing"
"github.com/ipfs/go-cid" "github.com/ipfs/go-cid"
ds "github.com/ipfs/go-datastore" ds "github.com/ipfs/go-datastore"
ds_sync "github.com/ipfs/go-datastore/sync" ds_sync "github.com/ipfs/go-datastore/sync"
"github.com/stretchr/testify/require" "github.com/stretchr/testify/require"
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
tutils2 "github.com/filecoin-project/specs-actors/v2/support/testing"
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
paychmock "github.com/filecoin-project/lotus/chain/actors/builtin/paych/mock"
"github.com/filecoin-project/lotus/chain/types"
) )
// TestPaychAddVoucherAfterAddFunds tests adding a voucher to a channel with // TestPaychAddVoucherAfterAddFunds tests adding a voucher to a channel with
@ -27,11 +27,11 @@ func TestPaychAddVoucherAfterAddFunds(t *testing.T) {
store := NewStore(ds_sync.MutexWrap(ds.NewMapDatastore())) store := NewStore(ds_sync.MutexWrap(ds.NewMapDatastore()))
fromKeyPrivate, fromKeyPublic := testGenerateKeyPair(t) fromKeyPrivate, fromKeyPublic := testGenerateKeyPair(t)
ch := tutils.NewIDAddr(t, 100) ch := tutils2.NewIDAddr(t, 100)
from := tutils.NewSECP256K1Addr(t, string(fromKeyPublic)) from := tutils2.NewSECP256K1Addr(t, string(fromKeyPublic))
to := tutils.NewSECP256K1Addr(t, "secpTo") to := tutils2.NewSECP256K1Addr(t, "secpTo")
fromAcct := tutils.NewActorAddr(t, "fromAct") fromAcct := tutils2.NewActorAddr(t, "fromAct")
toAcct := tutils.NewActorAddr(t, "toAct") toAcct := tutils2.NewActorAddr(t, "toAct")
mock := newMockManagerAPI() mock := newMockManagerAPI()
defer mock.close() defer mock.close()
@ -55,7 +55,7 @@ func TestPaychAddVoucherAfterAddFunds(t *testing.T) {
// Create an actor in state for the channel with the initial channel balance // Create an actor in state for the channel with the initial channel balance
act := &types.Actor{ act := &types.Actor{
Code: builtin.AccountActorCodeID, Code: builtin2.AccountActorCodeID,
Head: cid.Cid{}, Head: cid.Cid{},
Nonce: 0, Nonce: 0,
Balance: createAmt, Balance: createAmt,

View File

@ -14,7 +14,7 @@ import (
"github.com/filecoin-project/go-address" "github.com/filecoin-project/go-address"
"github.com/filecoin-project/go-state-types/abi" "github.com/filecoin-project/go-state-types/abi"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
@ -107,7 +107,7 @@ func (pcs *paymentChannelSettler) revertHandler(ctx context.Context, ts *types.T
func (pcs *paymentChannelSettler) matcher(msg *types.Message) (matchOnce bool, matched bool, err error) { func (pcs *paymentChannelSettler) matcher(msg *types.Message) (matchOnce bool, matched bool, err error) {
// Check if this is a settle payment channel message // Check if this is a settle payment channel message
if msg.Method != builtin0.MethodsPaych.Settle { if msg.Method != builtin2.MethodsPaych.Settle {
return false, false, nil return false, false, nil
} }
// Check if this payment channel is of concern to this node (i.e. tracked in payment channel store), // Check if this payment channel is of concern to this node (i.e. tracked in payment channel store),

View File

@ -15,8 +15,8 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/api/apibstore" "github.com/filecoin-project/lotus/api/apibstore"
@ -138,7 +138,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err) return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
} }
ccparams, err := actors.SerializeParams(&market0.ComputeDataCommitmentParams{ ccparams, err := actors.SerializeParams(&market2.ComputeDataCommitmentParams{
DealIDs: deals, DealIDs: deals,
SectorType: sectorType, SectorType: sectorType,
}) })
@ -150,7 +150,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
To: market.Address, To: market.Address,
From: maddr, From: maddr,
Value: types.NewInt(0), Value: types.NewInt(0),
Method: builtin0.MethodsMarket.ComputeDataCommitment, Method: builtin2.MethodsMarket.ComputeDataCommitment,
Params: ccparams, Params: ccparams,
} }
r, err := s.delegate.StateCall(ctx, ccmt, tsk) r, err := s.delegate.StateCall(ctx, ccmt, tsk)

View File

@ -5,9 +5,6 @@ import (
"errors" "errors"
"time" "time"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
@ -29,7 +26,9 @@ import (
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors/builtin"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/events" "github.com/filecoin-project/lotus/chain/events"
"github.com/filecoin-project/lotus/chain/gen" "github.com/filecoin-project/lotus/chain/gen"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
@ -150,7 +149,7 @@ func (m *Miner) Run(ctx context.Context) error {
evts := events.NewEvents(ctx, m.api) evts := events.NewEvents(ctx, m.api)
adaptedAPI := NewSealingAPIAdapter(m.api) adaptedAPI := NewSealingAPIAdapter(m.api)
// TODO: Maybe we update this policy after actor upgrades? // TODO: Maybe we update this policy after actor upgrades?
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, miner0.MaxSectorExpirationExtension-(miner0.WPoStProvingPeriod*2), md.PeriodStart%miner0.WPoStProvingPeriod) pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, policy.GetMaxSectorExpirationExtension()-(md.WPoStProvingPeriod*2), md.PeriodStart%md.WPoStProvingPeriod)
m.sealing = sealing.New(adaptedAPI, fc, NewEventsAdapter(evts), m.maddr, m.ds, m.sealer, m.sc, m.verif, &pcp, sealing.GetSealingConfigFunc(m.getSealConfig), m.handleSealingNotifications) m.sealing = sealing.New(adaptedAPI, fc, NewEventsAdapter(evts), m.maddr, m.ds, m.sealer, m.sc, m.verif, &pcp, sealing.GetSealingConfigFunc(m.getSealConfig), m.handleSealingNotifications)
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function
@ -238,9 +237,9 @@ func (wpp *StorageWpp) GenerateCandidates(ctx context.Context, randomness abi.Po
return cds, nil return cds, nil
} }
func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []proof0.SectorInfo, rand abi.PoStRandomness) ([]proof0.PoStProof, error) { func (wpp *StorageWpp) ComputeProof(ctx context.Context, ssi []builtin.SectorInfo, rand abi.PoStRandomness) ([]builtin.PoStProof, error) {
if build.InsecurePoStValidation { if build.InsecurePoStValidation {
return []proof0.PoStProof{{ProofBytes: []byte("valid proof")}}, nil return []builtin.PoStProof{{ProofBytes: []byte("valid proof")}}, nil
} }
log.Infof("Computing WinningPoSt ;%+v; %v", ssi, rand) log.Infof("Computing WinningPoSt ;%+v; %v", ssi, rand)

View File

@ -9,7 +9,7 @@ import (
"github.com/filecoin-project/go-state-types/big" "github.com/filecoin-project/go-state-types/big"
"github.com/filecoin-project/lotus/extern/sector-storage/mock" "github.com/filecoin-project/lotus/extern/sector-storage/mock"
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market" market2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/market"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
"github.com/filecoin-project/lotus/chain/wallet" "github.com/filecoin-project/lotus/chain/wallet"
@ -48,7 +48,7 @@ func PreSeal(ssize abi.SectorSize, maddr address.Address, sectors int) (*genesis
r := mock.CommDR(d) r := mock.CommDR(d)
preseal.CommR, _ = commcid.ReplicaCommitmentV1ToCID(r[:]) preseal.CommR, _ = commcid.ReplicaCommitmentV1ToCID(r[:])
preseal.SectorID = abi.SectorNumber(i + 1) preseal.SectorID = abi.SectorNumber(i + 1)
preseal.Deal = market0.DealProposal{ preseal.Deal = market2.DealProposal{
PieceCID: preseal.CommD, PieceCID: preseal.CommD,
PieceSize: abi.PaddedPieceSize(ssize), PieceSize: abi.PaddedPieceSize(ssize),
Client: k.Address, Client: k.Address,

View File

@ -17,14 +17,14 @@ import (
"go.opencensus.io/trace" "go.opencensus.io/trace"
"golang.org/x/xerrors" "golang.org/x/xerrors"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/build" "github.com/filecoin-project/lotus/build"
"github.com/filecoin-project/lotus/chain/actors" "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
"github.com/filecoin-project/lotus/chain/actors/policy"
"github.com/filecoin-project/lotus/chain/types" "github.com/filecoin-project/lotus/chain/types"
) )
@ -290,7 +290,7 @@ func (s *WindowPoStScheduler) checkNextRecoveries(ctx context.Context, dlIdx uin
msg := &types.Message{ msg := &types.Message{
To: s.actor, To: s.actor,
From: s.worker, From: s.worker,
Method: builtin0.MethodsMiner.DeclareFaultsRecovered, Method: builtin2.MethodsMiner.DeclareFaultsRecovered,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }
@ -374,7 +374,7 @@ func (s *WindowPoStScheduler) checkNextFaults(ctx context.Context, dlIdx uint64,
msg := &types.Message{ msg := &types.Message{
To: s.actor, To: s.actor,
From: s.worker, From: s.worker,
Method: builtin0.MethodsMiner.DeclareFaults, Method: builtin2.MethodsMiner.DeclareFaults,
Params: enc, Params: enc,
Value: types.NewInt(0), // TODO: Is there a fee? Value: types.NewInt(0), // TODO: Is there a fee?
} }
@ -505,12 +505,12 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
skipCount := uint64(0) skipCount := uint64(0)
postSkipped := bitfield.New() postSkipped := bitfield.New()
var postOut []proof.PoStProof var postOut []proof2.PoStProof
somethingToProve := true somethingToProve := true
for retries := 0; retries < 5; retries++ { for retries := 0; retries < 5; retries++ {
var partitions []miner.PoStPartition var partitions []miner.PoStPartition
var sinfos []proof.SectorInfo var sinfos []proof2.SectorInfo
for partIdx, partition := range batch { for partIdx, partition := range batch {
// TODO: Can do this in parallel // TODO: Can do this in parallel
toProve, err := bitfield.SubtractBitField(partition.LiveSectors, partition.FaultySectors) toProve, err := bitfield.SubtractBitField(partition.LiveSectors, partition.FaultySectors)
@ -625,12 +625,6 @@ func (s *WindowPoStScheduler) runPost(ctx context.Context, di dline.Info, ts *ty
} }
func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]api.Partition, error) { func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]api.Partition, error) {
// Get the number of sectors allowed in a partition, for this proof size
sectorsPerPartition, err := builtin0.PoStProofWindowPoStPartitionSectors(s.proofType)
if err != nil {
return nil, xerrors.Errorf("getting sectors per partition: %w", err)
}
// We don't want to exceed the number of sectors allowed in a message. // We don't want to exceed the number of sectors allowed in a message.
// So given the number of sectors in a partition, work out the number of // So given the number of sectors in a partition, work out the number of
// partitions that can be in a message without exceeding sectors per // partitions that can be in a message without exceeding sectors per
@ -641,9 +635,10 @@ func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]a
// sectors per partition 3: ooo // sectors per partition 3: ooo
// partitions per message 2: oooOOO // partitions per message 2: oooOOO
// <1><2> (3rd doesn't fit) // <1><2> (3rd doesn't fit)
// TODO(NETUPGRADE): we're going to need some form of policy abstraction partitionsPerMsg, err := policy.GetMaxPoStPartitions(s.proofType)
// where we can get policy from the future. Unfortunately, we can't just get this from the state. if err != nil {
partitionsPerMsg := int(miner0.AddressedSectorsMax / sectorsPerPartition) return nil, xerrors.Errorf("getting sectors per partition: %w", err)
}
// The number of messages will be: // The number of messages will be:
// ceiling(number of partitions / partitions per message) // ceiling(number of partitions / partitions per message)
@ -665,7 +660,7 @@ func (s *WindowPoStScheduler) batchPartitions(partitions []api.Partition) ([][]a
return batches, nil return batches, nil
} }
func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors, allSectors bitfield.BitField, ts *types.TipSet) ([]proof.SectorInfo, error) { func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors, allSectors bitfield.BitField, ts *types.TipSet) ([]proof2.SectorInfo, error) {
sset, err := s.api.StateMinerSectors(ctx, s.actor, &goodSectors, ts.Key()) sset, err := s.api.StateMinerSectors(ctx, s.actor, &goodSectors, ts.Key())
if err != nil { if err != nil {
return nil, err return nil, err
@ -675,22 +670,22 @@ func (s *WindowPoStScheduler) sectorsForProof(ctx context.Context, goodSectors,
return nil, nil return nil, nil
} }
substitute := proof.SectorInfo{ substitute := proof2.SectorInfo{
SectorNumber: sset[0].SectorNumber, SectorNumber: sset[0].SectorNumber,
SealedCID: sset[0].SealedCID, SealedCID: sset[0].SealedCID,
SealProof: sset[0].SealProof, SealProof: sset[0].SealProof,
} }
sectorByID := make(map[uint64]proof.SectorInfo, len(sset)) sectorByID := make(map[uint64]proof2.SectorInfo, len(sset))
for _, sector := range sset { for _, sector := range sset {
sectorByID[uint64(sector.SectorNumber)] = proof.SectorInfo{ sectorByID[uint64(sector.SectorNumber)] = proof2.SectorInfo{
SectorNumber: sector.SectorNumber, SectorNumber: sector.SectorNumber,
SealedCID: sector.SealedCID, SealedCID: sector.SealedCID,
SealProof: sector.SealProof, SealProof: sector.SealProof,
} }
} }
proofSectors := make([]proof.SectorInfo, 0, len(sset)) proofSectors := make([]proof2.SectorInfo, 0, len(sset))
if err := allSectors.ForEach(func(sectorNo uint64) error { if err := allSectors.ForEach(func(sectorNo uint64) error {
if info, found := sectorByID[sectorNo]; found { if info, found := sectorByID[sectorNo]; found {
proofSectors = append(proofSectors, info) proofSectors = append(proofSectors, info)
@ -719,7 +714,7 @@ func (s *WindowPoStScheduler) submitPost(ctx context.Context, proof *miner.Submi
msg := &types.Message{ msg := &types.Message{
To: s.actor, To: s.actor,
From: s.worker, From: s.worker,
Method: builtin0.MethodsMiner.SubmitWindowedPoSt, Method: builtin2.MethodsMiner.SubmitWindowedPoSt,
Params: enc, Params: enc,
Value: types.NewInt(0), Value: types.NewInt(0),
} }

View File

@ -17,10 +17,10 @@ import (
"github.com/filecoin-project/go-state-types/crypto" "github.com/filecoin-project/go-state-types/crypto"
"github.com/filecoin-project/go-state-types/dline" "github.com/filecoin-project/go-state-types/dline"
"github.com/filecoin-project/go-state-types/network" "github.com/filecoin-project/go-state-types/network"
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin" builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner" miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof" proof2 "github.com/filecoin-project/specs-actors/v2/actors/runtime/proof"
tutils "github.com/filecoin-project/specs-actors/support/testing" tutils "github.com/filecoin-project/specs-actors/v2/support/testing"
"github.com/filecoin-project/lotus/api" "github.com/filecoin-project/lotus/api"
"github.com/filecoin-project/lotus/chain/actors/builtin/miner" "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
@ -98,12 +98,12 @@ func (m *mockStorageMinerAPI) StateWaitMsg(ctx context.Context, cid cid.Cid, con
type mockProver struct { type mockProver struct {
} }
func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proof0.SectorInfo, abi.PoStRandomness) ([]proof0.PoStProof, error) { func (m *mockProver) GenerateWinningPoSt(context.Context, abi.ActorID, []proof2.SectorInfo, abi.PoStRandomness) ([]proof2.PoStProof, error) {
panic("implement me") panic("implement me")
} }
func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof0.SectorInfo, pr abi.PoStRandomness) ([]proof0.PoStProof, []abi.SectorID, error) { func (m *mockProver) GenerateWindowPoSt(ctx context.Context, aid abi.ActorID, sis []proof2.SectorInfo, pr abi.PoStRandomness) ([]proof2.PoStProof, []abi.SectorID, error) {
return []proof0.PoStProof{ return []proof2.PoStProof{
{ {
PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1, PoStProof: abi.RegisteredPoStProof_StackedDrgWindow2KiBV1,
ProofBytes: []byte("post-proof"), ProofBytes: []byte("post-proof"),
@ -132,13 +132,13 @@ func TestWDPostDoPost(t *testing.T) {
mockStgMinerAPI := newMockStorageMinerAPI() mockStgMinerAPI := newMockStorageMinerAPI()
// Get the number of sectors allowed in a partition for this proof type // Get the number of sectors allowed in a partition for this proof type
sectorsPerPartition, err := builtin0.PoStProofWindowPoStPartitionSectors(proofType) sectorsPerPartition, err := builtin2.PoStProofWindowPoStPartitionSectors(proofType)
require.NoError(t, err) require.NoError(t, err)
// Work out the number of partitions that can be included in a message // Work out the number of partitions that can be included in a message
// without exceeding the message sector limit // without exceeding the message sector limit
require.NoError(t, err) require.NoError(t, err)
partitionsPerMsg := int(miner0.AddressedSectorsMax / sectorsPerPartition) partitionsPerMsg := int(miner2.AddressedSectorsMax / sectorsPerPartition)
// Enough partitions to fill expectedMsgCount-1 messages // Enough partitions to fill expectedMsgCount-1 messages
partitionCount := (expectedMsgCount - 1) * partitionsPerMsg partitionCount := (expectedMsgCount - 1) * partitionsPerMsg
@ -173,11 +173,11 @@ func TestWDPostDoPost(t *testing.T) {
} }
di := &dline.Info{ di := &dline.Info{
WPoStPeriodDeadlines: miner0.WPoStPeriodDeadlines, WPoStPeriodDeadlines: miner2.WPoStPeriodDeadlines,
WPoStProvingPeriod: miner0.WPoStProvingPeriod, WPoStProvingPeriod: miner2.WPoStProvingPeriod,
WPoStChallengeWindow: miner0.WPoStChallengeWindow, WPoStChallengeWindow: miner2.WPoStChallengeWindow,
WPoStChallengeLookback: miner0.WPoStChallengeLookback, WPoStChallengeLookback: miner2.WPoStChallengeLookback,
FaultDeclarationCutoff: miner0.FaultDeclarationCutoff, FaultDeclarationCutoff: miner2.FaultDeclarationCutoff,
} }
ts := mockTipSet(t) ts := mockTipSet(t)
@ -188,7 +188,7 @@ func TestWDPostDoPost(t *testing.T) {
// Read the window PoST messages // Read the window PoST messages
for i := 0; i < expectedMsgCount; i++ { for i := 0; i < expectedMsgCount; i++ {
msg := <-mockStgMinerAPI.pushedMessages msg := <-mockStgMinerAPI.pushedMessages
require.Equal(t, builtin0.MethodsMiner.SubmitWindowedPoSt, msg.Method) require.Equal(t, builtin2.MethodsMiner.SubmitWindowedPoSt, msg.Method)
var params miner.SubmitWindowedPoStParams var params miner.SubmitWindowedPoStParams
err := params.UnmarshalCBOR(bytes.NewReader(msg.Params)) err := params.UnmarshalCBOR(bytes.NewReader(msg.Params))
require.NoError(t, err) require.NoError(t, err)
@ -254,11 +254,11 @@ func (m *mockStorageMinerAPI) StateMinerProvingDeadline(ctx context.Context, add
Close: 0, Close: 0,
Challenge: 0, Challenge: 0,
FaultCutoff: 0, FaultCutoff: 0,
WPoStPeriodDeadlines: miner0.WPoStPeriodDeadlines, WPoStPeriodDeadlines: miner2.WPoStPeriodDeadlines,
WPoStProvingPeriod: miner0.WPoStProvingPeriod, WPoStProvingPeriod: miner2.WPoStProvingPeriod,
WPoStChallengeWindow: miner0.WPoStChallengeWindow, WPoStChallengeWindow: miner2.WPoStChallengeWindow,
WPoStChallengeLookback: miner0.WPoStChallengeLookback, WPoStChallengeLookback: miner2.WPoStChallengeLookback,
FaultDeclarationCutoff: miner0.FaultDeclarationCutoff, FaultDeclarationCutoff: miner2.FaultDeclarationCutoff,
}, nil }, nil
} }
@ -276,7 +276,7 @@ func (m *mockStorageMinerAPI) StateSearchMsg(ctx context.Context, cid cid.Cid) (
func (m *mockStorageMinerAPI) StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) { func (m *mockStorageMinerAPI) StateGetActor(ctx context.Context, actor address.Address, ts types.TipSetKey) (*types.Actor, error) {
return &types.Actor{ return &types.Actor{
Code: builtin0.StorageMinerActorCodeID, Code: builtin2.StorageMinerActorCodeID,
}, nil }, nil
} }