Merge pull request #898 from filecoin-project/feat/storage-market-tracing
add a bit more tracing in publish storage deal
This commit is contained in:
commit
1415ba4ce7
@ -5,6 +5,7 @@ import (
|
|||||||
"context"
|
"context"
|
||||||
"sort"
|
"sort"
|
||||||
|
|
||||||
|
"go.opencensus.io/trace"
|
||||||
"golang.org/x/xerrors"
|
"golang.org/x/xerrors"
|
||||||
|
|
||||||
"github.com/filecoin-project/go-amt-ipld"
|
"github.com/filecoin-project/go-amt-ipld"
|
||||||
@ -254,6 +255,9 @@ func setMarketBalances(vmctx types.VMContext, nd *hamt.Node, set map[address.Add
|
|||||||
}
|
}
|
||||||
|
|
||||||
func GetMarketBalances(ctx context.Context, store *hamt.CborIpldStore, rcid cid.Cid, addrs ...address.Address) ([]StorageParticipantBalance, *hamt.Node, ActorError) {
|
func GetMarketBalances(ctx context.Context, store *hamt.CborIpldStore, rcid cid.Cid, addrs ...address.Address) ([]StorageParticipantBalance, *hamt.Node, ActorError) {
|
||||||
|
ctx, span := trace.StartSpan(ctx, "GetMarketBalances")
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
nd, err := hamt.LoadNode(ctx, store, rcid)
|
nd, err := hamt.LoadNode(ctx, store, rcid)
|
||||||
if err != nil {
|
if err != nil {
|
||||||
return nil, nil, aerrors.HandleExternalError(err, "failed to load miner set")
|
return nil, nil, aerrors.HandleExternalError(err, "failed to load miner set")
|
||||||
@ -381,6 +385,9 @@ func (sma StorageMarketActor) PublishStorageDeals(act *types.Actor, vmctx types.
|
|||||||
}
|
}
|
||||||
|
|
||||||
func (st *StorageMarketState) validateDeal(vmctx types.VMContext, deal StorageDealProposal, providerWorker address.Address) aerrors.ActorError {
|
func (st *StorageMarketState) validateDeal(vmctx types.VMContext, deal StorageDealProposal, providerWorker address.Address) aerrors.ActorError {
|
||||||
|
ctx, span := trace.StartSpan(vmctx.Context(), "validateDeal")
|
||||||
|
defer span.End()
|
||||||
|
|
||||||
if vmctx.BlockHeight() > deal.ProposalExpiration {
|
if vmctx.BlockHeight() > deal.ProposalExpiration {
|
||||||
return aerrors.New(1, "deal proposal already expired")
|
return aerrors.New(1, "deal proposal already expired")
|
||||||
}
|
}
|
||||||
@ -394,7 +401,7 @@ func (st *StorageMarketState) validateDeal(vmctx types.VMContext, deal StorageDe
|
|||||||
}
|
}
|
||||||
|
|
||||||
// TODO: do some caching (changes gas so needs to be in spec too)
|
// TODO: do some caching (changes gas so needs to be in spec too)
|
||||||
b, bnd, aerr := GetMarketBalances(vmctx.Context(), vmctx.Ipld(), st.Balances, deal.Client, providerWorker)
|
b, bnd, aerr := GetMarketBalances(ctx, vmctx.Ipld(), st.Balances, deal.Client, providerWorker)
|
||||||
if aerr != nil {
|
if aerr != nil {
|
||||||
return aerrors.Wrap(aerr, "getting client, and provider balances")
|
return aerrors.Wrap(aerr, "getting client, and provider balances")
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user