types: Drop some redundant alias types
This commit is contained in:
parent
ae634ef7df
commit
0a9e0acc6f
@ -10,6 +10,7 @@ import (
|
|||||||
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
"github.com/filecoin-project/specs-actors/actors/builtin/market"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/ipfs/go-filestore"
|
"github.com/ipfs/go-filestore"
|
||||||
@ -93,7 +94,7 @@ type FullNode interface {
|
|||||||
ClientHasLocal(ctx context.Context, root cid.Cid) (bool, error)
|
ClientHasLocal(ctx context.Context, root cid.Cid) (bool, error)
|
||||||
ClientFindData(ctx context.Context, root cid.Cid) ([]QueryOffer, error)
|
ClientFindData(ctx context.Context, root cid.Cid) ([]QueryOffer, error)
|
||||||
ClientRetrieve(ctx context.Context, order RetrievalOrder, path string) error
|
ClientRetrieve(ctx context.Context, order RetrievalOrder, path string) error
|
||||||
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error)
|
ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error)
|
||||||
|
|
||||||
// ClientUnimport removes references to the specified file from filestore
|
// ClientUnimport removes references to the specified file from filestore
|
||||||
//ClientUnimport(path string)
|
//ClientUnimport(path string)
|
||||||
@ -143,12 +144,12 @@ type FullNode interface {
|
|||||||
PaychClose(context.Context, address.Address) (cid.Cid, error)
|
PaychClose(context.Context, address.Address) (cid.Cid, error)
|
||||||
PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error)
|
PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error)
|
||||||
PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []VoucherSpec) (*PaymentInfo, error)
|
PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []VoucherSpec) (*PaymentInfo, error)
|
||||||
PaychVoucherCheckValid(context.Context, address.Address, *types.SignedVoucher) error
|
PaychVoucherCheckValid(context.Context, address.Address, *paych.SignedVoucher) error
|
||||||
PaychVoucherCheckSpendable(context.Context, address.Address, *types.SignedVoucher, []byte, []byte) (bool, error)
|
PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error)
|
||||||
PaychVoucherCreate(context.Context, address.Address, types.BigInt, uint64) (*types.SignedVoucher, error)
|
PaychVoucherCreate(context.Context, address.Address, types.BigInt, uint64) (*paych.SignedVoucher, error)
|
||||||
PaychVoucherAdd(context.Context, address.Address, *types.SignedVoucher, []byte, types.BigInt) (types.BigInt, error)
|
PaychVoucherAdd(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error)
|
||||||
PaychVoucherList(context.Context, address.Address) ([]*types.SignedVoucher, error)
|
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error)
|
||||||
PaychVoucherSubmit(context.Context, address.Address, *types.SignedVoucher) (cid.Cid, error)
|
PaychVoucherSubmit(context.Context, address.Address, *paych.SignedVoucher) (cid.Cid, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type MinerSectors struct {
|
type MinerSectors struct {
|
||||||
@ -223,7 +224,7 @@ type ChannelInfo struct {
|
|||||||
type PaymentInfo struct {
|
type PaymentInfo struct {
|
||||||
Channel address.Address
|
Channel address.Address
|
||||||
ChannelMessage *cid.Cid
|
ChannelMessage *cid.Cid
|
||||||
Vouchers []*types.SignedVoucher
|
Vouchers []*paych.SignedVoucher
|
||||||
}
|
}
|
||||||
|
|
||||||
type VoucherSpec struct {
|
type VoucherSpec struct {
|
||||||
@ -231,7 +232,7 @@ type VoucherSpec struct {
|
|||||||
TimeLock abi.ChainEpoch
|
TimeLock abi.ChainEpoch
|
||||||
MinSettle abi.ChainEpoch
|
MinSettle abi.ChainEpoch
|
||||||
|
|
||||||
Extra *types.ModVerifyParams
|
Extra *paych.ModVerifyParams
|
||||||
}
|
}
|
||||||
|
|
||||||
type MinerPower struct {
|
type MinerPower struct {
|
||||||
|
@ -3,17 +3,18 @@ package apistruct
|
|||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
|
||||||
|
|
||||||
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
"github.com/libp2p/go-libp2p-core/network"
|
"github.com/libp2p/go-libp2p-core/network"
|
||||||
"github.com/libp2p/go-libp2p-core/peer"
|
"github.com/libp2p/go-libp2p-core/peer"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
|
sectorbuilder "github.com/filecoin-project/go-sectorbuilder"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/abi/big"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/chain/store"
|
"github.com/filecoin-project/lotus/chain/store"
|
||||||
@ -100,7 +101,7 @@ type FullNodeStruct struct {
|
|||||||
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
|
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
|
||||||
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
|
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
|
||||||
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"`
|
ClientRetrieve func(ctx context.Context, order api.RetrievalOrder, path string) error `perm:"admin"`
|
||||||
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error) `perm:"read"`
|
ClientQueryAsk func(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) `perm:"read"`
|
||||||
|
|
||||||
StateMinerSectors func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
StateMinerSectors func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||||
StateMinerProvingSet func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
StateMinerProvingSet func(context.Context, address.Address, types.TipSetKey) ([]*api.ChainSectorInfo, error) `perm:"read"`
|
||||||
@ -139,13 +140,13 @@ type FullNodeStruct struct {
|
|||||||
PaychClose func(context.Context, address.Address) (cid.Cid, error) `perm:"sign"`
|
PaychClose func(context.Context, address.Address) (cid.Cid, error) `perm:"sign"`
|
||||||
PaychAllocateLane func(context.Context, address.Address) (uint64, error) `perm:"sign"`
|
PaychAllocateLane func(context.Context, address.Address) (uint64, error) `perm:"sign"`
|
||||||
PaychNewPayment func(ctx context.Context, from, to address.Address, vouchers []api.VoucherSpec) (*api.PaymentInfo, error) `perm:"sign"`
|
PaychNewPayment func(ctx context.Context, from, to address.Address, vouchers []api.VoucherSpec) (*api.PaymentInfo, error) `perm:"sign"`
|
||||||
PaychVoucherCheck func(context.Context, *types.SignedVoucher) error `perm:"read"`
|
PaychVoucherCheck func(context.Context, *paych.SignedVoucher) error `perm:"read"`
|
||||||
PaychVoucherCheckValid func(context.Context, address.Address, *types.SignedVoucher) error `perm:"read"`
|
PaychVoucherCheckValid func(context.Context, address.Address, *paych.SignedVoucher) error `perm:"read"`
|
||||||
PaychVoucherCheckSpendable func(context.Context, address.Address, *types.SignedVoucher, []byte, []byte) (bool, error) `perm:"read"`
|
PaychVoucherCheckSpendable func(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) `perm:"read"`
|
||||||
PaychVoucherAdd func(context.Context, address.Address, *types.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) `perm:"write"`
|
PaychVoucherAdd func(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) `perm:"write"`
|
||||||
PaychVoucherCreate func(context.Context, address.Address, types.BigInt, uint64) (*types.SignedVoucher, error) `perm:"sign"`
|
PaychVoucherCreate func(context.Context, address.Address, big.Int, uint64) (*paych.SignedVoucher, error) `perm:"sign"`
|
||||||
PaychVoucherList func(context.Context, address.Address) ([]*types.SignedVoucher, error) `perm:"write"`
|
PaychVoucherList func(context.Context, address.Address) ([]*paych.SignedVoucher, error) `perm:"write"`
|
||||||
PaychVoucherSubmit func(context.Context, address.Address, *types.SignedVoucher) (cid.Cid, error) `perm:"sign"`
|
PaychVoucherSubmit func(context.Context, address.Address, *paych.SignedVoucher) (cid.Cid, error) `perm:"sign"`
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -255,7 +256,7 @@ func (c *FullNodeStruct) ClientRetrieve(ctx context.Context, order api.Retrieval
|
|||||||
return c.Internal.ClientRetrieve(ctx, order, path)
|
return c.Internal.ClientRetrieve(ctx, order, path)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*types.SignedStorageAsk, error) {
|
func (c *FullNodeStruct) ClientQueryAsk(ctx context.Context, p peer.ID, miner address.Address) (*storagemarket.SignedStorageAsk, error) {
|
||||||
return c.Internal.ClientQueryAsk(ctx, p, miner)
|
return c.Internal.ClientQueryAsk(ctx, p, miner)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -534,23 +535,23 @@ func (c *FullNodeStruct) PaychStatus(ctx context.Context, pch address.Address) (
|
|||||||
return c.Internal.PaychStatus(ctx, pch)
|
return c.Internal.PaychStatus(ctx, pch)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychVoucherCheckValid(ctx context.Context, addr address.Address, sv *types.SignedVoucher) error {
|
func (c *FullNodeStruct) PaychVoucherCheckValid(ctx context.Context, addr address.Address, sv *paych.SignedVoucher) error {
|
||||||
return c.Internal.PaychVoucherCheckValid(ctx, addr, sv)
|
return c.Internal.PaychVoucherCheckValid(ctx, addr, sv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychVoucherCheckSpendable(ctx context.Context, addr address.Address, sv *types.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
func (c *FullNodeStruct) PaychVoucherCheckSpendable(ctx context.Context, addr address.Address, sv *paych.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||||
return c.Internal.PaychVoucherCheckSpendable(ctx, addr, sv, secret, proof)
|
return c.Internal.PaychVoucherCheckSpendable(ctx, addr, sv, secret, proof)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychVoucherAdd(ctx context.Context, addr address.Address, sv *types.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
func (c *FullNodeStruct) PaychVoucherAdd(ctx context.Context, addr address.Address, sv *paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||||
return c.Internal.PaychVoucherAdd(ctx, addr, sv, proof, minDelta)
|
return c.Internal.PaychVoucherAdd(ctx, addr, sv, proof, minDelta)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*types.SignedVoucher, error) {
|
func (c *FullNodeStruct) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*paych.SignedVoucher, error) {
|
||||||
return c.Internal.PaychVoucherCreate(ctx, pch, amt, lane)
|
return c.Internal.PaychVoucherCreate(ctx, pch, amt, lane)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychVoucherList(ctx context.Context, pch address.Address) ([]*types.SignedVoucher, error) {
|
func (c *FullNodeStruct) PaychVoucherList(ctx context.Context, pch address.Address) ([]*paych.SignedVoucher, error) {
|
||||||
return c.Internal.PaychVoucherList(ctx, pch)
|
return c.Internal.PaychVoucherList(ctx, pch)
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -566,7 +567,7 @@ func (c *FullNodeStruct) PaychNewPayment(ctx context.Context, from, to address.A
|
|||||||
return c.Internal.PaychNewPayment(ctx, from, to, vouchers)
|
return c.Internal.PaychNewPayment(ctx, from, to, vouchers)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (c *FullNodeStruct) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *types.SignedVoucher) (cid.Cid, error) {
|
func (c *FullNodeStruct) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paych.SignedVoucher) (cid.Cid, error) {
|
||||||
return c.Internal.PaychVoucherSubmit(ctx, ch, sv)
|
return c.Internal.PaychVoucherSubmit(ctx, ch, sv)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -4,12 +4,12 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SignFunc = func(context.Context, []byte) (*types.Signature, error)
|
type SignFunc = func(context.Context, []byte) (*crypto.Signature, error)
|
||||||
|
|
||||||
type Signer func(context.Context, address.Address, []byte) (*types.Signature, error)
|
type Signer func(context.Context, address.Address, []byte) (*crypto.Signature, error)
|
||||||
|
|
||||||
type Signable interface {
|
type Signable interface {
|
||||||
Sign(context.Context, SignFunc) error
|
Sign(context.Context, SignFunc) error
|
||||||
@ -17,7 +17,7 @@ type Signable interface {
|
|||||||
|
|
||||||
func SignWith(ctx context.Context, signer Signer, addr address.Address, signable ...Signable) error {
|
func SignWith(ctx context.Context, signer Signer, addr address.Address, signable ...Signable) error {
|
||||||
for _, s := range signable {
|
for _, s := range signable {
|
||||||
err := s.Sign(ctx, func(ctx context.Context, b []byte) (*types.Signature, error) {
|
err := s.Sign(ctx, func(ctx context.Context, b []byte) (*crypto.Signature, error) {
|
||||||
return signer(ctx, addr, b)
|
return signer(ctx, addr, b)
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -69,8 +69,8 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
|
|||||||
Messages: msgcid,
|
Messages: msgcid,
|
||||||
ParentMessageReceipts: dummyCid,
|
ParentMessageReceipts: dummyCid,
|
||||||
|
|
||||||
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
|
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
|
||||||
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
|
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
Height: h,
|
Height: h,
|
||||||
@ -82,8 +82,8 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
|
|||||||
Messages: msgcid,
|
Messages: msgcid,
|
||||||
ParentMessageReceipts: dummyCid,
|
ParentMessageReceipts: dummyCid,
|
||||||
|
|
||||||
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
|
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
|
||||||
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
|
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
|
||||||
},
|
},
|
||||||
})
|
})
|
||||||
|
|
||||||
|
@ -2,10 +2,10 @@ package state
|
|||||||
|
|
||||||
import (
|
import (
|
||||||
"context"
|
"context"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
"testing"
|
"testing"
|
||||||
|
|
||||||
address "github.com/filecoin-project/go-address"
|
address "github.com/filecoin-project/go-address"
|
||||||
actors "github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
)
|
)
|
||||||
@ -27,8 +27,8 @@ func BenchmarkStateTreeSet(b *testing.B) {
|
|||||||
}
|
}
|
||||||
err = st.SetActor(a, &types.Actor{
|
err = st.SetActor(a, &types.Actor{
|
||||||
Balance: types.NewInt(1258812523),
|
Balance: types.NewInt(1258812523),
|
||||||
Code: actors.StorageMinerCodeCid,
|
Code: builtin.StorageMinerActorCodeID,
|
||||||
Head: actors.AccountCodeCid,
|
Head: builtin.AccountActorCodeID,
|
||||||
Nonce: uint64(i),
|
Nonce: uint64(i),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -54,8 +54,8 @@ func BenchmarkStateTreeSetFlush(b *testing.B) {
|
|||||||
}
|
}
|
||||||
err = st.SetActor(a, &types.Actor{
|
err = st.SetActor(a, &types.Actor{
|
||||||
Balance: types.NewInt(1258812523),
|
Balance: types.NewInt(1258812523),
|
||||||
Code: actors.StorageMinerCodeCid,
|
Code: builtin.StorageMinerActorCodeID,
|
||||||
Head: actors.AccountCodeCid,
|
Head: builtin.AccountActorCodeID,
|
||||||
Nonce: uint64(i),
|
Nonce: uint64(i),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -80,8 +80,8 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
|
|||||||
}
|
}
|
||||||
err = st.SetActor(a, &types.Actor{
|
err = st.SetActor(a, &types.Actor{
|
||||||
Balance: types.NewInt(1258812523 + uint64(i)),
|
Balance: types.NewInt(1258812523 + uint64(i)),
|
||||||
Code: actors.StorageMinerCodeCid,
|
Code: builtin.StorageMinerActorCodeID,
|
||||||
Head: actors.AccountCodeCid,
|
Head: builtin.AccountActorCodeID,
|
||||||
Nonce: uint64(i),
|
Nonce: uint64(i),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
@ -123,8 +123,8 @@ func TestSetCache(t *testing.T) {
|
|||||||
|
|
||||||
act := &types.Actor{
|
act := &types.Actor{
|
||||||
Balance: types.NewInt(0),
|
Balance: types.NewInt(0),
|
||||||
Code: actors.StorageMinerCodeCid,
|
Code: builtin.StorageMinerActorCodeID,
|
||||||
Head: actors.AccountCodeCid,
|
Head: builtin.AccountActorCodeID,
|
||||||
Nonce: 0,
|
Nonce: 0,
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -184,7 +184,7 @@ func TestForkHeightTriggers(t *testing.T) {
|
|||||||
|
|
||||||
m := &types.Message{
|
m := &types.Message{
|
||||||
From: cg.Banker(),
|
From: cg.Banker(),
|
||||||
To: actors.InitAddress,
|
To: builtin.InitActorAddr,
|
||||||
Method: builtin.MethodsInit.Exec,
|
Method: builtin.MethodsInit.Exec,
|
||||||
Params: enc,
|
Params: enc,
|
||||||
GasLimit: types.NewInt(10000),
|
GasLimit: types.NewInt(10000),
|
||||||
|
@ -1,9 +0,0 @@
|
|||||||
package types
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
|
||||||
)
|
|
||||||
|
|
||||||
type SignedStorageAsk = storagemarket.SignedStorageAsk
|
|
||||||
|
|
||||||
type StorageAsk = storagemarket.StorageAsk
|
|
@ -1,7 +0,0 @@
|
|||||||
package types
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
|
||||||
)
|
|
||||||
|
|
||||||
type BitField = abi.BitField
|
|
@ -1,7 +0,0 @@
|
|||||||
package types
|
|
||||||
|
|
||||||
import (
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/crypto"
|
|
||||||
)
|
|
||||||
|
|
||||||
type Signature = crypto.Signature
|
|
@ -8,7 +8,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
func TestSignatureSerializeRoundTrip(t *testing.T) {
|
func TestSignatureSerializeRoundTrip(t *testing.T) {
|
||||||
s := &Signature{
|
s := &crypto.Signature{
|
||||||
Data: []byte("foo bar cat dog"),
|
Data: []byte("foo bar cat dog"),
|
||||||
Type: crypto.SigTypeBLS,
|
Type: crypto.SigTypeBLS,
|
||||||
}
|
}
|
||||||
@ -18,7 +18,7 @@ func TestSignatureSerializeRoundTrip(t *testing.T) {
|
|||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
|
||||||
var outs Signature
|
var outs crypto.Signature
|
||||||
if err := outs.UnmarshalCBOR(buf); err != nil {
|
if err := outs.UnmarshalCBOR(buf); err != nil {
|
||||||
t.Fatal(err)
|
t.Fatal(err)
|
||||||
}
|
}
|
||||||
|
@ -1,27 +1,22 @@
|
|||||||
package types
|
package types
|
||||||
|
|
||||||
import (
|
import(
|
||||||
"encoding/base64"
|
"encoding/base64"
|
||||||
|
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
|
||||||
cbor "github.com/ipfs/go-ipld-cbor"
|
cbor "github.com/ipfs/go-ipld-cbor"
|
||||||
)
|
)
|
||||||
|
|
||||||
type SignedVoucher = paych.SignedVoucher
|
func DecodeSignedVoucher(s string) (*paych.SignedVoucher, error) {
|
||||||
|
|
||||||
func DecodeSignedVoucher(s string) (*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 paych.SignedVoucher
|
||||||
if err := cbor.DecodeInto(data, &sv); err != nil {
|
if err := cbor.DecodeInto(data, &sv); err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
return &sv, nil
|
return &sv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
type Merge = paych.Merge
|
|
||||||
type ModVerifyParams = paych.ModVerifyParams
|
|
||||||
|
@ -14,12 +14,13 @@ import (
|
|||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
"github.com/filecoin-project/specs-actors/actors/builtin"
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/crypto"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/types"
|
"github.com/filecoin-project/lotus/chain/types"
|
||||||
)
|
)
|
||||||
|
|
||||||
type Signer interface {
|
type Signer interface {
|
||||||
Sign(ctx context.Context, addr vaddress.Address, msg []byte) (*types.Signature, error)
|
Sign(ctx context.Context, addr vaddress.Address, msg []byte) (*crypto.Signature, error)
|
||||||
}
|
}
|
||||||
|
|
||||||
type MessageFactory struct {
|
type MessageFactory struct {
|
||||||
|
@ -295,7 +295,7 @@ var paychVoucherBestSpendableCmd = &cli.Command{
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var best *types.SignedVoucher
|
var best *paych.SignedVoucher
|
||||||
for _, v := range vouchers {
|
for _, v := range vouchers {
|
||||||
spendable, err := api.PaychVoucherCheckSpendable(ctx, ch, v, nil, nil)
|
spendable, err := api.PaychVoucherCheckSpendable(ctx, ch, v, nil, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
|
@ -259,7 +259,7 @@ func main() {
|
|||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
var genmm map[string]genesis.GenesisMiner
|
var genmm map[string]genesis.Miner
|
||||||
if err := json.Unmarshal(fdata, &genmm); err != nil {
|
if err := json.Unmarshal(fdata, &genmm); err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
@ -471,11 +471,11 @@ create temp table mh (like miner_heads excluding constraints) on commit drop;
|
|||||||
fmt.Sprint(i.psize),
|
fmt.Sprint(i.psize),
|
||||||
i.info.Owner.String(),
|
i.info.Owner.String(),
|
||||||
i.info.Worker.String(),
|
i.info.Worker.String(),
|
||||||
i.info.PeerID.String(),
|
i.info.PeerId.String(),
|
||||||
i.info.SectorSize,
|
i.info.SectorSize,
|
||||||
i.state.Power.String(),
|
i.state.Power.String(), // TODO: SPA
|
||||||
i.state.Active,
|
i.state.Active,
|
||||||
i.state.ElectionPeriodStart,
|
i.state.PoStState.ProvingPeriodStart,
|
||||||
i.state.SlashedAt,
|
i.state.SlashedAt,
|
||||||
); err != nil {
|
); err != nil {
|
||||||
return err
|
return err
|
||||||
|
@ -5,14 +5,14 @@ import (
|
|||||||
"container/list"
|
"container/list"
|
||||||
"context"
|
"context"
|
||||||
"encoding/json"
|
"encoding/json"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
|
||||||
"math"
|
"math"
|
||||||
"sync"
|
"sync"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
|
||||||
actors2 "github.com/filecoin-project/lotus/chain/actors"
|
|
||||||
|
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
@ -53,8 +53,8 @@ type minerKey struct {
|
|||||||
}
|
}
|
||||||
|
|
||||||
type minerInfo struct {
|
type minerInfo struct {
|
||||||
state actors2.StorageMinerActorState
|
state miner.State
|
||||||
info actors2.MinerInfo
|
info miner.MinerInfo
|
||||||
|
|
||||||
ssize uint64
|
ssize uint64
|
||||||
psize uint64
|
psize uint64
|
||||||
@ -253,7 +253,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
|
|
||||||
for addr, m := range actors {
|
for addr, m := range actors {
|
||||||
for actor, c := range m {
|
for actor, c := range m {
|
||||||
if actor.Code != actors2.StorageMinerCodeCid {
|
if actor.Code != builtin.StorageMinerActorCodeID {
|
||||||
continue
|
continue
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -287,16 +287,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
|
|||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
ib, err := api.ChainReadObj(ctx, info.state.Info)
|
info.info = info.state.Info
|
||||||
if err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
|
|
||||||
if err := info.info.UnmarshalCBOR(bytes.NewReader(ib)); err != nil {
|
|
||||||
log.Error(err)
|
|
||||||
return
|
|
||||||
}
|
|
||||||
})
|
})
|
||||||
|
|
||||||
log.Info("Getting receipts")
|
log.Info("Getting receipts")
|
||||||
|
@ -11,6 +11,8 @@ import (
|
|||||||
|
|
||||||
rice "github.com/GeertJohan/go.rice"
|
rice "github.com/GeertJohan/go.rice"
|
||||||
"github.com/filecoin-project/specs-actors/actors/abi"
|
"github.com/filecoin-project/specs-actors/actors/abi"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin"
|
||||||
|
"github.com/filecoin-project/specs-actors/actors/builtin/power"
|
||||||
"github.com/ipfs/go-cid"
|
"github.com/ipfs/go-cid"
|
||||||
logging "github.com/ipfs/go-log/v2"
|
logging "github.com/ipfs/go-log/v2"
|
||||||
peer "github.com/libp2p/go-libp2p-peer"
|
peer "github.com/libp2p/go-libp2p-peer"
|
||||||
@ -262,11 +264,11 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
log.Infof("%s: push funds %s", owner, smsg.Cid())
|
log.Infof("%s: push funds %s", owner, smsg.Cid())
|
||||||
|
|
||||||
params, err := actors.SerializeParams(&actors.CreateStorageMinerParams{
|
params, err := actors.SerializeParams(&power.CreateMinerParams{
|
||||||
Owner: owner,
|
Owner: owner, // TODO: That is useful
|
||||||
Worker: owner,
|
Worker: owner,
|
||||||
SectorSize: abi.SectorSize(ssize),
|
SectorSize: abi.SectorSize(ssize),
|
||||||
PeerID: peer.ID("SETME"),
|
Peer: peer.ID("SETME"),
|
||||||
})
|
})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
w.WriteHeader(400)
|
w.WriteHeader(400)
|
||||||
@ -275,11 +277,11 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
createStorageMinerMsg := &types.Message{
|
createStorageMinerMsg := &types.Message{
|
||||||
To: actors.StoragePowerAddress,
|
To: builtin.StoragePowerActorAddr,
|
||||||
From: h.from,
|
From: h.from,
|
||||||
Value: types.BigAdd(collateral, types.BigDiv(collateral, types.NewInt(100))),
|
Value: types.BigAdd(collateral, types.BigDiv(collateral, types.NewInt(100))),
|
||||||
|
|
||||||
Method: actors.SPAMethods.CreateStorageMiner,
|
Method: builtin.MethodsPower.CreateMiner,
|
||||||
Params: params,
|
Params: params,
|
||||||
|
|
||||||
GasLimit: types.NewInt(10000000),
|
GasLimit: types.NewInt(10000000),
|
||||||
|
@ -59,10 +59,10 @@ func (a *PaychAPI) PaychNewPayment(ctx context.Context, from, to address.Address
|
|||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
svs := make([]*types.SignedVoucher, len(vouchers))
|
svs := make([]*paych.SignedVoucher, len(vouchers))
|
||||||
|
|
||||||
for i, v := range vouchers {
|
for i, v := range vouchers {
|
||||||
sv, err := a.paychVoucherCreate(ctx, ch.Channel, types.SignedVoucher{
|
sv, err := a.paychVoucherCreate(ctx, ch.Channel, paych.SignedVoucher{
|
||||||
Amount: v.Amount,
|
Amount: v.Amount,
|
||||||
Lane: uint64(lane),
|
Lane: uint64(lane),
|
||||||
|
|
||||||
@ -140,15 +140,15 @@ func (a *PaychAPI) PaychClose(ctx context.Context, addr address.Address) (cid.Ci
|
|||||||
return smsg.Cid(), nil
|
return smsg.Cid(), nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PaychAPI) PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *types.SignedVoucher) error {
|
func (a *PaychAPI) PaychVoucherCheckValid(ctx context.Context, ch address.Address, sv *paych.SignedVoucher) error {
|
||||||
return a.PaychMgr.CheckVoucherValid(ctx, ch, sv)
|
return a.PaychMgr.CheckVoucherValid(ctx, ch, sv)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PaychAPI) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *types.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
func (a *PaychAPI) PaychVoucherCheckSpendable(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||||
return a.PaychMgr.CheckVoucherSpendable(ctx, ch, sv, secret, proof)
|
return a.PaychMgr.CheckVoucherSpendable(ctx, ch, sv, secret, proof)
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PaychAPI) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *types.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
func (a *PaychAPI) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||||
_ = a.PaychMgr.TrackInboundChannel(ctx, ch) // TODO: expose those calls
|
_ = a.PaychMgr.TrackInboundChannel(ctx, ch) // TODO: expose those calls
|
||||||
|
|
||||||
return a.PaychMgr.AddVoucher(ctx, ch, sv, proof, minDelta)
|
return a.PaychMgr.AddVoucher(ctx, ch, sv, proof, minDelta)
|
||||||
@ -159,11 +159,11 @@ func (a *PaychAPI) PaychVoucherAdd(ctx context.Context, ch address.Address, sv *
|
|||||||
// that will be used to create the voucher, so if previous vouchers exist, the
|
// that will be used to create the voucher, so if previous vouchers exist, the
|
||||||
// actual additional value of this voucher will only be the difference between
|
// actual additional value of this voucher will only be the difference between
|
||||||
// the two.
|
// the two.
|
||||||
func (a *PaychAPI) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*types.SignedVoucher, error) {
|
func (a *PaychAPI) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*paych.SignedVoucher, error) {
|
||||||
return a.paychVoucherCreate(ctx, pch, types.SignedVoucher{Amount: amt, Lane: lane})
|
return a.paychVoucherCreate(ctx, pch, paych.SignedVoucher{Amount: amt, Lane: lane})
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PaychAPI) paychVoucherCreate(ctx context.Context, pch address.Address, voucher types.SignedVoucher) (*types.SignedVoucher, error) {
|
func (a *PaychAPI) paychVoucherCreate(ctx context.Context, pch address.Address, voucher paych.SignedVoucher) (*paych.SignedVoucher, error) {
|
||||||
ci, err := a.PaychMgr.GetChannelInfo(pch)
|
ci, err := a.PaychMgr.GetChannelInfo(pch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, xerrors.Errorf("get channel info: %w", err)
|
return nil, xerrors.Errorf("get channel info: %w", err)
|
||||||
@ -196,13 +196,13 @@ func (a *PaychAPI) paychVoucherCreate(ctx context.Context, pch address.Address,
|
|||||||
return sv, nil
|
return sv, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([]*types.SignedVoucher, error) {
|
func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([]*paych.SignedVoucher, error) {
|
||||||
vi, err := a.PaychMgr.ListVouchers(ctx, pch)
|
vi, err := a.PaychMgr.ListVouchers(ctx, pch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
|
|
||||||
out := make([]*types.SignedVoucher, len(vi))
|
out := make([]*paych.SignedVoucher, len(vi))
|
||||||
for k, v := range vi {
|
for k, v := range vi {
|
||||||
out[k] = v.Voucher
|
out[k] = v.Voucher
|
||||||
}
|
}
|
||||||
@ -210,7 +210,7 @@ func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([
|
|||||||
return out, nil
|
return out, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *types.SignedVoucher) (cid.Cid, error) {
|
func (a *PaychAPI) PaychVoucherSubmit(ctx context.Context, ch address.Address, sv *paych.SignedVoucher) (cid.Cid, error) {
|
||||||
ci, err := a.PaychMgr.GetChannelInfo(ch)
|
ci, err := a.PaychMgr.GetChannelInfo(ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return cid.Undef, err
|
return cid.Undef, err
|
||||||
|
@ -123,7 +123,7 @@ func (pm *Manager) GetChannelInfo(addr address.Address) (*ChannelInfo, error) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checks if the given voucher is valid (is or could become spendable at some point)
|
// checks if the given voucher is valid (is or could become spendable at some point)
|
||||||
func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv *types.SignedVoucher) error {
|
func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv *paych.SignedVoucher) error {
|
||||||
act, pca, err := pm.loadPaychState(ctx, ch)
|
act, pca, err := pm.loadPaychState(ctx, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
@ -171,7 +171,7 @@ func (pm *Manager) CheckVoucherValid(ctx context.Context, ch address.Address, sv
|
|||||||
}
|
}
|
||||||
|
|
||||||
// checks if the given voucher is currently spendable
|
// checks if the given voucher is currently spendable
|
||||||
func (pm *Manager) CheckVoucherSpendable(ctx context.Context, ch address.Address, sv *types.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
func (pm *Manager) CheckVoucherSpendable(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, secret []byte, proof []byte) (bool, error) {
|
||||||
owner, err := pm.getPaychOwner(ctx, ch)
|
owner, err := pm.getPaychOwner(ctx, ch)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return false, err
|
return false, err
|
||||||
@ -234,7 +234,7 @@ func (pm *Manager) getPaychOwner(ctx context.Context, ch address.Address) (addre
|
|||||||
return state.From, nil
|
return state.From, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
func (pm *Manager) AddVoucher(ctx context.Context, ch address.Address, sv *types.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
func (pm *Manager) AddVoucher(ctx context.Context, ch address.Address, sv *paych.SignedVoucher, proof []byte, minDelta types.BigInt) (types.BigInt, error) {
|
||||||
if err := pm.CheckVoucherValid(ctx, ch, sv); err != nil {
|
if err := pm.CheckVoucherValid(ctx, ch, sv); err != nil {
|
||||||
return types.NewInt(0), err
|
return types.NewInt(0), err
|
||||||
}
|
}
|
||||||
|
@ -65,7 +65,7 @@ type storageMinerApi interface {
|
|||||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||||
|
|
||||||
WalletSign(context.Context, address.Address, []byte) (*types.Signature, error)
|
WalletSign(context.Context, address.Address, []byte) (*crypto.Signature, error)
|
||||||
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
||||||
WalletHas(context.Context, address.Address) (bool, error)
|
WalletHas(context.Context, address.Address) (bool, error)
|
||||||
}
|
}
|
||||||
|
@ -53,7 +53,7 @@ type sealingApi interface { // TODO: trim down
|
|||||||
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
ChainReadObj(context.Context, cid.Cid) ([]byte, error)
|
||||||
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
ChainHasObj(context.Context, cid.Cid) (bool, error)
|
||||||
|
|
||||||
WalletSign(context.Context, address.Address, []byte) (*types.Signature, error)
|
WalletSign(context.Context, address.Address, []byte) (*crypto.Signature, error)
|
||||||
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
WalletBalance(context.Context, address.Address) (types.BigInt, error)
|
||||||
WalletHas(context.Context, address.Address) (bool, error)
|
WalletHas(context.Context, address.Address) (bool, error)
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user