Skip to content
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

Merged
merged 5 commits into from
Mar 26, 2020

Conversation

laser
Copy link
Contributor

@laser laser commented Mar 25, 2020

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.

@laser laser force-pushed the feat/send-state-identifier-beta branch from 79dc1c5 to fb66677 Compare March 25, 2020 22:09
@@ -180,8 +180,8 @@ func (n *FakeClientNode) OnDealSectorCommitted(ctx context.Context, provider add
}

// ValidateAskSignature returns the stubbed validation error
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

fix comment

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done!

Copy link
Contributor

@shannonwells shannonwells left a 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

Copy link
Collaborator

@hannahhoward hannahhoward left a 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 Show resolved Hide resolved
@@ -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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@@ -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)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@@ -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) {
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see above

@@ -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) {
Copy link
Collaborator

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

}

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) {
Copy link
Collaborator

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)
Copy link
Collaborator

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.

Copy link
Contributor Author

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.

@laser
Copy link
Contributor Author

laser commented Mar 26, 2020

@hannahhoward

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

That makes sense to me. I'll make that update tomorrow.

@laser
Copy link
Contributor Author

laser commented Mar 26, 2020

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.

Yep, indeed it does. At least in go-filecoin.

@laser laser requested a review from hannahhoward March 26, 2020 20:07
@laser laser force-pushed the feat/send-state-identifier-beta branch from 87066d3 to 11da847 Compare March 26, 2020 20:08
@laser laser merged commit 16ce89e into master Mar 26, 2020
@laser laser deleted the feat/send-state-identifier-beta branch March 26, 2020 20:21
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants