rename imports to match actors code
`sed -i 's/\bv0\(\w\)\(\w*\)/\L\1\E\20/g' **/*.go`
This commit is contained in:
parent
c130806c37
commit
1bf3b4989d
@ -5,9 +5,9 @@ package build
|
||||
import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
)
|
||||
|
||||
const UpgradeBreezeHeight = -1
|
||||
@ -20,11 +20,11 @@ var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
}
|
||||
|
||||
func init() {
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
|
||||
BuildType |= Build2k
|
||||
}
|
||||
|
@ -6,14 +6,14 @@ import (
|
||||
"github.com/libp2p/go-libp2p-core/protocol"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
func DefaultSectorSize() abi.SectorSize {
|
||||
szs := make([]abi.SectorSize, 0, len(v0miner.SupportedProofTypes))
|
||||
for spt := range v0miner.SupportedProofTypes {
|
||||
szs := make([]abi.SectorSize, 0, len(miner0.SupportedProofTypes))
|
||||
for spt := range miner0.SupportedProofTypes {
|
||||
ss, err := spt.SectorSize()
|
||||
if err != nil {
|
||||
panic(err)
|
||||
|
@ -9,7 +9,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
)
|
||||
|
||||
// /////
|
||||
@ -32,7 +32,7 @@ const ForkLengthThreshold = Finality
|
||||
var BlocksPerEpoch = uint64(builtin.ExpectedLeadersPerEpoch)
|
||||
|
||||
// Epochs
|
||||
const Finality = v0miner.ChainFinality
|
||||
const Finality = miner0.ChainFinality
|
||||
const MessageConfidence = uint64(5)
|
||||
|
||||
// constants for Weight calculation
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
)
|
||||
|
||||
var (
|
||||
@ -32,7 +32,7 @@ var (
|
||||
|
||||
AllowableClockDriftSecs = uint64(1)
|
||||
|
||||
Finality = v0miner.ChainFinality
|
||||
Finality = miner0.ChainFinality
|
||||
ForkLengthThreshold = Finality
|
||||
|
||||
SlashablePowerDelay = 20
|
||||
|
@ -8,8 +8,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
)
|
||||
|
||||
var DrandSchedule = map[abi.ChainEpoch]DrandEnum{
|
||||
@ -23,8 +23,8 @@ const BreezeGasTampingDuration = 120
|
||||
const UpgradeSmokeHeight = 51000
|
||||
|
||||
func init() {
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(10 << 40)
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
power0.ConsensusMinerMinPower = big.NewInt(10 << 40)
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg32GiBV1: {},
|
||||
abi.RegisteredSealProof_StackedDrg64GiBV1: {},
|
||||
}
|
||||
|
@ -8,7 +8,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
)
|
||||
|
||||
type Map interface {
|
||||
@ -24,7 +24,7 @@ type Map interface {
|
||||
func AsMap(store Store, root cid.Cid, version builtin.Version) (Map, error) {
|
||||
switch version {
|
||||
case builtin.Version0:
|
||||
return v0adt.AsMap(store, root)
|
||||
return adt0.AsMap(store, root)
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown network version: %d", version)
|
||||
}
|
||||
@ -32,7 +32,7 @@ func AsMap(store Store, root cid.Cid, version builtin.Version) (Map, error) {
|
||||
func NewMap(store Store, version builtin.Version) (Map, error) {
|
||||
switch version {
|
||||
case builtin.Version0:
|
||||
return v0adt.MakeEmptyMap(store), nil
|
||||
return adt0.MakeEmptyMap(store), nil
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown network version: %d", version)
|
||||
}
|
||||
@ -51,7 +51,7 @@ type Array interface {
|
||||
func AsArray(store Store, root cid.Cid, version network.Version) (Array, error) {
|
||||
switch builtin.VersionForNetwork(version) {
|
||||
case builtin.Version0:
|
||||
return v0adt.AsArray(store, root)
|
||||
return adt0.AsArray(store, root)
|
||||
}
|
||||
return nil, xerrors.Errorf("unknown network version: %d", version)
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
bstore "github.com/filecoin-project/lotus/lib/blockstore"
|
||||
)
|
||||
@ -22,8 +22,8 @@ func TestDiffAdtArray(t *testing.T) {
|
||||
ctxstoreA := newContextStore()
|
||||
ctxstoreB := newContextStore()
|
||||
|
||||
arrA := v0adt.MakeEmptyArray(ctxstoreA)
|
||||
arrB := v0adt.MakeEmptyArray(ctxstoreB)
|
||||
arrA := adt0.MakeEmptyArray(ctxstoreA)
|
||||
arrB := adt0.MakeEmptyArray(ctxstoreB)
|
||||
|
||||
require.NoError(t, arrA.Set(0, runtime.CBORBytes([]byte{0}))) // delete
|
||||
|
||||
@ -76,8 +76,8 @@ func TestDiffAdtMap(t *testing.T) {
|
||||
ctxstoreA := newContextStore()
|
||||
ctxstoreB := newContextStore()
|
||||
|
||||
mapA := v0adt.MakeEmptyMap(ctxstoreA)
|
||||
mapB := v0adt.MakeEmptyMap(ctxstoreB)
|
||||
mapA := adt0.MakeEmptyMap(ctxstoreA)
|
||||
mapB := adt0.MakeEmptyMap(ctxstoreB)
|
||||
|
||||
require.NoError(t, mapA.Put(abi.UIntKey(0), runtime.CBORBytes([]byte{0}))) // delete
|
||||
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -13,8 +13,8 @@ import (
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
switch act.Code {
|
||||
case v0builtin.AccountActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.AccountActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -6,11 +6,11 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
type state0 struct {
|
||||
account.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) PubkeyAddress() (address.Address, error) {
|
||||
func (s *state0) PubkeyAddress() (address.Address, error) {
|
||||
return s.Address, nil
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
v0smoothing "github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
||||
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
||||
)
|
||||
|
||||
type Version int
|
||||
@ -25,4 +25,4 @@ func VersionForNetwork(version network.Version) Version {
|
||||
}
|
||||
|
||||
// TODO: find some way to abstract over this.
|
||||
type FilterEstimate = v0smoothing.FilterEstimate
|
||||
type FilterEstimate = smoothing0.FilterEstimate
|
||||
|
@ -6,19 +6,19 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
)
|
||||
|
||||
var Address = v0builtin.InitActorAddr
|
||||
var Address = builtin0.InitActorAddr
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
switch act.Code {
|
||||
case v0builtin.InitActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.InitActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -10,24 +10,24 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
type state0 struct {
|
||||
init_.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) ResolveAddress(address address.Address) (address.Address, bool, error) {
|
||||
func (s *state0) ResolveAddress(address address.Address) (address.Address, bool, error) {
|
||||
return s.State.ResolveAddress(s.store, address)
|
||||
}
|
||||
|
||||
func (s *v0State) MapAddressToNewID(address address.Address) (address.Address, error) {
|
||||
func (s *state0) MapAddressToNewID(address address.Address) (address.Address, error) {
|
||||
return s.State.MapAddressToNewID(s.store, address)
|
||||
}
|
||||
|
||||
func (s *v0State) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
|
||||
addrs, err := v0adt.AsMap(s.store, s.State.AddressMap)
|
||||
func (s *state0) ForEachActor(cb func(id abi.ActorID, address address.Address) error) error {
|
||||
addrs, err := adt0.AsMap(s.store, s.State.AddressMap)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -41,6 +41,6 @@ func (s *v0State) ForEachActor(cb func(id abi.ActorID, address address.Address)
|
||||
})
|
||||
}
|
||||
|
||||
func (s *v0State) NetworkName() (dtypes.NetworkName, error) {
|
||||
func (s *state0) NetworkName() (dtypes.NetworkName, error) {
|
||||
return dtypes.NetworkName(s.State.NetworkName), nil
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
"github.com/ipfs/go-cid"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
|
||||
@ -14,12 +14,12 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Address = v0builtin.StorageMarketActorAddr
|
||||
var Address = builtin0.StorageMarketActorAddr
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
||||
switch act.Code {
|
||||
case v0builtin.StorageMarketActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.StorageMarketActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -8,95 +8,95 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
type state0 struct {
|
||||
market.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) TotalLocked() (abi.TokenAmount, error) {
|
||||
func (s *state0) TotalLocked() (abi.TokenAmount, error) {
|
||||
fml := types.BigAdd(s.TotalClientLockedCollateral, s.TotalProviderLockedCollateral)
|
||||
fml = types.BigAdd(fml, s.TotalClientStorageFee)
|
||||
return fml, nil
|
||||
}
|
||||
|
||||
func (s *v0State) BalancesChanged(otherState State) bool {
|
||||
v0otherState, ok := otherState.(*v0State)
|
||||
func (s *state0) BalancesChanged(otherState State) bool {
|
||||
otherState0, ok := otherState.(*state0)
|
||||
if !ok {
|
||||
// there's no way to compare differnt versions of the state, so let's
|
||||
// just say that means the state of balances has changed
|
||||
return true
|
||||
}
|
||||
return !s.State.EscrowTable.Equals(v0otherState.State.EscrowTable) || !s.State.LockedTable.Equals(v0otherState.State.LockedTable)
|
||||
return !s.State.EscrowTable.Equals(otherState0.State.EscrowTable) || !s.State.LockedTable.Equals(otherState0.State.LockedTable)
|
||||
}
|
||||
|
||||
func (s *v0State) StatesChanged(otherState State) bool {
|
||||
v0otherState, ok := otherState.(*v0State)
|
||||
func (s *state0) StatesChanged(otherState State) bool {
|
||||
otherState0, ok := otherState.(*state0)
|
||||
if !ok {
|
||||
// there's no way to compare differnt versions of the state, so let's
|
||||
// just say that means the state of balances has changed
|
||||
return true
|
||||
}
|
||||
return !s.State.States.Equals(v0otherState.State.States)
|
||||
return !s.State.States.Equals(otherState0.State.States)
|
||||
}
|
||||
|
||||
func (s *v0State) States() (DealStates, error) {
|
||||
stateArray, err := v0adt.AsArray(s.store, s.State.States)
|
||||
func (s *state0) States() (DealStates, error) {
|
||||
stateArray, err := adt0.AsArray(s.store, s.State.States)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v0DealStates{stateArray}, nil
|
||||
return &dealStates0{stateArray}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) ProposalsChanged(otherState State) bool {
|
||||
v0otherState, ok := otherState.(*v0State)
|
||||
func (s *state0) ProposalsChanged(otherState State) bool {
|
||||
otherState0, ok := otherState.(*state0)
|
||||
if !ok {
|
||||
// there's no way to compare differnt versions of the state, so let's
|
||||
// just say that means the state of balances has changed
|
||||
return true
|
||||
}
|
||||
return !s.State.Proposals.Equals(v0otherState.State.Proposals)
|
||||
return !s.State.Proposals.Equals(otherState0.State.Proposals)
|
||||
}
|
||||
|
||||
func (s *v0State) Proposals() (DealProposals, error) {
|
||||
proposalArray, err := v0adt.AsArray(s.store, s.State.Proposals)
|
||||
func (s *state0) Proposals() (DealProposals, error) {
|
||||
proposalArray, err := adt0.AsArray(s.store, s.State.Proposals)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v0DealProposals{proposalArray}, nil
|
||||
return &dealProposals0{proposalArray}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) EscrowTable() (BalanceTable, error) {
|
||||
bt, err := v0adt.AsBalanceTable(s.store, s.State.EscrowTable)
|
||||
func (s *state0) EscrowTable() (BalanceTable, error) {
|
||||
bt, err := adt0.AsBalanceTable(s.store, s.State.EscrowTable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v0BalanceTable{bt}, nil
|
||||
return &balanceTable0{bt}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) LockedTable() (BalanceTable, error) {
|
||||
bt, err := v0adt.AsBalanceTable(s.store, s.State.LockedTable)
|
||||
func (s *state0) LockedTable() (BalanceTable, error) {
|
||||
bt, err := adt0.AsBalanceTable(s.store, s.State.LockedTable)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v0BalanceTable{bt}, nil
|
||||
return &balanceTable0{bt}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) VerifyDealsForActivation(
|
||||
func (s *state0) VerifyDealsForActivation(
|
||||
minerAddr address.Address, deals []abi.DealID, currEpoch, sectorExpiry abi.ChainEpoch,
|
||||
) (weight, verifiedWeight abi.DealWeight, err error) {
|
||||
return market.ValidateDealsForActivation(&s.State, s.store, deals, minerAddr, sectorExpiry, currEpoch)
|
||||
}
|
||||
|
||||
type v0BalanceTable struct {
|
||||
*v0adt.BalanceTable
|
||||
type balanceTable0 struct {
|
||||
*adt0.BalanceTable
|
||||
}
|
||||
|
||||
func (bt *v0BalanceTable) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
|
||||
asMap := (*v0adt.Map)(bt.BalanceTable)
|
||||
func (bt *balanceTable0) ForEach(cb func(address.Address, abi.TokenAmount) error) error {
|
||||
asMap := (*adt0.Map)(bt.BalanceTable)
|
||||
var ta abi.TokenAmount
|
||||
return asMap.ForEach(&ta, func(key string) error {
|
||||
a, err := address.NewFromBytes([]byte(key))
|
||||
@ -107,33 +107,33 @@ func (bt *v0BalanceTable) ForEach(cb func(address.Address, abi.TokenAmount) erro
|
||||
})
|
||||
}
|
||||
|
||||
type v0DealStates struct {
|
||||
type dealStates0 struct {
|
||||
adt.Array
|
||||
}
|
||||
|
||||
func (s *v0DealStates) Get(dealID abi.DealID) (*DealState, bool, error) {
|
||||
var v0deal market.DealState
|
||||
found, err := s.Array.Get(uint64(dealID), &v0deal)
|
||||
func (s *dealStates0) Get(dealID abi.DealID) (*DealState, bool, error) {
|
||||
var deal0 market.DealState
|
||||
found, err := s.Array.Get(uint64(dealID), &deal0)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
deal := fromV0DealState(v0deal)
|
||||
deal := fromV0DealState(deal0)
|
||||
return &deal, true, nil
|
||||
}
|
||||
|
||||
func (s *v0DealStates) decode(val *cbg.Deferred) (*DealState, error) {
|
||||
var v0ds market.DealState
|
||||
if err := v0ds.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
func (s *dealStates0) decode(val *cbg.Deferred) (*DealState, error) {
|
||||
var ds0 market.DealState
|
||||
if err := ds0.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
ds := fromV0DealState(v0ds)
|
||||
ds := fromV0DealState(ds0)
|
||||
return &ds, nil
|
||||
}
|
||||
|
||||
func (s *v0DealStates) array() adt.Array {
|
||||
func (s *dealStates0) array() adt.Array {
|
||||
return s.Array
|
||||
}
|
||||
|
||||
@ -141,40 +141,40 @@ func fromV0DealState(v0 market.DealState) DealState {
|
||||
return (DealState)(v0)
|
||||
}
|
||||
|
||||
type v0DealProposals struct {
|
||||
type dealProposals0 struct {
|
||||
adt.Array
|
||||
}
|
||||
|
||||
func (s *v0DealProposals) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
var v0proposal market.DealProposal
|
||||
found, err := s.Array.Get(uint64(dealID), &v0proposal)
|
||||
func (s *dealProposals0) Get(dealID abi.DealID) (*DealProposal, bool, error) {
|
||||
var proposal0 market.DealProposal
|
||||
found, err := s.Array.Get(uint64(dealID), &proposal0)
|
||||
if err != nil {
|
||||
return nil, false, err
|
||||
}
|
||||
if !found {
|
||||
return nil, false, nil
|
||||
}
|
||||
proposal := fromV0DealProposal(v0proposal)
|
||||
proposal := fromV0DealProposal(proposal0)
|
||||
return &proposal, true, nil
|
||||
}
|
||||
|
||||
func (s *v0DealProposals) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var v0dp market.DealProposal
|
||||
return s.Array.ForEach(&v0dp, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV0DealProposal(v0dp))
|
||||
func (s *dealProposals0) ForEach(cb func(dealID abi.DealID, dp DealProposal) error) error {
|
||||
var dp0 market.DealProposal
|
||||
return s.Array.ForEach(&dp0, func(idx int64) error {
|
||||
return cb(abi.DealID(idx), fromV0DealProposal(dp0))
|
||||
})
|
||||
}
|
||||
|
||||
func (s *v0DealProposals) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
var v0dp market.DealProposal
|
||||
if err := v0dp.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
func (s *dealProposals0) decode(val *cbg.Deferred) (*DealProposal, error) {
|
||||
var dp0 market.DealProposal
|
||||
if err := dp0.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
dp := fromV0DealProposal(v0dp)
|
||||
dp := fromV0DealProposal(dp0)
|
||||
return &dp, nil
|
||||
}
|
||||
|
||||
func (s *v0DealProposals) array() adt.Array {
|
||||
func (s *dealProposals0) array() adt.Array {
|
||||
return s.Array
|
||||
}
|
||||
|
||||
|
@ -10,19 +10,19 @@ import (
|
||||
"github.com/filecoin-project/go-bitfield"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Address = v0builtin.InitActorAddr
|
||||
var Address = builtin0.InitActorAddr
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
||||
switch act.Code {
|
||||
case v0builtin.StorageMinerActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.StorageMinerActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -83,18 +83,18 @@ type Partition interface {
|
||||
ActiveSectors() (bitfield.BitField, error)
|
||||
}
|
||||
|
||||
type SectorOnChainInfo = v0miner.SectorOnChainInfo
|
||||
type SectorPreCommitInfo = v0miner.SectorPreCommitInfo
|
||||
type SectorPreCommitOnChainInfo = v0miner.SectorPreCommitOnChainInfo
|
||||
type PoStPartition = v0miner.PoStPartition
|
||||
type RecoveryDeclaration = v0miner.RecoveryDeclaration
|
||||
type FaultDeclaration = v0miner.FaultDeclaration
|
||||
type SectorOnChainInfo = miner0.SectorOnChainInfo
|
||||
type SectorPreCommitInfo = miner0.SectorPreCommitInfo
|
||||
type SectorPreCommitOnChainInfo = miner0.SectorPreCommitOnChainInfo
|
||||
type PoStPartition = miner0.PoStPartition
|
||||
type RecoveryDeclaration = miner0.RecoveryDeclaration
|
||||
type FaultDeclaration = miner0.FaultDeclaration
|
||||
|
||||
// Params
|
||||
type DeclareFaultsParams = v0miner.DeclareFaultsParams
|
||||
type DeclareFaultsRecoveredParams = v0miner.DeclareFaultsRecoveredParams
|
||||
type SubmitWindowedPoStParams = v0miner.SubmitWindowedPoStParams
|
||||
type ProveCommitSectorParams = v0miner.ProveCommitSectorParams
|
||||
type DeclareFaultsParams = miner0.DeclareFaultsParams
|
||||
type DeclareFaultsRecoveredParams = miner0.DeclareFaultsRecoveredParams
|
||||
type SubmitWindowedPoStParams = miner0.SubmitWindowedPoStParams
|
||||
type ProveCommitSectorParams = miner0.ProveCommitSectorParams
|
||||
|
||||
type MinerInfo struct {
|
||||
Owner address.Address // Must be an ID-address.
|
||||
|
@ -9,38 +9,38 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/dline"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
v0miner.State
|
||||
type state0 struct {
|
||||
miner0.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
type v0Deadline struct {
|
||||
v0miner.Deadline
|
||||
type deadline0 struct {
|
||||
miner0.Deadline
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
type v0Partition struct {
|
||||
v0miner.Partition
|
||||
type partition0 struct {
|
||||
miner0.Partition
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) AvailableBalance(bal abi.TokenAmount) (abi.TokenAmount, error) {
|
||||
func (s *state0) AvailableBalance(bal abi.TokenAmount) (abi.TokenAmount, error) {
|
||||
return s.GetAvailableBalance(bal), nil
|
||||
}
|
||||
|
||||
func (s *v0State) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||
func (s *state0) VestedFunds(epoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||
return s.CheckVestedFunds(s.store, epoch)
|
||||
}
|
||||
|
||||
func (s *v0State) LockedFunds() (LockedFunds, error) {
|
||||
func (s *state0) LockedFunds() (LockedFunds, error) {
|
||||
return LockedFunds{
|
||||
VestingFunds: s.State.LockedFunds,
|
||||
InitialPledgeRequirement: s.State.InitialPledgeRequirement,
|
||||
@ -48,15 +48,15 @@ func (s *v0State) LockedFunds() (LockedFunds, error) {
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) InitialPledge() (abi.TokenAmount, error) {
|
||||
func (s *state0) InitialPledge() (abi.TokenAmount, error) {
|
||||
return s.State.InitialPledgeRequirement, nil
|
||||
}
|
||||
|
||||
func (s *v0State) PreCommitDeposits() (abi.TokenAmount, error) {
|
||||
func (s *state0) PreCommitDeposits() (abi.TokenAmount, error) {
|
||||
return s.State.PreCommitDeposits, nil
|
||||
}
|
||||
|
||||
func (s *v0State) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
||||
func (s *state0) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
||||
info, ok, err := s.State.GetSector(s.store, num)
|
||||
if !ok || err != nil {
|
||||
return nil, err
|
||||
@ -65,7 +65,7 @@ func (s *v0State) GetSector(num abi.SectorNumber) (*SectorOnChainInfo, error) {
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *v0State) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
|
||||
func (s *state0) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
|
||||
dlIdx, partIdx, err := s.State.FindSector(s.store, num)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -81,7 +81,7 @@ func (s *v0State) FindSector(num abi.SectorNumber) (*SectorLocation, error) {
|
||||
// If the sector isn't found or has already been terminated, this method returns
|
||||
// nil and no error. If the sector does not expire early, the Early expiration
|
||||
// field is 0.
|
||||
func (s *v0State) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
|
||||
func (s *state0) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -94,13 +94,13 @@ func (s *v0State) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration,
|
||||
// of the expiration queue.
|
||||
stopErr := errors.New("stop")
|
||||
out := SectorExpiration{}
|
||||
err = dls.ForEach(s.store, func(dlIdx uint64, dl *v0miner.Deadline) error {
|
||||
err = dls.ForEach(s.store, func(dlIdx uint64, dl *miner0.Deadline) error {
|
||||
partitions, err := dl.PartitionsArray(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
quant := s.State.QuantSpecForDeadline(dlIdx)
|
||||
var part v0miner.Partition
|
||||
var part miner0.Partition
|
||||
return partitions.ForEach(&part, func(partIdx int64) error {
|
||||
if found, err := part.Sectors.IsSet(uint64(num)); err != nil {
|
||||
return err
|
||||
@ -114,11 +114,11 @@ func (s *v0State) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration,
|
||||
return stopErr
|
||||
}
|
||||
|
||||
q, err := v0miner.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant)
|
||||
q, err := miner0.LoadExpirationQueue(s.store, part.ExpirationsEpochs, quant)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var exp v0miner.ExpirationSet
|
||||
var exp miner0.ExpirationSet
|
||||
return q.ForEach(&exp, func(epoch int64) error {
|
||||
if early, err := exp.EarlySectors.IsSet(uint64(num)); err != nil {
|
||||
return err
|
||||
@ -148,7 +148,7 @@ func (s *v0State) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration,
|
||||
return &out, nil
|
||||
}
|
||||
|
||||
func (s *v0State) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
||||
func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||
if !ok || err != nil {
|
||||
return nil, err
|
||||
@ -157,8 +157,8 @@ func (s *v0State) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitO
|
||||
return info, nil
|
||||
}
|
||||
|
||||
func (s *v0State) LoadSectorsFromSet(filter *bitfield.BitField, filterOut bool) (adt.Array, error) {
|
||||
a, err := v0adt.AsArray(s.store, s.State.Sectors)
|
||||
func (s *state0) LoadSectorsFromSet(filter *bitfield.BitField, filterOut bool) (adt.Array, error) {
|
||||
a, err := adt0.AsArray(s.store, s.State.Sectors)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -185,11 +185,11 @@ func (s *v0State) LoadSectorsFromSet(filter *bitfield.BitField, filterOut bool)
|
||||
return a, nil
|
||||
}
|
||||
|
||||
func (s *v0State) LoadPreCommittedSectors() (adt.Map, error) {
|
||||
return v0adt.AsMap(s.store, s.State.PreCommittedSectors)
|
||||
func (s *state0) LoadPreCommittedSectors() (adt.Map, error) {
|
||||
return adt0.AsMap(s.store, s.State.PreCommittedSectors)
|
||||
}
|
||||
|
||||
func (s *v0State) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
func (s *state0) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
var allocatedSectors bitfield.BitField
|
||||
if err := s.store.Get(s.store.Context(), s.State.AllocatedSectors, &allocatedSectors); err != nil {
|
||||
return false, err
|
||||
@ -198,7 +198,7 @@ func (s *v0State) IsAllocated(num abi.SectorNumber) (bool, error) {
|
||||
return allocatedSectors.IsSet(uint64(num))
|
||||
}
|
||||
|
||||
func (s *v0State) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
func (s *state0) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -207,39 +207,39 @@ func (s *v0State) LoadDeadline(idx uint64) (Deadline, error) {
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v0Deadline{*dl, s.store}, nil
|
||||
return &deadline0{*dl, s.store}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) ForEachDeadline(cb func(uint64, Deadline) error) error {
|
||||
func (s *state0) ForEachDeadline(cb func(uint64, Deadline) error) error {
|
||||
dls, err := s.State.LoadDeadlines(s.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
return dls.ForEach(s.store, func(i uint64, dl *v0miner.Deadline) error {
|
||||
return cb(i, &v0Deadline{*dl, s.store})
|
||||
return dls.ForEach(s.store, func(i uint64, dl *miner0.Deadline) error {
|
||||
return cb(i, &deadline0{*dl, s.store})
|
||||
})
|
||||
}
|
||||
|
||||
func (s *v0State) NumDeadlines() (uint64, error) {
|
||||
return v0miner.WPoStPeriodDeadlines, nil
|
||||
func (s *state0) NumDeadlines() (uint64, error) {
|
||||
return miner0.WPoStPeriodDeadlines, nil
|
||||
}
|
||||
|
||||
// Max sectors per PoSt
|
||||
func (s *v0State) MaxAddressedSectors() (uint64, error) {
|
||||
return v0miner.AddressedSectorsMax, nil
|
||||
func (s *state0) MaxAddressedSectors() (uint64, error) {
|
||||
return miner0.AddressedSectorsMax, nil
|
||||
}
|
||||
|
||||
func (s *v0State) DeadlinesChanged(other State) bool {
|
||||
v0other, ok := other.(*v0State)
|
||||
func (s *state0) DeadlinesChanged(other State) bool {
|
||||
other0, ok := other.(*state0)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true
|
||||
}
|
||||
|
||||
return s.State.Deadlines.Equals(v0other.Deadlines)
|
||||
return s.State.Deadlines.Equals(other0.Deadlines)
|
||||
}
|
||||
|
||||
func (s *v0State) Info() (MinerInfo, error) {
|
||||
func (s *state0) Info() (MinerInfo, error) {
|
||||
info, err := s.State.GetInfo(s.store)
|
||||
if err != nil {
|
||||
return MinerInfo{}, err
|
||||
@ -273,71 +273,71 @@ func (s *v0State) Info() (MinerInfo, error) {
|
||||
return mi, nil
|
||||
}
|
||||
|
||||
func (s *v0State) DeadlineInfo(epoch abi.ChainEpoch) *dline.Info {
|
||||
func (s *state0) DeadlineInfo(epoch abi.ChainEpoch) *dline.Info {
|
||||
return s.State.DeadlineInfo(epoch)
|
||||
}
|
||||
|
||||
func (s *v0State) sectors() (adt.Array, error) {
|
||||
return v0adt.AsArray(s.store, s.Sectors)
|
||||
func (s *state0) sectors() (adt.Array, error) {
|
||||
return adt0.AsArray(s.store, s.Sectors)
|
||||
}
|
||||
|
||||
func (s *v0State) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
|
||||
var si v0miner.SectorOnChainInfo
|
||||
func (s *state0) decodeSectorOnChainInfo(val *cbg.Deferred) (SectorOnChainInfo, error) {
|
||||
var si miner0.SectorOnChainInfo
|
||||
err := si.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||
return si, err
|
||||
}
|
||||
|
||||
func (s *v0State) precommits() (adt.Map, error) {
|
||||
return v0adt.AsMap(s.store, s.PreCommittedSectors)
|
||||
func (s *state0) precommits() (adt.Map, error) {
|
||||
return adt0.AsMap(s.store, s.PreCommittedSectors)
|
||||
}
|
||||
|
||||
func (s *v0State) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
||||
var sp v0miner.SectorPreCommitOnChainInfo
|
||||
func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
||||
var sp miner0.SectorPreCommitOnChainInfo
|
||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||
return sp, err
|
||||
}
|
||||
|
||||
func (d *v0Deadline) LoadPartition(idx uint64) (Partition, error) {
|
||||
func (d *deadline0) LoadPartition(idx uint64) (Partition, error) {
|
||||
p, err := d.Deadline.LoadPartition(d.store, idx)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
return &v0Partition{*p, d.store}, nil
|
||||
return &partition0{*p, d.store}, nil
|
||||
}
|
||||
|
||||
func (d *v0Deadline) ForEachPartition(cb func(uint64, Partition) error) error {
|
||||
func (d *deadline0) ForEachPartition(cb func(uint64, Partition) error) error {
|
||||
ps, err := d.Deadline.PartitionsArray(d.store)
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
var part v0miner.Partition
|
||||
var part miner0.Partition
|
||||
return ps.ForEach(&part, func(i int64) error {
|
||||
return cb(uint64(i), &v0Partition{part, d.store})
|
||||
return cb(uint64(i), &partition0{part, d.store})
|
||||
})
|
||||
}
|
||||
|
||||
func (d *v0Deadline) PartitionsChanged(other Deadline) bool {
|
||||
v0other, ok := other.(*v0Deadline)
|
||||
func (d *deadline0) PartitionsChanged(other Deadline) bool {
|
||||
other0, ok := other.(*deadline0)
|
||||
if !ok {
|
||||
// treat an upgrade as a change, always
|
||||
return true
|
||||
}
|
||||
|
||||
return d.Deadline.Partitions.Equals(v0other.Deadline.Partitions)
|
||||
return d.Deadline.Partitions.Equals(other0.Deadline.Partitions)
|
||||
}
|
||||
|
||||
func (d *v0Deadline) PostSubmissions() (bitfield.BitField, error) {
|
||||
func (d *deadline0) PostSubmissions() (bitfield.BitField, error) {
|
||||
return d.Deadline.PostSubmissions, nil
|
||||
}
|
||||
|
||||
func (p *v0Partition) AllSectors() (bitfield.BitField, error) {
|
||||
func (p *partition0) AllSectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Sectors, nil
|
||||
}
|
||||
|
||||
func (p *v0Partition) FaultySectors() (bitfield.BitField, error) {
|
||||
func (p *partition0) FaultySectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Faults, nil
|
||||
}
|
||||
|
||||
func (p *v0Partition) RecoveringSectors() (bitfield.BitField, error) {
|
||||
func (p *partition0) RecoveringSectors() (bitfield.BitField, error) {
|
||||
return p.Partition.Recoveries, nil
|
||||
}
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -13,8 +13,8 @@ import (
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
switch act.Code {
|
||||
case v0builtin.MultisigActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.MultisigActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -6,23 +6,23 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
type state0 struct {
|
||||
multisig.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||
func (s *state0) LockedBalance(currEpoch abi.ChainEpoch) (abi.TokenAmount, error) {
|
||||
return s.State.AmountLocked(currEpoch - s.State.StartEpoch), nil
|
||||
}
|
||||
|
||||
func (s *v0State) StartEpoch() abi.ChainEpoch {
|
||||
func (s *state0) StartEpoch() abi.ChainEpoch {
|
||||
return s.State.StartEpoch
|
||||
}
|
||||
|
||||
func (s *v0State) UnlockDuration() abi.ChainEpoch {
|
||||
func (s *state0) UnlockDuration() abi.ChainEpoch {
|
||||
return s.State.UnlockDuration
|
||||
}
|
||||
|
||||
func (s *v0State) InitialBalance() abi.TokenAmount {
|
||||
func (s *state0) InitialBalance() abi.TokenAmount {
|
||||
return s.State.InitialBalance
|
||||
}
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
big "github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -16,8 +16,8 @@ import (
|
||||
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
switch act.Code {
|
||||
case v0builtin.PaymentChannelActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.PaymentChannelActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -6,42 +6,42 @@ import (
|
||||
big "github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
type state0 struct {
|
||||
paych.State
|
||||
store adt.Store
|
||||
lsAmt *v0adt.Array
|
||||
lsAmt *adt0.Array
|
||||
}
|
||||
|
||||
// Channel owner, who has funded the actor
|
||||
func (s *v0State) From() address.Address {
|
||||
func (s *state0) From() address.Address {
|
||||
return s.State.From
|
||||
}
|
||||
|
||||
// Recipient of payouts from channel
|
||||
func (s *v0State) To() address.Address {
|
||||
func (s *state0) To() address.Address {
|
||||
return s.State.To
|
||||
}
|
||||
|
||||
// Height at which the channel can be `Collected`
|
||||
func (s *v0State) SettlingAt() abi.ChainEpoch {
|
||||
func (s *state0) SettlingAt() abi.ChainEpoch {
|
||||
return s.State.SettlingAt
|
||||
}
|
||||
|
||||
// Amount successfully redeemed through the payment channel, paid out on `Collect()`
|
||||
func (s *v0State) ToSend() abi.TokenAmount {
|
||||
func (s *state0) ToSend() abi.TokenAmount {
|
||||
return s.State.ToSend
|
||||
}
|
||||
|
||||
func (s *v0State) getOrLoadLsAmt() (*v0adt.Array, error) {
|
||||
func (s *state0) getOrLoadLsAmt() (*adt0.Array, error) {
|
||||
if s.lsAmt != nil {
|
||||
return s.lsAmt, nil
|
||||
}
|
||||
|
||||
// Get the lane state from the chain
|
||||
lsamt, err := v0adt.AsArray(s.store, s.State.LaneStates)
|
||||
lsamt, err := adt0.AsArray(s.store, s.State.LaneStates)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -51,7 +51,7 @@ func (s *v0State) getOrLoadLsAmt() (*v0adt.Array, error) {
|
||||
}
|
||||
|
||||
// Get total number of lanes
|
||||
func (s *v0State) LaneCount() (uint64, error) {
|
||||
func (s *state0) LaneCount() (uint64, error) {
|
||||
lsamt, err := s.getOrLoadLsAmt()
|
||||
if err != nil {
|
||||
return 0, err
|
||||
@ -60,7 +60,7 @@ func (s *v0State) LaneCount() (uint64, error) {
|
||||
}
|
||||
|
||||
// Iterate lane states
|
||||
func (s *v0State) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
|
||||
func (s *state0) ForEachLaneState(cb func(idx uint64, dl LaneState) error) error {
|
||||
// Get the lane state from the chain
|
||||
lsamt, err := s.getOrLoadLsAmt()
|
||||
if err != nil {
|
||||
@ -72,18 +72,18 @@ func (s *v0State) ForEachLaneState(cb func(idx uint64, dl LaneState) error) erro
|
||||
// very large index.
|
||||
var ls paych.LaneState
|
||||
return lsamt.ForEach(&ls, func(i int64) error {
|
||||
return cb(uint64(i), &v0LaneState{ls})
|
||||
return cb(uint64(i), &laneState0{ls})
|
||||
})
|
||||
}
|
||||
|
||||
type v0LaneState struct {
|
||||
type laneState0 struct {
|
||||
paych.LaneState
|
||||
}
|
||||
|
||||
func (ls *v0LaneState) Redeemed() big.Int {
|
||||
func (ls *laneState0) Redeemed() big.Int {
|
||||
return ls.LaneState.Redeemed
|
||||
}
|
||||
|
||||
func (ls *v0LaneState) Nonce() uint64 {
|
||||
func (ls *laneState0) Nonce() uint64 {
|
||||
return ls.LaneState.Nonce
|
||||
}
|
||||
|
@ -6,19 +6,19 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Address = v0builtin.StoragePowerActorAddr
|
||||
var Address = builtin0.StoragePowerActorAddr
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
||||
switch act.Code {
|
||||
case v0builtin.StoragePowerActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.StoragePowerActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -4,20 +4,20 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
v0power.State
|
||||
type state0 struct {
|
||||
power0.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) TotalLocked() (abi.TokenAmount, error) {
|
||||
func (s *state0) TotalLocked() (abi.TokenAmount, error) {
|
||||
return s.TotalPledgeCollateral, nil
|
||||
}
|
||||
|
||||
func (s *v0State) TotalPower() (Claim, error) {
|
||||
func (s *state0) TotalPower() (Claim, error) {
|
||||
return Claim{
|
||||
RawBytePower: s.TotalRawBytePower,
|
||||
QualityAdjPower: s.TotalQualityAdjPower,
|
||||
@ -25,19 +25,19 @@ func (s *v0State) TotalPower() (Claim, error) {
|
||||
}
|
||||
|
||||
// Committed power to the network. Includes miners below the minimum threshold.
|
||||
func (s *v0State) TotalCommitted() (Claim, error) {
|
||||
func (s *state0) TotalCommitted() (Claim, error) {
|
||||
return Claim{
|
||||
RawBytePower: s.TotalBytesCommitted,
|
||||
QualityAdjPower: s.TotalQABytesCommitted,
|
||||
}, nil
|
||||
}
|
||||
|
||||
func (s *v0State) MinerPower(addr address.Address) (Claim, bool, error) {
|
||||
func (s *state0) MinerPower(addr address.Address) (Claim, bool, error) {
|
||||
claims, err := adt.AsMap(s.store, s.Claims)
|
||||
if err != nil {
|
||||
return Claim{}, false, err
|
||||
}
|
||||
var claim v0power.Claim
|
||||
var claim power0.Claim
|
||||
ok, err := claims.Get(abi.AddrKey(addr), &claim)
|
||||
if err != nil {
|
||||
return Claim{}, false, err
|
||||
@ -48,19 +48,19 @@ func (s *v0State) MinerPower(addr address.Address) (Claim, bool, error) {
|
||||
}, ok, nil
|
||||
}
|
||||
|
||||
func (s *v0State) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
|
||||
func (s *state0) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool, error) {
|
||||
return s.State.MinerNominalPowerMeetsConsensusMinimum(s.store, a)
|
||||
}
|
||||
|
||||
func (s *v0State) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||
func (s *state0) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||
return *s.State.ThisEpochQAPowerSmoothed, nil
|
||||
}
|
||||
|
||||
func (s *v0State) MinerCounts() (uint64, uint64, error) {
|
||||
func (s *state0) MinerCounts() (uint64, uint64, error) {
|
||||
return uint64(s.State.MinerAboveMinPowerCount), uint64(s.State.MinerCount), nil
|
||||
}
|
||||
|
||||
func (s *v0State) ListAllMiners() ([]address.Address, error) {
|
||||
func (s *state0) ListAllMiners() ([]address.Address, error) {
|
||||
claims, err := adt.AsMap(s.store, s.Claims)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -5,19 +5,19 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Address = v0builtin.RewardActorAddr
|
||||
var Address = builtin0.RewardActorAddr
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (st State, err error) {
|
||||
switch act.Code {
|
||||
case v0builtin.RewardActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.RewardActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -7,39 +7,39 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
type state0 struct {
|
||||
reward.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) ThisEpochReward() (abi.StoragePower, error) {
|
||||
func (s *state0) ThisEpochReward() (abi.StoragePower, error) {
|
||||
return s.State.ThisEpochReward, nil
|
||||
}
|
||||
|
||||
func (s *v0State) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||
func (s *state0) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||
return *s.State.ThisEpochRewardSmoothed, nil
|
||||
}
|
||||
|
||||
func (s *v0State) ThisEpochBaselinePower() (abi.StoragePower, error) {
|
||||
func (s *state0) ThisEpochBaselinePower() (abi.StoragePower, error) {
|
||||
return s.State.ThisEpochBaselinePower, nil
|
||||
}
|
||||
|
||||
func (s *v0State) TotalStoragePowerReward() (abi.TokenAmount, error) {
|
||||
func (s *state0) TotalStoragePowerReward() (abi.TokenAmount, error) {
|
||||
return s.State.TotalMined, nil
|
||||
}
|
||||
|
||||
func (s *v0State) EffectiveBaselinePower() (abi.StoragePower, error) {
|
||||
func (s *state0) EffectiveBaselinePower() (abi.StoragePower, error) {
|
||||
return s.State.EffectiveBaselinePower, nil
|
||||
}
|
||||
|
||||
func (s *v0State) EffectiveNetworkTime() (abi.ChainEpoch, error) {
|
||||
func (s *state0) EffectiveNetworkTime() (abi.ChainEpoch, error) {
|
||||
return s.State.EffectiveNetworkTime, nil
|
||||
}
|
||||
|
||||
func (s *v0State) CumsumBaseline() (abi.StoragePower, error) {
|
||||
func (s *state0) CumsumBaseline() (abi.StoragePower, error) {
|
||||
return s.State.CumsumBaseline, nil
|
||||
}
|
||||
|
||||
func (s *v0State) CumsumRealized() (abi.StoragePower, error) {
|
||||
func (s *state0) CumsumRealized() (abi.StoragePower, error) {
|
||||
return s.State.CumsumBaseline, nil
|
||||
}
|
||||
|
@ -4,24 +4,24 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
)
|
||||
|
||||
type v0State struct {
|
||||
v0verifreg.State
|
||||
type state0 struct {
|
||||
verifreg0.State
|
||||
store adt.Store
|
||||
}
|
||||
|
||||
func (s *v0State) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
func (s *state0) VerifiedClientDataCap(addr address.Address) (bool, abi.StoragePower, error) {
|
||||
if addr.Protocol() != address.ID {
|
||||
return false, big.Zero(), xerrors.Errorf("can only look up ID addresses")
|
||||
}
|
||||
|
||||
vh, err := v0adt.AsMap(s.store, s.VerifiedClients)
|
||||
vh, err := adt0.AsMap(s.store, s.VerifiedClients)
|
||||
if err != nil {
|
||||
return false, big.Zero(), xerrors.Errorf("loading verified clients: %w", err)
|
||||
}
|
||||
|
@ -6,18 +6,18 @@ import (
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/cbor"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
)
|
||||
|
||||
var Address = v0builtin.VerifiedRegistryActorAddr
|
||||
var Address = builtin0.VerifiedRegistryActorAddr
|
||||
|
||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||
switch act.Code {
|
||||
case v0builtin.VerifiedRegistryActorCodeID:
|
||||
out := v0State{store: store}
|
||||
case builtin0.VerifiedRegistryActorCodeID:
|
||||
out := state0{store: store}
|
||||
err := store.Get(store.Context(), act.Head, &out)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -509,12 +509,12 @@ func (sp *StatePredicates) OnAddressMapChange() DiffInitActorStateFunc {
|
||||
return false, nil, nil
|
||||
}
|
||||
|
||||
oldAddrs, err := v0adt.AsMap(ctxStore, oldState.AddressMap)
|
||||
oldAddrs, err := adt0.AsMap(ctxStore, oldState.AddressMap)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
||||
newAddrs, err := v0adt.AsMap(ctxStore, newState.AddressMap)
|
||||
newAddrs, err := adt0.AsMap(ctxStore, newState.AddressMap)
|
||||
if err != nil {
|
||||
return false, nil, err
|
||||
}
|
||||
|
@ -19,10 +19,10 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
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"
|
||||
|
||||
@ -74,22 +74,22 @@ func TestMarketPredicates(t *testing.T) {
|
||||
bs := bstore.NewTemporarySync()
|
||||
store := adt.WrapStore(ctx, cbornode.NewCborStore(bs))
|
||||
|
||||
oldDeal1 := &v0market.DealState{
|
||||
oldDeal1 := &market0.DealState{
|
||||
SectorStartEpoch: 1,
|
||||
LastUpdatedEpoch: 2,
|
||||
SlashEpoch: 0,
|
||||
}
|
||||
oldDeal2 := &v0market.DealState{
|
||||
oldDeal2 := &market0.DealState{
|
||||
SectorStartEpoch: 4,
|
||||
LastUpdatedEpoch: 5,
|
||||
SlashEpoch: 0,
|
||||
}
|
||||
oldDeals := map[abi.DealID]*v0market.DealState{
|
||||
oldDeals := map[abi.DealID]*market0.DealState{
|
||||
abi.DealID(1): oldDeal1,
|
||||
abi.DealID(2): oldDeal2,
|
||||
}
|
||||
|
||||
oldProp1 := &v0market.DealProposal{
|
||||
oldProp1 := &market0.DealProposal{
|
||||
PieceCID: dummyCid,
|
||||
PieceSize: 0,
|
||||
VerifiedDeal: false,
|
||||
@ -101,7 +101,7 @@ func TestMarketPredicates(t *testing.T) {
|
||||
ProviderCollateral: big.Zero(),
|
||||
ClientCollateral: big.Zero(),
|
||||
}
|
||||
oldProp2 := &v0market.DealProposal{
|
||||
oldProp2 := &market0.DealProposal{
|
||||
PieceCID: dummyCid,
|
||||
PieceSize: 0,
|
||||
VerifiedDeal: false,
|
||||
@ -113,7 +113,7 @@ func TestMarketPredicates(t *testing.T) {
|
||||
ProviderCollateral: big.Zero(),
|
||||
ClientCollateral: big.Zero(),
|
||||
}
|
||||
oldProps := map[abi.DealID]*v0market.DealProposal{
|
||||
oldProps := map[abi.DealID]*market0.DealProposal{
|
||||
abi.DealID(1): oldProp1,
|
||||
abi.DealID(2): oldProp2,
|
||||
}
|
||||
@ -127,7 +127,7 @@ func TestMarketPredicates(t *testing.T) {
|
||||
|
||||
oldStateC := createMarketState(ctx, t, store, oldDeals, oldProps, oldBalances)
|
||||
|
||||
newDeal1 := &v0market.DealState{
|
||||
newDeal1 := &market0.DealState{
|
||||
SectorStartEpoch: 1,
|
||||
LastUpdatedEpoch: 3,
|
||||
SlashEpoch: 0,
|
||||
@ -136,19 +136,19 @@ func TestMarketPredicates(t *testing.T) {
|
||||
// deal 2 removed
|
||||
|
||||
// added
|
||||
newDeal3 := &v0market.DealState{
|
||||
newDeal3 := &market0.DealState{
|
||||
SectorStartEpoch: 1,
|
||||
LastUpdatedEpoch: 2,
|
||||
SlashEpoch: 3,
|
||||
}
|
||||
newDeals := map[abi.DealID]*v0market.DealState{
|
||||
newDeals := map[abi.DealID]*market0.DealState{
|
||||
abi.DealID(1): newDeal1,
|
||||
// deal 2 was removed
|
||||
abi.DealID(3): newDeal3,
|
||||
}
|
||||
|
||||
// added
|
||||
newProp3 := &v0market.DealProposal{
|
||||
newProp3 := &market0.DealProposal{
|
||||
PieceCID: dummyCid,
|
||||
PieceSize: 0,
|
||||
VerifiedDeal: false,
|
||||
@ -160,7 +160,7 @@ func TestMarketPredicates(t *testing.T) {
|
||||
ProviderCollateral: big.Zero(),
|
||||
ClientCollateral: big.Zero(),
|
||||
}
|
||||
newProps := map[abi.DealID]*v0market.DealProposal{
|
||||
newProps := map[abi.DealID]*market0.DealProposal{
|
||||
abi.DealID(1): oldProp1, // 1 was persisted
|
||||
// prop 2 was removed
|
||||
abi.DealID(3): newProp3, // new
|
||||
@ -183,8 +183,8 @@ func TestMarketPredicates(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
api := newMockAPI(bs)
|
||||
api.setActor(oldState.Key(), &types.Actor{Code: v0builtin.StorageMarketActorCodeID, Head: oldStateC})
|
||||
api.setActor(newState.Key(), &types.Actor{Code: v0builtin.StorageMarketActorCodeID, Head: newStateC})
|
||||
api.setActor(oldState.Key(), &types.Actor{Code: builtin0.StorageMarketActorCodeID, Head: oldStateC})
|
||||
api.setActor(newState.Key(), &types.Actor{Code: builtin0.StorageMarketActorCodeID, Head: newStateC})
|
||||
|
||||
t.Run("deal ID predicate", func(t *testing.T) {
|
||||
preds := NewStatePredicates(api)
|
||||
@ -239,11 +239,11 @@ func TestMarketPredicates(t *testing.T) {
|
||||
t.Fatal("No state change so this should not be called")
|
||||
return false, nil, nil
|
||||
})
|
||||
v0marketState := createEmptyMarketState(t, store)
|
||||
marketCid, err := store.Put(ctx, v0marketState)
|
||||
marketState0 := createEmptyMarketState(t, store)
|
||||
marketCid, err := store.Put(ctx, marketState0)
|
||||
require.NoError(t, err)
|
||||
marketState, err := market.Load(store, &types.Actor{
|
||||
Code: v0builtin.StorageMarketActorCodeID,
|
||||
Code: builtin0.StorageMarketActorCodeID,
|
||||
Head: marketCid,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@ -352,11 +352,11 @@ func TestMarketPredicates(t *testing.T) {
|
||||
t.Fatal("No state change so this should not be called")
|
||||
return false, nil, nil
|
||||
})
|
||||
v0marketState := createEmptyMarketState(t, store)
|
||||
marketCid, err := store.Put(ctx, v0marketState)
|
||||
marketState0 := createEmptyMarketState(t, store)
|
||||
marketCid, err := store.Put(ctx, marketState0)
|
||||
require.NoError(t, err)
|
||||
marketState, err := market.Load(store, &types.Actor{
|
||||
Code: v0builtin.StorageMarketActorCodeID,
|
||||
Code: builtin0.StorageMarketActorCodeID,
|
||||
Head: marketCid,
|
||||
})
|
||||
require.NoError(t, err)
|
||||
@ -379,12 +379,12 @@ func TestMinerSectorChange(t *testing.T) {
|
||||
}
|
||||
|
||||
owner, worker := nextIDAddrF(), nextIDAddrF()
|
||||
si0 := newSectorOnChainInfo(0, tutils.MakeCID("0", &v0miner.SealedCIDPrefix), big.NewInt(0), abi.ChainEpoch(0), abi.ChainEpoch(10))
|
||||
si1 := newSectorOnChainInfo(1, tutils.MakeCID("1", &v0miner.SealedCIDPrefix), big.NewInt(1), abi.ChainEpoch(1), abi.ChainEpoch(11))
|
||||
si2 := newSectorOnChainInfo(2, tutils.MakeCID("2", &v0miner.SealedCIDPrefix), big.NewInt(2), abi.ChainEpoch(2), abi.ChainEpoch(11))
|
||||
si0 := newSectorOnChainInfo(0, tutils.MakeCID("0", &miner0.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))
|
||||
si2 := newSectorOnChainInfo(2, tutils.MakeCID("2", &miner0.SealedCIDPrefix), big.NewInt(2), abi.ChainEpoch(2), abi.ChainEpoch(11))
|
||||
oldMinerC := createMinerState(ctx, t, store, owner, worker, []miner.SectorOnChainInfo{si0, si1, si2})
|
||||
|
||||
si3 := newSectorOnChainInfo(3, tutils.MakeCID("3", &v0miner.SealedCIDPrefix), big.NewInt(3), abi.ChainEpoch(3), abi.ChainEpoch(12))
|
||||
si3 := newSectorOnChainInfo(3, tutils.MakeCID("3", &miner0.SealedCIDPrefix), big.NewInt(3), abi.ChainEpoch(3), abi.ChainEpoch(12))
|
||||
// 0 delete
|
||||
// 1 extend
|
||||
// 2 same
|
||||
@ -400,8 +400,8 @@ func TestMinerSectorChange(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
api := newMockAPI(bs)
|
||||
api.setActor(oldState.Key(), &types.Actor{Head: oldMinerC, Code: v0builtin.StorageMinerActorCodeID})
|
||||
api.setActor(newState.Key(), &types.Actor{Head: newMinerC, Code: v0builtin.StorageMinerActorCodeID})
|
||||
api.setActor(oldState.Key(), &types.Actor{Head: oldMinerC, Code: builtin0.StorageMinerActorCodeID})
|
||||
api.setActor(newState.Key(), &types.Actor{Head: newMinerC, Code: builtin0.StorageMinerActorCodeID})
|
||||
|
||||
preds := NewStatePredicates(api)
|
||||
|
||||
@ -467,7 +467,7 @@ type balance struct {
|
||||
locked abi.TokenAmount
|
||||
}
|
||||
|
||||
func createMarketState(ctx context.Context, t *testing.T, store adt.Store, deals map[abi.DealID]*v0market.DealState, props map[abi.DealID]*v0market.DealProposal, balances map[address.Address]balance) cid.Cid {
|
||||
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 {
|
||||
dealRootCid := createDealAMT(ctx, t, store, deals)
|
||||
propRootCid := createProposalAMT(ctx, t, store, props)
|
||||
balancesCids := createBalanceTable(ctx, t, store, balances)
|
||||
@ -482,15 +482,15 @@ func createMarketState(ctx context.Context, t *testing.T, store adt.Store, deals
|
||||
return stateC
|
||||
}
|
||||
|
||||
func createEmptyMarketState(t *testing.T, store adt.Store) *v0market.State {
|
||||
func createEmptyMarketState(t *testing.T, store adt.Store) *market0.State {
|
||||
emptyArrayCid, err := adt.MakeEmptyArray(store).Root()
|
||||
require.NoError(t, err)
|
||||
emptyMap, err := adt.MakeEmptyMap(store).Root()
|
||||
require.NoError(t, err)
|
||||
return v0market.ConstructState(emptyArrayCid, emptyMap, emptyMap)
|
||||
return market0.ConstructState(emptyArrayCid, emptyMap, emptyMap)
|
||||
}
|
||||
|
||||
func createDealAMT(ctx context.Context, t *testing.T, store adt.Store, deals map[abi.DealID]*v0market.DealState) cid.Cid {
|
||||
func createDealAMT(ctx context.Context, t *testing.T, store adt.Store, deals map[abi.DealID]*market0.DealState) cid.Cid {
|
||||
root := adt.MakeEmptyArray(store)
|
||||
for dealID, dealState := range deals {
|
||||
err := root.Set(uint64(dealID), dealState)
|
||||
@ -501,7 +501,7 @@ func createDealAMT(ctx context.Context, t *testing.T, store adt.Store, deals map
|
||||
return rootCid
|
||||
}
|
||||
|
||||
func createProposalAMT(ctx context.Context, t *testing.T, store adt.Store, props map[abi.DealID]*v0market.DealProposal) cid.Cid {
|
||||
func createProposalAMT(ctx context.Context, t *testing.T, store adt.Store, props map[abi.DealID]*market0.DealProposal) cid.Cid {
|
||||
root := adt.MakeEmptyArray(store)
|
||||
for dealID, prop := range props {
|
||||
err := root.Set(uint64(dealID), prop)
|
||||
@ -549,20 +549,20 @@ func createMinerState(ctx context.Context, t *testing.T, store adt.Store, owner,
|
||||
return stateC
|
||||
}
|
||||
|
||||
func createEmptyMinerState(ctx context.Context, t *testing.T, store adt.Store, owner, worker address.Address) *v0miner.State {
|
||||
func createEmptyMinerState(ctx context.Context, t *testing.T, store adt.Store, owner, worker address.Address) *miner0.State {
|
||||
emptyArrayCid, err := adt.MakeEmptyArray(store).Root()
|
||||
require.NoError(t, err)
|
||||
emptyMap, err := adt.MakeEmptyMap(store).Root()
|
||||
require.NoError(t, err)
|
||||
|
||||
emptyDeadline, err := store.Put(store.Context(), v0miner.ConstructDeadline(emptyArrayCid))
|
||||
emptyDeadline, err := store.Put(store.Context(), miner0.ConstructDeadline(emptyArrayCid))
|
||||
require.NoError(t, err)
|
||||
|
||||
emptyVestingFunds := v0miner.ConstructVestingFunds()
|
||||
emptyVestingFunds := miner0.ConstructVestingFunds()
|
||||
emptyVestingFundsCid, err := store.Put(store.Context(), emptyVestingFunds)
|
||||
require.NoError(t, err)
|
||||
|
||||
emptyDeadlines := v0miner.ConstructDeadlines(emptyDeadline)
|
||||
emptyDeadlines := miner0.ConstructDeadlines(emptyDeadline)
|
||||
emptyDeadlinesCid, err := store.Put(store.Context(), emptyDeadlines)
|
||||
require.NoError(t, err)
|
||||
|
||||
@ -572,7 +572,7 @@ func createEmptyMinerState(ctx context.Context, t *testing.T, store adt.Store, o
|
||||
emptyBitfieldCid, err := store.Put(store.Context(), emptyBitfield)
|
||||
require.NoError(t, err)
|
||||
|
||||
state, err := v0miner.ConstructState(minerInfo, 123, emptyBitfieldCid, emptyArrayCid, emptyMap, emptyDeadlinesCid, emptyVestingFundsCid)
|
||||
state, err := miner0.ConstructState(minerInfo, 123, emptyBitfieldCid, emptyArrayCid, emptyMap, emptyDeadlinesCid, emptyVestingFundsCid)
|
||||
require.NoError(t, err)
|
||||
return state
|
||||
|
||||
@ -625,7 +625,7 @@ func newSectorPreCommitInfo(sectorNo abi.SectorNumber, sealed cid.Cid, expiratio
|
||||
}
|
||||
}
|
||||
|
||||
func dealEquality(expected v0market.DealState, actual market.DealState) bool {
|
||||
func dealEquality(expected market0.DealState, actual market.DealState) bool {
|
||||
return expected.LastUpdatedEpoch == actual.LastUpdatedEpoch &&
|
||||
expected.SectorStartEpoch == actual.SectorStartEpoch &&
|
||||
expected.SlashEpoch == actual.SlashEpoch
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
block "github.com/ipfs/go-block-format"
|
||||
"github.com/ipfs/go-blockservice"
|
||||
"github.com/ipfs/go-cid"
|
||||
@ -121,7 +121,7 @@ var DefaultRemainderAccountActor = genesis.Actor{
|
||||
}
|
||||
|
||||
func NewGeneratorWithSectors(numSectors int) (*ChainGen, error) {
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
|
||||
|
@ -5,20 +5,20 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
|
||||
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
}
|
||||
|
||||
func testGeneration(t testing.TB, n int, msgs int, sectors int) {
|
||||
|
@ -17,11 +17,11 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0account "github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
v0multisig "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
v0adt "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
account0 "github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
multisig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||
@ -126,7 +126,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup init actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(v0builtin.SystemActorAddr, sysact); err != nil {
|
||||
if err := state.SetActor(builtin0.SystemActorAddr, sysact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set init actor: %w", err)
|
||||
}
|
||||
|
||||
@ -136,7 +136,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup init actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(v0builtin.InitActorAddr, initact); err != nil {
|
||||
if err := state.SetActor(builtin0.InitActorAddr, initact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set init actor: %w", err)
|
||||
}
|
||||
|
||||
@ -147,7 +147,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
return nil, nil, xerrors.Errorf("setup init actor: %w", err)
|
||||
}
|
||||
|
||||
err = state.SetActor(v0builtin.RewardActorAddr, rewact)
|
||||
err = state.SetActor(builtin0.RewardActorAddr, rewact)
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("set network account actor: %w", err)
|
||||
}
|
||||
@ -157,7 +157,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup cron actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(v0builtin.CronActorAddr, cronact); err != nil {
|
||||
if err := state.SetActor(builtin0.CronActorAddr, cronact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set cron actor: %w", err)
|
||||
}
|
||||
|
||||
@ -166,7 +166,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup storage market actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(v0builtin.StoragePowerActorAddr, spact); err != nil {
|
||||
if err := state.SetActor(builtin0.StoragePowerActorAddr, spact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set storage market actor: %w", err)
|
||||
}
|
||||
|
||||
@ -175,7 +175,7 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup storage market actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(v0builtin.StorageMarketActorAddr, marketact); err != nil {
|
||||
if err := state.SetActor(builtin0.StorageMarketActorAddr, marketact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set market actor: %w", err)
|
||||
}
|
||||
|
||||
@ -184,20 +184,20 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("setup storage market actor: %w", err)
|
||||
}
|
||||
if err := state.SetActor(v0builtin.VerifiedRegistryActorAddr, verifact); err != nil {
|
||||
if err := state.SetActor(builtin0.VerifiedRegistryActorAddr, verifact); err != nil {
|
||||
return nil, nil, xerrors.Errorf("set market actor: %w", err)
|
||||
}
|
||||
|
||||
burntRoot, err := cst.Put(ctx, &v0account.State{
|
||||
Address: v0builtin.BurntFundsActorAddr,
|
||||
burntRoot, err := cst.Put(ctx, &account0.State{
|
||||
Address: builtin0.BurntFundsActorAddr,
|
||||
})
|
||||
if err != nil {
|
||||
return nil, nil, xerrors.Errorf("failed to setup burnt funds actor state: %w", err)
|
||||
}
|
||||
|
||||
// Setup burnt-funds
|
||||
err = state.SetActor(v0builtin.BurntFundsActorAddr, &types.Actor{
|
||||
Code: v0builtin.AccountActorCodeID,
|
||||
err = state.SetActor(builtin0.BurntFundsActorAddr, &types.Actor{
|
||||
Code: builtin0.AccountActorCodeID,
|
||||
Balance: types.NewInt(0),
|
||||
Head: burntRoot,
|
||||
})
|
||||
@ -262,13 +262,13 @@ func MakeInitialStateTree(ctx context.Context, bs bstore.Blockstore, template ge
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
verifierState, err := cst.Put(ctx, &v0account.State{Address: verifierAd})
|
||||
verifierState, err := cst.Put(ctx, &account0.State{Address: verifierAd})
|
||||
if err != nil {
|
||||
return nil, nil, err
|
||||
}
|
||||
|
||||
err = state.SetActor(verifierId, &types.Actor{
|
||||
Code: v0builtin.AccountActorCodeID,
|
||||
Code: builtin0.AccountActorCodeID,
|
||||
Balance: types.NewInt(0),
|
||||
Head: verifierState,
|
||||
})
|
||||
@ -315,7 +315,7 @@ func createAccountActor(ctx context.Context, cst cbor.IpldStore, state *state.St
|
||||
if err := json.Unmarshal(info.Meta, &ainfo); err != nil {
|
||||
return xerrors.Errorf("unmarshaling account meta: %w", err)
|
||||
}
|
||||
st, err := cst.Put(ctx, &v0account.State{Address: ainfo.Owner})
|
||||
st, err := cst.Put(ctx, &account0.State{Address: ainfo.Owner})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -326,7 +326,7 @@ func createAccountActor(ctx context.Context, cst cbor.IpldStore, state *state.St
|
||||
}
|
||||
|
||||
err = state.SetActor(ida, &types.Actor{
|
||||
Code: v0builtin.AccountActorCodeID,
|
||||
Code: builtin0.AccountActorCodeID,
|
||||
Balance: info.Balance,
|
||||
Head: st,
|
||||
})
|
||||
@ -344,7 +344,7 @@ func createMultisigAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.I
|
||||
if err := json.Unmarshal(info.Meta, &ainfo); err != nil {
|
||||
return xerrors.Errorf("unmarshaling account meta: %w", err)
|
||||
}
|
||||
pending, err := v0adt.MakeEmptyMap(v0adt.WrapStore(ctx, cst)).Root()
|
||||
pending, err := adt0.MakeEmptyMap(adt0.WrapStore(ctx, cst)).Root()
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to create empty map: %v", err)
|
||||
}
|
||||
@ -364,12 +364,12 @@ func createMultisigAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.I
|
||||
continue
|
||||
}
|
||||
|
||||
st, err := cst.Put(ctx, &v0account.State{Address: e})
|
||||
st, err := cst.Put(ctx, &account0.State{Address: e})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
err = state.SetActor(idAddress, &types.Actor{
|
||||
Code: v0builtin.AccountActorCodeID,
|
||||
Code: builtin0.AccountActorCodeID,
|
||||
Balance: types.NewInt(0),
|
||||
Head: st,
|
||||
})
|
||||
@ -379,7 +379,7 @@ func createMultisigAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.I
|
||||
signers = append(signers, idAddress)
|
||||
}
|
||||
|
||||
st, err := cst.Put(ctx, &v0multisig.State{
|
||||
st, err := cst.Put(ctx, &multisig0.State{
|
||||
Signers: signers,
|
||||
NumApprovalsThreshold: uint64(ainfo.Threshold),
|
||||
StartEpoch: abi.ChainEpoch(ainfo.VestingStart),
|
||||
@ -391,7 +391,7 @@ func createMultisigAccount(ctx context.Context, bs bstore.Blockstore, cst cbor.I
|
||||
return err
|
||||
}
|
||||
err = state.SetActor(ida, &types.Actor{
|
||||
Code: v0builtin.MultisigActorCodeID,
|
||||
Code: builtin0.MultisigActorCodeID,
|
||||
Balance: info.Balance,
|
||||
Head: st,
|
||||
})
|
||||
@ -442,7 +442,7 @@ func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, stateroot ci
|
||||
return cid.Undef, err
|
||||
}
|
||||
|
||||
_, err = doExecValue(ctx, vm, v0builtin.VerifiedRegistryActorAddr, verifregRoot, types.NewInt(0), v0builtin.MethodsVerifiedRegistry.AddVerifier, mustEnc(&v0verifreg.AddVerifierParams{
|
||||
_, err = doExecValue(ctx, vm, builtin0.VerifiedRegistryActorAddr, verifregRoot, types.NewInt(0), builtin0.MethodsVerifiedRegistry.AddVerifier, mustEnc(&verifreg0.AddVerifierParams{
|
||||
|
||||
Address: verifier,
|
||||
Allowance: abi.NewStoragePower(int64(sum)), // eh, close enough
|
||||
@ -453,7 +453,7 @@ func VerifyPreSealedData(ctx context.Context, cs *store.ChainStore, stateroot ci
|
||||
}
|
||||
|
||||
for c, amt := range verifNeeds {
|
||||
_, err := doExecValue(ctx, vm, v0builtin.VerifiedRegistryActorAddr, verifier, types.NewInt(0), v0builtin.MethodsVerifiedRegistry.AddVerifiedClient, mustEnc(&v0verifreg.AddVerifiedClientParams{
|
||||
_, err := doExecValue(ctx, vm, builtin0.VerifiedRegistryActorAddr, verifier, types.NewInt(0), builtin0.MethodsVerifiedRegistry.AddVerifiedClient, mustEnc(&verifreg0.AddVerifiedClientParams{
|
||||
Address: c,
|
||||
Allowance: abi.NewStoragePower(int64(amt)),
|
||||
}))
|
||||
@ -495,8 +495,8 @@ func MakeGenesisBlock(ctx context.Context, bs bstore.Blockstore, sys vm.SyscallB
|
||||
return nil, xerrors.Errorf("setup miners failed: %w", err)
|
||||
}
|
||||
|
||||
store := v0adt.WrapStore(ctx, cbor.NewCborStore(bs))
|
||||
emptyroot, err := v0adt.MakeEmptyArray(store).Root()
|
||||
store := adt0.WrapStore(ctx, cbor.NewCborStore(bs))
|
||||
emptyroot, err := adt0.MakeEmptyArray(store).Root()
|
||||
if err != nil {
|
||||
return nil, xerrors.Errorf("amt build failed: %w", err)
|
||||
}
|
||||
@ -544,7 +544,7 @@ func MakeGenesisBlock(ctx context.Context, bs bstore.Blockstore, sys vm.SyscallB
|
||||
}
|
||||
|
||||
b := &types.BlockHeader{
|
||||
Miner: v0builtin.SystemActorAddr,
|
||||
Miner: builtin0.SystemActorAddr,
|
||||
Ticket: genesisticket,
|
||||
Parents: []cid.Cid{filecoinGenesisCid},
|
||||
Height: 0,
|
||||
|
@ -20,9 +20,9 @@ import (
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0reward "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/state"
|
||||
@ -101,7 +101,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
}
|
||||
|
||||
{
|
||||
constructorParams := &v0power.CreateMinerParams{
|
||||
constructorParams := &power0.CreateMinerParams{
|
||||
Owner: m.Worker,
|
||||
Worker: m.Worker,
|
||||
Peer: []byte(m.PeerId),
|
||||
@ -114,7 +114,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
return cid.Undef, xerrors.Errorf("failed to create genesis miner: %w", err)
|
||||
}
|
||||
|
||||
var ma v0power.CreateMinerReturn
|
||||
var ma power0.CreateMinerReturn
|
||||
if err := ma.UnmarshalCBOR(bytes.NewReader(rval)); err != nil {
|
||||
return cid.Undef, xerrors.Errorf("unmarshaling CreateMinerReturn: %w", err)
|
||||
}
|
||||
@ -126,9 +126,9 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
minerInfos[i].maddr = ma.IDAddress
|
||||
|
||||
// TODO: ActorUpgrade
|
||||
err = vm.MutateState(ctx, minerInfos[i].maddr, func(cst cbor.IpldStore, st *v0miner.State) error {
|
||||
maxPeriods := v0miner.MaxSectorExpirationExtension / v0miner.WPoStProvingPeriod
|
||||
minerInfos[i].presealExp = (maxPeriods-1)*v0miner.WPoStProvingPeriod + st.ProvingPeriodStart - 1
|
||||
err = vm.MutateState(ctx, minerInfos[i].maddr, func(cst cbor.IpldStore, st *miner0.State) error {
|
||||
maxPeriods := miner0.MaxSectorExpirationExtension / miner0.WPoStProvingPeriod
|
||||
minerInfos[i].presealExp = (maxPeriods-1)*miner0.WPoStProvingPeriod + st.ProvingPeriodStart - 1
|
||||
|
||||
return nil
|
||||
})
|
||||
@ -204,13 +204,13 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
return cid.Undef, xerrors.Errorf("getting deal weight: %w", err)
|
||||
}
|
||||
|
||||
sectorWeight := v0miner.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, dweight.DealWeight, dweight.VerifiedDealWeight)
|
||||
sectorWeight := miner0.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, dweight.DealWeight, dweight.VerifiedDealWeight)
|
||||
|
||||
qaPow = types.BigAdd(qaPow, sectorWeight)
|
||||
}
|
||||
}
|
||||
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *v0power.State) error {
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power0.State) error {
|
||||
st.TotalQualityAdjPower = qaPow
|
||||
st.TotalRawBytePower = rawPow
|
||||
|
||||
@ -222,8 +222,8 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
return cid.Undef, xerrors.Errorf("mutating state: %w", err)
|
||||
}
|
||||
|
||||
err = vm.MutateState(ctx, builtin.RewardActorAddr, func(sct cbor.IpldStore, st *v0reward.State) error {
|
||||
*st = *v0reward.ConstructState(qaPow)
|
||||
err = vm.MutateState(ctx, builtin.RewardActorAddr, func(sct cbor.IpldStore, st *reward0.State) error {
|
||||
*st = *reward0.ConstructState(qaPow)
|
||||
return nil
|
||||
})
|
||||
if err != nil {
|
||||
@ -249,10 +249,10 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
return cid.Undef, xerrors.Errorf("getting deal weight: %w", err)
|
||||
}
|
||||
|
||||
sectorWeight := v0miner.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, dweight.DealWeight, dweight.VerifiedDealWeight)
|
||||
sectorWeight := miner0.QAPowerForWeight(m.SectorSize, minerInfos[i].presealExp, dweight.DealWeight, dweight.VerifiedDealWeight)
|
||||
|
||||
// we've added fake power for this sector above, remove it now
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *v0power.State) error {
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power0.State) error {
|
||||
st.TotalQualityAdjPower = types.BigSub(st.TotalQualityAdjPower, sectorWeight) //nolint:scopelint
|
||||
st.TotalRawBytePower = types.BigSub(st.TotalRawBytePower, types.NewInt(uint64(m.SectorSize)))
|
||||
return nil
|
||||
@ -271,9 +271,9 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
return cid.Undef, xerrors.Errorf("getting current total power: %w", err)
|
||||
}
|
||||
|
||||
pcd := v0miner.PreCommitDepositForPower(epochReward.ThisEpochRewardSmoothed, tpow.QualityAdjPowerSmoothed, sectorWeight)
|
||||
pcd := miner0.PreCommitDepositForPower(epochReward.ThisEpochRewardSmoothed, tpow.QualityAdjPowerSmoothed, sectorWeight)
|
||||
|
||||
pledge := v0miner.InitialPledgeForPower(
|
||||
pledge := miner0.InitialPledgeForPower(
|
||||
sectorWeight,
|
||||
epochReward.ThisEpochBaselinePower,
|
||||
tpow.PledgeCollateral,
|
||||
@ -304,7 +304,7 @@ func SetupStorageMiners(ctx context.Context, cs *store.ChainStore, sroot cid.Cid
|
||||
}
|
||||
|
||||
// Sanity-check total network power
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *v0power.State) error {
|
||||
err = vm.MutateState(ctx, builtin.StoragePowerActorAddr, func(cst cbor.IpldStore, st *power0.State) error {
|
||||
if !st.TotalRawBytePower.Equals(rawPow) {
|
||||
return xerrors.Errorf("st.TotalRawBytePower doesn't match previously calculated rawPow")
|
||||
}
|
||||
@ -343,12 +343,12 @@ func (fr *fakeRand) GetBeaconRandomness(ctx context.Context, personalization cry
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*v0power.CurrentTotalPowerReturn, error) {
|
||||
func currentTotalPower(ctx context.Context, vm *vm.VM, maddr address.Address) (*power0.CurrentTotalPowerReturn, error) {
|
||||
pwret, err := doExecValue(ctx, vm, builtin.StoragePowerActorAddr, maddr, big.Zero(), builtin.MethodsPower.CurrentTotalPower, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
var pwr v0power.CurrentTotalPowerReturn
|
||||
var pwr power0.CurrentTotalPowerReturn
|
||||
if err := pwr.UnmarshalCBOR(bytes.NewReader(pwret)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
@ -381,13 +381,13 @@ func dealWeight(ctx context.Context, vm *vm.VM, maddr address.Address, dealIDs [
|
||||
return dealWeights, nil
|
||||
}
|
||||
|
||||
func currentEpochBlockReward(ctx context.Context, vm *vm.VM, maddr address.Address) (*v0reward.ThisEpochRewardReturn, error) {
|
||||
func currentEpochBlockReward(ctx context.Context, vm *vm.VM, maddr address.Address) (*reward0.ThisEpochRewardReturn, error) {
|
||||
rwret, err := doExecValue(ctx, vm, builtin.RewardActorAddr, maddr, big.Zero(), builtin.MethodsReward.ThisEpochReward, nil)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
var epochReward v0reward.ThisEpochRewardReturn
|
||||
var epochReward reward0.ThisEpochRewardReturn
|
||||
if err := epochReward.UnmarshalCBOR(bytes.NewReader(rwret)); err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0reward "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -17,7 +17,7 @@ import (
|
||||
func SetupRewardActor(bs bstore.Blockstore, qaPower big.Int) (*types.Actor, error) {
|
||||
cst := cbor.NewCborStore(bs)
|
||||
|
||||
st := v0reward.ConstructState(qaPower)
|
||||
st := reward0.ConstructState(qaPower)
|
||||
|
||||
hcid, err := cst.Put(context.TODO(), st)
|
||||
if err != nil {
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -30,7 +30,7 @@ func SetupStoragePowerActor(bs bstore.Blockstore) (*types.Actor, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sms := v0power.ConstructState(emptyMap, emptyMultiMap)
|
||||
sms := power0.ConstructState(emptyMap, emptyMultiMap)
|
||||
|
||||
stcid, err := store.Put(store.Context(), sms)
|
||||
if err != nil {
|
||||
|
@ -7,7 +7,7 @@ import (
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -34,7 +34,7 @@ func SetupVerifiedRegistryActor(bs bstore.Blockstore) (*types.Actor, error) {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
sms := v0verifreg.ConstructState(h, RootVerifierID)
|
||||
sms := verifreg0.ConstructState(h, RootVerifierID)
|
||||
|
||||
stcid, err := store.Put(store.Context(), sms)
|
||||
if err != nil {
|
||||
|
@ -9,8 +9,8 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"golang.org/x/xerrors"
|
||||
@ -135,7 +135,7 @@ func UpgradeFaucetBurnRecovery(ctx context.Context, sm *StateManager, tree types
|
||||
})
|
||||
}
|
||||
case builtin.StorageMinerActorCodeID:
|
||||
var st v0miner.State
|
||||
var st miner0.State
|
||||
if err := sm.ChainStore().Store(ctx).Get(ctx, act.Head, &st); err != nil {
|
||||
return xerrors.Errorf("failed to load miner state: %w", err)
|
||||
}
|
||||
@ -172,7 +172,7 @@ func UpgradeFaucetBurnRecovery(ctx context.Context, sm *StateManager, tree types
|
||||
}
|
||||
|
||||
// pull up power table to give miners back some funds proportional to their power
|
||||
var ps v0power.State
|
||||
var ps power0.State
|
||||
powAct, err := tree.GetActor(builtin.StoragePowerActorAddr)
|
||||
if err != nil {
|
||||
return xerrors.Errorf("failed to load power actor: %w", err)
|
||||
@ -211,12 +211,12 @@ func UpgradeFaucetBurnRecovery(ctx context.Context, sm *StateManager, tree types
|
||||
})
|
||||
}
|
||||
case builtin.StorageMinerActorCodeID:
|
||||
var st v0miner.State
|
||||
var st miner0.State
|
||||
if err := sm.ChainStore().Store(ctx).Get(ctx, act.Head, &st); err != nil {
|
||||
return xerrors.Errorf("failed to load miner state: %w", err)
|
||||
}
|
||||
|
||||
var minfo v0miner.MinerInfo
|
||||
var minfo miner0.MinerInfo
|
||||
if err := cst.Get(ctx, st.Info, &minfo); err != nil {
|
||||
return xerrors.Errorf("failed to get miner info: %w", err)
|
||||
}
|
||||
@ -240,7 +240,7 @@ func UpgradeFaucetBurnRecovery(ctx context.Context, sm *StateManager, tree types
|
||||
// Now make sure to give each miner who had power at the lookback some FIL
|
||||
lbact, err := lbtree.GetActor(addr)
|
||||
if err == nil {
|
||||
var lbst v0miner.State
|
||||
var lbst miner0.State
|
||||
if err := sm.ChainStore().Store(ctx).Get(ctx, lbact.Head, &lbst); err != nil {
|
||||
return xerrors.Errorf("failed to load miner state: %w", err)
|
||||
}
|
||||
|
@ -11,9 +11,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -33,11 +33,11 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
}
|
||||
|
||||
const testForkHeight = 40
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"fmt"
|
||||
"sync"
|
||||
|
||||
v0msig "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/multisig"
|
||||
|
||||
@ -23,7 +23,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0reward "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/util/adt"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@ -251,7 +251,7 @@ func (sm *StateManager) ApplyBlocks(ctx context.Context, parentEpoch abi.ChainEp
|
||||
|
||||
nv := sm.GetNtwkVersion(ctx, epoch)
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
params, err = actors.SerializeParams(&v0reward.AwardBlockRewardParams{
|
||||
params, err = actors.SerializeParams(&reward0.AwardBlockRewardParams{
|
||||
Miner: b.Miner,
|
||||
Penalty: penalty,
|
||||
GasReward: gasReward,
|
||||
@ -797,7 +797,7 @@ func (sm *StateManager) SetVMConstructor(nvm func(context.Context, *vm.VMOpts) (
|
||||
}
|
||||
|
||||
type genesisInfo struct {
|
||||
genesisMsigs []v0msig.State
|
||||
genesisMsigs []msig0.State
|
||||
// info about the Accounts in the genesis state
|
||||
genesisActors []genesisActor
|
||||
genesisPledge abi.TokenAmount
|
||||
@ -898,9 +898,9 @@ func (sm *StateManager) setupGenesisActors(ctx context.Context) error {
|
||||
return xerrors.Errorf("error setting up genesis infos: %w", err)
|
||||
}
|
||||
|
||||
gi.genesisMsigs = make([]v0msig.State, 0, len(totalsByEpoch))
|
||||
gi.genesisMsigs = make([]msig0.State, 0, len(totalsByEpoch))
|
||||
for k, v := range totalsByEpoch {
|
||||
ns := v0msig.State{
|
||||
ns := msig0.State{
|
||||
InitialBalance: v,
|
||||
UnlockDuration: k,
|
||||
PendingTxns: cid.Undef,
|
||||
@ -975,9 +975,9 @@ func (sm *StateManager) setupGenesisActorsTestnet(ctx context.Context) error {
|
||||
totalsByEpoch[sixYears] = big.NewInt(100_000_000)
|
||||
totalsByEpoch[sixYears] = big.Add(totalsByEpoch[sixYears], big.NewInt(300_000_000))
|
||||
|
||||
gi.genesisMsigs = make([]v0msig.State, 0, len(totalsByEpoch))
|
||||
gi.genesisMsigs = make([]msig0.State, 0, len(totalsByEpoch))
|
||||
for k, v := range totalsByEpoch {
|
||||
ns := v0msig.State{
|
||||
ns := msig0.State{
|
||||
InitialBalance: v,
|
||||
UnlockDuration: k,
|
||||
PendingTxns: cid.Undef,
|
||||
|
@ -9,11 +9,11 @@ import (
|
||||
"runtime"
|
||||
"strings"
|
||||
|
||||
v0init "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
saruntime "github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
@ -31,10 +31,10 @@ import (
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/cron"
|
||||
v0msig "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
v0reward "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -169,7 +169,7 @@ func GetMinerSectorSet(ctx context.Context, sm *StateManager, ts *types.TipSet,
|
||||
var sset []*miner.ChainSectorInfo
|
||||
var v cbg.Deferred
|
||||
if err := sectors.ForEach(&v, func(i int64) error {
|
||||
var oci v0miner.SectorOnChainInfo
|
||||
var oci miner0.SectorOnChainInfo
|
||||
if err := oci.UnmarshalCBOR(bytes.NewReader(v.Raw)); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -555,16 +555,16 @@ var MethodsMap = map[cid.Cid]map[abi.MethodNum]MethodMeta{}
|
||||
func init() {
|
||||
cidToMethods := map[cid.Cid][2]interface{}{
|
||||
// builtin.SystemActorCodeID: {builtin.MethodsSystem, system.Actor{} }- apparently it doesn't have methods
|
||||
builtin.InitActorCodeID: {builtin.MethodsInit, v0init.Actor{}},
|
||||
builtin.InitActorCodeID: {builtin.MethodsInit, init0.Actor{}},
|
||||
builtin.CronActorCodeID: {builtin.MethodsCron, cron.Actor{}},
|
||||
builtin.AccountActorCodeID: {builtin.MethodsAccount, account.Actor{}},
|
||||
builtin.StoragePowerActorCodeID: {builtin.MethodsPower, v0power.Actor{}},
|
||||
builtin.StorageMinerActorCodeID: {builtin.MethodsMiner, v0miner.Actor{}},
|
||||
builtin.StorageMarketActorCodeID: {builtin.MethodsMarket, v0market.Actor{}},
|
||||
builtin.StoragePowerActorCodeID: {builtin.MethodsPower, power0.Actor{}},
|
||||
builtin.StorageMinerActorCodeID: {builtin.MethodsMiner, miner0.Actor{}},
|
||||
builtin.StorageMarketActorCodeID: {builtin.MethodsMarket, market0.Actor{}},
|
||||
builtin.PaymentChannelActorCodeID: {builtin.MethodsPaych, paych.Actor{}},
|
||||
builtin.MultisigActorCodeID: {builtin.MethodsMultisig, v0msig.Actor{}},
|
||||
builtin.RewardActorCodeID: {builtin.MethodsReward, v0reward.Actor{}},
|
||||
builtin.VerifiedRegistryActorCodeID: {builtin.MethodsVerifiedRegistry, v0verifreg.Actor{}},
|
||||
builtin.MultisigActorCodeID: {builtin.MethodsMultisig, msig0.Actor{}},
|
||||
builtin.RewardActorCodeID: {builtin.MethodsReward, reward0.Actor{}},
|
||||
builtin.VerifiedRegistryActorCodeID: {builtin.MethodsVerifiedRegistry, verifreg0.Actor{}},
|
||||
}
|
||||
|
||||
for c, m := range cidToMethods {
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/gen"
|
||||
"github.com/filecoin-project/lotus/chain/store"
|
||||
@ -22,11 +22,11 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
}
|
||||
|
||||
func BenchmarkGetRandomness(b *testing.B) {
|
||||
|
@ -20,9 +20,9 @@ import (
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -43,11 +43,11 @@ func init() {
|
||||
if err != nil {
|
||||
panic(err)
|
||||
}
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
}
|
||||
|
||||
const source = 0
|
||||
|
@ -6,7 +6,7 @@ import (
|
||||
"math/rand"
|
||||
"os"
|
||||
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"golang.org/x/xerrors"
|
||||
@ -19,15 +19,15 @@ import (
|
||||
"github.com/filecoin-project/lotus/chain/types/mock"
|
||||
"github.com/filecoin-project/lotus/chain/vectors"
|
||||
"github.com/filecoin-project/lotus/chain/wallet"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
|
||||
_ "github.com/filecoin-project/lotus/lib/sigs/bls"
|
||||
_ "github.com/filecoin-project/lotus/lib/sigs/secp"
|
||||
)
|
||||
|
||||
func init() {
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(2048)
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(2048)
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
}
|
||||
|
||||
func MakeHeaderVectors() []vectors.HeaderVector {
|
||||
|
@ -10,18 +10,18 @@ import (
|
||||
cbg "github.com/whyrusleeping/cbor-gen"
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0account "github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
v0cron "github.com/filecoin-project/specs-actors/actors/builtin/cron"
|
||||
v0init "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0msig "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
v0paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0reward "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
v0system "github.com/filecoin-project/specs-actors/actors/builtin/system"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
account0 "github.com/filecoin-project/specs-actors/actors/builtin/account"
|
||||
cron0 "github.com/filecoin-project/specs-actors/actors/builtin/cron"
|
||||
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||
system0 "github.com/filecoin-project/specs-actors/actors/builtin/system"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
vmr "github.com/filecoin-project/specs-actors/actors/runtime"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
@ -46,17 +46,17 @@ func NewInvoker() *Invoker {
|
||||
|
||||
// add builtInCode using: register(cid, singleton)
|
||||
// NETUPGRADE: register code IDs for v2, etc.
|
||||
inv.Register(v0builtin.SystemActorCodeID, v0system.Actor{}, abi.EmptyValue{})
|
||||
inv.Register(v0builtin.InitActorCodeID, v0init.Actor{}, v0init.State{})
|
||||
inv.Register(v0builtin.RewardActorCodeID, v0reward.Actor{}, v0reward.State{})
|
||||
inv.Register(v0builtin.CronActorCodeID, v0cron.Actor{}, v0cron.State{})
|
||||
inv.Register(v0builtin.StoragePowerActorCodeID, v0power.Actor{}, v0power.State{})
|
||||
inv.Register(v0builtin.StorageMarketActorCodeID, v0market.Actor{}, v0market.State{})
|
||||
inv.Register(v0builtin.StorageMinerActorCodeID, v0miner.Actor{}, v0miner.State{})
|
||||
inv.Register(v0builtin.MultisigActorCodeID, v0msig.Actor{}, v0msig.State{})
|
||||
inv.Register(v0builtin.PaymentChannelActorCodeID, v0paych.Actor{}, v0paych.State{})
|
||||
inv.Register(v0builtin.VerifiedRegistryActorCodeID, v0verifreg.Actor{}, v0verifreg.State{})
|
||||
inv.Register(v0builtin.AccountActorCodeID, v0account.Actor{}, v0account.State{})
|
||||
inv.Register(builtin0.SystemActorCodeID, system0.Actor{}, abi.EmptyValue{})
|
||||
inv.Register(builtin0.InitActorCodeID, init0.Actor{}, init0.State{})
|
||||
inv.Register(builtin0.RewardActorCodeID, reward0.Actor{}, reward0.State{})
|
||||
inv.Register(builtin0.CronActorCodeID, cron0.Actor{}, cron0.State{})
|
||||
inv.Register(builtin0.StoragePowerActorCodeID, power0.Actor{}, power0.State{})
|
||||
inv.Register(builtin0.StorageMarketActorCodeID, market0.Actor{}, market0.State{})
|
||||
inv.Register(builtin0.StorageMinerActorCodeID, miner0.Actor{}, miner0.State{})
|
||||
inv.Register(builtin0.MultisigActorCodeID, msig0.Actor{}, msig0.State{})
|
||||
inv.Register(builtin0.PaymentChannelActorCodeID, paych0.Actor{}, paych0.State{})
|
||||
inv.Register(builtin0.VerifiedRegistryActorCodeID, verifreg0.Actor{}, verifreg0.State{})
|
||||
inv.Register(builtin0.AccountActorCodeID, account0.Actor{}, account0.State{})
|
||||
|
||||
return inv
|
||||
}
|
||||
@ -177,7 +177,7 @@ func DecodeParams(b []byte, out interface{}) error {
|
||||
}
|
||||
|
||||
func DumpActorState(code cid.Cid, b []byte) (interface{}, error) {
|
||||
if code == v0builtin.AccountActorCodeID { // Account code special case
|
||||
if code == builtin0.AccountActorCodeID { // Account code special case
|
||||
return nil, nil
|
||||
}
|
||||
|
||||
|
@ -17,7 +17,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
v0msig "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||
cid "github.com/ipfs/go-cid"
|
||||
cbor "github.com/ipfs/go-ipld-cbor"
|
||||
"github.com/urfave/cli/v2"
|
||||
@ -199,7 +199,7 @@ var msigInspectCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
var mstate v0msig.State
|
||||
var mstate msig0.State
|
||||
if err := mstate.UnmarshalCBOR(bytes.NewReader(obj)); err != nil {
|
||||
return err
|
||||
}
|
||||
@ -251,7 +251,7 @@ var msigInspectCmd = &cli.Command{
|
||||
},
|
||||
}
|
||||
|
||||
func GetMultisigPending(ctx context.Context, lapi api.FullNode, hroot cid.Cid) (map[int64]*v0msig.Transaction, error) {
|
||||
func GetMultisigPending(ctx context.Context, lapi api.FullNode, hroot cid.Cid) (map[int64]*msig0.Transaction, error) {
|
||||
bs := apibstore.NewAPIBlockstore(lapi)
|
||||
store := adt.WrapStore(ctx, cbor.NewCborStore(bs))
|
||||
|
||||
@ -260,8 +260,8 @@ func GetMultisigPending(ctx context.Context, lapi api.FullNode, hroot cid.Cid) (
|
||||
return nil, err
|
||||
}
|
||||
|
||||
txs := make(map[int64]*v0msig.Transaction)
|
||||
var tx v0msig.Transaction
|
||||
txs := make(map[int64]*msig0.Transaction)
|
||||
var tx msig0.Transaction
|
||||
err = nd.ForEach(&tx, func(k string) error {
|
||||
txid, _ := binary.Varint([]byte(k))
|
||||
|
||||
@ -276,7 +276,7 @@ func GetMultisigPending(ctx context.Context, lapi api.FullNode, hroot cid.Cid) (
|
||||
return txs, nil
|
||||
}
|
||||
|
||||
func state(tx *v0msig.Transaction) string {
|
||||
func state(tx *msig0.Transaction) string {
|
||||
/* // TODO(why): I strongly disagree with not having these... but i need to move forward
|
||||
if tx.Complete {
|
||||
return "done"
|
||||
@ -385,7 +385,7 @@ var msigProposeCmd = &cli.Command{
|
||||
return fmt.Errorf("proposal returned exit %d", wait.Receipt.ExitCode)
|
||||
}
|
||||
|
||||
var retval v0msig.ProposeReturn
|
||||
var retval msig0.ProposeReturn
|
||||
if err := retval.UnmarshalCBOR(bytes.NewReader(wait.Receipt.Return)); err != nil {
|
||||
return fmt.Errorf("failed to unmarshal propose return value: %w", err)
|
||||
}
|
||||
|
@ -15,9 +15,9 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
|
||||
"github.com/multiformats/go-multiaddr"
|
||||
|
||||
@ -40,11 +40,11 @@ import (
|
||||
)
|
||||
|
||||
func init() {
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
}
|
||||
|
||||
// TestPaymentChannels does a basic test to exercise the payment channel CLI
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
"strconv"
|
||||
"time"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/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/lotus/chain/actors/builtin/miner"
|
||||
@ -403,7 +403,7 @@ func (r *refunder) ProcessTipset(ctx context.Context, tipset *types.TipSet, refu
|
||||
}
|
||||
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
var proveCommitSector v0miner.ProveCommitSectorParams
|
||||
var proveCommitSector miner0.ProveCommitSectorParams
|
||||
if err := proveCommitSector.UnmarshalCBOR(bytes.NewBuffer(m.Params)); err != nil {
|
||||
log.Warnw("failed to decode provecommit params", "err", err, "method", messageMethod, "cid", msg.Cid, "miner", m.To)
|
||||
continue
|
||||
|
@ -16,7 +16,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
"github.com/filecoin-project/lotus/chain/types"
|
||||
@ -88,7 +88,7 @@ var actorSetAddrsCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&v0miner.ChangeMultiaddrsParams{NewMultiaddrs: addrs})
|
||||
params, err := actors.SerializeParams(&miner0.ChangeMultiaddrsParams{NewMultiaddrs: addrs})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -153,7 +153,7 @@ var actorSetPeeridCmd = &cli.Command{
|
||||
return err
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&v0miner.ChangePeerIDParams{NewID: abi.PeerID(pid)})
|
||||
params, err := actors.SerializeParams(&miner0.ChangePeerIDParams{NewID: abi.PeerID(pid)})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -226,7 +226,7 @@ var actorWithdrawCmd = &cli.Command{
|
||||
}
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&v0miner.WithdrawBalanceParams{
|
||||
params, err := actors.SerializeParams(&miner0.WithdrawBalanceParams{
|
||||
AmountRequested: amount, // Default to attempting to withdraw all the extra funds in the miner actor
|
||||
})
|
||||
if err != nil {
|
||||
@ -451,7 +451,7 @@ var actorControlSet = &cli.Command{
|
||||
return nil
|
||||
}
|
||||
|
||||
cwp := &v0miner.ChangeWorkerAddressParams{
|
||||
cwp := &miner0.ChangeWorkerAddressParams{
|
||||
NewWorker: mi.Worker,
|
||||
NewControlAddrs: toSet,
|
||||
}
|
||||
|
@ -32,10 +32,10 @@ import (
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/stores"
|
||||
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
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"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
|
||||
lapi "github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -373,7 +373,7 @@ func migratePreSealMeta(ctx context.Context, api lapi.FullNode, metadata string,
|
||||
return mds.Put(datastore.NewKey(modules.StorageCounterDSPrefix), buf[:size])
|
||||
}
|
||||
|
||||
func findMarketDealID(ctx context.Context, api lapi.FullNode, deal v0market.DealProposal) (abi.DealID, error) {
|
||||
func findMarketDealID(ctx context.Context, api lapi.FullNode, deal market0.DealProposal) (abi.DealID, error) {
|
||||
// TODO: find a better way
|
||||
// (this is only used by genesis miners)
|
||||
|
||||
@ -567,7 +567,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
|
||||
return xerrors.Errorf("getWorkerAddr returned bad address: %w", err)
|
||||
}
|
||||
|
||||
enc, err := actors.SerializeParams(&v0miner.ChangePeerIDParams{NewID: abi.PeerID(peerid)})
|
||||
enc, err := actors.SerializeParams(&miner0.ChangePeerIDParams{NewID: abi.PeerID(peerid)})
|
||||
if err != nil {
|
||||
return err
|
||||
}
|
||||
@ -575,7 +575,7 @@ func configureStorageMiner(ctx context.Context, api lapi.FullNode, addr address.
|
||||
msg := &types.Message{
|
||||
To: addr,
|
||||
From: mi.Worker,
|
||||
Method: v0builtin.MethodsMiner.ChangePeerID,
|
||||
Method: builtin0.MethodsMiner.ChangePeerID,
|
||||
Params: enc,
|
||||
Value: types.NewInt(0),
|
||||
GasPremium: gasPrice,
|
||||
@ -634,7 +634,7 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
|
||||
return address.Undef, err
|
||||
}
|
||||
|
||||
params, err := actors.SerializeParams(&v0power.CreateMinerParams{
|
||||
params, err := actors.SerializeParams(&power0.CreateMinerParams{
|
||||
Owner: owner,
|
||||
Worker: worker,
|
||||
SealProofType: spt,
|
||||
@ -654,11 +654,11 @@ func createStorageMiner(ctx context.Context, api lapi.FullNode, peerid peer.ID,
|
||||
}
|
||||
|
||||
createStorageMinerMsg := &types.Message{
|
||||
To: v0builtin.StoragePowerActorAddr,
|
||||
To: builtin0.StoragePowerActorAddr,
|
||||
From: sender,
|
||||
Value: big.Zero(),
|
||||
|
||||
Method: v0builtin.MethodsPower.CreateMiner,
|
||||
Method: builtin0.MethodsPower.CreateMiner,
|
||||
Params: params,
|
||||
|
||||
GasLimit: 0,
|
||||
@ -682,7 +682,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)
|
||||
}
|
||||
|
||||
var retval v0power.CreateMinerReturn
|
||||
var retval power0.CreateMinerReturn
|
||||
if err := retval.UnmarshalCBOR(bytes.NewReader(mw.Receipt.Return)); err != nil {
|
||||
return address.Undef, err
|
||||
}
|
||||
|
@ -13,7 +13,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
@ -380,7 +380,7 @@ var sectorsCapacityCollateralCmd = &cli.Command{
|
||||
Expiration: abi.ChainEpoch(cctx.Uint64("expiration")),
|
||||
}
|
||||
if pci.Expiration == 0 {
|
||||
pci.Expiration = v0miner.MaxSectorExpirationExtension
|
||||
pci.Expiration = miner0.MaxSectorExpirationExtension
|
||||
}
|
||||
pc, err := nApi.StateMinerInitialPledgeCollateral(ctx, maddr, pci, types.EmptyTSK)
|
||||
if err != nil {
|
||||
|
8
extern/storage-sealing/checks.go
vendored
8
extern/storage-sealing/checks.go
vendored
@ -5,9 +5,9 @@ import (
|
||||
"context"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
v0proof "github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
proof0 "github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -102,7 +102,7 @@ func checkPrecommit(ctx context.Context, maddr address.Address, si SectorInfo, t
|
||||
|
||||
var msd abi.ChainEpoch
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
msd = v0miner.MaxSealDuration[si.SectorType]
|
||||
msd = miner0.MaxSealDuration[si.SectorType]
|
||||
} else {
|
||||
// TODO: ActorUpgrade
|
||||
msd = 0
|
||||
@ -190,7 +190,7 @@ func (m *Sealing) checkCommit(ctx context.Context, si SectorInfo, proof []byte,
|
||||
log.Warn("on-chain sealed CID doesn't match!")
|
||||
}
|
||||
|
||||
ok, err := m.verif.VerifySeal(v0proof.SealVerifyInfo{
|
||||
ok, err := m.verif.VerifySeal(proof0.SealVerifyInfo{
|
||||
SectorID: m.minerSector(si.SectorNumber),
|
||||
SealedCID: pci.Info.SealedCID,
|
||||
SealProof: spt,
|
||||
|
4
extern/storage-sealing/constants.go
vendored
4
extern/storage-sealing/constants.go
vendored
@ -1,11 +1,11 @@
|
||||
package sealing
|
||||
|
||||
import (
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
)
|
||||
|
||||
// Epochs
|
||||
const SealRandomnessLookback = v0miner.ChainFinality
|
||||
const SealRandomnessLookback = miner0.ChainFinality
|
||||
|
||||
// Epochs
|
||||
const InteractivePoRepConfidence = 6
|
||||
|
4
extern/storage-sealing/precommit_policy.go
vendored
4
extern/storage-sealing/precommit_policy.go
vendored
@ -7,7 +7,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
)
|
||||
|
||||
type PreCommitPolicy interface {
|
||||
@ -87,7 +87,7 @@ func (p *BasicPreCommitPolicy) Expiration(ctx context.Context, ps ...Piece) (abi
|
||||
|
||||
var wpp abi.ChainEpoch
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
wpp = v0miner.WPoStProvingPeriod
|
||||
wpp = miner0.WPoStProvingPeriod
|
||||
} else {
|
||||
// TODO: ActorUpgrade
|
||||
wpp = 0
|
||||
|
4
extern/storage-sealing/sealing.go
vendored
4
extern/storage-sealing/sealing.go
vendored
@ -9,7 +9,7 @@ import (
|
||||
"time"
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/ipfs/go-cid"
|
||||
@ -430,7 +430,7 @@ func (m *Sealing) getPreCommitChallengeDelay(ctx context.Context, tok TipSetToke
|
||||
}
|
||||
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
return v0miner.PreCommitChallengeDelay, nil
|
||||
return miner0.PreCommitChallengeDelay, nil
|
||||
}
|
||||
|
||||
// TODO: ActorUpgrade
|
||||
|
8
extern/storage-sealing/states_sealing.go
vendored
8
extern/storage-sealing/states_sealing.go
vendored
@ -6,7 +6,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"golang.org/x/xerrors"
|
||||
|
||||
@ -191,8 +191,8 @@ func (m *Sealing) handlePreCommitting(ctx statemachine.Context, sector SectorInf
|
||||
var msd abi.ChainEpoch
|
||||
var mse abi.ChainEpoch
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
msd = v0miner.MaxSealDuration[sector.SectorType]
|
||||
mse = v0miner.MinSectorExpiration
|
||||
msd = miner0.MaxSealDuration[sector.SectorType]
|
||||
mse = miner0.MinSectorExpiration
|
||||
} else {
|
||||
// TODO: ActorUpgrade
|
||||
msd = 0
|
||||
@ -387,7 +387,7 @@ func (m *Sealing) handleSubmitCommit(ctx statemachine.Context, sector SectorInfo
|
||||
|
||||
enc := new(bytes.Buffer)
|
||||
if nv < build.ActorUpgradeNetworkVersion {
|
||||
params := &v0miner.ProveCommitSectorParams{
|
||||
params := &miner0.ProveCommitSectorParams{
|
||||
SectorNumber: sector.SectorNumber,
|
||||
Proof: sector.Proof,
|
||||
}
|
||||
|
@ -41,7 +41,7 @@ import (
|
||||
"github.com/filecoin-project/go-multistore"
|
||||
"github.com/filecoin-project/go-padreader"
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||
@ -87,7 +87,7 @@ func calcDealExpiration(minDuration uint64, md *dline.Info, startEpoch abi.Chain
|
||||
minExp := startEpoch + abi.ChainEpoch(minDuration)
|
||||
|
||||
// Align on miners ProvingPeriodBoundary
|
||||
return minExp + v0miner.WPoStProvingPeriod - (minExp % v0miner.WPoStProvingPeriod) + (md.PeriodStart % v0miner.WPoStProvingPeriod) - 1
|
||||
return minExp + miner0.WPoStProvingPeriod - (minExp % miner0.WPoStProvingPeriod) + (md.PeriodStart % miner0.WPoStProvingPeriod) - 1
|
||||
}
|
||||
|
||||
func (a *API) imgr() *importmgr.Mgr {
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"context"
|
||||
"strconv"
|
||||
|
||||
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/chain/actors/builtin/verifreg"
|
||||
|
||||
@ -24,7 +24,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/lotus/extern/sector-storage/ffiwrapper"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||
"github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
||||
|
||||
@ -921,7 +921,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
||||
duration := pci.Expiration - ts.Height()
|
||||
|
||||
// TODO: ActorUpgrade
|
||||
sectorWeight = v0miner.QAPowerForWeight(ssize, duration, w, vw)
|
||||
sectorWeight = miner0.QAPowerForWeight(ssize, duration, w, vw)
|
||||
}
|
||||
|
||||
var powerSmoothed smoothing.FilterEstimate
|
||||
@ -947,7 +947,7 @@ func (a *StateAPI) StateMinerPreCommitDepositForPower(ctx context.Context, maddr
|
||||
}
|
||||
|
||||
// TODO: ActorUpgrade
|
||||
deposit := v0miner.PreCommitDepositForPower(&rewardSmoothed, &powerSmoothed, sectorWeight)
|
||||
deposit := miner0.PreCommitDepositForPower(&rewardSmoothed, &powerSmoothed, sectorWeight)
|
||||
|
||||
return types.BigDiv(types.BigMul(deposit, initialPledgeNum), initialPledgeDen), nil
|
||||
}
|
||||
@ -983,7 +983,7 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
||||
duration := pci.Expiration - ts.Height()
|
||||
|
||||
// TODO: handle changes to this function across actor upgrades.
|
||||
sectorWeight = v0miner.QAPowerForWeight(ssize, duration, w, vw)
|
||||
sectorWeight = miner0.QAPowerForWeight(ssize, duration, w, vw)
|
||||
}
|
||||
|
||||
var (
|
||||
@ -1027,7 +1027,7 @@ func (a *StateAPI) StateMinerInitialPledgeCollateral(ctx context.Context, maddr
|
||||
|
||||
// TODO: ActorUpgrade
|
||||
|
||||
initialPledge := v0miner.InitialPledgeForPower(
|
||||
initialPledge := miner0.InitialPledgeForPower(
|
||||
sectorWeight,
|
||||
baselinePower,
|
||||
pledgeCollateral,
|
||||
@ -1145,7 +1145,7 @@ func (a *StateAPI) StateDealProviderCollateralBounds(ctx context.Context, size a
|
||||
return api.DealCollateralBounds{}, xerrors.Errorf("getting reward baseline power: %w", err)
|
||||
}
|
||||
|
||||
min, max := v0market.DealProviderCollateralBounds(size,
|
||||
min, max := market0.DealProviderCollateralBounds(size,
|
||||
verified,
|
||||
powClaim.RawBytePower,
|
||||
powClaim.QualityAdjPower,
|
||||
|
@ -10,9 +10,9 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/abi"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/lotus/lib/lotuslog"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
v0power "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
v0verifreg "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
power0 "github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||
verifreg0 "github.com/filecoin-project/specs-actors/actors/builtin/verifreg"
|
||||
logging "github.com/ipfs/go-log/v2"
|
||||
|
||||
"github.com/filecoin-project/lotus/api/test"
|
||||
@ -21,11 +21,11 @@ import (
|
||||
func init() {
|
||||
_ = logging.SetLogLevel("*", "INFO")
|
||||
|
||||
v0power.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
v0miner.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
power0.ConsensusMinerMinPower = big.NewInt(2048)
|
||||
miner0.SupportedProofTypes = map[abi.RegisteredSealProof]struct{}{
|
||||
abi.RegisteredSealProof_StackedDrg2KiBV1: {},
|
||||
}
|
||||
v0verifreg.MinVerifiedDealSize = big.NewInt(256)
|
||||
verifreg0.MinVerifiedDealSize = big.NewInt(256)
|
||||
}
|
||||
|
||||
func TestAPI(t *testing.T) {
|
||||
@ -68,7 +68,7 @@ func TestAPIDealFlowReal(t *testing.T) {
|
||||
logging.SetLogLevel("sub", "ERROR")
|
||||
logging.SetLogLevel("storageminer", "ERROR")
|
||||
|
||||
v0miner.PreCommitChallengeDelay = 5
|
||||
miner0.PreCommitChallengeDelay = 5
|
||||
|
||||
t.Run("basic", func(t *testing.T) {
|
||||
test.TestDealFlow(t, builder.Builder, time.Second, false, false)
|
||||
|
@ -37,7 +37,7 @@ import (
|
||||
"github.com/filecoin-project/lotus/node/repo"
|
||||
"github.com/filecoin-project/lotus/storage/mockstorage"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
"github.com/ipfs/go-datastore"
|
||||
"github.com/libp2p/go-libp2p-core/crypto"
|
||||
"github.com/libp2p/go-libp2p-core/peer"
|
||||
@ -83,7 +83,7 @@ func CreateTestStorageNode(ctx context.Context, t *testing.T, waddr address.Addr
|
||||
peerid, err := peer.IDFromPrivateKey(pk)
|
||||
require.NoError(t, err)
|
||||
|
||||
enc, err := actors.SerializeParams(&v0miner.ChangePeerIDParams{NewID: abi.PeerID(peerid)})
|
||||
enc, err := actors.SerializeParams(&miner0.ChangePeerIDParams{NewID: abi.PeerID(peerid)})
|
||||
require.NoError(t, err)
|
||||
|
||||
msg := &types.Message{
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
|
||||
"github.com/filecoin-project/go-address"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
v0paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||
@ -221,7 +221,7 @@ func (pm *Manager) GetChannelInfo(addr address.Address) (*ChannelInfo, error) {
|
||||
return ca.getChannelInfo(addr)
|
||||
}
|
||||
|
||||
func (pm *Manager) CreateVoucher(ctx context.Context, ch address.Address, voucher v0paych.SignedVoucher) (*api.VoucherCreateResult, error) {
|
||||
func (pm *Manager) CreateVoucher(ctx context.Context, ch address.Address, voucher paych0.SignedVoucher) (*api.VoucherCreateResult, error) {
|
||||
ca, err := pm.accessorByAddress(ch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
@ -233,7 +233,7 @@ func (pm *Manager) CreateVoucher(ctx context.Context, ch address.Address, vouche
|
||||
// CheckVoucherValid checks if the given voucher is valid (is or could become spendable at some point).
|
||||
// If the channel is not in the store, fetches the channel from state (and checks that
|
||||
// the channel To address is owned by the wallet).
|
||||
func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher) error {
|
||||
func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher) error {
|
||||
// Get an accessor for the channel, creating it from state if necessary
|
||||
ca, err := pm.inboundChannelAccessor(ctx, ch)
|
||||
if err != nil {
|
||||
@ -245,7 +245,7 @@ func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv
|
||||
}
|
||||
|
||||
// CheckVoucherSpendable checks if the given voucher is currently spendable
|
||||
func (pm *Manager) CheckVoucherSpendable(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||
func (pm *Manager) CheckVoucherSpendable(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||
ca, err := pm.accessorByAddress(ch)
|
||||
if err != nil {
|
||||
return false, err
|
||||
@ -256,7 +256,7 @@ func (pm *Manager) CheckVoucherSpendable(ctx context.Context, ch address.Address
|
||||
|
||||
// AddVoucherOutbound adds a voucher for an outbound channel.
|
||||
// Returns an error if the channel is not already in the store.
|
||||
func (pm *Manager) AddVoucherOutbound(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
func (pm *Manager) AddVoucherOutbound(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
ca, err := pm.accessorByAddress(ch)
|
||||
if err != nil {
|
||||
return types.NewInt(0), err
|
||||
@ -267,7 +267,7 @@ func (pm *Manager) AddVoucherOutbound(ctx context.Context, ch address.Address, s
|
||||
// AddVoucherInbound adds a voucher for an inbound channel.
|
||||
// If the channel is not in the store, fetches the channel from state (and checks that
|
||||
// the channel To address is owned by the wallet).
|
||||
func (pm *Manager) AddVoucherInbound(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
func (pm *Manager) AddVoucherInbound(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
// Get an accessor for the channel, creating it from state if necessary
|
||||
ca, err := pm.inboundChannelAccessor(ctx, ch)
|
||||
if err != nil {
|
||||
@ -336,7 +336,7 @@ func (pm *Manager) trackInboundChannel(ctx context.Context, ch address.Address)
|
||||
return pm.store.TrackChannel(stateCi)
|
||||
}
|
||||
|
||||
func (pm *Manager) SubmitVoucher(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error) {
|
||||
func (pm *Manager) SubmitVoucher(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error) {
|
||||
ca, err := pm.accessorByAddress(ch)
|
||||
if err != nil {
|
||||
return cid.Undef, err
|
||||
|
@ -12,7 +12,7 @@ import (
|
||||
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/chain/actors"
|
||||
@ -103,7 +103,7 @@ func (ca *channelAccessor) outboundActiveByFromTo(from, to address.Address) (*Ch
|
||||
// nonce, signing the voucher and storing it in the local datastore.
|
||||
// If there are not enough funds in the channel to create the voucher, returns
|
||||
// the shortfall in funds.
|
||||
func (ca *channelAccessor) createVoucher(ctx context.Context, ch address.Address, voucher v0paych.SignedVoucher) (*api.VoucherCreateResult, error) {
|
||||
func (ca *channelAccessor) createVoucher(ctx context.Context, ch address.Address, voucher paych0.SignedVoucher) (*api.VoucherCreateResult, error) {
|
||||
ca.lk.Lock()
|
||||
defer ca.lk.Unlock()
|
||||
|
||||
@ -162,14 +162,14 @@ func (ca *channelAccessor) nextNonceForLane(ci *ChannelInfo, lane uint64) uint64
|
||||
return maxnonce + 1
|
||||
}
|
||||
|
||||
func (ca *channelAccessor) checkVoucherValid(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher) (map[uint64]paych.LaneState, error) {
|
||||
func (ca *channelAccessor) checkVoucherValid(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher) (map[uint64]paych.LaneState, error) {
|
||||
ca.lk.Lock()
|
||||
defer ca.lk.Unlock()
|
||||
|
||||
return ca.checkVoucherValidUnlocked(ctx, ch, sv)
|
||||
}
|
||||
|
||||
func (ca *channelAccessor) checkVoucherValidUnlocked(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher) (map[uint64]paych.LaneState, error) {
|
||||
func (ca *channelAccessor) checkVoucherValidUnlocked(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher) (map[uint64]paych.LaneState, error) {
|
||||
if sv.ChannelAddr != ch {
|
||||
return nil, xerrors.Errorf("voucher ChannelAddr doesn't match channel address, got %s, expected %s", sv.ChannelAddr, ch)
|
||||
}
|
||||
@ -251,7 +251,7 @@ func (ca *channelAccessor) checkVoucherValidUnlocked(ctx context.Context, ch add
|
||||
return laneStates, nil
|
||||
}
|
||||
|
||||
func (ca *channelAccessor) checkVoucherSpendable(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||
func (ca *channelAccessor) checkVoucherSpendable(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||
ca.lk.Lock()
|
||||
defer ca.lk.Unlock()
|
||||
|
||||
@ -290,7 +290,7 @@ func (ca *channelAccessor) checkVoucherSpendable(ctx context.Context, ch address
|
||||
}
|
||||
}
|
||||
|
||||
enc, err := actors.SerializeParams(&v0paych.UpdateChannelStateParams{
|
||||
enc, err := actors.SerializeParams(&paych0.UpdateChannelStateParams{
|
||||
Sv: *sv,
|
||||
Secret: secret,
|
||||
Proof: proof,
|
||||
@ -325,14 +325,14 @@ func (ca *channelAccessor) getPaychRecipient(ctx context.Context, ch address.Add
|
||||
return state.To(), nil
|
||||
}
|
||||
|
||||
func (ca *channelAccessor) addVoucher(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
func (ca *channelAccessor) addVoucher(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
ca.lk.Lock()
|
||||
defer ca.lk.Unlock()
|
||||
|
||||
return ca.addVoucherUnlocked(ctx, ch, sv, proof, minDelta)
|
||||
}
|
||||
|
||||
func (ca *channelAccessor) addVoucherUnlocked(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
func (ca *channelAccessor) addVoucherUnlocked(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||
ci, err := ca.store.ByAddress(ch)
|
||||
if err != nil {
|
||||
return types.BigInt{}, err
|
||||
@ -396,7 +396,7 @@ func (ca *channelAccessor) addVoucherUnlocked(ctx context.Context, ch address.Ad
|
||||
return delta, ca.store.putChannelInfo(ci)
|
||||
}
|
||||
|
||||
func (ca *channelAccessor) submitVoucher(ctx context.Context, ch address.Address, sv *v0paych.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error) {
|
||||
func (ca *channelAccessor) submitVoucher(ctx context.Context, ch address.Address, sv *paych0.SignedVoucher, secret []byte, proof []byte) (cid.Cid, error) {
|
||||
ca.lk.Lock()
|
||||
defer ca.lk.Unlock()
|
||||
|
||||
@ -437,7 +437,7 @@ func (ca *channelAccessor) submitVoucher(ctx context.Context, ch address.Address
|
||||
}
|
||||
}
|
||||
|
||||
enc, err := actors.SerializeParams(&v0paych.UpdateChannelStateParams{
|
||||
enc, err := actors.SerializeParams(&paych0.UpdateChannelStateParams{
|
||||
Sv: *sv,
|
||||
Secret: secret,
|
||||
Proof: proof,
|
||||
@ -543,7 +543,7 @@ func (ca *channelAccessor) laneState(ctx context.Context, state paych.State, ch
|
||||
}
|
||||
|
||||
// Get the total redeemed amount across all lanes, after applying the voucher
|
||||
func (ca *channelAccessor) totalRedeemedWithVoucher(laneStates map[uint64]paych.LaneState, sv *v0paych.SignedVoucher) (big.Int, error) {
|
||||
func (ca *channelAccessor) totalRedeemedWithVoucher(laneStates map[uint64]paych.LaneState, sv *paych0.SignedVoucher) (big.Int, error) {
|
||||
// TODO: merges
|
||||
if len(sv.Merges) != 0 {
|
||||
return big.Int{}, xerrors.Errorf("dont currently support paych lane merges")
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
tutils "github.com/filecoin-project/specs-actors/support/testing"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
@ -339,7 +339,7 @@ func TestCreateVoucher(t *testing.T) {
|
||||
|
||||
// Create a voucher in lane 1
|
||||
voucherLane1Amt := big.NewInt(5)
|
||||
voucher := v0paych.SignedVoucher{
|
||||
voucher := paych0.SignedVoucher{
|
||||
Lane: 1,
|
||||
Amount: voucherLane1Amt,
|
||||
}
|
||||
@ -354,7 +354,7 @@ func TestCreateVoucher(t *testing.T) {
|
||||
|
||||
// Create a voucher in lane 1 again, with a higher amount
|
||||
voucherLane1Amt = big.NewInt(8)
|
||||
voucher = v0paych.SignedVoucher{
|
||||
voucher = paych0.SignedVoucher{
|
||||
Lane: 1,
|
||||
Amount: voucherLane1Amt,
|
||||
}
|
||||
@ -369,7 +369,7 @@ func TestCreateVoucher(t *testing.T) {
|
||||
// Create a voucher in lane 2 that covers all the remaining funds
|
||||
// in the channel
|
||||
voucherLane2Amt := big.Sub(s.amt, voucherLane1Amt)
|
||||
voucher = v0paych.SignedVoucher{
|
||||
voucher = paych0.SignedVoucher{
|
||||
Lane: 2,
|
||||
Amount: voucherLane2Amt,
|
||||
}
|
||||
@ -383,7 +383,7 @@ func TestCreateVoucher(t *testing.T) {
|
||||
// Create a voucher in lane 2 that exceeds the remaining funds in the
|
||||
// channel
|
||||
voucherLane2Amt = big.Add(voucherLane2Amt, big.NewInt(1))
|
||||
voucher = v0paych.SignedVoucher{
|
||||
voucher = paych0.SignedVoucher{
|
||||
Lane: 2,
|
||||
Amount: voucherLane2Amt,
|
||||
}
|
||||
@ -772,7 +772,7 @@ func TestCheckSpendable(t *testing.T) {
|
||||
|
||||
// Check that the secret and proof were passed through correctly
|
||||
lastCall := s.mock.getLastCall()
|
||||
var p v0paych.UpdateChannelStateParams
|
||||
var p paych0.UpdateChannelStateParams
|
||||
err = p.UnmarshalCBOR(bytes.NewReader(lastCall.Params))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, otherProof, p.Proof)
|
||||
@ -786,7 +786,7 @@ func TestCheckSpendable(t *testing.T) {
|
||||
require.True(t, spendable)
|
||||
|
||||
lastCall = s.mock.getLastCall()
|
||||
var p2 v0paych.UpdateChannelStateParams
|
||||
var p2 paych0.UpdateChannelStateParams
|
||||
err = p2.UnmarshalCBOR(bytes.NewReader(lastCall.Params))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, proof, p2.Proof)
|
||||
@ -843,7 +843,7 @@ func TestSubmitVoucher(t *testing.T) {
|
||||
|
||||
// Check that the secret and proof were passed through correctly
|
||||
msg := s.mock.pushedMessages(submitCid)
|
||||
var p v0paych.UpdateChannelStateParams
|
||||
var p paych0.UpdateChannelStateParams
|
||||
err = p.UnmarshalCBOR(bytes.NewReader(msg.Message.Params))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, submitProof, p.Proof)
|
||||
@ -863,7 +863,7 @@ func TestSubmitVoucher(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
msg = s.mock.pushedMessages(submitCid)
|
||||
var p2 v0paych.UpdateChannelStateParams
|
||||
var p2 paych0.UpdateChannelStateParams
|
||||
err = p2.UnmarshalCBOR(bytes.NewReader(msg.Message.Params))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, addVoucherProof2, p2.Proof)
|
||||
@ -879,7 +879,7 @@ func TestSubmitVoucher(t *testing.T) {
|
||||
require.NoError(t, err)
|
||||
|
||||
msg = s.mock.pushedMessages(submitCid)
|
||||
var p3 v0paych.UpdateChannelStateParams
|
||||
var p3 paych0.UpdateChannelStateParams
|
||||
err = p3.UnmarshalCBOR(bytes.NewReader(msg.Message.Params))
|
||||
require.NoError(t, err)
|
||||
require.Equal(t, proof3, p3.Proof)
|
||||
@ -966,8 +966,8 @@ func testGenerateKeyPair(t *testing.T) ([]byte, []byte) {
|
||||
return priv, pub
|
||||
}
|
||||
|
||||
func createTestVoucher(t *testing.T, ch address.Address, voucherLane uint64, nonce uint64, voucherAmount big.Int, key []byte) *v0paych.SignedVoucher {
|
||||
sv := &v0paych.SignedVoucher{
|
||||
func createTestVoucher(t *testing.T, ch address.Address, voucherLane uint64, nonce uint64, voucherAmount big.Int, key []byte) *paych0.SignedVoucher {
|
||||
sv := &paych0.SignedVoucher{
|
||||
ChannelAddr: ch,
|
||||
Lane: voucherLane,
|
||||
Nonce: nonce,
|
||||
@ -982,13 +982,13 @@ func createTestVoucher(t *testing.T, ch address.Address, voucherLane uint64, non
|
||||
return sv
|
||||
}
|
||||
|
||||
func createTestVoucherWithExtra(t *testing.T, ch address.Address, voucherLane uint64, nonce uint64, voucherAmount big.Int, key []byte) *v0paych.SignedVoucher {
|
||||
sv := &v0paych.SignedVoucher{
|
||||
func createTestVoucherWithExtra(t *testing.T, ch address.Address, voucherLane uint64, nonce uint64, voucherAmount big.Int, key []byte) *paych0.SignedVoucher {
|
||||
sv := &paych0.SignedVoucher{
|
||||
ChannelAddr: ch,
|
||||
Lane: voucherLane,
|
||||
Nonce: nonce,
|
||||
Amount: voucherAmount,
|
||||
Extra: &v0paych.ModVerifyParams{
|
||||
Extra: &paych0.ModVerifyParams{
|
||||
Actor: tutils.NewActorAddr(t, "act"),
|
||||
},
|
||||
}
|
||||
@ -1006,13 +1006,13 @@ type mockBestSpendableAPI struct {
|
||||
mgr *Manager
|
||||
}
|
||||
|
||||
func (m *mockBestSpendableAPI) PaychVoucherList(ctx context.Context, ch address.Address) ([]*v0paych.SignedVoucher, error) {
|
||||
func (m *mockBestSpendableAPI) PaychVoucherList(ctx context.Context, ch address.Address) ([]*paych0.SignedVoucher, error) {
|
||||
vi, err := m.mgr.ListVouchers(ctx, ch)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
}
|
||||
|
||||
out := make([]*v0paych.SignedVoucher, len(vi))
|
||||
out := make([]*paych0.SignedVoucher, len(vi))
|
||||
for k, v := range vi {
|
||||
out[k] = v.Voucher
|
||||
}
|
||||
@ -1020,7 +1020,7 @@ func (m *mockBestSpendableAPI) PaychVoucherList(ctx context.Context, ch address.
|
||||
return out, nil
|
||||
}
|
||||
|
||||
func (m *mockBestSpendableAPI) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, voucher *v0paych.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||
func (m *mockBestSpendableAPI) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, voucher *paych0.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||
return m.mgr.CheckVoucherSpendable(ctx, ch, voucher, secret, proof)
|
||||
}
|
||||
|
||||
|
@ -14,7 +14,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
init_ "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||
v0paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/build"
|
||||
@ -382,7 +382,7 @@ func (ca *channelAccessor) processTask(ctx context.Context, amt types.BigInt) *p
|
||||
|
||||
// createPaych sends a message to create the channel and returns the message cid
|
||||
func (ca *channelAccessor) createPaych(ctx context.Context, amt types.BigInt) (cid.Cid, error) {
|
||||
params, aerr := actors.SerializeParams(&v0paych.ConstructorParams{From: ca.from, To: ca.to})
|
||||
params, aerr := actors.SerializeParams(&paych0.ConstructorParams{From: ca.from, To: ca.to})
|
||||
if aerr != nil {
|
||||
return cid.Undef, aerr
|
||||
}
|
||||
|
@ -15,7 +15,7 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/big"
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0market "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||
|
||||
"github.com/filecoin-project/lotus/api"
|
||||
"github.com/filecoin-project/lotus/api/apibstore"
|
||||
@ -137,7 +137,7 @@ func (s SealingAPIAdapter) StateComputeDataCommitment(ctx context.Context, maddr
|
||||
return cid.Undef, xerrors.Errorf("failed to unmarshal TipSetToken to TipSetKey: %w", err)
|
||||
}
|
||||
|
||||
ccparams, err := actors.SerializeParams(&v0market.ComputeDataCommitmentParams{
|
||||
ccparams, err := actors.SerializeParams(&market0.ComputeDataCommitmentParams{
|
||||
DealIDs: deals,
|
||||
SectorType: sectorType,
|
||||
})
|
||||
|
@ -5,7 +5,7 @@ import (
|
||||
"errors"
|
||||
"time"
|
||||
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
|
||||
@ -146,7 +146,7 @@ func (m *Miner) Run(ctx context.Context) error {
|
||||
evts := events.NewEvents(ctx, m.api)
|
||||
adaptedAPI := NewSealingAPIAdapter(m.api)
|
||||
// TODO: Maybe we update this policy after actor upgrades?
|
||||
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, v0miner.MaxSectorExpirationExtension-(v0miner.WPoStProvingPeriod*2), md.PeriodStart%v0miner.WPoStProvingPeriod)
|
||||
pcp := sealing.NewBasicPreCommitPolicy(adaptedAPI, miner0.MaxSectorExpirationExtension-(miner0.WPoStProvingPeriod*2), md.PeriodStart%miner0.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)
|
||||
|
||||
go m.sealing.Run(ctx) //nolint:errcheck // logged intside the function
|
||||
|
@ -19,8 +19,8 @@ import (
|
||||
"github.com/filecoin-project/go-state-types/crypto"
|
||||
"github.com/filecoin-project/go-state-types/network"
|
||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0builtin "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
v0miner "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||
"github.com/filecoin-project/specs-actors/actors/runtime/proof"
|
||||
tutils "github.com/filecoin-project/specs-actors/support/testing"
|
||||
|
||||
@ -134,7 +134,7 @@ func TestWDPostDoPost(t *testing.T) {
|
||||
// without exceeding the message sector limit
|
||||
|
||||
require.NoError(t, err)
|
||||
partitionsPerMsg := int(v0miner.AddressedSectorsMax / sectorsPerPartition)
|
||||
partitionsPerMsg := int(miner0.AddressedSectorsMax / sectorsPerPartition)
|
||||
|
||||
// Enough partitions to fill expectedMsgCount-1 messages
|
||||
partitionCount := (expectedMsgCount - 1) * partitionsPerMsg
|
||||
@ -249,7 +249,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) {
|
||||
return &types.Actor{
|
||||
Code: v0builtin.StorageMinerActorCodeID,
|
||||
Code: builtin0.StorageMinerActorCodeID,
|
||||
}, nil
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user