-
Notifications
You must be signed in to change notification settings - Fork 59
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
send tipset identifier to node when interacting with chain #172
Conversation
79dc1c5
to
fb66677
Compare
storagemarket/testnodes/testnodes.go
Outdated
@@ -180,8 +180,8 @@ func (n *FakeClientNode) OnDealSectorCommitted(ctx context.Context, provider add | |||
} | |||
|
|||
// ValidateAskSignature returns the stubbed validation error |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
fix comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
done!
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM, updating comment is optional
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
For the forward facing APIs on Client and Provider, I would prefer not to augment them with a tipset token, and instead have them internally call GetMoreRecentStateID internally — these are intended to be used at the command line level in a user facing way, and I think it’s unlikely that a user will want or know how to pass a TipSet token in directly. Open to a discussion about this -- it might be useful to hear @ingar 's feedback cause he's worked with StorageMarket a fair amount. One other alternative is to let it be a variadic argument, but I'd be inclined to lean away from that.
Also, should LocatePieceForDealWithinSector take a tipset token? My understanding is this doesn't really talk to the chain so much as it uses the storage miner code directly. This is non-blocking if you can confirm my understanding is wrong.
storagemarket/impl/client.go
Outdated
@@ -242,8 +248,8 @@ func (c *Client) ProposeStorageDeal( | |||
}) | |||
} | |||
|
|||
func (c *Client) GetPaymentEscrow(ctx context.Context, addr address.Address) (storagemarket.Balance, error) { | |||
return c.node.GetBalance(ctx, addr) | |||
func (c *Client) GetPaymentEscrow(ctx context.Context, addr address.Address, tok shared.TipSetToken) (storagemarket.Balance, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
storagemarket/impl/client.go
Outdated
@@ -137,7 +138,7 @@ func (c *Client) GetInProgressDeal(ctx context.Context, cid cid.Cid) (storagemar | |||
return out, nil | |||
} | |||
|
|||
func (c *Client) GetAsk(ctx context.Context, info storagemarket.StorageProviderInfo) (*storagemarket.SignedStorageAsk, error) { | |||
func (c *Client) GetAsk(ctx context.Context, info storagemarket.StorageProviderInfo, tok shared.TipSetToken) (*storagemarket.SignedStorageAsk, error) { | |||
s, err := c.net.NewAskStream(info.PeerID) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
storagemarket/impl/client.go
Outdated
@@ -117,8 +118,8 @@ func (c *Client) ListProviders(ctx context.Context) (<-chan storagemarket.Storag | |||
return out, nil | |||
} | |||
|
|||
func (c *Client) ListDeals(ctx context.Context, addr address.Address) ([]storagemarket.StorageDeal, error) { | |||
return c.node.ListClientDeals(ctx, addr) | |||
func (c *Client) ListDeals(ctx context.Context, addr address.Address, tok shared.TipSetToken) ([]storagemarket.StorageDeal, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
storagemarket/impl/provider.go
Outdated
@@ -223,16 +225,16 @@ func (p *Provider) ListAsks(addr address.Address) []*storagemarket.SignedStorage | |||
return nil | |||
} | |||
|
|||
func (p *Provider) ListDeals(ctx context.Context) ([]storagemarket.StorageDeal, error) { | |||
return p.spn.ListProviderDeals(ctx, p.actor) | |||
func (p *Provider) ListDeals(ctx context.Context, tok shared.TipSetToken) ([]storagemarket.StorageDeal, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please call MostRecentStateID internally and leave signature unchanged
storagemarket/impl/provider.go
Outdated
} | ||
|
||
func (p *Provider) AddStorageCollateral(ctx context.Context, amount abi.TokenAmount) error { | ||
return p.spn.AddFunds(ctx, p.actor, amount) | ||
} | ||
|
||
func (p *Provider) GetStorageCollateral(ctx context.Context) (storagemarket.Balance, error) { | ||
return p.spn.GetBalance(ctx, p.actor) | ||
func (p *Provider) GetStorageCollateral(ctx context.Context, tok shared.TipSetToken) (storagemarket.Balance, error) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see above
@@ -321,7 +321,7 @@ type StorageProviderNode interface { | |||
|
|||
OnDealSectorCommitted(ctx context.Context, provider address.Address, dealID abi.DealID, cb DealSectorCommittedCallback) error | |||
|
|||
LocatePieceForDealWithinSector(ctx context.Context, dealID abi.DealID) (sectorID uint64, offset uint64, length uint64, err error) | |||
LocatePieceForDealWithinSector(ctx context.Context, dealID abi.DealID, tok shared.TipSetToken) (sectorID uint64, offset uint64, length uint64, err error) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this method actually talking to the chain? I believe it's not.. though I could be wrong.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yep. The go-filecoin implementation of this method requires both storage miner actor and storage miner actor states.
That makes sense to me. I'll make that update tomorrow. |
Yep, indeed it does. At least in go-filecoin. |
87066d3
to
11da847
Compare
Why does this PR exist?
This is the last (hopefully) PR in a chain of PRs which pass chain state identifiers to methods on the
Node*
interfaces.