fix(storagemarket): fix compile errors
This commit is contained in:
parent
353f93fddf
commit
56653eeca6
1
go.sum
1
go.sum
@ -113,6 +113,7 @@ github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce
|
|||||||
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww=
|
github.com/filecoin-project/go-data-transfer v0.0.0-20191219005021-4accf56bd2ce/go.mod h1:b14UWxhxVCAjrQUYvVGrQRRsjAh79wXYejw9RbUcAww=
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42 h1:7OW2AiWtwxwtYnC16CiXZ/idQ7w3W7W1hhX+N4YSAyQ=
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42 h1:7OW2AiWtwxwtYnC16CiXZ/idQ7w3W7W1hhX+N4YSAyQ=
|
||||||
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42/go.mod h1:Q5fvJGMISyUIna19DpoqiqTas4L9RVD7w3Udv7uCrTo=
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200110170857-c200f161be42/go.mod h1:Q5fvJGMISyUIna19DpoqiqTas4L9RVD7w3Udv7uCrTo=
|
||||||
|
github.com/filecoin-project/go-fil-markets v0.0.0-20200110172620-7ac5a8af146a h1:mLz0GBjx8nlztlo2sZ6w1JbuyN7EX7zoCYQBblrgoBM=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
|
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
|
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878 h1:YicJT9xhPzZ1SBGiJFNUCkfwqK/G9vFyY1ytKBSjNJA=
|
||||||
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
github.com/filecoin-project/go-paramfetch v0.0.0-20200102181131-b20d579f2878/go.mod h1:40kI2Gv16mwcRsHptI3OAV4nlOEU7wVDc4RgMylNFjU=
|
||||||
|
@ -36,7 +36,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/node/impl/full"
|
"github.com/filecoin-project/lotus/node/impl/full"
|
||||||
"github.com/filecoin-project/lotus/node/impl/paych"
|
"github.com/filecoin-project/lotus/node/impl/paych"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/retrievaladapter"
|
|
||||||
"github.com/filecoin-project/lotus/storagemarketadapter"
|
"github.com/filecoin-project/lotus/storagemarketadapter"
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -79,7 +78,7 @@ func (a *API) ClientStartDeal(ctx context.Context, data cid.Cid, addr address.Ad
|
|||||||
providerInfo := storagemarketadapter.NewStorageProviderInfo(miner, mw, 0, pid)
|
providerInfo := storagemarketadapter.NewStorageProviderInfo(miner, mw, 0, pid)
|
||||||
result, err := a.SMDealClient.ProposeStorageDeal(
|
result, err := a.SMDealClient.ProposeStorageDeal(
|
||||||
ctx,
|
ctx,
|
||||||
sharedutils.ToSharedAddress(addr),
|
addr,
|
||||||
&providerInfo,
|
&providerInfo,
|
||||||
data,
|
data,
|
||||||
storagemarket.Epoch(math.MaxUint64),
|
storagemarket.Epoch(math.MaxUint64),
|
||||||
@ -105,7 +104,7 @@ func (a *API) ClientListDeals(ctx context.Context) ([]api.DealInfo, error) {
|
|||||||
out[k] = api.DealInfo{
|
out[k] = api.DealInfo{
|
||||||
ProposalCid: v.ProposalCid,
|
ProposalCid: v.ProposalCid,
|
||||||
State: v.State,
|
State: v.State,
|
||||||
Provider: sharedutils.FromSharedAddress(v.Proposal.Provider),
|
Provider: v.Proposal.Provider,
|
||||||
|
|
||||||
PieceRef: v.Proposal.PieceRef,
|
PieceRef: v.Proposal.PieceRef,
|
||||||
Size: v.Proposal.PieceSize,
|
Size: v.Proposal.PieceSize,
|
||||||
@ -127,7 +126,7 @@ func (a *API) ClientGetDealInfo(ctx context.Context, d cid.Cid) (*api.DealInfo,
|
|||||||
return &api.DealInfo{
|
return &api.DealInfo{
|
||||||
ProposalCid: v.ProposalCid,
|
ProposalCid: v.ProposalCid,
|
||||||
State: v.State,
|
State: v.State,
|
||||||
Provider: sharedutils.FromSharedAddress(v.Proposal.Provider),
|
Provider: v.Proposal.Provider,
|
||||||
PieceRef: v.Proposal.PieceRef,
|
PieceRef: v.Proposal.PieceRef,
|
||||||
Size: v.Proposal.PieceSize,
|
Size: v.Proposal.PieceSize,
|
||||||
PricePerEpoch: sharedutils.FromSharedTokenAmount(v.Proposal.StoragePricePerEpoch),
|
PricePerEpoch: sharedutils.FromSharedTokenAmount(v.Proposal.StoragePricePerEpoch),
|
||||||
@ -159,13 +158,13 @@ func (a *API) ClientFindData(ctx context.Context, root cid.Cid) ([]api.QueryOffe
|
|||||||
for k, p := range peers {
|
for k, p := range peers {
|
||||||
queryResponse, err := a.Retrieval.Query(ctx, p, root.Bytes(), retrievalmarket.QueryParams{})
|
queryResponse, err := a.Retrieval.Query(ctx, p, root.Bytes(), retrievalmarket.QueryParams{})
|
||||||
if err != nil {
|
if err != nil {
|
||||||
out[k] = api.QueryOffer{Err: err.Error(), Miner: retrievaladapter.FromSharedAddress(p.Address), MinerPeerID: p.ID}
|
out[k] = api.QueryOffer{Err: err.Error(), Miner: p.Address, MinerPeerID: p.ID}
|
||||||
} else {
|
} else {
|
||||||
out[k] = api.QueryOffer{
|
out[k] = api.QueryOffer{
|
||||||
Root: root,
|
Root: root,
|
||||||
Size: queryResponse.Size,
|
Size: queryResponse.Size,
|
||||||
MinPrice: retrievaladapter.FromSharedTokenAmount(queryResponse.PieceRetrievalPrice()),
|
MinPrice: sharedutils.FromSharedTokenAmount(queryResponse.PieceRetrievalPrice()),
|
||||||
Miner: retrievaladapter.FromSharedAddress(p.Address), // TODO: check
|
Miner: p.Address, // TODO: check
|
||||||
MinerPeerID: p.ID,
|
MinerPeerID: p.ID,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -297,8 +296,8 @@ func (a *API) ClientRetrieve(ctx context.Context, order api.RetrievalOrder, path
|
|||||||
retrievalmarket.NewParamsV0(types.BigDiv(order.Total, types.NewInt(order.Size)).Int, 0, 0),
|
retrievalmarket.NewParamsV0(types.BigDiv(order.Total, types.NewInt(order.Size)).Int, 0, 0),
|
||||||
sharedutils.ToSharedTokenAmount(order.Total),
|
sharedutils.ToSharedTokenAmount(order.Total),
|
||||||
order.MinerPeerID,
|
order.MinerPeerID,
|
||||||
retrievaladapter.ToSharedAddress(order.Client),
|
order.Client,
|
||||||
retrievaladapter.ToSharedAddress(order.Miner))
|
order.Miner)
|
||||||
select {
|
select {
|
||||||
case <-ctx.Done():
|
case <-ctx.Done():
|
||||||
return xerrors.New("Retrieval Timed Out")
|
return xerrors.New("Retrieval Timed Out")
|
||||||
|
@ -10,6 +10,7 @@ import (
|
|||||||
|
|
||||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
"github.com/filecoin-project/go-fil-markets/retrievalmarket"
|
||||||
"github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery"
|
"github.com/filecoin-project/go-fil-markets/retrievalmarket/discovery"
|
||||||
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/lotus/chain"
|
"github.com/filecoin-project/lotus/chain"
|
||||||
"github.com/filecoin-project/lotus/chain/blocksync"
|
"github.com/filecoin-project/lotus/chain/blocksync"
|
||||||
"github.com/filecoin-project/lotus/chain/messagepool"
|
"github.com/filecoin-project/lotus/chain/messagepool"
|
||||||
@ -18,7 +19,6 @@ import (
|
|||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/node/modules/helpers"
|
"github.com/filecoin-project/lotus/node/modules/helpers"
|
||||||
"github.com/filecoin-project/lotus/peermgr"
|
"github.com/filecoin-project/lotus/peermgr"
|
||||||
"github.com/filecoin-project/go-fil-components/storagemarket"
|
|
||||||
)
|
)
|
||||||
|
|
||||||
func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) {
|
func RunHello(mctx helpers.MetricsCtx, lc fx.Lifecycle, h host.Host, svc *hello.Service) {
|
||||||
|
@ -29,21 +29,17 @@ import (
|
|||||||
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
|
retrievalimpl "github.com/filecoin-project/go-fil-markets/retrievalmarket/impl"
|
||||||
deals "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
|
deals "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
|
||||||
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
|
storageimpl "github.com/filecoin-project/go-fil-markets/storagemarket/impl"
|
||||||
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/go-sectorbuilder"
|
"github.com/filecoin-project/go-sectorbuilder"
|
||||||
"github.com/filecoin-project/go-statestore"
|
"github.com/filecoin-project/go-statestore"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
"github.com/filecoin-project/lotus/build"
|
"github.com/filecoin-project/lotus/build"
|
||||||
"github.com/filecoin-project/lotus/chain/address"
|
|
||||||
"github.com/filecoin-project/lotus/chain/deals"
|
|
||||||
"github.com/filecoin-project/lotus/chain/gen"
|
"github.com/filecoin-project/lotus/chain/gen"
|
||||||
"github.com/filecoin-project/lotus/lib/sectorbuilder"
|
|
||||||
"github.com/filecoin-project/lotus/lib/statestore"
|
|
||||||
"github.com/filecoin-project/lotus/miner"
|
"github.com/filecoin-project/lotus/miner"
|
||||||
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
"github.com/filecoin-project/lotus/node/modules/dtypes"
|
||||||
"github.com/filecoin-project/lotus/node/modules/helpers"
|
"github.com/filecoin-project/lotus/node/modules/helpers"
|
||||||
"github.com/filecoin-project/lotus/node/repo"
|
"github.com/filecoin-project/lotus/node/repo"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-fil-components/storagemarket"
|
|
||||||
"github.com/filecoin-project/lotus/retrievaladapter"
|
"github.com/filecoin-project/lotus/retrievaladapter"
|
||||||
"github.com/filecoin-project/lotus/storage"
|
"github.com/filecoin-project/lotus/storage"
|
||||||
"github.com/filecoin-project/lotus/storage/sectorblocks"
|
"github.com/filecoin-project/lotus/storage/sectorblocks"
|
||||||
|
@ -5,12 +5,14 @@ package storagemarketadapter
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
"context"
|
"context"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/lib/sharedutils"
|
"github.com/filecoin-project/lotus/lib/sharedutils"
|
||||||
|
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-address"
|
"github.com/filecoin-project/go-address"
|
||||||
"github.com/filecoin-project/go-cbor-util"
|
cborutil "github.com/filecoin-project/go-cbor-util"
|
||||||
|
"github.com/filecoin-project/go-fil-markets/shared/tokenamount"
|
||||||
sharedtypes "github.com/filecoin-project/go-fil-markets/shared/types"
|
sharedtypes "github.com/filecoin-project/go-fil-markets/shared/types"
|
||||||
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
"github.com/filecoin-project/lotus/api"
|
"github.com/filecoin-project/lotus/api"
|
||||||
@ -115,7 +117,7 @@ func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address,
|
|||||||
// (Provider Node API)
|
// (Provider Node API)
|
||||||
smsg, err := n.MpoolPushMessage(ctx, &types.Message{
|
smsg, err := n.MpoolPushMessage(ctx, &types.Message{
|
||||||
To: actors.StorageMarketAddress,
|
To: actors.StorageMarketAddress,
|
||||||
From: sharedutils.FromSharedAddress(addr),
|
From: addr,
|
||||||
Value: sharedutils.FromSharedTokenAmount(amount),
|
Value: sharedutils.FromSharedTokenAmount(amount),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1000000),
|
GasLimit: types.NewInt(1000000),
|
||||||
@ -138,11 +140,11 @@ func (n *ClientNodeAdapter) AddFunds(ctx context.Context, addr address.Address,
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) EnsureFunds(ctx context.Context, addr address.Address, amount tokenamount.TokenAmount) error {
|
func (n *ClientNodeAdapter) EnsureFunds(ctx context.Context, addr address.Address, amount tokenamount.TokenAmount) error {
|
||||||
return n.fm.EnsureAvailable(ctx, sharedutils.FromSharedAddress(addr), sharedutils.FromSharedTokenAmount(amount))
|
return n.fm.EnsureAvailable(ctx, addr, sharedutils.FromSharedTokenAmount(amount))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
func (n *ClientNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
||||||
bal, err := n.StateMarketBalance(ctx, sharedutils.FromSharedAddress(addr), nil)
|
bal, err := n.StateMarketBalance(ctx, addr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return storagemarket.Balance{}, err
|
return storagemarket.Balance{}, err
|
||||||
}
|
}
|
||||||
@ -160,7 +162,7 @@ func (c *ClientNodeAdapter) ValidatePublishedDeal(ctx context.Context, deal stor
|
|||||||
return 0, xerrors.Errorf("getting deal pubsish message: %w", err)
|
return 0, xerrors.Errorf("getting deal pubsish message: %w", err)
|
||||||
}
|
}
|
||||||
|
|
||||||
pw, err := stmgr.GetMinerWorker(ctx, c.sm, nil, sharedutils.FromSharedAddress(deal.Proposal.Provider))
|
pw, err := stmgr.GetMinerWorker(ctx, c.sm, nil, deal.Proposal.Provider)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, xerrors.Errorf("getting miner worker failed: %w", err)
|
return 0, xerrors.Errorf("getting miner worker failed: %w", err)
|
||||||
}
|
}
|
||||||
@ -268,7 +270,7 @@ func (c *ClientNodeAdapter) OnDealSectorCommitted(ctx context.Context, provider
|
|||||||
}
|
}
|
||||||
|
|
||||||
matchEvent := func(msg *types.Message) (bool, error) {
|
matchEvent := func(msg *types.Message) (bool, error) {
|
||||||
if msg.To != sharedutils.FromSharedAddress(provider) {
|
if msg.To != provider {
|
||||||
return false, nil
|
return false, nil
|
||||||
}
|
}
|
||||||
|
|
||||||
@ -304,7 +306,7 @@ func (n *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Add
|
|||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
err = api.SignWith(ctx, n.Wallet.Sign, sharedutils.FromSharedAddress(signer), localProposal)
|
err = api.SignWith(ctx, n.Wallet.Sign, signer, localProposal)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
@ -318,13 +320,13 @@ func (n *ClientNodeAdapter) SignProposal(ctx context.Context, signer address.Add
|
|||||||
|
|
||||||
func (n *ClientNodeAdapter) GetDefaultWalletAddress(ctx context.Context) (address.Address, error) {
|
func (n *ClientNodeAdapter) GetDefaultWalletAddress(ctx context.Context) (address.Address, error) {
|
||||||
addr, err := n.Wallet.GetDefault()
|
addr, err := n.Wallet.GetDefault()
|
||||||
return sharedutils.ToSharedAddress(addr), err
|
return addr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ClientNodeAdapter) ValidateAskSignature(ask *sharedtypes.SignedStorageAsk) error {
|
func (n *ClientNodeAdapter) ValidateAskSignature(ask *sharedtypes.SignedStorageAsk) error {
|
||||||
tss := n.cs.GetHeaviestTipSet().ParentState()
|
tss := n.cs.GetHeaviestTipSet().ParentState()
|
||||||
|
|
||||||
w, err := stmgr.GetMinerWorkerRaw(context.TODO(), n.StateManager, tss, sharedutils.FromSharedAddress(ask.Ask.Miner))
|
w, err := stmgr.GetMinerWorkerRaw(context.TODO(), n.StateManager, tss, ask.Ask.Miner)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return xerrors.Errorf("failed to get worker for miner in ask", err)
|
return xerrors.Errorf("failed to get worker for miner in ask", err)
|
||||||
}
|
}
|
||||||
@ -334,7 +336,7 @@ func (n *ClientNodeAdapter) ValidateAskSignature(ask *sharedtypes.SignedStorageA
|
|||||||
return xerrors.Errorf("failed to re-serialize ask")
|
return xerrors.Errorf("failed to re-serialize ask")
|
||||||
}
|
}
|
||||||
|
|
||||||
return ask.Signature.Verify(sharedutils.ToSharedAddress(w), sigb)
|
return ask.Signature.Verify(w, sigb)
|
||||||
}
|
}
|
||||||
|
|
||||||
var _ storagemarket.StorageClientNode = &ClientNodeAdapter{}
|
var _ storagemarket.StorageClientNode = &ClientNodeAdapter{}
|
||||||
|
@ -47,7 +47,7 @@ func NewProviderNodeAdapter(dag dtypes.StagingDAG, secb *sectorblocks.SectorBloc
|
|||||||
func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemarket.MinerDeal) (storagemarket.DealID, cid.Cid, error) {
|
func (n *ProviderNodeAdapter) PublishDeals(ctx context.Context, deal storagemarket.MinerDeal) (storagemarket.DealID, cid.Cid, error) {
|
||||||
log.Info("publishing deal")
|
log.Info("publishing deal")
|
||||||
|
|
||||||
worker, err := n.StateMinerWorker(ctx, sharedutils.FromSharedAddress(deal.Proposal.Provider), nil)
|
worker, err := n.StateMinerWorker(ctx, deal.Proposal.Provider, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return 0, cid.Undef, err
|
return 0, cid.Undef, err
|
||||||
}
|
}
|
||||||
@ -151,12 +151,12 @@ func (n *ProviderNodeAdapter) ListProviderDeals(ctx context.Context, addr addres
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) {
|
func (n *ProviderNodeAdapter) GetMinerWorker(ctx context.Context, miner address.Address) (address.Address, error) {
|
||||||
addr, err := n.StateMinerWorker(ctx, sharedutils.FromSharedAddress(miner), nil)
|
addr, err := n.StateMinerWorker(ctx, miner, nil)
|
||||||
return sharedutils.ToSharedAddress(addr), err
|
return addr, err
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*sharedtypes.Signature, error) {
|
func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Address, b []byte) (*sharedtypes.Signature, error) {
|
||||||
localSignature, err := n.WalletSign(ctx, sharedutils.FromSharedAddress(signer), b)
|
localSignature, err := n.WalletSign(ctx, signer, b)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, err
|
return nil, err
|
||||||
}
|
}
|
||||||
@ -164,7 +164,7 @@ func (n *ProviderNodeAdapter) SignBytes(ctx context.Context, signer address.Addr
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr address.Address, amt tokenamount.TokenAmount) error {
|
func (n *ProviderNodeAdapter) EnsureFunds(ctx context.Context, addr address.Address, amt tokenamount.TokenAmount) error {
|
||||||
return n.MarketEnsureAvailable(ctx, sharedutils.FromSharedAddress(addr), sharedutils.FromSharedTokenAmount(amt))
|
return n.MarketEnsureAvailable(ctx, addr, sharedutils.FromSharedTokenAmount(amt))
|
||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) MostRecentStateId(ctx context.Context) (storagemarket.StateKey, error) {
|
func (n *ProviderNodeAdapter) MostRecentStateId(ctx context.Context) (storagemarket.StateKey, error) {
|
||||||
@ -176,7 +176,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
|
|||||||
// (Provider Node API)
|
// (Provider Node API)
|
||||||
smsg, err := n.MpoolPushMessage(ctx, &types.Message{
|
smsg, err := n.MpoolPushMessage(ctx, &types.Message{
|
||||||
To: actors.StorageMarketAddress,
|
To: actors.StorageMarketAddress,
|
||||||
From: sharedutils.FromSharedAddress(addr),
|
From: addr,
|
||||||
Value: sharedutils.FromSharedTokenAmount(amount),
|
Value: sharedutils.FromSharedTokenAmount(amount),
|
||||||
GasPrice: types.NewInt(0),
|
GasPrice: types.NewInt(0),
|
||||||
GasLimit: types.NewInt(1000000),
|
GasLimit: types.NewInt(1000000),
|
||||||
@ -199,7 +199,7 @@ func (n *ProviderNodeAdapter) AddFunds(ctx context.Context, addr address.Address
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (n *ProviderNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
func (n *ProviderNodeAdapter) GetBalance(ctx context.Context, addr address.Address) (storagemarket.Balance, error) {
|
||||||
bal, err := n.StateMarketBalance(ctx, sharedutils.FromSharedAddress(addr), nil)
|
bal, err := n.StateMarketBalance(ctx, addr, nil)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return storagemarket.Balance{}, err
|
return storagemarket.Balance{}, err
|
||||||
}
|
}
|
||||||
|
@ -3,17 +3,18 @@ package storagemarketadapter
|
|||||||
import (
|
import (
|
||||||
"bytes"
|
"bytes"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-fil-components/storagemarket"
|
"github.com/filecoin-project/go-address"
|
||||||
|
"github.com/filecoin-project/go-fil-markets/storagemarket"
|
||||||
|
|
||||||
"github.com/filecoin-project/lotus/chain/actors"
|
"github.com/filecoin-project/lotus/chain/actors"
|
||||||
"github.com/filecoin-project/lotus/chain/address"
|
|
||||||
"github.com/filecoin-project/lotus/lib/sharedutils"
|
"github.com/filecoin-project/lotus/lib/sharedutils"
|
||||||
peer "github.com/libp2p/go-libp2p-peer"
|
peer "github.com/libp2p/go-libp2p-peer"
|
||||||
)
|
)
|
||||||
|
|
||||||
func NewStorageProviderInfo(address address.Address, miner address.Address, sectorSize uint64, peer peer.ID) storagemarket.StorageProviderInfo {
|
func NewStorageProviderInfo(address address.Address, miner address.Address, sectorSize uint64, peer peer.ID) storagemarket.StorageProviderInfo {
|
||||||
return storagemarket.StorageProviderInfo{
|
return storagemarket.StorageProviderInfo{
|
||||||
Address: sharedutils.ToSharedAddress(address),
|
Address: address,
|
||||||
Worker: sharedutils.ToSharedAddress(miner),
|
Worker: miner,
|
||||||
SectorSize: sectorSize,
|
SectorSize: sectorSize,
|
||||||
PeerID: peer,
|
PeerID: peer,
|
||||||
}
|
}
|
||||||
@ -23,8 +24,8 @@ func FromOnChainDeal(deal actors.OnChainDeal) storagemarket.StorageDeal {
|
|||||||
return storagemarket.StorageDeal{
|
return storagemarket.StorageDeal{
|
||||||
PieceRef: deal.PieceRef,
|
PieceRef: deal.PieceRef,
|
||||||
PieceSize: deal.PieceSize,
|
PieceSize: deal.PieceSize,
|
||||||
Client: sharedutils.ToSharedAddress(deal.Client),
|
Client: deal.Client,
|
||||||
Provider: sharedutils.ToSharedAddress(deal.Provider),
|
Provider: deal.Provider,
|
||||||
StoragePricePerEpoch: sharedutils.ToSharedTokenAmount(deal.StoragePricePerEpoch),
|
StoragePricePerEpoch: sharedutils.ToSharedTokenAmount(deal.StoragePricePerEpoch),
|
||||||
StorageCollateral: sharedutils.ToSharedTokenAmount(deal.StorageCollateral),
|
StorageCollateral: sharedutils.ToSharedTokenAmount(deal.StorageCollateral),
|
||||||
ActivationEpoch: deal.ActivationEpoch,
|
ActivationEpoch: deal.ActivationEpoch,
|
||||||
@ -35,8 +36,8 @@ func ToOnChainDeal(deal storagemarket.StorageDeal) actors.OnChainDeal {
|
|||||||
return actors.OnChainDeal{
|
return actors.OnChainDeal{
|
||||||
PieceRef: deal.PieceRef,
|
PieceRef: deal.PieceRef,
|
||||||
PieceSize: deal.PieceSize,
|
PieceSize: deal.PieceSize,
|
||||||
Client: sharedutils.FromSharedAddress(deal.Client),
|
Client: deal.Client,
|
||||||
Provider: sharedutils.FromSharedAddress(deal.Provider),
|
Provider: deal.Provider,
|
||||||
StoragePricePerEpoch: sharedutils.FromSharedTokenAmount(deal.StoragePricePerEpoch),
|
StoragePricePerEpoch: sharedutils.FromSharedTokenAmount(deal.StoragePricePerEpoch),
|
||||||
StorageCollateral: sharedutils.FromSharedTokenAmount(deal.StorageCollateral),
|
StorageCollateral: sharedutils.FromSharedTokenAmount(deal.StorageCollateral),
|
||||||
ActivationEpoch: deal.ActivationEpoch,
|
ActivationEpoch: deal.ActivationEpoch,
|
||||||
|
Loading…
Reference in New Issue
Block a user