types: Drop some redundant alias types

This commit is contained in:
Łukasz Magiera 2020-02-25 22:09:22 +01:00
parent ae634ef7df
commit 0a9e0acc6f
21 changed files with 91 additions and 123 deletions

View File

@ -10,6 +10,7 @@ import (
"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/miner"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/ipfs/go-cid"
"github.com/ipfs/go-filestore"
@ -93,7 +94,7 @@ type FullNode interface {
ClientHasLocal(ctx context.Context, root cid.Cid) (bool, error)
ClientFindData(ctx context.Context, root cid.Cid) ([]QueryOffer, 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(path string)
@ -143,12 +144,12 @@ type FullNode interface {
PaychClose(context.Context, address.Address) (cid.Cid, error)
PaychAllocateLane(ctx context.Context, ch address.Address) (uint64, error)
PaychNewPayment(ctx context.Context, from, to address.Address, vouchers []VoucherSpec) (*PaymentInfo, error)
PaychVoucherCheckValid(context.Context, address.Address, *types.SignedVoucher) error
PaychVoucherCheckSpendable(context.Context, address.Address, *types.SignedVoucher, []byte, []byte) (bool, error)
PaychVoucherCreate(context.Context, address.Address, types.BigInt, uint64) (*types.SignedVoucher, error)
PaychVoucherAdd(context.Context, address.Address, *types.SignedVoucher, []byte, types.BigInt) (types.BigInt, error)
PaychVoucherList(context.Context, address.Address) ([]*types.SignedVoucher, error)
PaychVoucherSubmit(context.Context, address.Address, *types.SignedVoucher) (cid.Cid, error)
PaychVoucherCheckValid(context.Context, address.Address, *paych.SignedVoucher) error
PaychVoucherCheckSpendable(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error)
PaychVoucherCreate(context.Context, address.Address, types.BigInt, uint64) (*paych.SignedVoucher, error)
PaychVoucherAdd(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error)
PaychVoucherList(context.Context, address.Address) ([]*paych.SignedVoucher, error)
PaychVoucherSubmit(context.Context, address.Address, *paych.SignedVoucher) (cid.Cid, error)
}
type MinerSectors struct {
@ -223,7 +224,7 @@ type ChannelInfo struct {
type PaymentInfo struct {
Channel address.Address
ChannelMessage *cid.Cid
Vouchers []*types.SignedVoucher
Vouchers []*paych.SignedVoucher
}
type VoucherSpec struct {
@ -231,7 +232,7 @@ type VoucherSpec struct {
TimeLock abi.ChainEpoch
MinSettle abi.ChainEpoch
Extra *types.ModVerifyParams
Extra *paych.ModVerifyParams
}
type MinerPower struct {

View File

@ -3,17 +3,18 @@ package apistruct
import (
"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/libp2p/go-libp2p-core/network"
"github.com/libp2p/go-libp2p-core/peer"
"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/chain/store"
@ -100,7 +101,7 @@ type FullNodeStruct struct {
ClientGetDealInfo func(context.Context, cid.Cid) (*api.DealInfo, error) `perm:"read"`
ClientListDeals func(ctx context.Context) ([]api.DealInfo, error) `perm:"write"`
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"`
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"`
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"`
PaychVoucherCheck func(context.Context, *types.SignedVoucher) error `perm:"read"`
PaychVoucherCheckValid func(context.Context, address.Address, *types.SignedVoucher) error `perm:"read"`
PaychVoucherCheckSpendable func(context.Context, address.Address, *types.SignedVoucher, []byte, []byte) (bool, error) `perm:"read"`
PaychVoucherAdd func(context.Context, address.Address, *types.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) `perm:"write"`
PaychVoucherCreate func(context.Context, address.Address, types.BigInt, uint64) (*types.SignedVoucher, error) `perm:"sign"`
PaychVoucherList func(context.Context, address.Address) ([]*types.SignedVoucher, error) `perm:"write"`
PaychVoucherSubmit func(context.Context, address.Address, *types.SignedVoucher) (cid.Cid, error) `perm:"sign"`
PaychVoucherCheck func(context.Context, *paych.SignedVoucher) error `perm:"read"`
PaychVoucherCheckValid func(context.Context, address.Address, *paych.SignedVoucher) error `perm:"read"`
PaychVoucherCheckSpendable func(context.Context, address.Address, *paych.SignedVoucher, []byte, []byte) (bool, error) `perm:"read"`
PaychVoucherAdd func(context.Context, address.Address, *paych.SignedVoucher, []byte, types.BigInt) (types.BigInt, error) `perm:"write"`
PaychVoucherCreate func(context.Context, address.Address, big.Int, uint64) (*paych.SignedVoucher, error) `perm:"sign"`
PaychVoucherList func(context.Context, address.Address) ([]*paych.SignedVoucher, error) `perm:"write"`
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)
}
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)
}
@ -534,23 +535,23 @@ func (c *FullNodeStruct) PaychStatus(ctx context.Context, pch address.Address) (
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)
}
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)
}
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)
}
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)
}
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)
}
@ -566,7 +567,7 @@ func (c *FullNodeStruct) PaychNewPayment(ctx context.Context, from, to address.A
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)
}

