Use new go-state-types accessors
This commit is contained in:
parent
ee11018780
commit
8cca9b1970
@ -20,11 +20,12 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/market"
|
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
"github.com/filecoin-project/lotus/chain/actors/builtin/power"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
@ -443,7 +444,7 @@ type FullNode interface {
|
|||||||
// StateMinerPower returns the power of the indicated miner
|
// StateMinerPower returns the power of the indicated miner
|
||||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error) //perm:read
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error) //perm:read
|
||||||
// StateMinerInfo returns info about the indicated miner
|
// StateMinerInfo returns info about the indicated miner
|
||||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) //perm:read
|
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (MinerInfo, error) //perm:read
|
||||||
// StateMinerDeadlines returns all the proving deadlines for the given miner
|
// StateMinerDeadlines returns all the proving deadlines for the given miner
|
||||||
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]Deadline, error) //perm:read
|
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]Deadline, error) //perm:read
|
||||||
// StateMinerPartitions returns all partitions in the specified deadline
|
// StateMinerPartitions returns all partitions in the specified deadline
|
||||||
@ -469,9 +470,9 @@ type FullNode interface {
|
|||||||
// expiration epoch
|
// expiration epoch
|
||||||
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error) //perm:read
|
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error) //perm:read
|
||||||
// StateSectorExpiration returns epoch at which given sector will expire
|
// StateSectorExpiration returns epoch at which given sector will expire
|
||||||
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error) //perm:read
|
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*lminer.SectorExpiration, error) //perm:read
|
||||||
// StateSectorPartition finds deadline/partition with the specified sector
|
// StateSectorPartition finds deadline/partition with the specified sector
|
||||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error) //perm:read
|
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*lminer.SectorLocation, error) //perm:read
|
||||||
// StateSearchMsg looks back up to limit epochs in the chain for a message, and returns its receipt and the tipset where it was executed
|
// StateSearchMsg looks back up to limit epochs in the chain for a message, and returns its receipt and the tipset where it was executed
|
||||||
//
|
//
|
||||||
// NOTE: If a replacing message is found on chain, this method will return
|
// NOTE: If a replacing message is found on chain, this method will return
|
||||||
@ -918,6 +919,20 @@ type MinerPower struct {
|
|||||||
HasMinPower bool
|
HasMinPower bool
|
||||||
}
|
}
|
||||||
|
|
||||||
|
type MinerInfo struct {
|
||||||
|
Owner address.Address // Must be an ID-address.
|
||||||
|
Worker address.Address // Must be an ID-address.
|
||||||
|
NewWorker address.Address // Must be an ID-address.
|
||||||
|
ControlAddresses []address.Address // Must be an ID-addresses.
|
||||||
|
WorkerChangeEpoch abi.ChainEpoch
|
||||||
|
PeerId *peer.ID
|
||||||
|
Multiaddrs []abi.Multiaddrs
|
||||||
|
WindowPoStProofType abi.RegisteredPoStProof
|
||||||
|
SectorSize abi.SectorSize
|
||||||
|
WindowPoStPartitionSectors uint64
|
||||||
|
ConsensusFaultElapsed abi.ChainEpoch
|
||||||
|
}
|
||||||
|
|
||||||
type QueryOffer struct {
|
type QueryOffer struct {
|
||||||
Err string
|
Err string
|
||||||
|
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -56,7 +56,7 @@ type Gateway interface {
|
|||||||
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
||||||
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MarketBalance, error)
|
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (MarketBalance, error)
|
||||||
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*MarketDeal, error)
|
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*MarketDeal, error)
|
||||||
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (miner.MinerInfo, error)
|
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (MinerInfo, error)
|
||||||
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
||||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*MinerPower, error)
|
||||||
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error)
|
StateNetworkVersion(context.Context, types.TipSetKey) (apitypes.NetworkVersion, error)
|
||||||
|
@ -5,8 +5,8 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"time"
|
"time"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -15,8 +15,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
datatransfer "github.com/filecoin-project/go-data-transfer"
|
datatransfer "github.com/filecoin-project/go-data-transfer"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-fil-markets/piecestore"
|
"github.com/filecoin-project/go-fil-markets/piecestore"
|
||||||
|
@ -3,12 +3,12 @@ package api
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/proof"
|
||||||
|
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
"github.com/filecoin-project/lotus/extern/sector-storage/storiface"
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
|
298
api/cbor_gen.go
298
api/cbor_gen.go
@ -9,8 +9,8 @@ import (
|
|||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
abi "github.com/filecoin-project/go-state-types/abi"
|
abi "github.com/filecoin-project/go-state-types/abi"
|
||||||
paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
market "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||||
market "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
xerrors "golang.org/x/xerrors"
|
xerrors "golang.org/x/xerrors"
|
||||||
@ -26,25 +26,26 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{163}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{163}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.Channel (address.Address) (struct)
|
// t.Channel (address.Address) (struct)
|
||||||
if len("Channel") > cbg.MaxLength {
|
if len("Channel") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"Channel\" was too long")
|
return xerrors.Errorf("Value in field \"Channel\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Channel"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Channel"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Channel")); err != nil {
|
if _, err := io.WriteString(w, string("Channel")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := t.Channel.MarshalCBOR(w); err != nil {
|
if err := t.Channel.MarshalCBOR(cw); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -53,14 +54,14 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"WaitSentinel\" was too long")
|
return xerrors.Errorf("Value in field \"WaitSentinel\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("WaitSentinel"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("WaitSentinel"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("WaitSentinel")); err != nil {
|
if _, err := io.WriteString(w, string("WaitSentinel")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteCidBuf(scratch, w, t.WaitSentinel); err != nil {
|
if err := cbg.WriteCid(cw, t.WaitSentinel); err != nil {
|
||||||
return xerrors.Errorf("failed to write cid field t.WaitSentinel: %w", err)
|
return xerrors.Errorf("failed to write cid field t.WaitSentinel: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -69,7 +70,7 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"Vouchers\" was too long")
|
return xerrors.Errorf("Value in field \"Vouchers\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Vouchers"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Vouchers"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Vouchers")); err != nil {
|
if _, err := io.WriteString(w, string("Vouchers")); err != nil {
|
||||||
@ -80,27 +81,32 @@ func (t *PaymentInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Slice value in field t.Vouchers was too long")
|
return xerrors.Errorf("Slice value in field t.Vouchers was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajArray, uint64(len(t.Vouchers))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Vouchers))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, v := range t.Vouchers {
|
for _, v := range t.Vouchers {
|
||||||
if err := v.MarshalCBOR(w); err != nil {
|
if err := v.MarshalCBOR(cw); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = PaymentInfo{}
|
*t = PaymentInfo{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -115,7 +121,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -129,7 +135,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if err := t.Channel.UnmarshalCBOR(br); err != nil {
|
if err := t.Channel.UnmarshalCBOR(cr); err != nil {
|
||||||
return xerrors.Errorf("unmarshaling t.Channel: %w", err)
|
return xerrors.Errorf("unmarshaling t.Channel: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -139,7 +145,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
c, err := cbg.ReadCid(br)
|
c, err := cbg.ReadCid(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to read cid field t.WaitSentinel: %w", err)
|
return xerrors.Errorf("failed to read cid field t.WaitSentinel: %w", err)
|
||||||
}
|
}
|
||||||
@ -150,7 +156,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.Vouchers ([]*paych.SignedVoucher) (slice)
|
// t.Vouchers ([]*paych.SignedVoucher) (slice)
|
||||||
case "Vouchers":
|
case "Vouchers":
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -170,7 +176,7 @@ func (t *PaymentInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := 0; i < int(extra); i++ {
|
for i := 0; i < int(extra); i++ {
|
||||||
|
|
||||||
var v paych.SignedVoucher
|
var v paych.SignedVoucher
|
||||||
if err := v.UnmarshalCBOR(br); err != nil {
|
if err := v.UnmarshalCBOR(cr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -190,25 +196,26 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{163}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{163}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.SectorID (abi.SectorNumber) (uint64)
|
// t.SectorID (abi.SectorNumber) (uint64)
|
||||||
if len("SectorID") > cbg.MaxLength {
|
if len("SectorID") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"SectorID\" was too long")
|
return xerrors.Errorf("Value in field \"SectorID\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("SectorID"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("SectorID"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("SectorID")); err != nil {
|
if _, err := io.WriteString(w, string("SectorID")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.SectorID)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.SectorID)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -217,14 +224,14 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"Offset\" was too long")
|
return xerrors.Errorf("Value in field \"Offset\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Offset"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Offset"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Offset")); err != nil {
|
if _, err := io.WriteString(w, string("Offset")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.Offset)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Offset)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -233,30 +240,35 @@ func (t *SealedRef) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"Size\" was too long")
|
return xerrors.Errorf("Value in field \"Size\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Size"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Size"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Size")); err != nil {
|
if _, err := io.WriteString(w, string("Size")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.Size)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Size)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
|
func (t *SealedRef) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = SealedRef{}
|
*t = SealedRef{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -271,7 +283,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -285,7 +297,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -300,7 +312,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -315,7 +327,7 @@ func (t *SealedRef) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -339,18 +351,19 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{161}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{161}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.Refs ([]api.SealedRef) (slice)
|
// t.Refs ([]api.SealedRef) (slice)
|
||||||
if len("Refs") > cbg.MaxLength {
|
if len("Refs") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"Refs\" was too long")
|
return xerrors.Errorf("Value in field \"Refs\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Refs"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Refs"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Refs")); err != nil {
|
if _, err := io.WriteString(w, string("Refs")); err != nil {
|
||||||
@ -361,27 +374,32 @@ func (t *SealedRefs) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Slice value in field t.Refs was too long")
|
return xerrors.Errorf("Slice value in field t.Refs was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajArray, uint64(len(t.Refs))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajArray, uint64(len(t.Refs))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
for _, v := range t.Refs {
|
for _, v := range t.Refs {
|
||||||
if err := v.MarshalCBOR(w); err != nil {
|
if err := v.MarshalCBOR(cw); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error {
|
func (t *SealedRefs) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = SealedRefs{}
|
*t = SealedRefs{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -396,7 +414,7 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -408,7 +426,7 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.Refs ([]api.SealedRef) (slice)
|
// t.Refs ([]api.SealedRef) (slice)
|
||||||
case "Refs":
|
case "Refs":
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -428,7 +446,7 @@ func (t *SealedRefs) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := 0; i < int(extra); i++ {
|
for i := 0; i < int(extra); i++ {
|
||||||
|
|
||||||
var v SealedRef
|
var v SealedRef
|
||||||
if err := v.UnmarshalCBOR(br); err != nil {
|
if err := v.UnmarshalCBOR(cr); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -448,18 +466,19 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{162}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{162}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.Value (abi.SealRandomness) (slice)
|
// t.Value (abi.SealRandomness) (slice)
|
||||||
if len("Value") > cbg.MaxLength {
|
if len("Value") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"Value\" was too long")
|
return xerrors.Errorf("Value in field \"Value\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Value"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Value"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Value")); err != nil {
|
if _, err := io.WriteString(w, string("Value")); err != nil {
|
||||||
@ -470,11 +489,11 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Byte array in field t.Value was too long")
|
return xerrors.Errorf("Byte array in field t.Value was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajByteString, uint64(len(t.Value))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Value))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := w.Write(t.Value[:]); err != nil {
|
if _, err := cw.Write(t.Value[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -483,7 +502,7 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"Epoch\" was too long")
|
return xerrors.Errorf("Value in field \"Epoch\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Epoch"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Epoch")); err != nil {
|
if _, err := io.WriteString(w, string("Epoch")); err != nil {
|
||||||
@ -491,27 +510,32 @@ func (t *SealTicket) MarshalCBOR(w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.Epoch >= 0 {
|
if t.Epoch >= 0 {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
|
func (t *SealTicket) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = SealTicket{}
|
*t = SealTicket{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -526,7 +550,7 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -538,7 +562,7 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.Value (abi.SealRandomness) (slice)
|
// t.Value (abi.SealRandomness) (slice)
|
||||||
case "Value":
|
case "Value":
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -554,13 +578,13 @@ func (t *SealTicket) UnmarshalCBOR(r io.Reader) error {
|
|||||||
t.Value = make([]uint8, extra)
|
t.Value = make([]uint8, extra)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := io.ReadFull(br, t.Value[:]); err != nil {
|
if _, err := io.ReadFull(cr, t.Value[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// t.Epoch (abi.ChainEpoch) (int64)
|
// t.Epoch (abi.ChainEpoch) (int64)
|
||||||
case "Epoch":
|
case "Epoch":
|
||||||
{
|
{
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
var extraI int64
|
var extraI int64
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -597,18 +621,19 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{162}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{162}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.Value (abi.InteractiveSealRandomness) (slice)
|
// t.Value (abi.InteractiveSealRandomness) (slice)
|
||||||
if len("Value") > cbg.MaxLength {
|
if len("Value") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"Value\" was too long")
|
return xerrors.Errorf("Value in field \"Value\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Value"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Value"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Value")); err != nil {
|
if _, err := io.WriteString(w, string("Value")); err != nil {
|
||||||
@ -619,11 +644,11 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Byte array in field t.Value was too long")
|
return xerrors.Errorf("Byte array in field t.Value was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajByteString, uint64(len(t.Value))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajByteString, uint64(len(t.Value))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := w.Write(t.Value[:]); err != nil {
|
if _, err := cw.Write(t.Value[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -632,7 +657,7 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"Epoch\" was too long")
|
return xerrors.Errorf("Value in field \"Epoch\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("Epoch"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("Epoch"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("Epoch")); err != nil {
|
if _, err := io.WriteString(w, string("Epoch")); err != nil {
|
||||||
@ -640,27 +665,32 @@ func (t *SealSeed) MarshalCBOR(w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.Epoch >= 0 {
|
if t.Epoch >= 0 {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.Epoch)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.Epoch-1)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
|
func (t *SealSeed) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = SealSeed{}
|
*t = SealSeed{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -675,7 +705,7 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -687,7 +717,7 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.Value (abi.InteractiveSealRandomness) (slice)
|
// t.Value (abi.InteractiveSealRandomness) (slice)
|
||||||
case "Value":
|
case "Value":
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -703,13 +733,13 @@ func (t *SealSeed) UnmarshalCBOR(r io.Reader) error {
|
|||||||
t.Value = make([]uint8, extra)
|
t.Value = make([]uint8, extra)
|
||||||
}
|
}
|
||||||
|
|
||||||
if _, err := io.ReadFull(br, t.Value[:]); err != nil {
|
if _, err := io.ReadFull(cr, t.Value[:]); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
// t.Epoch (abi.ChainEpoch) (int64)
|
// t.Epoch (abi.ChainEpoch) (int64)
|
||||||
case "Epoch":
|
case "Epoch":
|
||||||
{
|
{
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
var extraI int64
|
var extraI int64
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -746,18 +776,19 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{165}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{165}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.PublishCid (cid.Cid) (struct)
|
// t.PublishCid (cid.Cid) (struct)
|
||||||
if len("PublishCid") > cbg.MaxLength {
|
if len("PublishCid") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"PublishCid\" was too long")
|
return xerrors.Errorf("Value in field \"PublishCid\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("PublishCid"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("PublishCid"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("PublishCid")); err != nil {
|
if _, err := io.WriteString(w, string("PublishCid")); err != nil {
|
||||||
@ -765,11 +796,11 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.PublishCid == nil {
|
if t.PublishCid == nil {
|
||||||
if _, err := w.Write(cbg.CborNull); err != nil {
|
if _, err := cw.Write(cbg.CborNull); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := cbg.WriteCidBuf(scratch, w, *t.PublishCid); err != nil {
|
if err := cbg.WriteCid(cw, *t.PublishCid); err != nil {
|
||||||
return xerrors.Errorf("failed to write cid field t.PublishCid: %w", err)
|
return xerrors.Errorf("failed to write cid field t.PublishCid: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -779,14 +810,14 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"DealID\" was too long")
|
return xerrors.Errorf("Value in field \"DealID\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("DealID"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealID"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("DealID")); err != nil {
|
if _, err := io.WriteString(w, string("DealID")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.DealID)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.DealID)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -795,14 +826,14 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"DealProposal\" was too long")
|
return xerrors.Errorf("Value in field \"DealProposal\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("DealProposal"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealProposal"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("DealProposal")); err != nil {
|
if _, err := io.WriteString(w, string("DealProposal")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := t.DealProposal.MarshalCBOR(w); err != nil {
|
if err := t.DealProposal.MarshalCBOR(cw); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -811,14 +842,14 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"DealSchedule\" was too long")
|
return xerrors.Errorf("Value in field \"DealSchedule\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("DealSchedule"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("DealSchedule"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("DealSchedule")); err != nil {
|
if _, err := io.WriteString(w, string("DealSchedule")); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := t.DealSchedule.MarshalCBOR(w); err != nil {
|
if err := t.DealSchedule.MarshalCBOR(cw); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -827,7 +858,7 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"KeepUnsealed\" was too long")
|
return xerrors.Errorf("Value in field \"KeepUnsealed\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("KeepUnsealed"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("KeepUnsealed"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("KeepUnsealed")); err != nil {
|
if _, err := io.WriteString(w, string("KeepUnsealed")); err != nil {
|
||||||
@ -840,16 +871,21 @@ func (t *PieceDealInfo) MarshalCBOR(w io.Writer) error {
|
|||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = PieceDealInfo{}
|
*t = PieceDealInfo{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -864,7 +900,7 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -878,16 +914,16 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
b, err := br.ReadByte()
|
b, err := cr.ReadByte()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if b != cbg.CborNull[0] {
|
if b != cbg.CborNull[0] {
|
||||||
if err := br.UnreadByte(); err != nil {
|
if err := cr.UnreadByte(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
c, err := cbg.ReadCid(br)
|
c, err := cbg.ReadCid(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to read cid field t.PublishCid: %w", err)
|
return xerrors.Errorf("failed to read cid field t.PublishCid: %w", err)
|
||||||
}
|
}
|
||||||
@ -901,7 +937,7 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -916,16 +952,16 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
b, err := br.ReadByte()
|
b, err := cr.ReadByte()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if b != cbg.CborNull[0] {
|
if b != cbg.CborNull[0] {
|
||||||
if err := br.UnreadByte(); err != nil {
|
if err := cr.UnreadByte(); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
t.DealProposal = new(market.DealProposal)
|
t.DealProposal = new(market.DealProposal)
|
||||||
if err := t.DealProposal.UnmarshalCBOR(br); err != nil {
|
if err := t.DealProposal.UnmarshalCBOR(cr); err != nil {
|
||||||
return xerrors.Errorf("unmarshaling t.DealProposal pointer: %w", err)
|
return xerrors.Errorf("unmarshaling t.DealProposal pointer: %w", err)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -936,7 +972,7 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
|
|
||||||
{
|
{
|
||||||
|
|
||||||
if err := t.DealSchedule.UnmarshalCBOR(br); err != nil {
|
if err := t.DealSchedule.UnmarshalCBOR(cr); err != nil {
|
||||||
return xerrors.Errorf("unmarshaling t.DealSchedule: %w", err)
|
return xerrors.Errorf("unmarshaling t.DealSchedule: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -944,7 +980,7 @@ func (t *PieceDealInfo) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.KeepUnsealed (bool) (bool)
|
// t.KeepUnsealed (bool) (bool)
|
||||||
case "KeepUnsealed":
|
case "KeepUnsealed":
|
||||||
|
|
||||||
maj, extra, err = cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err = cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -973,18 +1009,19 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error {
|
|||||||
_, err := w.Write(cbg.CborNull)
|
_, err := w.Write(cbg.CborNull)
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := w.Write([]byte{162}); err != nil {
|
|
||||||
|
cw := cbg.NewCborWriter(w)
|
||||||
|
|
||||||
|
if _, err := cw.Write([]byte{162}); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
scratch := make([]byte, 9)
|
|
||||||
|
|
||||||
// t.StartEpoch (abi.ChainEpoch) (int64)
|
// t.StartEpoch (abi.ChainEpoch) (int64)
|
||||||
if len("StartEpoch") > cbg.MaxLength {
|
if len("StartEpoch") > cbg.MaxLength {
|
||||||
return xerrors.Errorf("Value in field \"StartEpoch\" was too long")
|
return xerrors.Errorf("Value in field \"StartEpoch\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("StartEpoch"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("StartEpoch"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("StartEpoch")); err != nil {
|
if _, err := io.WriteString(w, string("StartEpoch")); err != nil {
|
||||||
@ -992,11 +1029,11 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.StartEpoch >= 0 {
|
if t.StartEpoch >= 0 {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.StartEpoch)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.StartEpoch)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.StartEpoch-1)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.StartEpoch-1)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -1006,7 +1043,7 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error {
|
|||||||
return xerrors.Errorf("Value in field \"EndEpoch\" was too long")
|
return xerrors.Errorf("Value in field \"EndEpoch\" was too long")
|
||||||
}
|
}
|
||||||
|
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajTextString, uint64(len("EndEpoch"))); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajTextString, uint64(len("EndEpoch"))); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
if _, err := io.WriteString(w, string("EndEpoch")); err != nil {
|
if _, err := io.WriteString(w, string("EndEpoch")); err != nil {
|
||||||
@ -1014,27 +1051,32 @@ func (t *DealSchedule) MarshalCBOR(w io.Writer) error {
|
|||||||
}
|
}
|
||||||
|
|
||||||
if t.EndEpoch >= 0 {
|
if t.EndEpoch >= 0 {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajUnsignedInt, uint64(t.EndEpoch)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajUnsignedInt, uint64(t.EndEpoch)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
if err := cbg.WriteMajorTypeHeaderBuf(scratch, w, cbg.MajNegativeInt, uint64(-t.EndEpoch-1)); err != nil {
|
if err := cw.WriteMajorTypeHeader(cbg.MajNegativeInt, uint64(-t.EndEpoch-1)); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return nil
|
return nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (t *DealSchedule) UnmarshalCBOR(r io.Reader) error {
|
func (t *DealSchedule) UnmarshalCBOR(r io.Reader) (err error) {
|
||||||
*t = DealSchedule{}
|
*t = DealSchedule{}
|
||||||
|
|
||||||
br := cbg.GetPeeker(r)
|
cr := cbg.NewCborReader(r)
|
||||||
scratch := make([]byte, 8)
|
|
||||||
|
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
defer func() {
|
||||||
|
if err == io.EOF {
|
||||||
|
err = io.ErrUnexpectedEOF
|
||||||
|
}
|
||||||
|
}()
|
||||||
|
|
||||||
if maj != cbg.MajMap {
|
if maj != cbg.MajMap {
|
||||||
return fmt.Errorf("cbor input should be of type map")
|
return fmt.Errorf("cbor input should be of type map")
|
||||||
}
|
}
|
||||||
@ -1049,7 +1091,7 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) error {
|
|||||||
for i := uint64(0); i < n; i++ {
|
for i := uint64(0); i < n; i++ {
|
||||||
|
|
||||||
{
|
{
|
||||||
sval, err := cbg.ReadStringBuf(br, scratch)
|
sval, err := cbg.ReadString(cr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -1061,7 +1103,7 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.StartEpoch (abi.ChainEpoch) (int64)
|
// t.StartEpoch (abi.ChainEpoch) (int64)
|
||||||
case "StartEpoch":
|
case "StartEpoch":
|
||||||
{
|
{
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
var extraI int64
|
var extraI int64
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -1087,7 +1129,7 @@ func (t *DealSchedule) UnmarshalCBOR(r io.Reader) error {
|
|||||||
// t.EndEpoch (abi.ChainEpoch) (int64)
|
// t.EndEpoch (abi.ChainEpoch) (int64)
|
||||||
case "EndEpoch":
|
case "EndEpoch":
|
||||||
{
|
{
|
||||||
maj, extra, err := cbg.CborReadHeaderBuf(br, scratch)
|
maj, extra, err := cr.ReadHeader()
|
||||||
var extraI int64
|
var extraI int64
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -17,18 +17,18 @@ import (
|
|||||||
auth "github.com/filecoin-project/go-jsonrpc/auth"
|
auth "github.com/filecoin-project/go-jsonrpc/auth"
|
||||||
abi "github.com/filecoin-project/go-state-types/abi"
|
abi "github.com/filecoin-project/go-state-types/abi"
|
||||||
big "github.com/filecoin-project/go-state-types/big"
|
big "github.com/filecoin-project/go-state-types/big"
|
||||||
|
miner "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
crypto "github.com/filecoin-project/go-state-types/crypto"
|
crypto "github.com/filecoin-project/go-state-types/crypto"
|
||||||
dline "github.com/filecoin-project/go-state-types/dline"
|
dline "github.com/filecoin-project/go-state-types/dline"
|
||||||
network "github.com/filecoin-project/go-state-types/network"
|
network "github.com/filecoin-project/go-state-types/network"
|
||||||
api "github.com/filecoin-project/lotus/api"
|
api "github.com/filecoin-project/lotus/api"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
miner "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
types "github.com/filecoin-project/lotus/chain/types"
|
types "github.com/filecoin-project/lotus/chain/types"
|
||||||
alerting "github.com/filecoin-project/lotus/journal/alerting"
|
alerting "github.com/filecoin-project/lotus/journal/alerting"
|
||||||
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
|
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
imports "github.com/filecoin-project/lotus/node/repo/imports"
|
imports "github.com/filecoin-project/lotus/node/repo/imports"
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
||||||
paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
uuid "github.com/google/uuid"
|
uuid "github.com/google/uuid"
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
@ -2617,10 +2617,10 @@ func (mr *MockFullNodeMockRecorder) StateMinerFaults(arg0, arg1, arg2 interface{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMinerInfo mocks base method.
|
// StateMinerInfo mocks base method.
|
||||||
func (m *MockFullNode) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (m *MockFullNode) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (api.MinerInfo, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
||||||
ret0, _ := ret[0].(miner.MinerInfo)
|
ret0, _ := ret[0].(api.MinerInfo)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@ -2632,7 +2632,7 @@ func (mr *MockFullNodeMockRecorder) StateMinerInfo(arg0, arg1, arg2 interface{})
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMinerInitialPledgeCollateral mocks base method.
|
// StateMinerInitialPledgeCollateral mocks base method.
|
||||||
func (m *MockFullNode) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner0.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
func (m *MockFullNode) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(big.Int)
|
ret0, _ := ret[0].(big.Int)
|
||||||
@ -2677,7 +2677,7 @@ func (mr *MockFullNodeMockRecorder) StateMinerPower(arg0, arg1, arg2 interface{}
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMinerPreCommitDepositForPower mocks base method.
|
// StateMinerPreCommitDepositForPower mocks base method.
|
||||||
func (m *MockFullNode) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner0.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
func (m *MockFullNode) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(big.Int)
|
ret0, _ := ret[0].(big.Int)
|
||||||
@ -2842,10 +2842,10 @@ func (mr *MockFullNodeMockRecorder) StateSearchMsg(arg0, arg1, arg2, arg3, arg4
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateSectorExpiration mocks base method.
|
// StateSectorExpiration mocks base method.
|
||||||
func (m *MockFullNode) StateSectorExpiration(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorExpiration, error) {
|
func (m *MockFullNode) StateSectorExpiration(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner0.SectorExpiration, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateSectorExpiration", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateSectorExpiration", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(*miner.SectorExpiration)
|
ret0, _ := ret[0].(*miner0.SectorExpiration)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@ -2872,10 +2872,10 @@ func (mr *MockFullNodeMockRecorder) StateSectorGetInfo(arg0, arg1, arg2, arg3 in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateSectorPartition mocks base method.
|
// StateSectorPartition mocks base method.
|
||||||
func (m *MockFullNode) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorLocation, error) {
|
func (m *MockFullNode) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner0.SectorLocation, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(*miner.SectorLocation)
|
ret0, _ := ret[0].(*miner0.SectorLocation)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
@ -15,13 +15,15 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/go-jsonrpc/auth"
|
"github.com/filecoin-project/go-jsonrpc/auth"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||||
|
"github.com/filecoin-project/go-state-types/proof"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
"github.com/filecoin-project/lotus/extern/sector-storage/fsutil"
|
||||||
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
"github.com/filecoin-project/lotus/extern/sector-storage/sealtasks"
|
||||||
@ -30,7 +32,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/journal/alerting"
|
"github.com/filecoin-project/lotus/journal/alerting"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/node/repo/imports"
|
"github.com/filecoin-project/lotus/node/repo/imports"
|
||||||
"github.com/filecoin-project/specs-actors/v5/actors/runtime/proof"
|
|
||||||
"github.com/filecoin-project/specs-storage/storage"
|
"github.com/filecoin-project/specs-storage/storage"
|
||||||
"github.com/google/uuid"
|
"github.com/google/uuid"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -380,7 +381,7 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
StateMinerFaults func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
StateMinerFaults func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) `perm:"read"`
|
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MinerInfo, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerInitialPledgeCollateral func(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
StateMinerInitialPledgeCollateral func(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
||||||
|
|
||||||
@ -410,11 +411,11 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
StateSearchMsg func(p0 context.Context, p1 types.TipSetKey, p2 cid.Cid, p3 abi.ChainEpoch, p4 bool) (*MsgLookup, error) `perm:"read"`
|
StateSearchMsg func(p0 context.Context, p1 types.TipSetKey, p2 cid.Cid, p3 abi.ChainEpoch, p4 bool) (*MsgLookup, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorExpiration func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorExpiration, error) `perm:"read"`
|
StateSectorExpiration func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorExpiration, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorGetInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorOnChainInfo, error) `perm:"read"`
|
StateSectorGetInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorOnChainInfo, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorPartition func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorLocation, error) `perm:"read"`
|
StateSectorPartition func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorPreCommitInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) `perm:"read"`
|
StateSectorPreCommitInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) `perm:"read"`
|
||||||
|
|
||||||
@ -534,7 +535,7 @@ type GatewayStruct struct {
|
|||||||
|
|
||||||
StateMarketStorageDeal func(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*MarketDeal, error) ``
|
StateMarketStorageDeal func(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*MarketDeal, error) ``
|
||||||
|
|
||||||
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) ``
|
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MinerInfo, error) ``
|
||||||
|
|
||||||
StateMinerPower func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*MinerPower, error) ``
|
StateMinerPower func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*MinerPower, error) ``
|
||||||
|
|
||||||
@ -2616,15 +2617,15 @@ func (s *FullNodeStub) StateMinerFaults(p0 context.Context, p1 address.Address,
|
|||||||
return *new(bitfield.BitField), ErrNotSupported
|
return *new(bitfield.BitField), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *FullNodeStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MinerInfo, error) {
|
||||||
if s.Internal.StateMinerInfo == nil {
|
if s.Internal.StateMinerInfo == nil {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateMinerInfo(p0, p1, p2)
|
return s.Internal.StateMinerInfo(p0, p1, p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *FullNodeStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MinerInfo, error) {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) {
|
func (s *FullNodeStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) {
|
||||||
@ -2781,14 +2782,14 @@ func (s *FullNodeStub) StateSearchMsg(p0 context.Context, p1 types.TipSetKey, p2
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorExpiration, error) {
|
func (s *FullNodeStruct) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorExpiration, error) {
|
||||||
if s.Internal.StateSectorExpiration == nil {
|
if s.Internal.StateSectorExpiration == nil {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateSectorExpiration(p0, p1, p2, p3)
|
return s.Internal.StateSectorExpiration(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorExpiration, error) {
|
func (s *FullNodeStub) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorExpiration, error) {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2803,14 +2804,14 @@ func (s *FullNodeStub) StateSectorGetInfo(p0 context.Context, p1 address.Address
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorLocation, error) {
|
func (s *FullNodeStruct) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) {
|
||||||
if s.Internal.StateSectorPartition == nil {
|
if s.Internal.StateSectorPartition == nil {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateSectorPartition(p0, p1, p2, p3)
|
return s.Internal.StateSectorPartition(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorLocation, error) {
|
func (s *FullNodeStub) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -3408,15 +3409,15 @@ func (s *GatewayStub) StateMarketStorageDeal(p0 context.Context, p1 abi.DealID,
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewayStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *GatewayStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MinerInfo, error) {
|
||||||
if s.Internal.StateMinerInfo == nil {
|
if s.Internal.StateMinerInfo == nil {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateMinerInfo(p0, p1, p2)
|
return s.Internal.StateMinerInfo(p0, p1, p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewayStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *GatewayStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (MinerInfo, error) {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewayStruct) StateMinerPower(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*MinerPower, error) {
|
func (s *GatewayStruct) StateMinerPower(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*MinerPower, error) {
|
||||||
|
@ -15,10 +15,11 @@ import (
|
|||||||
textselector "github.com/ipld/go-ipld-selector-text-lite"
|
textselector "github.com/ipld/go-ipld-selector-text-lite"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
@ -416,7 +417,7 @@ type FullNode interface {
|
|||||||
// StateMinerPower returns the power of the indicated miner
|
// StateMinerPower returns the power of the indicated miner
|
||||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error) //perm:read
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error) //perm:read
|
||||||
// StateMinerInfo returns info about the indicated miner
|
// StateMinerInfo returns info about the indicated miner
|
||||||
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (miner.MinerInfo, error) //perm:read
|
StateMinerInfo(context.Context, address.Address, types.TipSetKey) (api.MinerInfo, error) //perm:read
|
||||||
// StateMinerDeadlines returns all the proving deadlines for the given miner
|
// StateMinerDeadlines returns all the proving deadlines for the given miner
|
||||||
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error) //perm:read
|
StateMinerDeadlines(context.Context, address.Address, types.TipSetKey) ([]api.Deadline, error) //perm:read
|
||||||
// StateMinerPartitions returns all partitions in the specified deadline
|
// StateMinerPartitions returns all partitions in the specified deadline
|
||||||
@ -442,9 +443,9 @@ type FullNode interface {
|
|||||||
// expiration epoch
|
// expiration epoch
|
||||||
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error) //perm:read
|
StateSectorGetInfo(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorOnChainInfo, error) //perm:read
|
||||||
// StateSectorExpiration returns epoch at which given sector will expire
|
// StateSectorExpiration returns epoch at which given sector will expire
|
||||||
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*miner.SectorExpiration, error) //perm:read
|
StateSectorExpiration(context.Context, address.Address, abi.SectorNumber, types.TipSetKey) (*lminer.SectorExpiration, error) //perm:read
|
||||||
// StateSectorPartition finds deadline/partition with the specified sector
|
// StateSectorPartition finds deadline/partition with the specified sector
|
||||||
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*miner.SectorLocation, error) //perm:read
|
StateSectorPartition(ctx context.Context, maddr address.Address, sectorNumber abi.SectorNumber, tok types.TipSetKey) (*lminer.SectorLocation, error) //perm:read
|
||||||
// StateSearchMsg searches for a message in the chain, and returns its receipt and the tipset where it was executed
|
// StateSearchMsg searches for a message in the chain, and returns its receipt and the tipset where it was executed
|
||||||
//
|
//
|
||||||
// NOTE: If a replacing message is found on chain, this method will return
|
// NOTE: If a replacing message is found on chain, this method will return
|
||||||
|
@ -10,8 +10,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||||
|
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -54,7 +54,7 @@ type Gateway interface {
|
|||||||
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
StateLookupID(ctx context.Context, addr address.Address, tsk types.TipSetKey) (address.Address, error)
|
||||||
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MarketBalance, error)
|
StateMarketBalance(ctx context.Context, addr address.Address, tsk types.TipSetKey) (api.MarketBalance, error)
|
||||||
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error)
|
StateMarketStorageDeal(ctx context.Context, dealId abi.DealID, tsk types.TipSetKey) (*api.MarketDeal, error)
|
||||||
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (miner.MinerInfo, error)
|
StateMinerInfo(ctx context.Context, actor address.Address, tsk types.TipSetKey) (api.MinerInfo, error)
|
||||||
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
StateMinerProvingDeadline(ctx context.Context, addr address.Address, tsk types.TipSetKey) (*dline.Info, error)
|
||||||
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error)
|
StateMinerPower(context.Context, address.Address, types.TipSetKey) (*api.MinerPower, error)
|
||||||
StateNetworkVersion(context.Context, types.TipSetKey) (abinetwork.Version, error)
|
StateNetworkVersion(context.Context, types.TipSetKey) (abinetwork.Version, error)
|
||||||
|
@ -11,13 +11,14 @@ import (
|
|||||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
"github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
"github.com/filecoin-project/go-state-types/crypto"
|
"github.com/filecoin-project/go-state-types/crypto"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
abinetwork "github.com/filecoin-project/go-state-types/network"
|
abinetwork "github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
lminer "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin/paych"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
@ -297,7 +298,7 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
StateMinerFaults func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
StateMinerFaults func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (bitfield.BitField, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) `perm:"read"`
|
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MinerInfo, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerInitialPledgeCollateral func(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
StateMinerInitialPledgeCollateral func(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) `perm:"read"`
|
||||||
|
|
||||||
@ -329,11 +330,11 @@ type FullNodeStruct struct {
|
|||||||
|
|
||||||
StateSearchMsgLimited func(p0 context.Context, p1 cid.Cid, p2 abi.ChainEpoch) (*api.MsgLookup, error) `perm:"read"`
|
StateSearchMsgLimited func(p0 context.Context, p1 cid.Cid, p2 abi.ChainEpoch) (*api.MsgLookup, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorExpiration func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorExpiration, error) `perm:"read"`
|
StateSectorExpiration func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorExpiration, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorGetInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorOnChainInfo, error) `perm:"read"`
|
StateSectorGetInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorOnChainInfo, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorPartition func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorLocation, error) `perm:"read"`
|
StateSectorPartition func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) `perm:"read"`
|
||||||
|
|
||||||
StateSectorPreCommitInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) `perm:"read"`
|
StateSectorPreCommitInfo func(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (miner.SectorPreCommitOnChainInfo, error) `perm:"read"`
|
||||||
|
|
||||||
@ -445,7 +446,7 @@ type GatewayStruct struct {
|
|||||||
|
|
||||||
StateMarketStorageDeal func(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*api.MarketDeal, error) ``
|
StateMarketStorageDeal func(p0 context.Context, p1 abi.DealID, p2 types.TipSetKey) (*api.MarketDeal, error) ``
|
||||||
|
|
||||||
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) ``
|
StateMinerInfo func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MinerInfo, error) ``
|
||||||
|
|
||||||
StateMinerPower func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*api.MinerPower, error) ``
|
StateMinerPower func(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*api.MinerPower, error) ``
|
||||||
|
|
||||||
@ -1911,15 +1912,15 @@ func (s *FullNodeStub) StateMinerFaults(p0 context.Context, p1 address.Address,
|
|||||||
return *new(bitfield.BitField), ErrNotSupported
|
return *new(bitfield.BitField), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *FullNodeStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MinerInfo, error) {
|
||||||
if s.Internal.StateMinerInfo == nil {
|
if s.Internal.StateMinerInfo == nil {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(api.MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateMinerInfo(p0, p1, p2)
|
return s.Internal.StateMinerInfo(p0, p1, p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *FullNodeStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MinerInfo, error) {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(api.MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) {
|
func (s *FullNodeStruct) StateMinerInitialPledgeCollateral(p0 context.Context, p1 address.Address, p2 miner.SectorPreCommitInfo, p3 types.TipSetKey) (types.BigInt, error) {
|
||||||
@ -2087,14 +2088,14 @@ func (s *FullNodeStub) StateSearchMsgLimited(p0 context.Context, p1 cid.Cid, p2
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorExpiration, error) {
|
func (s *FullNodeStruct) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorExpiration, error) {
|
||||||
if s.Internal.StateSectorExpiration == nil {
|
if s.Internal.StateSectorExpiration == nil {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateSectorExpiration(p0, p1, p2, p3)
|
return s.Internal.StateSectorExpiration(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorExpiration, error) {
|
func (s *FullNodeStub) StateSectorExpiration(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorExpiration, error) {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2109,14 +2110,14 @@ func (s *FullNodeStub) StateSectorGetInfo(p0 context.Context, p1 address.Address
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStruct) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorLocation, error) {
|
func (s *FullNodeStruct) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) {
|
||||||
if s.Internal.StateSectorPartition == nil {
|
if s.Internal.StateSectorPartition == nil {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateSectorPartition(p0, p1, p2, p3)
|
return s.Internal.StateSectorPartition(p0, p1, p2, p3)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *FullNodeStub) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*miner.SectorLocation, error) {
|
func (s *FullNodeStub) StateSectorPartition(p0 context.Context, p1 address.Address, p2 abi.SectorNumber, p3 types.TipSetKey) (*lminer.SectorLocation, error) {
|
||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -2670,15 +2671,15 @@ func (s *GatewayStub) StateMarketStorageDeal(p0 context.Context, p1 abi.DealID,
|
|||||||
return nil, ErrNotSupported
|
return nil, ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewayStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *GatewayStruct) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MinerInfo, error) {
|
||||||
if s.Internal.StateMinerInfo == nil {
|
if s.Internal.StateMinerInfo == nil {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(api.MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
return s.Internal.StateMinerInfo(p0, p1, p2)
|
return s.Internal.StateMinerInfo(p0, p1, p2)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewayStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (s *GatewayStub) StateMinerInfo(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (api.MinerInfo, error) {
|
||||||
return *new(miner.MinerInfo), ErrNotSupported
|
return *new(api.MinerInfo), ErrNotSupported
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *GatewayStruct) StateMinerPower(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*api.MinerPower, error) {
|
func (s *GatewayStruct) StateMinerPower(p0 context.Context, p1 address.Address, p2 types.TipSetKey) (*api.MinerPower, error) {
|
||||||
|
@ -17,20 +17,20 @@ import (
|
|||||||
auth "github.com/filecoin-project/go-jsonrpc/auth"
|
auth "github.com/filecoin-project/go-jsonrpc/auth"
|
||||||
abi "github.com/filecoin-project/go-state-types/abi"
|
abi "github.com/filecoin-project/go-state-types/abi"
|
||||||
big "github.com/filecoin-project/go-state-types/big"
|
big "github.com/filecoin-project/go-state-types/big"
|
||||||
|
miner "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
paych "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
crypto "github.com/filecoin-project/go-state-types/crypto"
|
crypto "github.com/filecoin-project/go-state-types/crypto"
|
||||||
dline "github.com/filecoin-project/go-state-types/dline"
|
dline "github.com/filecoin-project/go-state-types/dline"
|
||||||
network "github.com/filecoin-project/go-state-types/network"
|
network "github.com/filecoin-project/go-state-types/network"
|
||||||
api "github.com/filecoin-project/lotus/api"
|
api "github.com/filecoin-project/lotus/api"
|
||||||
apitypes "github.com/filecoin-project/lotus/api/types"
|
apitypes "github.com/filecoin-project/lotus/api/types"
|
||||||
v0api "github.com/filecoin-project/lotus/api/v0api"
|
v0api "github.com/filecoin-project/lotus/api/v0api"
|
||||||
miner "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/lotus/chain/actors/builtin/miner"
|
||||||
types "github.com/filecoin-project/lotus/chain/types"
|
types "github.com/filecoin-project/lotus/chain/types"
|
||||||
alerting "github.com/filecoin-project/lotus/journal/alerting"
|
alerting "github.com/filecoin-project/lotus/journal/alerting"
|
||||||
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
marketevents "github.com/filecoin-project/lotus/markets/loggers"
|
||||||
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
|
dtypes "github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
imports "github.com/filecoin-project/lotus/node/repo/imports"
|
imports "github.com/filecoin-project/lotus/node/repo/imports"
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
||||||
paych "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
|
||||||
gomock "github.com/golang/mock/gomock"
|
gomock "github.com/golang/mock/gomock"
|
||||||
uuid "github.com/google/uuid"
|
uuid "github.com/google/uuid"
|
||||||
cid "github.com/ipfs/go-cid"
|
cid "github.com/ipfs/go-cid"
|
||||||
@ -2501,10 +2501,10 @@ func (mr *MockFullNodeMockRecorder) StateMinerFaults(arg0, arg1, arg2 interface{
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMinerInfo mocks base method.
|
// StateMinerInfo mocks base method.
|
||||||
func (m *MockFullNode) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (miner.MinerInfo, error) {
|
func (m *MockFullNode) StateMinerInfo(arg0 context.Context, arg1 address.Address, arg2 types.TipSetKey) (api.MinerInfo, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
ret := m.ctrl.Call(m, "StateMinerInfo", arg0, arg1, arg2)
|
||||||
ret0, _ := ret[0].(miner.MinerInfo)
|
ret0, _ := ret[0].(api.MinerInfo)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@ -2516,7 +2516,7 @@ func (mr *MockFullNodeMockRecorder) StateMinerInfo(arg0, arg1, arg2 interface{})
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMinerInitialPledgeCollateral mocks base method.
|
// StateMinerInitialPledgeCollateral mocks base method.
|
||||||
func (m *MockFullNode) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner0.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
func (m *MockFullNode) StateMinerInitialPledgeCollateral(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateMinerInitialPledgeCollateral", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(big.Int)
|
ret0, _ := ret[0].(big.Int)
|
||||||
@ -2561,7 +2561,7 @@ func (mr *MockFullNodeMockRecorder) StateMinerPower(arg0, arg1, arg2 interface{}
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateMinerPreCommitDepositForPower mocks base method.
|
// StateMinerPreCommitDepositForPower mocks base method.
|
||||||
func (m *MockFullNode) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner0.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
func (m *MockFullNode) StateMinerPreCommitDepositForPower(arg0 context.Context, arg1 address.Address, arg2 miner.SectorPreCommitInfo, arg3 types.TipSetKey) (big.Int, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateMinerPreCommitDepositForPower", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(big.Int)
|
ret0, _ := ret[0].(big.Int)
|
||||||
@ -2741,10 +2741,10 @@ func (mr *MockFullNodeMockRecorder) StateSearchMsgLimited(arg0, arg1, arg2 inter
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateSectorExpiration mocks base method.
|
// StateSectorExpiration mocks base method.
|
||||||
func (m *MockFullNode) StateSectorExpiration(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorExpiration, error) {
|
func (m *MockFullNode) StateSectorExpiration(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner0.SectorExpiration, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateSectorExpiration", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateSectorExpiration", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(*miner.SectorExpiration)
|
ret0, _ := ret[0].(*miner0.SectorExpiration)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
@ -2771,10 +2771,10 @@ func (mr *MockFullNodeMockRecorder) StateSectorGetInfo(arg0, arg1, arg2, arg3 in
|
|||||||
}
|
}
|
||||||
|
|
||||||
// StateSectorPartition mocks base method.
|
// StateSectorPartition mocks base method.
|
||||||
func (m *MockFullNode) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner.SectorLocation, error) {
|
func (m *MockFullNode) StateSectorPartition(arg0 context.Context, arg1 address.Address, arg2 abi.SectorNumber, arg3 types.TipSetKey) (*miner0.SectorLocation, error) {
|
||||||
m.ctrl.T.Helper()
|
m.ctrl.T.Helper()
|
||||||
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
|
ret := m.ctrl.Call(m, "StateSectorPartition", arg0, arg1, arg2, arg3)
|
||||||
ret0, _ := ret[0].(*miner.SectorLocation)
|
ret0, _ := ret[0].(*miner0.SectorLocation)
|
||||||
ret1, _ := ret[1].(error)
|
ret1, _ := ret[1].(error)
|
||||||
return ret0, ret1
|
return ret0, ret1
|
||||||
}
|
}
|
||||||
|
Binary file not shown.
Binary file not shown.
Binary file not shown.
@ -6,10 +6,8 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -26,80 +24,22 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
var Methods = builtin8.MethodsAccount
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var Methods = builtin4.MethodsAccount
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "account" {
|
if name != actors.AccountKey {
|
||||||
return nil, xerrors.Errorf("actor code is not account: %s", name)
|
return nil, xerrors.Errorf("actor code is not account: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -126,10 +66,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.AccountActorCodeID:
|
case builtin7.AccountActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.AccountActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -164,42 +102,6 @@ func MakeState(store adt.Store, av actors.Version, addr address.Address) (State,
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "account"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.AccountActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -6,47 +6,45 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
var Methods = builtin{{.latestVersion}}.MethodsAccount
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.AccountActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
var Methods = builtin4.MethodsAccount
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "account" {
|
if name != actors.AccountKey {
|
||||||
return nil, xerrors.Errorf("actor code is not account: %s", name)
|
return nil, xerrors.Errorf("actor code is not account: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.AccountActorCodeID:
|
case builtin{{.}}.AccountActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -60,21 +58,6 @@ func MakeState(store adt.Store, av actors.Version, addr address.Address) (State,
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "account"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.AccountActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -6,7 +6,11 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
account{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/account"
|
account{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/account"
|
||||||
|
{{else}}
|
||||||
|
account{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}account"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
|
@ -6,7 +6,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
account8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/account"
|
account8 "github.com/filecoin-project/go-state-types/builtin/v8/account"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
|
@ -6,38 +6,28 @@ import (
|
|||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
smoothing0 "github.com/filecoin-project/specs-actors/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
smoothing2 "github.com/filecoin-project/specs-actors/v2/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
smoothing3 "github.com/filecoin-project/specs-actors/v3/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
smoothing4 "github.com/filecoin-project/specs-actors/v4/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
smoothing5 "github.com/filecoin-project/specs-actors/v5/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
smoothing6 "github.com/filecoin-project/specs-actors/v6/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
smoothing7 "github.com/filecoin-project/specs-actors/v7/actors/util/smoothing"
|
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
smoothing8 "github.com/filecoin-project/specs-actors/v8/actors/util/smoothing"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/proof"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
|
|
||||||
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
proof8 "github.com/filecoin-project/specs-actors/v8/actors/runtime/proof"
|
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var SystemActorAddr = builtin8.SystemActorAddr
|
var SystemActorAddr = builtin8.SystemActorAddr
|
||||||
@ -64,79 +54,15 @@ const (
|
|||||||
|
|
||||||
// These are all just type aliases across actor versions. In the future, that might change
|
// These are all just type aliases across actor versions. In the future, that might change
|
||||||
// and we might need to do something fancier.
|
// and we might need to do something fancier.
|
||||||
type SectorInfo = proof8.SectorInfo
|
type SectorInfo = proof.SectorInfo
|
||||||
type ExtendedSectorInfo = proof8.ExtendedSectorInfo
|
type ExtendedSectorInfo = proof.ExtendedSectorInfo
|
||||||
type PoStProof = proof8.PoStProof
|
type PoStProof = proof.PoStProof
|
||||||
type FilterEstimate = smoothing0.FilterEstimate
|
type FilterEstimate = smoothingtypes.FilterEstimate
|
||||||
|
|
||||||
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
|
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
|
||||||
return miner8.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
return miner8.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
func FromV0FilterEstimate(v0 smoothing0.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v0) //nolint:unconvert
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV2FilterEstimate(v2 smoothing2.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v2)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV3FilterEstimate(v3 smoothing3.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v3)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV4FilterEstimate(v4 smoothing4.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v4)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV5FilterEstimate(v5 smoothing5.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v5)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV6FilterEstimate(v6 smoothing6.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v6)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV7FilterEstimate(v7 smoothing7.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v7)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
func FromV8FilterEstimate(v8 smoothing8.FilterEstimate) FilterEstimate {
|
|
||||||
|
|
||||||
return (FilterEstimate)(v8)
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
|
|
||||||
|
|
||||||
var ActorStateLoaders = make(map[cid.Cid]ActorStateLoader)
|
|
||||||
|
|
||||||
func RegisterActorState(code cid.Cid, loader ActorStateLoader) {
|
|
||||||
ActorStateLoaders[code] = loader
|
|
||||||
}
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
|
|
||||||
loader, found := ActorStateLoaders[act.Code]
|
|
||||||
if !found {
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
|
||||||
}
|
|
||||||
return loader(store, act.Head)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ActorNameByCode(c cid.Cid) string {
|
func ActorNameByCode(c cid.Cid) string {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
@ -166,9 +92,6 @@ func ActorNameByCode(c cid.Cid) string {
|
|||||||
case builtin7.IsBuiltinActor(c):
|
case builtin7.IsBuiltinActor(c):
|
||||||
return builtin7.ActorNameByCode(c)
|
return builtin7.ActorNameByCode(c)
|
||||||
|
|
||||||
case builtin8.IsBuiltinActor(c):
|
|
||||||
return builtin8.ActorNameByCode(c)
|
|
||||||
|
|
||||||
default:
|
default:
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
}
|
}
|
||||||
@ -208,11 +131,40 @@ func IsBuiltinActor(c cid.Cid) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if builtin8.IsBuiltinActor(c) {
|
return false
|
||||||
return true
|
}
|
||||||
|
|
||||||
|
func GetAccountActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.AccountKey); ok {
|
||||||
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.AccountActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsAccountActor(c cid.Cid) bool {
|
func IsAccountActor(c cid.Cid) bool {
|
||||||
@ -249,17 +201,145 @@ func IsAccountActor(c cid.Cid) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.AccountActorCodeID {
|
return false
|
||||||
return true
|
}
|
||||||
|
|
||||||
|
func GetCronActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.CronKey); ok {
|
||||||
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.CronActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.CronActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.CronActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.CronActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.CronActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.CronActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.CronActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetInitActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.InitKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.InitActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.InitActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.InitActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.InitActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.InitActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.InitActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.InitActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMarketActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.MarketKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.StorageMarketActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMinerActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.MinerKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.StorageMinerActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsStorageMinerActor(c cid.Cid) bool {
|
func IsStorageMinerActor(c cid.Cid) bool {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
return name == "storageminer"
|
return name == actors.MinerKey
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin0.StorageMinerActorCodeID {
|
if c == builtin0.StorageMinerActorCodeID {
|
||||||
@ -290,17 +370,46 @@ func IsStorageMinerActor(c cid.Cid) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.StorageMinerActorCodeID {
|
return false
|
||||||
return true
|
}
|
||||||
|
|
||||||
|
func GetMultisigActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.MultisigKey); ok {
|
||||||
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.MultisigActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsMultisigActor(c cid.Cid) bool {
|
func IsMultisigActor(c cid.Cid) bool {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
return name == "multisig"
|
return name == actors.MultisigKey
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin0.MultisigActorCodeID {
|
if c == builtin0.MultisigActorCodeID {
|
||||||
@ -331,11 +440,40 @@ func IsMultisigActor(c cid.Cid) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.MultisigActorCodeID {
|
return false
|
||||||
return true
|
}
|
||||||
|
|
||||||
|
func GetPaymentChannelActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.PaychKey); ok {
|
||||||
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.PaymentChannelActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func IsPaymentChannelActor(c cid.Cid) bool {
|
func IsPaymentChannelActor(c cid.Cid) bool {
|
||||||
@ -372,11 +510,139 @@ func IsPaymentChannelActor(c cid.Cid) bool {
|
|||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
|
|
||||||
if c == builtin8.PaymentChannelActorCodeID {
|
return false
|
||||||
return true
|
}
|
||||||
|
|
||||||
|
func GetPowerActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.PowerKey); ok {
|
||||||
|
return c, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
return false
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.StoragePowerActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRewardActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.RewardKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.RewardActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetSystemActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.SystemKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.SystemActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetVerifregActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.VerifregKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version0:
|
||||||
|
return builtin0.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version2:
|
||||||
|
return builtin2.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version3:
|
||||||
|
return builtin3.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version4:
|
||||||
|
return builtin4.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version5:
|
||||||
|
return builtin5.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version6:
|
||||||
|
return builtin6.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
case actors.Version7:
|
||||||
|
return builtin7.VerifiedRegistryActorCodeID, nil
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func makeAddress(addr string) address.Address {
|
func makeAddress(addr string) address.Address {
|
||||||
|
@ -5,20 +5,21 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
smoothing{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/util/smoothing"
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/proof"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
|
||||||
|
|
||||||
miner{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/builtin/miner"
|
miner{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
proof{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/runtime/proof"
|
smoothingtypes "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var SystemActorAddr = builtin{{.latestVersion}}.SystemActorAddr
|
var SystemActorAddr = builtin{{.latestVersion}}.SystemActorAddr
|
||||||
@ -45,41 +46,15 @@ const (
|
|||||||
|
|
||||||
// These are all just type aliases across actor versions. In the future, that might change
|
// These are all just type aliases across actor versions. In the future, that might change
|
||||||
// and we might need to do something fancier.
|
// and we might need to do something fancier.
|
||||||
type SectorInfo = proof{{.latestVersion}}.SectorInfo
|
type SectorInfo = proof.SectorInfo
|
||||||
type ExtendedSectorInfo = proof{{.latestVersion}}.ExtendedSectorInfo
|
type ExtendedSectorInfo = proof.ExtendedSectorInfo
|
||||||
type PoStProof = proof{{.latestVersion}}.PoStProof
|
type PoStProof = proof.PoStProof
|
||||||
type FilterEstimate = smoothing0.FilterEstimate
|
type FilterEstimate = smoothingtypes.FilterEstimate
|
||||||
|
|
||||||
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
|
func QAPowerForWeight(size abi.SectorSize, duration abi.ChainEpoch, dealWeight, verifiedWeight abi.DealWeight) abi.StoragePower {
|
||||||
return miner{{.latestVersion}}.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
return miner{{.latestVersion}}.QAPowerForWeight(size, duration, dealWeight, verifiedWeight)
|
||||||
}
|
}
|
||||||
|
|
||||||
{{range .versions}}
|
|
||||||
func FromV{{.}}FilterEstimate(v{{.}} smoothing{{.}}.FilterEstimate) FilterEstimate {
|
|
||||||
{{if (eq . 0)}}
|
|
||||||
return (FilterEstimate)(v{{.}}) //nolint:unconvert
|
|
||||||
{{else}}
|
|
||||||
return (FilterEstimate)(v{{.}})
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
{{end}}
|
|
||||||
|
|
||||||
type ActorStateLoader func(store adt.Store, root cid.Cid) (cbor.Marshaler, error)
|
|
||||||
|
|
||||||
var ActorStateLoaders = make(map[cid.Cid]ActorStateLoader)
|
|
||||||
|
|
||||||
func RegisterActorState(code cid.Cid, loader ActorStateLoader) {
|
|
||||||
ActorStateLoaders[code] = loader
|
|
||||||
}
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (cbor.Marshaler, error) {
|
|
||||||
loader, found := ActorStateLoaders[act.Code]
|
|
||||||
if !found {
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
|
||||||
}
|
|
||||||
return loader(store, act.Head)
|
|
||||||
}
|
|
||||||
|
|
||||||
func ActorNameByCode(c cid.Cid) string {
|
func ActorNameByCode(c cid.Cid) string {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
@ -88,9 +63,11 @@ func ActorNameByCode(c cid.Cid) string {
|
|||||||
|
|
||||||
switch {
|
switch {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.IsBuiltinActor(c):
|
case builtin{{.}}.IsBuiltinActor(c):
|
||||||
return builtin{{.}}.ActorNameByCode(c)
|
return builtin{{.}}.ActorNameByCode(c)
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
default:
|
default:
|
||||||
return "<unknown>"
|
return "<unknown>"
|
||||||
}
|
}
|
||||||
@ -103,13 +80,32 @@ func IsBuiltinActor(c cid.Cid) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
if builtin{{.}}.IsBuiltinActor(c) {
|
if builtin{{.}}.IsBuiltinActor(c) {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetAccountActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.AccountKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.AccountActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
func IsAccountActor(c cid.Cid) bool {
|
func IsAccountActor(c cid.Cid) bool {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
@ -117,41 +113,149 @@ func IsAccountActor(c cid.Cid) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
if c == builtin{{.}}.AccountActorCodeID {
|
if c == builtin{{.}}.AccountActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetCronActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.CronKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.CronActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetInitActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.InitKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.InitActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMarketActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.MarketKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.StorageMarketActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetMinerActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.MinerKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.StorageMinerActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
func IsStorageMinerActor(c cid.Cid) bool {
|
func IsStorageMinerActor(c cid.Cid) bool {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
return name == "storageminer"
|
return name == actors.MinerKey
|
||||||
}
|
}
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
if c == builtin{{.}}.StorageMinerActorCodeID {
|
if c == builtin{{.}}.StorageMinerActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetMultisigActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.MultisigKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.MultisigActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
func IsMultisigActor(c cid.Cid) bool {
|
func IsMultisigActor(c cid.Cid) bool {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
return name == "multisig"
|
return name == actors.MultisigKey
|
||||||
}
|
}
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
if c == builtin{{.}}.MultisigActorCodeID {
|
if c == builtin{{.}}.MultisigActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetPaymentChannelActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.PaychKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.PaymentChannelActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
func IsPaymentChannelActor(c cid.Cid) bool {
|
func IsPaymentChannelActor(c cid.Cid) bool {
|
||||||
name, _, ok := actors.GetActorMetaByCode(c)
|
name, _, ok := actors.GetActorMetaByCode(c)
|
||||||
if ok {
|
if ok {
|
||||||
@ -159,13 +263,83 @@ func IsPaymentChannelActor(c cid.Cid) bool {
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
if c == builtin{{.}}.PaymentChannelActorCodeID {
|
if c == builtin{{.}}.PaymentChannelActorCodeID {
|
||||||
return true
|
return true
|
||||||
}
|
}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
{{end}}
|
||||||
return false
|
return false
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func GetPowerActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.PowerKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.StoragePowerActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetRewardActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.RewardKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.RewardActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetSystemActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.SystemKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.SystemActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
|
func GetVerifregActorCodeID(av actors.Version) (cid.Cid, error) {
|
||||||
|
if c, ok := actors.GetActorCodeID(av, actors.VerifregKey); ok {
|
||||||
|
return c, nil
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return builtin{{.}}.VerifiedRegistryActorCodeID, nil
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
||||||
|
}
|
||||||
|
|
||||||
func makeAddress(addr string) address.Address {
|
func makeAddress(addr string) address.Address {
|
||||||
ret, err := address.NewFromString(addr)
|
ret, err := address.NewFromString(addr)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -4,12 +4,45 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != actors.CronKey {
|
||||||
|
return nil, xerrors.Errorf("actor code is not cron: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch act.Code {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case builtin{{.}}.CronActorCodeID:
|
||||||
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
|
}
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
@ -20,21 +53,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "cron"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.CronActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin{{.latestVersion}}.CronActorAddr
|
Address = builtin{{.latestVersion}}.CronActorAddr
|
||||||
Methods = builtin{{.latestVersion}}.MethodsCron
|
Methods = builtin{{.latestVersion}}.MethodsCron
|
||||||
|
@ -3,7 +3,7 @@ package cron
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -20,9 +20,51 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != actors.CronKey {
|
||||||
|
return nil, xerrors.Errorf("actor code is not cron: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch act.Code {
|
||||||
|
|
||||||
|
case builtin0.CronActorCodeID:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case builtin2.CronActorCodeID:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case builtin3.CronActorCodeID:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case builtin4.CronActorCodeID:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case builtin5.CronActorCodeID:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case builtin6.CronActorCodeID:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case builtin7.CronActorCodeID:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
|
}
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
@ -54,42 +96,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "cron"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.CronActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.CronActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin8.CronActorAddr
|
Address = builtin8.CronActorAddr
|
||||||
Methods = builtin8.MethodsCron
|
Methods = builtin8.MethodsCron
|
||||||
|
@ -5,7 +5,11 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
cron{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/cron"
|
cron{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/cron"
|
||||||
|
{{else}}
|
||||||
|
cron{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}cron"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
cron8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/cron"
|
cron8 "github.com/filecoin-project/go-state-types/builtin/v8/cron"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
|
@ -10,21 +10,17 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin{{.latestVersion}}.InitActorAddr
|
Address = builtin{{.latestVersion}}.InitActorAddr
|
||||||
Methods = builtin{{.latestVersion}}.MethodsInit
|
Methods = builtin{{.latestVersion}}.MethodsInit
|
||||||
@ -32,26 +28,29 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "init" {
|
if name != actors.InitKey {
|
||||||
return nil, xerrors.Errorf("actor code is not init: %s", name)
|
return nil, xerrors.Errorf("actor code is not init: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.InitActorCodeID:
|
case builtin{{.}}.InitActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -65,21 +64,6 @@ func MakeState(store adt.Store, av actors.Version, networkName string) (State, e
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "init"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.InitActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -10,7 +10,6 @@ import (
|
|||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
@ -28,44 +27,9 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.InitActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin8.InitActorAddr
|
Address = builtin8.InitActorAddr
|
||||||
Methods = builtin8.MethodsInit
|
Methods = builtin8.MethodsInit
|
||||||
@ -73,38 +37,15 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "init" {
|
if name != actors.InitKey {
|
||||||
return nil, xerrors.Errorf("actor code is not init: %s", name)
|
return nil, xerrors.Errorf("actor code is not init: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -131,10 +72,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.InitActorCodeID:
|
case builtin7.InitActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.InitActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -169,42 +108,6 @@ func MakeState(store adt.Store, av actors.Version, networkName string) (State, e
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "init"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.InitActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.InitActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -10,12 +10,17 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
{{if (ge .v 3)}}
|
{{if (le .v 7)}}
|
||||||
|
{{if (ge .v 3)}}
|
||||||
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
|
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
init{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}init"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
|
@ -10,10 +10,9 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||||
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
|
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
|
@ -10,28 +10,22 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
|
||||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
market{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin{{import .latestVersion}}market"
|
||||||
market{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/builtin/market"
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin{{.latestVersion}}.StorageMarketActorAddr
|
Address = builtin{{.latestVersion}}.StorageMarketActorAddr
|
||||||
Methods = builtin{{.latestVersion}}.MethodsMarket
|
Methods = builtin{{.latestVersion}}.MethodsMarket
|
||||||
@ -39,26 +33,29 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "storagemarket" {
|
if name != actors.MarketKey {
|
||||||
return nil, xerrors.Errorf("actor code is not storagemarket: %s", name)
|
return nil, xerrors.Errorf("actor code is not market: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.StorageMarketActorCodeID:
|
case builtin{{.}}.StorageMarketActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -72,21 +69,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "storagemarket"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.StorageMarketActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
BalancesChanged(State) (bool, error)
|
BalancesChanged(State) (bool, error)
|
||||||
@ -118,14 +100,13 @@ type DealStates interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DealProposals interface {
|
type DealProposals interface {
|
||||||
ForEach(cb func(id abi.DealID, dp DealProposal) error) error
|
ForEach(cb func(id abi.DealID, dp market{{.latestVersion}}.DealProposal) error) error
|
||||||
Get(id abi.DealID) (*DealProposal, bool, error)
|
Get(id abi.DealID) (*market{{.latestVersion}}.DealProposal, bool, error)
|
||||||
|
|
||||||
array() adt.Array
|
array() adt.Array
|
||||||
decode(*cbg.Deferred) (*DealProposal, error)
|
decode(*cbg.Deferred) (*market{{.latestVersion}}.DealProposal, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PublishStorageDealsParams = market{{.latestVersion}}.PublishStorageDealsParams
|
|
||||||
|
|
||||||
type PublishStorageDealsReturn interface {
|
type PublishStorageDealsReturn interface {
|
||||||
DealIDs() ([]abi.DealID, error)
|
DealIDs() ([]abi.DealID, error)
|
||||||
@ -148,30 +129,9 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
type VerifyDealsForActivationParams = market0.VerifyDealsForActivationParams
|
type DealProposal = market{{.latestVersion}}.DealProposal
|
||||||
type WithdrawBalanceParams = market0.WithdrawBalanceParams
|
|
||||||
|
|
||||||
type ClientDealProposal = market{{.latestVersion}}.ClientDealProposal
|
type DealState = market{{.latestVersion}}.DealState
|
||||||
|
|
||||||
type DealState struct {
|
|
||||||
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
|
|
||||||
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
|
|
||||||
SlashEpoch abi.ChainEpoch // -1 if deal never slashed
|
|
||||||
}
|
|
||||||
|
|
||||||
type DealProposal struct {
|
|
||||||
PieceCID cid.Cid
|
|
||||||
PieceSize abi.PaddedPieceSize
|
|
||||||
VerifiedDeal bool
|
|
||||||
Client address.Address
|
|
||||||
Provider address.Address
|
|
||||||
Label market{{.latestVersion}}.DealLabel
|
|
||||||
StartEpoch abi.ChainEpoch
|
|
||||||
EndEpoch abi.ChainEpoch
|
|
||||||
StoragePricePerEpoch abi.TokenAmount
|
|
||||||
ProviderCollateral abi.TokenAmount
|
|
||||||
ClientCollateral abi.TokenAmount
|
|
||||||
}
|
|
||||||
|
|
||||||
type DealStateChanges struct {
|
type DealStateChanges struct {
|
||||||
Added []DealIDState
|
Added []DealIDState
|
||||||
@ -198,7 +158,7 @@ type DealProposalChanges struct {
|
|||||||
|
|
||||||
type ProposalIDState struct {
|
type ProposalIDState struct {
|
||||||
ID abi.DealID
|
ID abi.DealID
|
||||||
Proposal DealProposal
|
Proposal market{{.latestVersion}}.DealProposal
|
||||||
}
|
}
|
||||||
|
|
||||||
func EmptyDealState() *DealState {
|
func EmptyDealState() *DealState {
|
||||||
@ -210,7 +170,7 @@ func EmptyDealState() *DealState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns the earned fees and pending fees for a given deal
|
// returns the earned fees and pending fees for a given deal
|
||||||
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
func GetDealFees(deal market{{.latestVersion}}.DealProposal, height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
||||||
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
||||||
|
|
||||||
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
||||||
|
@ -10,11 +10,9 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
|
|
||||||
market0 "github.com/filecoin-project/specs-actors/actors/builtin/market"
|
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
@ -30,49 +28,13 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.StorageMarketActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin8.StorageMarketActorAddr
|
Address = builtin8.StorageMarketActorAddr
|
||||||
Methods = builtin8.MethodsMarket
|
Methods = builtin8.MethodsMarket
|
||||||
@ -80,38 +42,15 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "storagemarket" {
|
if name != actors.MarketKey {
|
||||||
return nil, xerrors.Errorf("actor code is not storagemarket: %s", name)
|
return nil, xerrors.Errorf("actor code is not market: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -138,10 +77,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.StorageMarketActorCodeID:
|
case builtin7.StorageMarketActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.StorageMarketActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -176,42 +113,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "storagemarket"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.StorageMarketActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
BalancesChanged(State) (bool, error)
|
BalancesChanged(State) (bool, error)
|
||||||
@ -243,15 +144,13 @@ type DealStates interface {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type DealProposals interface {
|
type DealProposals interface {
|
||||||
ForEach(cb func(id abi.DealID, dp DealProposal) error) error
|
ForEach(cb func(id abi.DealID, dp market8.DealProposal) error) error
|
||||||
Get(id abi.DealID) (*DealProposal, bool, error)
|
Get(id abi.DealID) (*market8.DealProposal, bool, error)
|
||||||
|
|
||||||
array() adt.Array
|
array() adt.Array
|
||||||
decode(*cbg.Deferred) (*DealProposal, error)
|
decode(*cbg.Deferred) (*market8.DealProposal, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type PublishStorageDealsParams = market8.PublishStorageDealsParams
|
|
||||||
|
|
||||||
type PublishStorageDealsReturn interface {
|
type PublishStorageDealsReturn interface {
|
||||||
DealIDs() ([]abi.DealID, error)
|
DealIDs() ([]abi.DealID, error)
|
||||||
// Note that this index is based on the batch of deals that were published, NOT the DealID
|
// Note that this index is based on the batch of deals that were published, NOT the DealID
|
||||||
@ -294,30 +193,9 @@ func DecodePublishStorageDealsReturn(b []byte, nv network.Version) (PublishStora
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
type VerifyDealsForActivationParams = market0.VerifyDealsForActivationParams
|
type DealProposal = market8.DealProposal
|
||||||
type WithdrawBalanceParams = market0.WithdrawBalanceParams
|
|
||||||
|
|
||||||
type ClientDealProposal = market8.ClientDealProposal
|
type DealState = market8.DealState
|
||||||
|
|
||||||
type DealState struct {
|
|
||||||
SectorStartEpoch abi.ChainEpoch // -1 if not yet included in proven sector
|
|
||||||
LastUpdatedEpoch abi.ChainEpoch // -1 if deal state never updated
|
|
||||||
SlashEpoch abi.ChainEpoch // -1 if deal never slashed
|
|
||||||
}
|
|
||||||
|
|
||||||
type DealProposal struct {
|
|
||||||
PieceCID cid.Cid
|
|
||||||
PieceSize abi.PaddedPieceSize
|
|
||||||
VerifiedDeal bool
|
|
||||||
Client address.Address
|
|
||||||
Provider address.Address
|
|
||||||
Label market8.DealLabel
|
|
||||||
StartEpoch abi.ChainEpoch
|
|
||||||
EndEpoch abi.ChainEpoch
|
|
||||||
StoragePricePerEpoch abi.TokenAmount
|
|
||||||
ProviderCollateral abi.TokenAmount
|
|
||||||
ClientCollateral abi.TokenAmount
|
|
||||||
}
|
|
||||||
|
|
||||||
type DealStateChanges struct {
|
type DealStateChanges struct {
|
||||||
Added []DealIDState
|
Added []DealIDState
|
||||||
@ -344,7 +222,7 @@ type DealProposalChanges struct {
|
|||||||
|
|
||||||
type ProposalIDState struct {
|
type ProposalIDState struct {
|
||||||
ID abi.DealID
|
ID abi.DealID
|
||||||
Proposal DealProposal
|
Proposal market8.DealProposal
|
||||||
}
|
}
|
||||||
|
|
||||||
func EmptyDealState() *DealState {
|
func EmptyDealState() *DealState {
|
||||||
@ -356,7 +234,7 @@ func EmptyDealState() *DealState {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// returns the earned fees and pending fees for a given deal
|
// returns the earned fees and pending fees for a given deal
|
||||||
func (deal DealProposal) GetDealFees(height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
func GetDealFees(deal market8.DealProposal, height abi.ChainEpoch) (abi.TokenAmount, abi.TokenAmount) {
|
||||||
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
tf := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(deal.EndEpoch-deal.StartEpoch)))
|
||||||
|
|
||||||
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
ef := big.Mul(deal.StoragePricePerEpoch, big.NewInt(int64(height-deal.StartEpoch)))
|
||||||
|
@ -12,8 +12,13 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
market{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/market"
|
market{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/market"
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
market{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}market"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
|
@ -12,8 +12,8 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
market8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/market"
|
market8 "github.com/filecoin-project/go-state-types/builtin/v8/market"
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
|
@ -4,77 +4,51 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
|
"github.com/filecoin-project/go-state-types/proof"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
miner{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin{{import .latestVersion}}miner"
|
||||||
|
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
||||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
|
||||||
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
|
||||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
|
||||||
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
var Methods = builtin{{.latestVersion}}.MethodsMiner
|
|
||||||
|
|
||||||
// Unchanged between v0, v2, v3, v4, and v5 actors
|
|
||||||
var WPoStProvingPeriod = miner0.WPoStProvingPeriod
|
|
||||||
var WPoStPeriodDeadlines = miner0.WPoStPeriodDeadlines
|
|
||||||
var WPoStChallengeWindow = miner0.WPoStChallengeWindow
|
|
||||||
var WPoStChallengeLookback = miner0.WPoStChallengeLookback
|
|
||||||
var FaultDeclarationCutoff = miner0.FaultDeclarationCutoff
|
|
||||||
|
|
||||||
const MinSectorExpiration = miner0.MinSectorExpiration
|
|
||||||
|
|
||||||
// Not used / checked in v0
|
|
||||||
// TODO: Abstract over network versions
|
|
||||||
var DeclarationsMax = miner2.DeclarationsMax
|
|
||||||
var AddressedSectorsMax = miner2.AddressedSectorsMax
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "storageminer" {
|
if name != actors.MinerKey {
|
||||||
return nil, xerrors.Errorf("actor code is not storageminer: %s", name)
|
return nil, xerrors.Errorf("actor code is not miner: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.StorageMinerActorCodeID:
|
case builtin{{.}}.StorageMinerActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -88,21 +62,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "storageminer"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.StorageMinerActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
@ -117,8 +76,8 @@ type State interface {
|
|||||||
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
|
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
|
||||||
FindSector(abi.SectorNumber) (*SectorLocation, error)
|
FindSector(abi.SectorNumber) (*SectorLocation, error)
|
||||||
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
||||||
GetPrecommittedSector(abi.SectorNumber) (*SectorPreCommitOnChainInfo, error)
|
GetPrecommittedSector(abi.SectorNumber) (*miner{{.latestVersion}}.SectorPreCommitOnChainInfo, error)
|
||||||
ForEachPrecommittedSector(func(SectorPreCommitOnChainInfo) error) error
|
ForEachPrecommittedSector(func(miner{{.latestVersion}}.SectorPreCommitOnChainInfo) error) error
|
||||||
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
|
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
|
||||||
NumLiveSectors() (uint64, error)
|
NumLiveSectors() (uint64, error)
|
||||||
IsAllocated(abi.SectorNumber) (bool, error)
|
IsAllocated(abi.SectorNumber) (bool, error)
|
||||||
@ -147,7 +106,7 @@ type State interface {
|
|||||||
sectors() (adt.Array, error)
|
sectors() (adt.Array, error)
|
||||||
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
|
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
|
||||||
precommits() (adt.Map, error)
|
precommits() (adt.Map, error)
|
||||||
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
|
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (miner{{.latestVersion}}.SectorPreCommitOnChainInfo, error)
|
||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -185,44 +144,7 @@ type Partition interface {
|
|||||||
UnprovenSectors() (bitfield.BitField, error)
|
UnprovenSectors() (bitfield.BitField, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SectorOnChainInfo struct {
|
type SectorOnChainInfo = miner{{.latestVersion}}.SectorOnChainInfo
|
||||||
SectorNumber abi.SectorNumber
|
|
||||||
SealProof abi.RegisteredSealProof
|
|
||||||
SealedCID cid.Cid
|
|
||||||
DealIDs []abi.DealID
|
|
||||||
Activation abi.ChainEpoch
|
|
||||||
Expiration abi.ChainEpoch
|
|
||||||
DealWeight abi.DealWeight
|
|
||||||
VerifiedDealWeight abi.DealWeight
|
|
||||||
InitialPledge abi.TokenAmount
|
|
||||||
ExpectedDayReward abi.TokenAmount
|
|
||||||
ExpectedStoragePledge abi.TokenAmount
|
|
||||||
SectorKeyCID *cid.Cid
|
|
||||||
}
|
|
||||||
|
|
||||||
type SectorPreCommitInfo = miner0.SectorPreCommitInfo
|
|
||||||
|
|
||||||
type SectorPreCommitOnChainInfo struct {
|
|
||||||
Info SectorPreCommitInfo
|
|
||||||
PreCommitDeposit abi.TokenAmount
|
|
||||||
PreCommitEpoch abi.ChainEpoch
|
|
||||||
DealWeight abi.DealWeight
|
|
||||||
VerifiedDealWeight abi.DealWeight
|
|
||||||
}
|
|
||||||
|
|
||||||
type PoStPartition = miner0.PoStPartition
|
|
||||||
type RecoveryDeclaration = miner0.RecoveryDeclaration
|
|
||||||
type FaultDeclaration = miner0.FaultDeclaration
|
|
||||||
type ReplicaUpdate = miner7.ReplicaUpdate
|
|
||||||
|
|
||||||
// Params
|
|
||||||
type DeclareFaultsParams = miner0.DeclareFaultsParams
|
|
||||||
type DeclareFaultsRecoveredParams = miner0.DeclareFaultsRecoveredParams
|
|
||||||
type SubmitWindowedPoStParams = miner0.SubmitWindowedPoStParams
|
|
||||||
type ProveCommitSectorParams = miner0.ProveCommitSectorParams
|
|
||||||
type DisputeWindowedPoStParams = miner3.DisputeWindowedPoStParams
|
|
||||||
type ProveCommitAggregateParams = miner5.ProveCommitAggregateParams
|
|
||||||
type ProveReplicaUpdatesParams = miner7.ProveReplicaUpdatesParams
|
|
||||||
|
|
||||||
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
|
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
|
||||||
// We added support for the new proofs in network version 7, and removed support for the old
|
// We added support for the new proofs in network version 7, and removed support for the old
|
||||||
@ -277,33 +199,9 @@ func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type MinerInfo struct {
|
type MinerInfo = miner{{.latestVersion}}.MinerInfo
|
||||||
Owner address.Address // Must be an ID-address.
|
type WorkerKeyChange = miner{{.latestVersion}}.WorkerKeyChange
|
||||||
Worker address.Address // Must be an ID-address.
|
type WindowPostVerifyInfo = proof.WindowPoStVerifyInfo
|
||||||
NewWorker address.Address // Must be an ID-address.
|
|
||||||
ControlAddresses []address.Address // Must be an ID-addresses.
|
|
||||||
WorkerChangeEpoch abi.ChainEpoch
|
|
||||||
PeerId *peer.ID
|
|
||||||
Multiaddrs []abi.Multiaddrs
|
|
||||||
WindowPoStProofType abi.RegisteredPoStProof
|
|
||||||
SectorSize abi.SectorSize
|
|
||||||
WindowPoStPartitionSectors uint64
|
|
||||||
ConsensusFaultElapsed abi.ChainEpoch
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mi MinerInfo) IsController(addr address.Address) bool {
|
|
||||||
if addr == mi.Owner || addr == mi.Worker {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, ca := range mi.ControlAddresses {
|
|
||||||
if addr == ca {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type SectorExpiration struct {
|
type SectorExpiration struct {
|
||||||
OnTime abi.ChainEpoch
|
OnTime abi.ChainEpoch
|
||||||
@ -330,8 +228,8 @@ type SectorExtensions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PreCommitChanges struct {
|
type PreCommitChanges struct {
|
||||||
Added []SectorPreCommitOnChainInfo
|
Added []miner{{.latestVersion}}.SectorPreCommitOnChainInfo
|
||||||
Removed []SectorPreCommitOnChainInfo
|
Removed []miner{{.latestVersion}}.SectorPreCommitOnChainInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type LockedFunds struct {
|
type LockedFunds struct {
|
||||||
|
@ -4,27 +4,19 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/network"
|
"github.com/filecoin-project/go-state-types/network"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
|
"github.com/filecoin-project/go-state-types/proof"
|
||||||
|
|
||||||
|
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
||||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
|
||||||
miner3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/miner"
|
|
||||||
miner5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/miner"
|
|
||||||
miner7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/miner"
|
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
@ -38,96 +30,19 @@ import (
|
|||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.StorageMinerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
var Methods = builtin8.MethodsMiner
|
|
||||||
|
|
||||||
// Unchanged between v0, v2, v3, v4, and v5 actors
|
|
||||||
var WPoStProvingPeriod = miner0.WPoStProvingPeriod
|
|
||||||
var WPoStPeriodDeadlines = miner0.WPoStPeriodDeadlines
|
|
||||||
var WPoStChallengeWindow = miner0.WPoStChallengeWindow
|
|
||||||
var WPoStChallengeLookback = miner0.WPoStChallengeLookback
|
|
||||||
var FaultDeclarationCutoff = miner0.FaultDeclarationCutoff
|
|
||||||
|
|
||||||
const MinSectorExpiration = miner0.MinSectorExpiration
|
|
||||||
|
|
||||||
// Not used / checked in v0
|
|
||||||
// TODO: Abstract over network versions
|
|
||||||
var DeclarationsMax = miner2.DeclarationsMax
|
|
||||||
var AddressedSectorsMax = miner2.AddressedSectorsMax
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "storageminer" {
|
if name != actors.MinerKey {
|
||||||
return nil, xerrors.Errorf("actor code is not storageminer: %s", name)
|
return nil, xerrors.Errorf("actor code is not miner: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -154,10 +69,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.StorageMinerActorCodeID:
|
case builtin7.StorageMinerActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.StorageMinerActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -192,42 +105,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "storageminer"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.StorageMinerActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
@ -242,8 +119,8 @@ type State interface {
|
|||||||
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
|
GetSector(abi.SectorNumber) (*SectorOnChainInfo, error)
|
||||||
FindSector(abi.SectorNumber) (*SectorLocation, error)
|
FindSector(abi.SectorNumber) (*SectorLocation, error)
|
||||||
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
GetSectorExpiration(abi.SectorNumber) (*SectorExpiration, error)
|
||||||
GetPrecommittedSector(abi.SectorNumber) (*SectorPreCommitOnChainInfo, error)
|
GetPrecommittedSector(abi.SectorNumber) (*miner8.SectorPreCommitOnChainInfo, error)
|
||||||
ForEachPrecommittedSector(func(SectorPreCommitOnChainInfo) error) error
|
ForEachPrecommittedSector(func(miner8.SectorPreCommitOnChainInfo) error) error
|
||||||
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
|
LoadSectors(sectorNos *bitfield.BitField) ([]*SectorOnChainInfo, error)
|
||||||
NumLiveSectors() (uint64, error)
|
NumLiveSectors() (uint64, error)
|
||||||
IsAllocated(abi.SectorNumber) (bool, error)
|
IsAllocated(abi.SectorNumber) (bool, error)
|
||||||
@ -272,7 +149,7 @@ type State interface {
|
|||||||
sectors() (adt.Array, error)
|
sectors() (adt.Array, error)
|
||||||
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
|
decodeSectorOnChainInfo(*cbg.Deferred) (SectorOnChainInfo, error)
|
||||||
precommits() (adt.Map, error)
|
precommits() (adt.Map, error)
|
||||||
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (SectorPreCommitOnChainInfo, error)
|
decodeSectorPreCommitOnChainInfo(*cbg.Deferred) (miner8.SectorPreCommitOnChainInfo, error)
|
||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -310,44 +187,7 @@ type Partition interface {
|
|||||||
UnprovenSectors() (bitfield.BitField, error)
|
UnprovenSectors() (bitfield.BitField, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SectorOnChainInfo struct {
|
type SectorOnChainInfo = miner8.SectorOnChainInfo
|
||||||
SectorNumber abi.SectorNumber
|
|
||||||
SealProof abi.RegisteredSealProof
|
|
||||||
SealedCID cid.Cid
|
|
||||||
DealIDs []abi.DealID
|
|
||||||
Activation abi.ChainEpoch
|
|
||||||
Expiration abi.ChainEpoch
|
|
||||||
DealWeight abi.DealWeight
|
|
||||||
VerifiedDealWeight abi.DealWeight
|
|
||||||
InitialPledge abi.TokenAmount
|
|
||||||
ExpectedDayReward abi.TokenAmount
|
|
||||||
ExpectedStoragePledge abi.TokenAmount
|
|
||||||
SectorKeyCID *cid.Cid
|
|
||||||
}
|
|
||||||
|
|
||||||
type SectorPreCommitInfo = miner0.SectorPreCommitInfo
|
|
||||||
|
|
||||||
type SectorPreCommitOnChainInfo struct {
|
|
||||||
Info SectorPreCommitInfo
|
|
||||||
PreCommitDeposit abi.TokenAmount
|
|
||||||
PreCommitEpoch abi.ChainEpoch
|
|
||||||
DealWeight abi.DealWeight
|
|
||||||
VerifiedDealWeight abi.DealWeight
|
|
||||||
}
|
|
||||||
|
|
||||||
type PoStPartition = miner0.PoStPartition
|
|
||||||
type RecoveryDeclaration = miner0.RecoveryDeclaration
|
|
||||||
type FaultDeclaration = miner0.FaultDeclaration
|
|
||||||
type ReplicaUpdate = miner7.ReplicaUpdate
|
|
||||||
|
|
||||||
// Params
|
|
||||||
type DeclareFaultsParams = miner0.DeclareFaultsParams
|
|
||||||
type DeclareFaultsRecoveredParams = miner0.DeclareFaultsRecoveredParams
|
|
||||||
type SubmitWindowedPoStParams = miner0.SubmitWindowedPoStParams
|
|
||||||
type ProveCommitSectorParams = miner0.ProveCommitSectorParams
|
|
||||||
type DisputeWindowedPoStParams = miner3.DisputeWindowedPoStParams
|
|
||||||
type ProveCommitAggregateParams = miner5.ProveCommitAggregateParams
|
|
||||||
type ProveReplicaUpdatesParams = miner7.ProveReplicaUpdatesParams
|
|
||||||
|
|
||||||
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
|
func PreferredSealProofTypeFromWindowPoStType(nver network.Version, proof abi.RegisteredPoStProof) (abi.RegisteredSealProof, error) {
|
||||||
// We added support for the new proofs in network version 7, and removed support for the old
|
// We added support for the new proofs in network version 7, and removed support for the old
|
||||||
@ -402,33 +242,9 @@ func WinningPoStProofTypeFromWindowPoStProofType(nver network.Version, proof abi
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
type MinerInfo struct {
|
type MinerInfo = miner8.MinerInfo
|
||||||
Owner address.Address // Must be an ID-address.
|
type WorkerKeyChange = miner8.WorkerKeyChange
|
||||||
Worker address.Address // Must be an ID-address.
|
type WindowPostVerifyInfo = proof.WindowPoStVerifyInfo
|
||||||
NewWorker address.Address // Must be an ID-address.
|
|
||||||
ControlAddresses []address.Address // Must be an ID-addresses.
|
|
||||||
WorkerChangeEpoch abi.ChainEpoch
|
|
||||||
PeerId *peer.ID
|
|
||||||
Multiaddrs []abi.Multiaddrs
|
|
||||||
WindowPoStProofType abi.RegisteredPoStProof
|
|
||||||
SectorSize abi.SectorSize
|
|
||||||
WindowPoStPartitionSectors uint64
|
|
||||||
ConsensusFaultElapsed abi.ChainEpoch
|
|
||||||
}
|
|
||||||
|
|
||||||
func (mi MinerInfo) IsController(addr address.Address) bool {
|
|
||||||
if addr == mi.Owner || addr == mi.Worker {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
|
|
||||||
for _, ca := range mi.ControlAddresses {
|
|
||||||
if addr == ca {
|
|
||||||
return true
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
return false
|
|
||||||
}
|
|
||||||
|
|
||||||
type SectorExpiration struct {
|
type SectorExpiration struct {
|
||||||
OnTime abi.ChainEpoch
|
OnTime abi.ChainEpoch
|
||||||
@ -455,8 +271,8 @@ type SectorExtensions struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type PreCommitChanges struct {
|
type PreCommitChanges struct {
|
||||||
Added []SectorPreCommitOnChainInfo
|
Added []miner8.SectorPreCommitOnChainInfo
|
||||||
Removed []SectorPreCommitOnChainInfo
|
Removed []miner8.SectorPreCommitOnChainInfo
|
||||||
}
|
}
|
||||||
|
|
||||||
type LockedFunds struct {
|
type LockedFunds struct {
|
||||||
|
@ -6,23 +6,28 @@ import (
|
|||||||
{{if (le .v 1)}}
|
{{if (le .v 1)}}
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
{{end}}
|
{{end}}
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
|
|
||||||
{{if (ge .v 3)}}
|
{{if (le .v 7)}}
|
||||||
|
{{if (ge .v 3)}}
|
||||||
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
{{end}}
|
{{end}}
|
||||||
miner{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/miner"
|
miner{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/miner"
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
miner{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}miner"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
@ -210,7 +215,7 @@ func (s *state{{.v}}) GetSectorExpiration(num abi.SectorNumber) (*SectorExpirati
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state{{.v}}) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -221,7 +226,7 @@ func (s *state{{.v}}) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCom
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state{{.v}}) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
{{if (ge .v 3) -}}
|
{{if (ge .v 3) -}}
|
||||||
precommitted, err := adt{{.v}}.AsMap(s.store, s.State.PreCommittedSectors, builtin{{.v}}.DefaultHamtBitwidth)
|
precommitted, err := adt{{.v}}.AsMap(s.store, s.State.PreCommittedSectors, builtin{{.v}}.DefaultHamtBitwidth)
|
||||||
{{- else -}}
|
{{- else -}}
|
||||||
@ -389,10 +394,6 @@ func (s *state{{.v}}) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
{{if (le .v 2)}}
|
{{if (le .v 2)}}
|
||||||
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -404,10 +405,9 @@ func (s *state{{.v}}) Info() (MinerInfo, error) {
|
|||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: {{if (ge .v 3)}}info.WindowPoStProofType{{else}}wpp{{end}},
|
WindowPoStProofType: {{if (ge .v 3)}}info.WindowPoStProofType{{else}}wpp{{end}},
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -415,11 +415,6 @@ func (s *state{{.v}}) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: {{if (ge .v 2)}}info.ConsensusFaultElapsed{{else}}-1{{end}},
|
ConsensusFaultElapsed: {{if (ge .v 2)}}info.ConsensusFaultElapsed{{else}}-1{{end}},
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -449,11 +444,11 @@ func (s *state{{.v}}) precommits() (adt.Map, error) {
|
|||||||
return adt{{.v}}.AsMap(s.store, s.PreCommittedSectors{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
return adt{{.v}}.AsMap(s.store, s.PreCommittedSectors{{if (ge .v 3)}}, builtin{{.v}}.DefaultHamtBitwidth{{end}})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state{{.v}}) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner{{.v}}.SectorPreCommitOnChainInfo
|
var sp miner{{.v}}.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV{{.v}}SectorPreCommitOnChainInfo(sp), nil
|
return fromV{{.v}}SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -584,18 +579,14 @@ func fromV{{.v}}SectorOnChainInfo(v{{.v}} miner{{.v}}.SectorOnChainInfo) SectorO
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV{{.v}}SectorPreCommitOnChainInfo(v{{.v}} miner{{.v}}.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
{{if (ge .v 2)}}
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v{{.v}}.Info),
|
||||||
Info: (SectorPreCommitInfo)(v{{.v}}.Info),
|
|
||||||
PreCommitDeposit: v{{.v}}.PreCommitDeposit,
|
PreCommitDeposit: v{{.v}}.PreCommitDeposit,
|
||||||
PreCommitEpoch: v{{.v}}.PreCommitEpoch,
|
PreCommitEpoch: v{{.v}}.PreCommitEpoch,
|
||||||
DealWeight: v{{.v}}.DealWeight,
|
DealWeight: v{{.v}}.DealWeight,
|
||||||
VerifiedDealWeight: v{{.v}}.VerifiedDealWeight,
|
VerifiedDealWeight: v{{.v}}.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
{{else}}
|
|
||||||
return (SectorPreCommitOnChainInfo)(v0)
|
|
||||||
{{end}}
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) GetState() interface{} {
|
func (s *state{{.v}}) GetState() interface{} {
|
||||||
|
@ -6,16 +6,15 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
miner0 "github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
@ -197,7 +196,7 @@ func (s *state0) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -208,7 +207,7 @@ func (s *state0) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state0) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
|
precommitted, err := adt0.AsMap(s.store, s.State.PreCommittedSectors)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -372,11 +371,6 @@ func (s *state0) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
@ -387,10 +381,9 @@ func (s *state0) Info() (MinerInfo, error) {
|
|||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: wpp,
|
WindowPoStProofType: wpp,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -398,11 +391,6 @@ func (s *state0) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: -1,
|
ConsensusFaultElapsed: -1,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -432,11 +420,11 @@ func (s *state0) precommits() (adt.Map, error) {
|
|||||||
return adt0.AsMap(s.store, s.PreCommittedSectors)
|
return adt0.AsMap(s.store, s.PreCommittedSectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state0) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner0.SectorPreCommitOnChainInfo
|
var sp miner0.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV0SectorPreCommitOnChainInfo(sp), nil
|
return fromV0SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -522,10 +510,14 @@ func fromV0SectorOnChainInfo(v0 miner0.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV0SectorPreCommitOnChainInfo(v0 miner0.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return (SectorPreCommitOnChainInfo)(v0)
|
Info: (minertypes.SectorPreCommitInfo)(v0.Info),
|
||||||
|
PreCommitDeposit: v0.PreCommitDeposit,
|
||||||
|
PreCommitEpoch: v0.PreCommitEpoch,
|
||||||
|
DealWeight: v0.DealWeight,
|
||||||
|
VerifiedDealWeight: v0.VerifiedDealWeight,
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) GetState() interface{} {
|
func (s *state0) GetState() interface{} {
|
||||||
|
@ -4,16 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
miner2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/miner"
|
||||||
@ -195,7 +194,7 @@ func (s *state2) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -206,7 +205,7 @@ func (s *state2) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state2) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
|
precommitted, err := adt2.AsMap(s.store, s.State.PreCommittedSectors)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -370,11 +369,6 @@ func (s *state2) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
wpp, err := info.SealProofType.RegisteredWindowPoStProof()
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
@ -385,10 +379,9 @@ func (s *state2) Info() (MinerInfo, error) {
|
|||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: wpp,
|
WindowPoStProofType: wpp,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -396,11 +389,6 @@ func (s *state2) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -430,11 +418,11 @@ func (s *state2) precommits() (adt.Map, error) {
|
|||||||
return adt2.AsMap(s.store, s.PreCommittedSectors)
|
return adt2.AsMap(s.store, s.PreCommittedSectors)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state2) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner2.SectorPreCommitOnChainInfo
|
var sp miner2.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV2SectorPreCommitOnChainInfo(sp), nil
|
return fromV2SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -552,16 +540,14 @@ func fromV2SectorOnChainInfo(v2 miner2.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV2SectorPreCommitOnChainInfo(v2 miner2.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v2.Info),
|
||||||
Info: (SectorPreCommitInfo)(v2.Info),
|
|
||||||
PreCommitDeposit: v2.PreCommitDeposit,
|
PreCommitDeposit: v2.PreCommitDeposit,
|
||||||
PreCommitEpoch: v2.PreCommitEpoch,
|
PreCommitEpoch: v2.PreCommitEpoch,
|
||||||
DealWeight: v2.DealWeight,
|
DealWeight: v2.DealWeight,
|
||||||
VerifiedDealWeight: v2.VerifiedDealWeight,
|
VerifiedDealWeight: v2.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) GetState() interface{} {
|
func (s *state2) GetState() interface{} {
|
||||||
|
@ -4,16 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
@ -197,7 +196,7 @@ func (s *state3) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -208,7 +207,7 @@ func (s *state3) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state3) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
|
precommitted, err := adt3.AsMap(s.store, s.State.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -372,20 +371,14 @@ func (s *state3) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: info.WindowPoStProofType,
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -393,11 +386,6 @@ func (s *state3) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,11 +415,11 @@ func (s *state3) precommits() (adt.Map, error) {
|
|||||||
return adt3.AsMap(s.store, s.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
|
return adt3.AsMap(s.store, s.PreCommittedSectors, builtin3.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state3) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner3.SectorPreCommitOnChainInfo
|
var sp miner3.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV3SectorPreCommitOnChainInfo(sp), nil
|
return fromV3SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -553,16 +541,14 @@ func fromV3SectorOnChainInfo(v3 miner3.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV3SectorPreCommitOnChainInfo(v3 miner3.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v3.Info),
|
||||||
Info: (SectorPreCommitInfo)(v3.Info),
|
|
||||||
PreCommitDeposit: v3.PreCommitDeposit,
|
PreCommitDeposit: v3.PreCommitDeposit,
|
||||||
PreCommitEpoch: v3.PreCommitEpoch,
|
PreCommitEpoch: v3.PreCommitEpoch,
|
||||||
DealWeight: v3.DealWeight,
|
DealWeight: v3.DealWeight,
|
||||||
VerifiedDealWeight: v3.VerifiedDealWeight,
|
VerifiedDealWeight: v3.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) GetState() interface{} {
|
func (s *state3) GetState() interface{} {
|
||||||
|
@ -4,16 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
@ -197,7 +196,7 @@ func (s *state4) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -208,7 +207,7 @@ func (s *state4) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state4) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
|
precommitted, err := adt4.AsMap(s.store, s.State.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -372,20 +371,14 @@ func (s *state4) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: info.WindowPoStProofType,
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -393,11 +386,6 @@ func (s *state4) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,11 +415,11 @@ func (s *state4) precommits() (adt.Map, error) {
|
|||||||
return adt4.AsMap(s.store, s.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
|
return adt4.AsMap(s.store, s.PreCommittedSectors, builtin4.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state4) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner4.SectorPreCommitOnChainInfo
|
var sp miner4.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV4SectorPreCommitOnChainInfo(sp), nil
|
return fromV4SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -553,16 +541,14 @@ func fromV4SectorOnChainInfo(v4 miner4.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV4SectorPreCommitOnChainInfo(v4 miner4.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v4.Info),
|
||||||
Info: (SectorPreCommitInfo)(v4.Info),
|
|
||||||
PreCommitDeposit: v4.PreCommitDeposit,
|
PreCommitDeposit: v4.PreCommitDeposit,
|
||||||
PreCommitEpoch: v4.PreCommitEpoch,
|
PreCommitEpoch: v4.PreCommitEpoch,
|
||||||
DealWeight: v4.DealWeight,
|
DealWeight: v4.DealWeight,
|
||||||
VerifiedDealWeight: v4.VerifiedDealWeight,
|
VerifiedDealWeight: v4.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) GetState() interface{} {
|
func (s *state4) GetState() interface{} {
|
||||||
|
@ -4,16 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
@ -197,7 +196,7 @@ func (s *state5) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -208,7 +207,7 @@ func (s *state5) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state5) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
|
precommitted, err := adt5.AsMap(s.store, s.State.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -372,20 +371,14 @@ func (s *state5) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: info.WindowPoStProofType,
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -393,11 +386,6 @@ func (s *state5) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,11 +415,11 @@ func (s *state5) precommits() (adt.Map, error) {
|
|||||||
return adt5.AsMap(s.store, s.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
|
return adt5.AsMap(s.store, s.PreCommittedSectors, builtin5.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state5) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner5.SectorPreCommitOnChainInfo
|
var sp miner5.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV5SectorPreCommitOnChainInfo(sp), nil
|
return fromV5SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -553,16 +541,14 @@ func fromV5SectorOnChainInfo(v5 miner5.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV5SectorPreCommitOnChainInfo(v5 miner5.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v5.Info),
|
||||||
Info: (SectorPreCommitInfo)(v5.Info),
|
|
||||||
PreCommitDeposit: v5.PreCommitDeposit,
|
PreCommitDeposit: v5.PreCommitDeposit,
|
||||||
PreCommitEpoch: v5.PreCommitEpoch,
|
PreCommitEpoch: v5.PreCommitEpoch,
|
||||||
DealWeight: v5.DealWeight,
|
DealWeight: v5.DealWeight,
|
||||||
VerifiedDealWeight: v5.VerifiedDealWeight,
|
VerifiedDealWeight: v5.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) GetState() interface{} {
|
func (s *state5) GetState() interface{} {
|
||||||
|
@ -4,16 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
@ -197,7 +196,7 @@ func (s *state6) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -208,7 +207,7 @@ func (s *state6) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state6) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
|
precommitted, err := adt6.AsMap(s.store, s.State.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -372,20 +371,14 @@ func (s *state6) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: info.WindowPoStProofType,
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -393,11 +386,6 @@ func (s *state6) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -427,11 +415,11 @@ func (s *state6) precommits() (adt.Map, error) {
|
|||||||
return adt6.AsMap(s.store, s.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
|
return adt6.AsMap(s.store, s.PreCommittedSectors, builtin6.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state6) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner6.SectorPreCommitOnChainInfo
|
var sp miner6.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV6SectorPreCommitOnChainInfo(sp), nil
|
return fromV6SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -553,16 +541,14 @@ func fromV6SectorOnChainInfo(v6 miner6.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV6SectorPreCommitOnChainInfo(v6 miner6.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v6.Info),
|
||||||
Info: (SectorPreCommitInfo)(v6.Info),
|
|
||||||
PreCommitDeposit: v6.PreCommitDeposit,
|
PreCommitDeposit: v6.PreCommitDeposit,
|
||||||
PreCommitEpoch: v6.PreCommitEpoch,
|
PreCommitEpoch: v6.PreCommitEpoch,
|
||||||
DealWeight: v6.DealWeight,
|
DealWeight: v6.DealWeight,
|
||||||
VerifiedDealWeight: v6.VerifiedDealWeight,
|
VerifiedDealWeight: v6.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) GetState() interface{} {
|
func (s *state6) GetState() interface{} {
|
||||||
|
@ -4,16 +4,15 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
@ -196,7 +195,7 @@ func (s *state7) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -207,7 +206,7 @@ func (s *state7) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state7) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
|
precommitted, err := adt7.AsMap(s.store, s.State.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -371,20 +370,14 @@ func (s *state7) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: info.WindowPoStProofType,
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -392,11 +385,6 @@ func (s *state7) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,11 +414,11 @@ func (s *state7) precommits() (adt.Map, error) {
|
|||||||
return adt7.AsMap(s.store, s.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
|
return adt7.AsMap(s.store, s.PreCommittedSectors, builtin7.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state7) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner7.SectorPreCommitOnChainInfo
|
var sp miner7.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV7SectorPreCommitOnChainInfo(sp), nil
|
return fromV7SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -554,16 +542,14 @@ func fromV7SectorOnChainInfo(v7 miner7.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV7SectorPreCommitOnChainInfo(v7 miner7.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v7.Info),
|
||||||
Info: (SectorPreCommitInfo)(v7.Info),
|
|
||||||
PreCommitDeposit: v7.PreCommitDeposit,
|
PreCommitDeposit: v7.PreCommitDeposit,
|
||||||
PreCommitEpoch: v7.PreCommitEpoch,
|
PreCommitEpoch: v7.PreCommitEpoch,
|
||||||
DealWeight: v7.DealWeight,
|
DealWeight: v7.DealWeight,
|
||||||
VerifiedDealWeight: v7.VerifiedDealWeight,
|
VerifiedDealWeight: v7.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) GetState() interface{} {
|
func (s *state7) GetState() interface{} {
|
||||||
|
@ -4,22 +4,20 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"errors"
|
"errors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
|
||||||
"github.com/filecoin-project/go-bitfield"
|
"github.com/filecoin-project/go-bitfield"
|
||||||
rle "github.com/filecoin-project/go-bitfield/rle"
|
rle "github.com/filecoin-project/go-bitfield/rle"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/dline"
|
"github.com/filecoin-project/go-state-types/dline"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
|
minertypes "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
@ -196,7 +194,7 @@ func (s *state8) GetSectorExpiration(num abi.SectorNumber) (*SectorExpiration, e
|
|||||||
return &out, nil
|
return &out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOnChainInfo, error) {
|
func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
info, ok, err := s.State.GetPrecommittedSector(s.store, num)
|
||||||
if !ok || err != nil {
|
if !ok || err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
@ -207,7 +205,7 @@ func (s *state8) GetPrecommittedSector(num abi.SectorNumber) (*SectorPreCommitOn
|
|||||||
return &ret, nil
|
return &ret, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) ForEachPrecommittedSector(cb func(SectorPreCommitOnChainInfo) error) error {
|
func (s *state8) ForEachPrecommittedSector(cb func(minertypes.SectorPreCommitOnChainInfo) error) error {
|
||||||
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
|
precommitted, err := adt8.AsMap(s.store, s.State.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -371,20 +369,14 @@ func (s *state8) Info() (MinerInfo, error) {
|
|||||||
return MinerInfo{}, err
|
return MinerInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var pid *peer.ID
|
|
||||||
if peerID, err := peer.IDFromBytes(info.PeerId); err == nil {
|
|
||||||
pid = &peerID
|
|
||||||
}
|
|
||||||
|
|
||||||
mi := MinerInfo{
|
mi := MinerInfo{
|
||||||
Owner: info.Owner,
|
Owner: info.Owner,
|
||||||
Worker: info.Worker,
|
Worker: info.Worker,
|
||||||
ControlAddresses: info.ControlAddresses,
|
ControlAddresses: info.ControlAddresses,
|
||||||
|
|
||||||
NewWorker: address.Undef,
|
PendingWorkerKey: (*WorkerKeyChange)(info.PendingWorkerKey),
|
||||||
WorkerChangeEpoch: -1,
|
|
||||||
|
|
||||||
PeerId: pid,
|
PeerId: info.PeerId,
|
||||||
Multiaddrs: info.Multiaddrs,
|
Multiaddrs: info.Multiaddrs,
|
||||||
WindowPoStProofType: info.WindowPoStProofType,
|
WindowPoStProofType: info.WindowPoStProofType,
|
||||||
SectorSize: info.SectorSize,
|
SectorSize: info.SectorSize,
|
||||||
@ -392,11 +384,6 @@ func (s *state8) Info() (MinerInfo, error) {
|
|||||||
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
ConsensusFaultElapsed: info.ConsensusFaultElapsed,
|
||||||
}
|
}
|
||||||
|
|
||||||
if info.PendingWorkerKey != nil {
|
|
||||||
mi.NewWorker = info.PendingWorkerKey.NewWorker
|
|
||||||
mi.WorkerChangeEpoch = info.PendingWorkerKey.EffectiveAt
|
|
||||||
}
|
|
||||||
|
|
||||||
return mi, nil
|
return mi, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -426,11 +413,11 @@ func (s *state8) precommits() (adt.Map, error) {
|
|||||||
return adt8.AsMap(s.store, s.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
|
return adt8.AsMap(s.store, s.PreCommittedSectors, builtin8.DefaultHamtBitwidth)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (SectorPreCommitOnChainInfo, error) {
|
func (s *state8) decodeSectorPreCommitOnChainInfo(val *cbg.Deferred) (minertypes.SectorPreCommitOnChainInfo, error) {
|
||||||
var sp miner8.SectorPreCommitOnChainInfo
|
var sp miner8.SectorPreCommitOnChainInfo
|
||||||
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
err := sp.UnmarshalCBOR(bytes.NewReader(val.Raw))
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return SectorPreCommitOnChainInfo{}, err
|
return minertypes.SectorPreCommitOnChainInfo{}, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return fromV8SectorPreCommitOnChainInfo(sp), nil
|
return fromV8SectorPreCommitOnChainInfo(sp), nil
|
||||||
@ -554,16 +541,14 @@ func fromV8SectorOnChainInfo(v8 miner8.SectorOnChainInfo) SectorOnChainInfo {
|
|||||||
return info
|
return info
|
||||||
}
|
}
|
||||||
|
|
||||||
func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) SectorPreCommitOnChainInfo {
|
func fromV8SectorPreCommitOnChainInfo(v8 miner8.SectorPreCommitOnChainInfo) minertypes.SectorPreCommitOnChainInfo {
|
||||||
|
return minertypes.SectorPreCommitOnChainInfo{
|
||||||
return SectorPreCommitOnChainInfo{
|
Info: (minertypes.SectorPreCommitInfo)(v8.Info),
|
||||||
Info: (SectorPreCommitInfo)(v8.Info),
|
|
||||||
PreCommitDeposit: v8.PreCommitDeposit,
|
PreCommitDeposit: v8.PreCommitDeposit,
|
||||||
PreCommitEpoch: v8.PreCommitEpoch,
|
PreCommitEpoch: v8.PreCommitEpoch,
|
||||||
DealWeight: v8.DealWeight,
|
DealWeight: v8.DealWeight,
|
||||||
VerifiedDealWeight: v8.VerifiedDealWeight,
|
VerifiedDealWeight: v8.VerifiedDealWeight,
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) GetState() interface{} {
|
func (s *state8) GetState() interface{} {
|
||||||
|
@ -10,49 +10,46 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
msig{{.latestVersion}} "github.com/filecoin-project/go-state-types/builtin{{import .latestVersion}}multisig"
|
||||||
msig{{.latestVersion}} "github.com/filecoin-project/specs-actors{{import .latestVersion}}actors/builtin/multisig"
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "multisig" {
|
if name != actors.MultisigKey {
|
||||||
return nil, xerrors.Errorf("actor code is not multisig: %s", name)
|
return nil, xerrors.Errorf("actor code is not multisig: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.MultisigActorCodeID:
|
case builtin{{.}}.MultisigActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,21 +63,6 @@ func MakeState(store adt.Store, av actors.Version, signers []address.Address, th
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "multisig"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.MultisigActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
@ -99,7 +81,7 @@ type State interface {
|
|||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Transaction = msig0.Transaction
|
type Transaction = msig{{.latestVersion}}.Transaction
|
||||||
|
|
||||||
var Methods = builtin{{.latestVersion}}.MethodsMultisig
|
var Methods = builtin{{.latestVersion}}.MethodsMultisig
|
||||||
|
|
||||||
|
@ -6,9 +6,17 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
|
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
|
||||||
multisig{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/multisig"
|
multisig{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/multisig"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
multisig{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||||
|
init{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
@ -55,18 +63,23 @@ func (m message{{.v}}) Create(
|
|||||||
}
|
}
|
||||||
|
|
||||||
{{if (le .v 7)}}
|
{{if (le .v 7)}}
|
||||||
actorCodeID := builtin{{.v}}.MultisigActorCodeID
|
|
||||||
{{else}}
|
|
||||||
actorCodeID, ok := actors.GetActorCodeID(actors.Version{{.v}}, "multisig")
|
|
||||||
if !ok {
|
|
||||||
return nil, xerrors.Errorf("error getting actor multisig code id for actor version %d", {{.v}})
|
|
||||||
}
|
|
||||||
{{end}}
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init{{.v}}.ExecParams{
|
execParams := &init{{.v}}.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin{{.v}}.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
{{else}}
|
||||||
|
code, err := builtin.GetMultisigActorCodeID(actors.Version{{.v}})
|
||||||
|
if err != nil {
|
||||||
|
return nil, xerrors.Errorf("failed to get multisig code ID")
|
||||||
|
}
|
||||||
|
|
||||||
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
|
execParams := &init8.ExecParams{
|
||||||
|
CodeCID: code,
|
||||||
|
ConstructorParams: enc,
|
||||||
|
}
|
||||||
|
{{end}}
|
||||||
|
|
||||||
enc, actErr = actors.SerializeParams(execParams)
|
enc, actErr = actors.SerializeParams(execParams)
|
||||||
if actErr != nil {
|
if actErr != nil {
|
||||||
|
@ -53,11 +53,9 @@ func (m message0) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin0.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init0.ExecParams{
|
execParams := &init0.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin0.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,9 @@ func (m message2) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin2.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init2.ExecParams{
|
execParams := &init2.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin2.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,9 @@ func (m message3) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin3.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init3.ExecParams{
|
execParams := &init3.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin3.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,9 @@ func (m message4) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin4.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init4.ExecParams{
|
execParams := &init4.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin4.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,9 @@ func (m message5) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin5.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init5.ExecParams{
|
execParams := &init5.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin5.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,9 @@ func (m message6) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin6.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init6.ExecParams{
|
execParams := &init6.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin6.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -50,11 +50,9 @@ func (m message7) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID := builtin7.MultisigActorCodeID
|
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init7.ExecParams{
|
execParams := &init7.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: builtin7.MultisigActorCodeID,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -6,9 +6,10 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
|
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||||
multisig8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/multisig"
|
multisig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||||
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
@ -50,14 +51,14 @@ func (m message8) Create(
|
|||||||
return nil, actErr
|
return nil, actErr
|
||||||
}
|
}
|
||||||
|
|
||||||
actorCodeID, ok := actors.GetActorCodeID(actors.Version8, "multisig")
|
code, err := builtin.GetMultisigActorCodeID(actors.Version8)
|
||||||
if !ok {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("error getting actor multisig code id for actor version %d", 8)
|
return nil, xerrors.Errorf("failed to get multisig code ID")
|
||||||
}
|
}
|
||||||
|
|
||||||
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
// new actors are created by invoking 'exec' on the init actor with the constructor params
|
||||||
execParams := &init8.ExecParams{
|
execParams := &init8.ExecParams{
|
||||||
CodeCID: actorCodeID,
|
CodeCID: code,
|
||||||
ConstructorParams: enc,
|
ConstructorParams: enc,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -10,10 +10,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
msig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||||
msig8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/multisig"
|
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
|
||||||
@ -29,83 +27,24 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.MultisigActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "multisig" {
|
if name != actors.MultisigKey {
|
||||||
return nil, xerrors.Errorf("actor code is not multisig: %s", name)
|
return nil, xerrors.Errorf("actor code is not multisig: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,10 +71,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.MultisigActorCodeID:
|
case builtin7.MultisigActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.MultisigActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,42 +107,6 @@ func MakeState(store adt.Store, av actors.Version, signers []address.Address, th
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "multisig"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.MultisigActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
@ -224,7 +125,7 @@ type State interface {
|
|||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
|
||||||
type Transaction = msig0.Transaction
|
type Transaction = msig8.Transaction
|
||||||
|
|
||||||
var Methods = builtin8.MethodsMultisig
|
var Methods = builtin8.MethodsMultisig
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
@ -14,10 +13,17 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
{{if (ge .v 3)}}
|
{{if (le .v 7)}}
|
||||||
|
{{if (ge .v 3)}}
|
||||||
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
{{end}}
|
{{end}}
|
||||||
msig{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/multisig"
|
msig{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/multisig"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
msig{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}multisig"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
@ -119,7 +125,7 @@ func (s *state{{.v}}) decodeTransaction(val *cbg.Deferred) (Transaction, error)
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) GetState() interface{} {
|
func (s *state{{.v}}) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -15,6 +13,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
msig0 "github.com/filecoin-project/specs-actors/actors/builtin/multisig"
|
||||||
|
adt0 "github.com/filecoin-project/specs-actors/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state0)(nil)
|
var _ State = (*state0)(nil)
|
||||||
@ -109,7 +108,7 @@ func (s *state0) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) GetState() interface{} {
|
func (s *state0) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -15,6 +13,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
|
msig2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/multisig"
|
||||||
|
adt2 "github.com/filecoin-project/specs-actors/v2/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state2)(nil)
|
var _ State = (*state2)(nil)
|
||||||
@ -109,7 +108,7 @@ func (s *state2) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) GetState() interface{} {
|
func (s *state2) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -17,6 +15,7 @@ import (
|
|||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
|
|
||||||
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
|
msig3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/multisig"
|
||||||
|
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state3)(nil)
|
var _ State = (*state3)(nil)
|
||||||
@ -111,7 +110,7 @@ func (s *state3) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) GetState() interface{} {
|
func (s *state3) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -17,6 +15,7 @@ import (
|
|||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
|
|
||||||
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
|
msig4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/multisig"
|
||||||
|
adt4 "github.com/filecoin-project/specs-actors/v4/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state4)(nil)
|
var _ State = (*state4)(nil)
|
||||||
@ -111,7 +110,7 @@ func (s *state4) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) GetState() interface{} {
|
func (s *state4) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -17,6 +15,7 @@ import (
|
|||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
|
|
||||||
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
|
msig5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/multisig"
|
||||||
|
adt5 "github.com/filecoin-project/specs-actors/v5/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state5)(nil)
|
var _ State = (*state5)(nil)
|
||||||
@ -111,7 +110,7 @@ func (s *state5) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) GetState() interface{} {
|
func (s *state5) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -17,6 +15,7 @@ import (
|
|||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
|
|
||||||
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
|
msig6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/multisig"
|
||||||
|
adt6 "github.com/filecoin-project/specs-actors/v6/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state6)(nil)
|
var _ State = (*state6)(nil)
|
||||||
@ -111,7 +110,7 @@ func (s *state6) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) GetState() interface{} {
|
func (s *state6) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -17,6 +15,7 @@ import (
|
|||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
|
msig7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/multisig"
|
||||||
|
adt7 "github.com/filecoin-project/specs-actors/v7/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state7)(nil)
|
var _ State = (*state7)(nil)
|
||||||
@ -111,7 +110,7 @@ func (s *state7) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) GetState() interface{} {
|
func (s *state7) GetState() interface{} {
|
||||||
|
@ -4,8 +4,6 @@ import (
|
|||||||
"bytes"
|
"bytes"
|
||||||
"encoding/binary"
|
"encoding/binary"
|
||||||
|
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
@ -14,9 +12,9 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
msig8 "github.com/filecoin-project/go-state-types/builtin/v8/multisig"
|
||||||
msig8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/multisig"
|
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
@ -111,7 +109,7 @@ func (s *state8) decodeTransaction(val *cbg.Deferred) (Transaction, error) {
|
|||||||
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
if err := tx.UnmarshalCBOR(bytes.NewReader(val.Raw)); err != nil {
|
||||||
return Transaction{}, err
|
return Transaction{}, err
|
||||||
}
|
}
|
||||||
return tx, nil
|
return Transaction(tx), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) GetState() interface{} {
|
func (s *state8) GetState() interface{} {
|
||||||
|
@ -10,78 +10,50 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
big "github.com/filecoin-project/go-state-types/big"
|
big "github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
||||||
|
|
||||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "paymentchannel" {
|
if name != actors.PaychKey {
|
||||||
return nil, xerrors.Errorf("actor code is not paymentchannel: %s", name)
|
return nil, xerrors.Errorf("actor code is not paych: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.PaymentChannelActorCodeID:
|
case builtin{{.}}.PaymentChannelActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return make{{.}}(store)
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "paymentchannel"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.PaymentChannelActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
// State is an abstract version of payment channel state that works across
|
// State is an abstract version of payment channel state that works across
|
||||||
// versions
|
// versions
|
||||||
type State interface {
|
type State interface {
|
||||||
@ -112,17 +84,14 @@ type LaneState interface {
|
|||||||
Nonce() (uint64, error)
|
Nonce() (uint64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignedVoucher = paych0.SignedVoucher
|
|
||||||
type ModVerifyParams = paych0.ModVerifyParams
|
|
||||||
|
|
||||||
// DecodeSignedVoucher decodes base64 encoded signed voucher.
|
// DecodeSignedVoucher decodes base64 encoded signed voucher.
|
||||||
func DecodeSignedVoucher(s string) (*SignedVoucher, error) {
|
func DecodeSignedVoucher(s string) (*paychtypes.SignedVoucher, error) {
|
||||||
data, err := base64.RawURLEncoding.DecodeString(s)
|
data, err := base64.RawURLEncoding.DecodeString(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var sv SignedVoucher
|
var sv paychtypes.SignedVoucher
|
||||||
if err := ipldcbor.DecodeInto(data, &sv); err != nil {
|
if err := ipldcbor.DecodeInto(data, &sv); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -130,8 +99,6 @@ func DecodeSignedVoucher(s string) (*SignedVoucher, error) {
|
|||||||
return &sv, nil
|
return &sv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var Methods = builtin{{.latestVersion}}.MethodsPaych
|
|
||||||
|
|
||||||
func Message(version actors.Version, from address.Address) MessageBuilder {
|
func Message(version actors.Version, from address.Address) MessageBuilder {
|
||||||
switch version {
|
switch version {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
@ -145,7 +112,23 @@ func Message(version actors.Version, from address.Address) MessageBuilder {
|
|||||||
|
|
||||||
type MessageBuilder interface {
|
type MessageBuilder interface {
|
||||||
Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error)
|
Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error)
|
||||||
Update(paych address.Address, voucher *SignedVoucher, secret []byte) (*types.Message, error)
|
Update(paych address.Address, voucher *paychtypes.SignedVoucher, secret []byte) (*types.Message, error)
|
||||||
Settle(paych address.Address) (*types.Message, error)
|
Settle(paych address.Address) (*types.Message, error)
|
||||||
Collect(paych address.Address) (*types.Message, error)
|
Collect(paych address.Address) (*types.Message, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func toV0SignedVoucher(sv paychtypes.SignedVoucher) paych0.SignedVoucher {
|
||||||
|
return paych0.SignedVoucher{
|
||||||
|
ChannelAddr: sv.ChannelAddr,
|
||||||
|
TimeLockMin: sv.TimeLockMin,
|
||||||
|
TimeLockMax: sv.TimeLockMax,
|
||||||
|
SecretPreimage: sv.SecretHash,
|
||||||
|
Extra: (*paych0.ModVerifyParams)(sv.Extra),
|
||||||
|
Lane: sv.Lane,
|
||||||
|
Nonce: sv.Nonce,
|
||||||
|
Amount: sv.Amount,
|
||||||
|
MinSettleHeight: sv.MinSettleHeight,
|
||||||
|
Merges: nil,
|
||||||
|
Signature: sv.Signature,
|
||||||
|
}
|
||||||
|
}
|
@ -8,9 +8,17 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
{{if (le .v 7)}}
|
||||||
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
|
init{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/init"
|
||||||
paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych"
|
paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
paych{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
init{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||||
|
{{end}}
|
||||||
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
@ -50,10 +58,10 @@ func (m message{{.v}}) Create(to address.Address, initialAmount abi.TokenAmount)
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message{{.v}}) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message{{.v}}) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych{{.v}}.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych{{.v}}.UpdateChannelStateParams{
|
||||||
{{if (ge .v 7)}}
|
{{if (le .v 6)}}
|
||||||
Sv: toV{{.v}}SignedVoucher(*sv),
|
Sv: toV0SignedVoucher(*sv),
|
||||||
{{else}}
|
{{else}}
|
||||||
Sv: *sv,
|
Sv: *sv,
|
||||||
{{end}}
|
{{end}}
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
init0 "github.com/filecoin-project/specs-actors/actors/builtin/init"
|
||||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message0) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message0) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message0) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych0.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych0.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: toV0SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
builtin2 "github.com/filecoin-project/specs-actors/v2/actors/builtin"
|
||||||
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
init2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/init"
|
||||||
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
|
paych2 "github.com/filecoin-project/specs-actors/v2/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message2) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message2) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message2) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych2.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych2.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: toV0SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
|
init3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/init"
|
||||||
paych3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/paych"
|
paych3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message3) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message3) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message3) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych3.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych3.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: toV0SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
builtin4 "github.com/filecoin-project/specs-actors/v4/actors/builtin"
|
||||||
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
|
init4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/init"
|
||||||
paych4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/paych"
|
paych4 "github.com/filecoin-project/specs-actors/v4/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message4) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message4) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message4) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych4.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych4.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: toV0SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
builtin5 "github.com/filecoin-project/specs-actors/v5/actors/builtin"
|
||||||
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
|
init5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/init"
|
||||||
paych5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/paych"
|
paych5 "github.com/filecoin-project/specs-actors/v5/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message5) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message5) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message5) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych5.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych5.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: toV0SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
builtin6 "github.com/filecoin-project/specs-actors/v6/actors/builtin"
|
||||||
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
|
init6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/init"
|
||||||
paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych"
|
paych6 "github.com/filecoin-project/specs-actors/v6/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message6) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message6) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message6) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych6.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych6.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: *sv,
|
Sv: toV0SignedVoucher(*sv),
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -4,6 +4,8 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
|
init7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/init"
|
||||||
paych7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/paych"
|
paych7 "github.com/filecoin-project/specs-actors/v7/actors/builtin/paych"
|
||||||
@ -40,10 +42,10 @@ func (m message7) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message7) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message7) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych7.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych7.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: toV7SignedVoucher(*sv),
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -6,9 +6,11 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
init8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/init"
|
|
||||||
paych8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/paych"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
init8 "github.com/filecoin-project/go-state-types/builtin/v8/init"
|
||||||
|
paych8 "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
init_ "github.com/filecoin-project/lotus/chain/actors/builtin/init"
|
||||||
@ -45,10 +47,10 @@ func (m message8) Create(to address.Address, initialAmount abi.TokenAmount) (*ty
|
|||||||
}, nil
|
}, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (m message8) Update(paych address.Address, sv *SignedVoucher, secret []byte) (*types.Message, error) {
|
func (m message8) Update(paych address.Address, sv *paychtypes.SignedVoucher, secret []byte) (*types.Message, error) {
|
||||||
params, aerr := actors.SerializeParams(&paych8.UpdateChannelStateParams{
|
params, aerr := actors.SerializeParams(&paych8.UpdateChannelStateParams{
|
||||||
|
|
||||||
Sv: toV8SignedVoucher(*sv),
|
Sv: *sv,
|
||||||
|
|
||||||
Secret: secret,
|
Secret: secret,
|
||||||
})
|
})
|
||||||
|
@ -10,9 +10,9 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
big "github.com/filecoin-project/go-state-types/big"
|
big "github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
ipldcbor "github.com/ipfs/go-ipld-cbor"
|
||||||
|
|
||||||
|
paychtypes "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
paych0 "github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -29,84 +29,23 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.PaymentChannelActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
// Load returns an abstract copy of payment channel state, irregardless of actor version
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "paymentchannel" {
|
if name != actors.PaychKey {
|
||||||
return nil, xerrors.Errorf("actor code is not paymentchannel: %s", name)
|
return nil, xerrors.Errorf("actor code is not paych: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -133,80 +72,11 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.PaymentChannelActorCodeID:
|
case builtin7.PaymentChannelActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.PaymentChannelActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return make0(store)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return make2(store)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return make3(store)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return make4(store)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return make5(store)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return make6(store)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return make7(store)
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return make8(store)
|
|
||||||
|
|
||||||
}
|
|
||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "paymentchannel"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.PaymentChannelActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
// State is an abstract version of payment channel state that works across
|
// State is an abstract version of payment channel state that works across
|
||||||
// versions
|
// versions
|
||||||
type State interface {
|
type State interface {
|
||||||
@ -237,17 +107,14 @@ type LaneState interface {
|
|||||||
Nonce() (uint64, error)
|
Nonce() (uint64, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type SignedVoucher = paych0.SignedVoucher
|
|
||||||
type ModVerifyParams = paych0.ModVerifyParams
|
|
||||||
|
|
||||||
// DecodeSignedVoucher decodes base64 encoded signed voucher.
|
// DecodeSignedVoucher decodes base64 encoded signed voucher.
|
||||||
func DecodeSignedVoucher(s string) (*SignedVoucher, error) {
|
func DecodeSignedVoucher(s string) (*paychtypes.SignedVoucher, error) {
|
||||||
data, err := base64.RawURLEncoding.DecodeString(s)
|
data, err := base64.RawURLEncoding.DecodeString(s)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
var sv SignedVoucher
|
var sv paychtypes.SignedVoucher
|
||||||
if err := ipldcbor.DecodeInto(data, &sv); err != nil {
|
if err := ipldcbor.DecodeInto(data, &sv); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -255,8 +122,6 @@ func DecodeSignedVoucher(s string) (*SignedVoucher, error) {
|
|||||||
return &sv, nil
|
return &sv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
var Methods = builtin8.MethodsPaych
|
|
||||||
|
|
||||||
func Message(version actors.Version, from address.Address) MessageBuilder {
|
func Message(version actors.Version, from address.Address) MessageBuilder {
|
||||||
switch version {
|
switch version {
|
||||||
|
|
||||||
@ -291,7 +156,23 @@ func Message(version actors.Version, from address.Address) MessageBuilder {
|
|||||||
|
|
||||||
type MessageBuilder interface {
|
type MessageBuilder interface {
|
||||||
Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error)
|
Create(to address.Address, initialAmount abi.TokenAmount) (*types.Message, error)
|
||||||
Update(paych address.Address, voucher *SignedVoucher, secret []byte) (*types.Message, error)
|
Update(paych address.Address, voucher *paychtypes.SignedVoucher, secret []byte) (*types.Message, error)
|
||||||
Settle(paych address.Address) (*types.Message, error)
|
Settle(paych address.Address) (*types.Message, error)
|
||||||
Collect(paych address.Address) (*types.Message, error)
|
Collect(paych address.Address) (*types.Message, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
func toV0SignedVoucher(sv paychtypes.SignedVoucher) paych0.SignedVoucher {
|
||||||
|
return paych0.SignedVoucher{
|
||||||
|
ChannelAddr: sv.ChannelAddr,
|
||||||
|
TimeLockMin: sv.TimeLockMin,
|
||||||
|
TimeLockMax: sv.TimeLockMax,
|
||||||
|
SecretPreimage: sv.SecretHash,
|
||||||
|
Extra: (*paych0.ModVerifyParams)(sv.Extra),
|
||||||
|
Lane: sv.Lane,
|
||||||
|
Nonce: sv.Nonce,
|
||||||
|
Amount: sv.Amount,
|
||||||
|
MinSettleHeight: sv.MinSettleHeight,
|
||||||
|
Merges: nil,
|
||||||
|
Signature: sv.Signature,
|
||||||
|
}
|
||||||
|
}
|
||||||
|
@ -9,8 +9,13 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych"
|
paych{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/paych"
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
paych{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}paych"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
@ -112,21 +117,3 @@ func (ls *laneState{{.v}}) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState{{.v}}) Nonce() (uint64, error) {
|
func (ls *laneState{{.v}}) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
{{if (ge .v 7)}}
|
|
||||||
func toV{{.v}}SignedVoucher(sv SignedVoucher) paych{{.v}}.SignedVoucher {
|
|
||||||
return paych{{.v}}.SignedVoucher{
|
|
||||||
ChannelAddr: sv.ChannelAddr,
|
|
||||||
TimeLockMin: sv.TimeLockMin,
|
|
||||||
TimeLockMax: sv.TimeLockMax,
|
|
||||||
SecretHash: sv.SecretPreimage,
|
|
||||||
Extra: sv.Extra,
|
|
||||||
Lane: sv.Lane,
|
|
||||||
Nonce: sv.Nonce,
|
|
||||||
Amount: sv.Amount,
|
|
||||||
MinSettleHeight: sv.MinSettleHeight,
|
|
||||||
Merges: sv.Merges,
|
|
||||||
Signature: sv.Signature,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
{{end}}
|
|
@ -112,19 +112,3 @@ func (ls *laneState7) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState7) Nonce() (uint64, error) {
|
func (ls *laneState7) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func toV7SignedVoucher(sv SignedVoucher) paych7.SignedVoucher {
|
|
||||||
return paych7.SignedVoucher{
|
|
||||||
ChannelAddr: sv.ChannelAddr,
|
|
||||||
TimeLockMin: sv.TimeLockMin,
|
|
||||||
TimeLockMax: sv.TimeLockMax,
|
|
||||||
SecretHash: sv.SecretPreimage,
|
|
||||||
Extra: sv.Extra,
|
|
||||||
Lane: sv.Lane,
|
|
||||||
Nonce: sv.Nonce,
|
|
||||||
Amount: sv.Amount,
|
|
||||||
MinSettleHeight: sv.MinSettleHeight,
|
|
||||||
Merges: sv.Merges,
|
|
||||||
Signature: sv.Signature,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -9,8 +9,8 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
paych8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/paych"
|
paych8 "github.com/filecoin-project/go-state-types/builtin/v8/paych"
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
@ -112,19 +112,3 @@ func (ls *laneState8) Redeemed() (big.Int, error) {
|
|||||||
func (ls *laneState8) Nonce() (uint64, error) {
|
func (ls *laneState8) Nonce() (uint64, error) {
|
||||||
return ls.LaneState.Nonce, nil
|
return ls.LaneState.Nonce, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func toV8SignedVoucher(sv SignedVoucher) paych8.SignedVoucher {
|
|
||||||
return paych8.SignedVoucher{
|
|
||||||
ChannelAddr: sv.ChannelAddr,
|
|
||||||
TimeLockMin: sv.TimeLockMin,
|
|
||||||
TimeLockMax: sv.TimeLockMax,
|
|
||||||
SecretHash: sv.SecretPreimage,
|
|
||||||
Extra: sv.Extra,
|
|
||||||
Lane: sv.Lane,
|
|
||||||
Nonce: sv.Nonce,
|
|
||||||
Amount: sv.Amount,
|
|
||||||
MinSettleHeight: sv.MinSettleHeight,
|
|
||||||
Merges: sv.Merges,
|
|
||||||
Signature: sv.Signature,
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -14,18 +13,16 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin{{.latestVersion}}.StoragePowerActorAddr
|
Address = builtin{{.latestVersion}}.StoragePowerActorAddr
|
||||||
Methods = builtin{{.latestVersion}}.MethodsPower
|
Methods = builtin{{.latestVersion}}.MethodsPower
|
||||||
@ -33,26 +30,29 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "storagepower" {
|
if name != actors.PowerKey {
|
||||||
return nil, xerrors.Errorf("actor code is not storagepower: %s", name)
|
return nil, xerrors.Errorf("actor code is not power: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.StoragePowerActorCodeID:
|
case builtin{{.}}.StoragePowerActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -66,21 +66,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "storagepower"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.StoragePowerActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-state-types/big"
|
"github.com/filecoin-project/go-state-types/big"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
cbg "github.com/whyrusleeping/cbor-gen"
|
cbg "github.com/whyrusleeping/cbor-gen"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
@ -29,44 +28,9 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.StoragePowerActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin8.StoragePowerActorAddr
|
Address = builtin8.StoragePowerActorAddr
|
||||||
Methods = builtin8.MethodsPower
|
Methods = builtin8.MethodsPower
|
||||||
@ -74,38 +38,15 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "storagepower" {
|
if name != actors.PowerKey {
|
||||||
return nil, xerrors.Errorf("actor code is not storagepower: %s", name)
|
return nil, xerrors.Errorf("actor code is not power: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -132,10 +73,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.StoragePowerActorCodeID:
|
case builtin7.StoragePowerActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.StoragePowerActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -170,42 +109,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "storagepower"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.StoragePowerActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -11,11 +11,17 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
{{if (ge .v 3)}}
|
{{if (le .v 7)}}
|
||||||
|
{{if (ge .v 3)}}
|
||||||
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
{{end}}
|
{{end}}
|
||||||
power{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/power"
|
power{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/power"
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
power{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}power"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
@ -100,7 +106,7 @@ func (s *state{{.v}}) MinerNominalPowerMeetsConsensusMinimum(a address.Address)
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state{{.v}}) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV{{.v}}FilterEstimate({{if (le .v 1)}}*{{end}}s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate({{if (le .v 1)}}*{{end}}s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state{{.v}}) MinerCounts() (uint64, uint64, error) {
|
func (s *state{{.v}}) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -89,7 +89,7 @@ func (s *state0) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state0) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV0FilterEstimate(*s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(*s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state0) MinerCounts() (uint64, uint64, error) {
|
func (s *state0) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -89,7 +89,7 @@ func (s *state2) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state2) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV2FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state2) MinerCounts() (uint64, uint64, error) {
|
func (s *state2) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -86,7 +86,7 @@ func (s *state3) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state3) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV3FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state3) MinerCounts() (uint64, uint64, error) {
|
func (s *state3) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -86,7 +86,7 @@ func (s *state4) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state4) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV4FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state4) MinerCounts() (uint64, uint64, error) {
|
func (s *state4) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -86,7 +86,7 @@ func (s *state5) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state5) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV5FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state5) MinerCounts() (uint64, uint64, error) {
|
func (s *state5) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -86,7 +86,7 @@ func (s *state6) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state6) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV6FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state6) MinerCounts() (uint64, uint64, error) {
|
func (s *state6) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -86,7 +86,7 @@ func (s *state7) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state7) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV7FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state7) MinerCounts() (uint64, uint64, error) {
|
func (s *state7) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -11,10 +11,9 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
power8 "github.com/filecoin-project/go-state-types/builtin/v8/power"
|
||||||
power8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/power"
|
adt8 "github.com/filecoin-project/go-state-types/builtin/v8/util/adt"
|
||||||
adt8 "github.com/filecoin-project/specs-actors/v8/actors/util/adt"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
@ -86,7 +85,7 @@ func (s *state8) MinerNominalPowerMeetsConsensusMinimum(a address.Address) (bool
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state8) TotalPowerSmoothed() (builtin.FilterEstimate, error) {
|
||||||
return builtin.FromV8FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
return builtin.FilterEstimate(s.State.ThisEpochQAPowerSmoothed), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (s *state8) MinerCounts() (uint64, uint64, error) {
|
func (s *state8) MinerCounts() (uint64, uint64, error) {
|
||||||
|
@ -3,13 +3,16 @@ package reward
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
@ -17,13 +20,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin{{.latestVersion}}.RewardActorAddr
|
Address = builtin{{.latestVersion}}.RewardActorAddr
|
||||||
Methods = builtin{{.latestVersion}}.MethodsReward
|
Methods = builtin{{.latestVersion}}.MethodsReward
|
||||||
@ -31,26 +27,29 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "reward" {
|
if name != actors.RewardKey {
|
||||||
return nil, xerrors.Errorf("actor code is not reward: %s", name)
|
return nil, xerrors.Errorf("actor code is not reward: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.RewardActorCodeID:
|
case builtin{{.}}.RewardActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -64,21 +63,6 @@ func MakeState(store adt.Store, av actors.Version, currRealizedPower abi.Storage
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "reward"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.RewardActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -4,7 +4,6 @@ import (
|
|||||||
"github.com/filecoin-project/go-state-types/abi"
|
"github.com/filecoin-project/go-state-types/abi"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
reward0 "github.com/filecoin-project/specs-actors/actors/builtin/reward"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
@ -23,48 +22,13 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin0.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load0(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin2.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load2(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin3.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load3(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin4.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load4(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin5.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load5(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin6.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load6(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin7.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load7(store, root)
|
|
||||||
})
|
|
||||||
|
|
||||||
builtin.RegisterActorState(builtin8.RewardActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load8(store, root)
|
|
||||||
})
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin8.RewardActorAddr
|
Address = builtin8.RewardActorAddr
|
||||||
Methods = builtin8.MethodsReward
|
Methods = builtin8.MethodsReward
|
||||||
@ -72,38 +36,15 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "reward" {
|
if name != actors.RewardKey {
|
||||||
return nil, xerrors.Errorf("actor code is not reward: %s", name)
|
return nil, xerrors.Errorf("actor code is not reward: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return load0(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return load2(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return load3(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return load4(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return load5(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return load6(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return load7(store, act.Head)
|
|
||||||
|
|
||||||
case actors.Version8:
|
case actors.Version8:
|
||||||
return load8(store, act.Head)
|
return load8(store, act.Head)
|
||||||
|
|
||||||
default:
|
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -130,10 +71,8 @@ func Load(store adt.Store, act *types.Actor) (State, error) {
|
|||||||
case builtin7.RewardActorCodeID:
|
case builtin7.RewardActorCodeID:
|
||||||
return load7(store, act.Head)
|
return load7(store, act.Head)
|
||||||
|
|
||||||
case builtin8.RewardActorCodeID:
|
|
||||||
return load8(store, act.Head)
|
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -168,42 +107,6 @@ func MakeState(store adt.Store, av actors.Version, currRealizedPower abi.Storage
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "reward"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.RewardActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -7,9 +7,15 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
miner{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/miner"
|
miner{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/miner"
|
||||||
reward{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/reward"
|
reward{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/reward"
|
||||||
smoothing{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/smoothing"
|
smoothing{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/smoothing"
|
||||||
|
{{else}}
|
||||||
|
smoothing{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/smoothing"
|
||||||
|
miner{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}miner"
|
||||||
|
reward{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}reward"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
@ -45,7 +51,7 @@ func (s *state{{.v}}) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error)
|
|||||||
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
VelocityEstimate: s.State.ThisEpochRewardSmoothed.VelocityEstimate,
|
||||||
}, nil
|
}, nil
|
||||||
{{else}}
|
{{else}}
|
||||||
return builtin.FromV0FilterEstimate(*s.State.ThisEpochRewardSmoothed), nil
|
return builtin.FilterEstimate(*s.State.ThisEpochRewardSmoothed), nil
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -40,7 +40,7 @@ func (s *state0) ThisEpochReward() (abi.TokenAmount, error) {
|
|||||||
|
|
||||||
func (s *state0) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
func (s *state0) ThisEpochRewardSmoothed() (builtin.FilterEstimate, error) {
|
||||||
|
|
||||||
return builtin.FromV0FilterEstimate(*s.State.ThisEpochRewardSmoothed), nil
|
return builtin.FilterEstimate(*s.State.ThisEpochRewardSmoothed), nil
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -7,9 +7,9 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
||||||
|
|
||||||
miner8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/miner"
|
miner8 "github.com/filecoin-project/go-state-types/builtin/v8/miner"
|
||||||
reward8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/reward"
|
reward8 "github.com/filecoin-project/go-state-types/builtin/v8/reward"
|
||||||
smoothing8 "github.com/filecoin-project/specs-actors/v8/actors/util/smoothing"
|
smoothing8 "github.com/filecoin-project/go-state-types/builtin/v8/util/smoothing"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
|
@ -3,11 +3,16 @@ package system
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
|
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -15,6 +20,34 @@ var (
|
|||||||
Address = builtin{{.latestVersion}}.SystemActorAddr
|
Address = builtin{{.latestVersion}}.SystemActorAddr
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != actors.SystemKey {
|
||||||
|
return nil, xerrors.Errorf("actor code is not system: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
|
case actors.Version{{.}}:
|
||||||
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch act.Code {
|
||||||
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
|
case builtin{{.}}.SystemActorCodeID:
|
||||||
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
|
{{end}}
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
|
}
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
@ -25,21 +58,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "system"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.SystemActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,11 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
|
{{if (le .v 7)}}
|
||||||
system{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/system"
|
system{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/system"
|
||||||
|
{{else}}
|
||||||
|
system{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}system"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
|
@ -3,7 +3,8 @@ package system
|
|||||||
import (
|
import (
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
builtin0 "github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
@ -20,13 +21,55 @@ import (
|
|||||||
|
|
||||||
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
builtin7 "github.com/filecoin-project/specs-actors/v7/actors/builtin"
|
||||||
|
|
||||||
builtin8 "github.com/filecoin-project/specs-actors/v8/actors/builtin"
|
builtin8 "github.com/filecoin-project/go-state-types/builtin"
|
||||||
)
|
)
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin8.SystemActorAddr
|
Address = builtin8.SystemActorAddr
|
||||||
)
|
)
|
||||||
|
|
||||||
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
|
if name != actors.SystemKey {
|
||||||
|
return nil, xerrors.Errorf("actor code is not system: %s", name)
|
||||||
|
}
|
||||||
|
|
||||||
|
switch av {
|
||||||
|
|
||||||
|
case actors.Version8:
|
||||||
|
return load8(store, act.Head)
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
switch act.Code {
|
||||||
|
|
||||||
|
case builtin0.SystemActorCodeID:
|
||||||
|
return load0(store, act.Head)
|
||||||
|
|
||||||
|
case builtin2.SystemActorCodeID:
|
||||||
|
return load2(store, act.Head)
|
||||||
|
|
||||||
|
case builtin3.SystemActorCodeID:
|
||||||
|
return load3(store, act.Head)
|
||||||
|
|
||||||
|
case builtin4.SystemActorCodeID:
|
||||||
|
return load4(store, act.Head)
|
||||||
|
|
||||||
|
case builtin5.SystemActorCodeID:
|
||||||
|
return load5(store, act.Head)
|
||||||
|
|
||||||
|
case builtin6.SystemActorCodeID:
|
||||||
|
return load6(store, act.Head)
|
||||||
|
|
||||||
|
case builtin7.SystemActorCodeID:
|
||||||
|
return load7(store, act.Head)
|
||||||
|
|
||||||
|
}
|
||||||
|
|
||||||
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
|
}
|
||||||
|
|
||||||
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
func MakeState(store adt.Store, av actors.Version) (State, error) {
|
||||||
switch av {
|
switch av {
|
||||||
|
|
||||||
@ -58,42 +101,6 @@ func MakeState(store adt.Store, av actors.Version) (State, error) {
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "system"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
|
|
||||||
case actors.Version0:
|
|
||||||
return builtin0.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version2:
|
|
||||||
return builtin2.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version3:
|
|
||||||
return builtin3.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version4:
|
|
||||||
return builtin4.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version5:
|
|
||||||
return builtin5.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version6:
|
|
||||||
return builtin6.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version7:
|
|
||||||
return builtin7.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
case actors.Version8:
|
|
||||||
return builtin8.SystemActorCodeID, nil
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
GetState() interface{}
|
GetState() interface{}
|
||||||
}
|
}
|
||||||
|
@ -5,7 +5,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
system8 "github.com/filecoin-project/specs-actors/v8/actors/builtin/system"
|
system8 "github.com/filecoin-project/go-state-types/builtin/v8/system"
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state8)(nil)
|
var _ State = (*state8)(nil)
|
||||||
|
@ -1,7 +1,6 @@
|
|||||||
package verifreg
|
package verifreg
|
||||||
|
|
||||||
import (
|
import (
|
||||||
"github.com/ipfs/go-cid"
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
@ -9,24 +8,18 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-state-types/cbor"
|
"github.com/filecoin-project/go-state-types/cbor"
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
builtin{{.}} "github.com/filecoin-project/specs-actors{{import .}}actors/builtin"
|
||||||
|
{{else}}
|
||||||
|
builtin{{.}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/builtin"
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
verifreg{{.latestVersion}} "github.com/filecoin-project/specs-actors/v7/actors/builtin/verifreg"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func init() {
|
|
||||||
{{range .versions}}
|
|
||||||
builtin.RegisterActorState(builtin{{.}}.VerifiedRegistryActorCodeID, func(store adt.Store, root cid.Cid) (cbor.Marshaler, error) {
|
|
||||||
return load{{.}}(store, root)
|
|
||||||
})
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
var (
|
var (
|
||||||
Address = builtin{{.latestVersion}}.VerifiedRegistryActorAddr
|
Address = builtin{{.latestVersion}}.VerifiedRegistryActorAddr
|
||||||
Methods = builtin{{.latestVersion}}.MethodsVerifiedRegistry
|
Methods = builtin{{.latestVersion}}.MethodsVerifiedRegistry
|
||||||
@ -34,26 +27,29 @@ var (
|
|||||||
|
|
||||||
func Load(store adt.Store, act *types.Actor) (State, error) {
|
func Load(store adt.Store, act *types.Actor) (State, error) {
|
||||||
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
if name, av, ok := actors.GetActorMetaByCode(act.Code); ok {
|
||||||
if name != "verifiedregistry" {
|
if name != actors.VerifregKey {
|
||||||
return nil, xerrors.Errorf("actor code is not verifiedregistry: %s", name)
|
return nil, xerrors.Errorf("actor code is not verifreg: %s", name)
|
||||||
}
|
}
|
||||||
|
|
||||||
switch av {
|
switch av {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (ge . 8)}}
|
||||||
case actors.Version{{.}}:
|
case actors.Version{{.}}:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
{{end}}
|
{{end}}
|
||||||
default:
|
{{end}}
|
||||||
return nil, xerrors.Errorf("unknown actor version: %d", av)
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
switch act.Code {
|
switch act.Code {
|
||||||
{{range .versions}}
|
{{range .versions}}
|
||||||
|
{{if (le . 7)}}
|
||||||
case builtin{{.}}.VerifiedRegistryActorCodeID:
|
case builtin{{.}}.VerifiedRegistryActorCodeID:
|
||||||
return load{{.}}(store, act.Head)
|
return load{{.}}(store, act.Head)
|
||||||
|
{{end}}
|
||||||
{{end}}
|
{{end}}
|
||||||
}
|
}
|
||||||
|
|
||||||
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
return nil, xerrors.Errorf("unknown actor code %s", act.Code)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -67,27 +63,6 @@ func MakeState(store adt.Store, av actors.Version, rootKeyAddress address.Addres
|
|||||||
return nil, xerrors.Errorf("unknown actor version %d", av)
|
return nil, xerrors.Errorf("unknown actor version %d", av)
|
||||||
}
|
}
|
||||||
|
|
||||||
func GetActorCodeID(av actors.Version) (cid.Cid, error) {
|
|
||||||
if c, ok := actors.GetActorCodeID(av, "verifiedregistry"); ok {
|
|
||||||
return c, nil
|
|
||||||
}
|
|
||||||
|
|
||||||
switch av {
|
|
||||||
{{range .versions}}
|
|
||||||
case actors.Version{{.}}:
|
|
||||||
return builtin{{.}}.VerifiedRegistryActorCodeID, nil
|
|
||||||
{{end}}
|
|
||||||
}
|
|
||||||
|
|
||||||
return cid.Undef, xerrors.Errorf("unknown actor version %d", av)
|
|
||||||
}
|
|
||||||
|
|
||||||
type RemoveDataCapProposal = verifreg{{.latestVersion}}.RemoveDataCapProposal
|
|
||||||
type RemoveDataCapRequest = verifreg{{.latestVersion}}.RemoveDataCapRequest
|
|
||||||
type RemoveDataCapParams = verifreg{{.latestVersion}}.RemoveDataCapParams
|
|
||||||
type RmDcProposalID = verifreg{{.latestVersion}}.RmDcProposalID
|
|
||||||
const SignatureDomainSeparation_RemoveDataCap = verifreg{{.latestVersion}}.SignatureDomainSeparation_RemoveDataCap
|
|
||||||
|
|
||||||
type State interface {
|
type State interface {
|
||||||
cbor.Marshaler
|
cbor.Marshaler
|
||||||
|
|
||||||
|
@ -8,9 +8,17 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
{{if (ge .v 3)}} builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
{{if (le .v 7)}}
|
||||||
{{end}} verifreg{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/verifreg"
|
{{if (ge .v 3)}}
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin"
|
||||||
|
{{end}}
|
||||||
|
verifreg{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/builtin/verifreg"
|
||||||
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
adt{{.v}} "github.com/filecoin-project/specs-actors{{.import}}actors/util/adt"
|
||||||
|
{{else}}
|
||||||
|
verifreg{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}verifreg"
|
||||||
|
adt{{.v}} "github.com/filecoin-project/go-state-types/builtin{{.import}}util/adt"
|
||||||
|
builtin{{.v}} "github.com/filecoin-project/go-state-types/builtin"
|
||||||
|
{{end}}
|
||||||
)
|
)
|
||||||
|
|
||||||
var _ State = (*state{{.v}})(nil)
|
var _ State = (*state{{.v}})(nil)
|
||||||
|
@ -9,6 +9,7 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/chain/actors/adt"
|
"github.com/filecoin-project/lotus/chain/actors/adt"
|
||||||
|
|
||||||
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
builtin3 "github.com/filecoin-project/specs-actors/v3/actors/builtin"
|
||||||
|
|
||||||
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
|
verifreg3 "github.com/filecoin-project/specs-actors/v3/actors/builtin/verifreg"
|
||||||
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
adt3 "github.com/filecoin-project/specs-actors/v3/actors/util/adt"
|
||||||
)
|
)
|
||||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user