View File

@ -4,12 +4,12 @@ import (
"context"
"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 {
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 {
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)
})
if err != nil {

View File

@ -69,8 +69,8 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
Messages: msgcid,
ParentMessageReceipts: dummyCid,
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
},
{
Height: h,
@ -82,8 +82,8 @@ func makeTs(t *testing.T, h abi.ChainEpoch, msgcid cid.Cid) *types.TipSet {
Messages: msgcid,
ParentMessageReceipts: dummyCid,
BlockSig: &types.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: types.Signature{Type: crypto.SigTypeBLS},
BlockSig: &crypto.Signature{Type: crypto.SigTypeBLS},
BLSAggregate: crypto.Signature{Type: crypto.SigTypeBLS},
},
})

View File

@ -2,10 +2,10 @@ package state
import (
"context"
"github.com/filecoin-project/specs-actors/actors/builtin"
"testing"
address "github.com/filecoin-project/go-address"
actors "github.com/filecoin-project/lotus/chain/actors"
"github.com/filecoin-project/lotus/chain/types"
cbor "github.com/ipfs/go-ipld-cbor"
)
@ -27,8 +27,8 @@ func BenchmarkStateTreeSet(b *testing.B) {
}
err = st.SetActor(a, &types.Actor{
Balance: types.NewInt(1258812523),
Code: actors.StorageMinerCodeCid,
Head: actors.AccountCodeCid,
Code: builtin.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID,
Nonce: uint64(i),
})
if err != nil {
@ -54,8 +54,8 @@ func BenchmarkStateTreeSetFlush(b *testing.B) {
}
err = st.SetActor(a, &types.Actor{
Balance: types.NewInt(1258812523),
Code: actors.StorageMinerCodeCid,
Head: actors.AccountCodeCid,
Code: builtin.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID,
Nonce: uint64(i),
})
if err != nil {
@ -80,8 +80,8 @@ func BenchmarkStateTree10kGetActor(b *testing.B) {
}
err = st.SetActor(a, &types.Actor{
Balance: types.NewInt(1258812523 + uint64(i)),
Code: actors.StorageMinerCodeCid,
Head: actors.AccountCodeCid,
Code: builtin.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID,
Nonce: uint64(i),
})
if err != nil {
@ -123,8 +123,8 @@ func TestSetCache(t *testing.T) {
act := &types.Actor{
Balance: types.NewInt(0),
Code: actors.StorageMinerCodeCid,
Head: actors.AccountCodeCid,
Code: builtin.StorageMinerActorCodeID,
Head: builtin.AccountActorCodeID,
Nonce: 0,
}

View File

@ -184,7 +184,7 @@ func TestForkHeightTriggers(t *testing.T) {
m := &types.Message{
From: cg.Banker(),
To: actors.InitAddress,
To: builtin.InitActorAddr,
Method: builtin.MethodsInit.Exec,
Params: enc,
GasLimit: types.NewInt(10000),

View File

@ -1,9 +0,0 @@
package types
import (
"github.com/filecoin-project/go-fil-markets/storagemarket"
)
type SignedStorageAsk = storagemarket.SignedStorageAsk
type StorageAsk = storagemarket.StorageAsk

View File

@ -1,7 +0,0 @@
package types
import (
"github.com/filecoin-project/specs-actors/actors/abi"
)
type BitField = abi.BitField

View File

@ -1,7 +0,0 @@
package types
import (
"github.com/filecoin-project/specs-actors/actors/crypto"
)
type Signature = crypto.Signature

View File

@ -8,7 +8,7 @@ import (
)
func TestSignatureSerializeRoundTrip(t *testing.T) {
s := &Signature{
s := &crypto.Signature{
Data: []byte("foo bar cat dog"),
Type: crypto.SigTypeBLS,
}
@ -18,7 +18,7 @@ func TestSignatureSerializeRoundTrip(t *testing.T) {
t.Fatal(err)
}
var outs Signature
var outs crypto.Signature
if err := outs.UnmarshalCBOR(buf); err != nil {
t.Fatal(err)
}

View File

@ -1,27 +1,22 @@
package types
import (
import(
"encoding/base64"
"github.com/filecoin-project/specs-actors/actors/builtin/paych"
cbor "github.com/ipfs/go-ipld-cbor"
)
type SignedVoucher = paych.SignedVoucher
func DecodeSignedVoucher(s string) (*SignedVoucher, error) {
func DecodeSignedVoucher(s string) (*paych.SignedVoucher, error) {
data, err := base64.RawURLEncoding.DecodeString(s)
if err != nil {
return nil, err
}
var sv SignedVoucher
var sv paych.SignedVoucher
if err := cbor.DecodeInto(data, &sv); err != nil {
return nil, err
}
return &sv, nil
}
type Merge = paych.Merge
type ModVerifyParams = paych.ModVerifyParams

View File

@ -14,12 +14,13 @@ import (
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/abi"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/crypto"
"github.com/filecoin-project/lotus/chain/types"
)
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 {

View File

@ -295,7 +295,7 @@ var paychVoucherBestSpendableCmd = &cli.Command{
return err
}
var best *types.SignedVoucher
var best *paych.SignedVoucher
for _, v := range vouchers {
spendable, err := api.PaychVoucherCheckSpendable(ctx, ch, v, nil, nil)
if err != nil {

View File

@ -259,7 +259,7 @@ func main() {
return err
}
var genmm map[string]genesis.GenesisMiner
var genmm map[string]genesis.Miner
if err := json.Unmarshal(fdata, &genmm); err != nil {
return err
}

View File

@ -471,11 +471,11 @@ create temp table mh (like miner_heads excluding constraints) on commit drop;
fmt.Sprint(i.psize),
i.info.Owner.String(),
i.info.Worker.String(),
i.info.PeerID.String(),
i.info.PeerId.String(),
i.info.SectorSize,
i.state.Power.String(),
i.state.Power.String(), // TODO: SPA
i.state.Active,
i.state.ElectionPeriodStart,
i.state.PoStState.ProvingPeriodStart,
i.state.SlashedAt,
); err != nil {
return err

View File

@ -5,14 +5,14 @@ import (
"container/list"
"context"
"encoding/json"
"github.com/filecoin-project/specs-actors/actors/builtin"
"github.com/filecoin-project/specs-actors/actors/builtin/miner"
"math"
"sync"
"github.com/filecoin-project/go-address"
"github.com/filecoin-project/specs-actors/actors/abi"
actors2 "github.com/filecoin-project/lotus/chain/actors"
"github.com/ipfs/go-cid"
"github.com/filecoin-project/lotus/api"
@ -53,8 +53,8 @@ type minerKey struct {
}
type minerInfo struct {
state actors2.StorageMinerActorState
info actors2.MinerInfo
state miner.State
info miner.MinerInfo
ssize 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 actor, c := range m {
if actor.Code != actors2.StorageMinerCodeCid {
if actor.Code != builtin.StorageMinerActorCodeID {
continue
}
@ -287,16 +287,7 @@ func syncHead(ctx context.Context, api api.FullNode, st *storage, ts *types.TipS
return
}
ib, err := api.ChainReadObj(ctx, info.state.Info)
if err != nil {
log.Error(err)
return
}
if err := info.info.UnmarshalCBOR(bytes.NewReader(ib)); err != nil {
log.Error(err)
return
}
info.info = info.state.Info
})
log.Info("Getting receipts")

View File

@ -11,6 +11,8 @@ import (
rice "github.com/GeertJohan/go.rice"
"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"
logging "github.com/ipfs/go-log/v2"
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())
params, err := actors.SerializeParams(&actors.CreateStorageMinerParams{
Owner: owner,
params, err := actors.SerializeParams(&power.CreateMinerParams{
Owner: owner, // TODO: That is useful
Worker: owner,
SectorSize: abi.SectorSize(ssize),
PeerID: peer.ID("SETME"),
Peer: peer.ID("SETME"),
})
if err != nil {
w.WriteHeader(400)
@ -275,11 +277,11 @@ func (h *handler) mkminer(w http.ResponseWriter, r *http.Request) {
}
createStorageMinerMsg := &types.Message{
To: actors.StoragePowerAddress,
To: builtin.StoragePowerActorAddr,
From: h.from,
Value: types.BigAdd(collateral, types.BigDiv(collateral, types.NewInt(100))),
Method: actors.SPAMethods.CreateStorageMiner,
Method: builtin.MethodsPower.CreateMiner,
Params: params,
GasLimit: types.NewInt(10000000),

View File

@ -59,10 +59,10 @@ func (a *PaychAPI) PaychNewPayment(ctx context.Context, from, to address.Address
return nil, err
}
svs := make([]*types.SignedVoucher, len(vouchers))
svs := make([]*paych.SignedVoucher, len(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,
Lane: uint64(lane),
@ -140,15 +140,15 @@ func (a *PaychAPI) PaychClose(ctx context.Context, addr address.Address) (cid.Ci
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)
}
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)
}
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
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
// actual additional value of this voucher will only be the difference between
// the two.
func (a *PaychAPI) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*types.SignedVoucher, error) {
return a.paychVoucherCreate(ctx, pch, types.SignedVoucher{Amount: amt, Lane: lane})
func (a *PaychAPI) PaychVoucherCreate(ctx context.Context, pch address.Address, amt types.BigInt, lane uint64) (*paych.SignedVoucher, error) {
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)
if err != nil {
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
}
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)
if err != nil {
return nil, err
}
out := make([]*types.SignedVoucher, len(vi))
out := make([]*paych.SignedVoucher, len(vi))
for k, v := range vi {
out[k] = v.Voucher
}
@ -210,7 +210,7 @@ func (a *PaychAPI) PaychVoucherList(ctx context.Context, pch address.Address) ([
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)
if err != nil {
return cid.Undef, err

View File

@ -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)
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)
if err != nil {
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
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)
if err != nil {
return false, err
@ -234,7 +234,7 @@ func (pm *Manager) getPaychOwner(ctx context.Context, ch address.Address) (addre
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 {
return types.NewInt(0), err
}

View File

@ -65,7 +65,7 @@ type storageMinerApi interface {
ChainReadObj(context.Context, cid.Cid) ([]byte, 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)
WalletHas(context.Context, address.Address) (bool, error)
}

View File

@ -53,7 +53,7 @@ type sealingApi interface { // TODO: trim down
ChainReadObj(context.Context, cid.Cid) ([]byte, 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)
WalletHas(context.Context, address.Address) (bool, error)
}