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

Track total funds commited in SMA, Client and Provider #331

Closed
hannahhoward opened this issue Jul 22, 2020 · 0 comments · Fixed by #336
Closed

Track total funds commited in SMA, Client and Provider #331

hannahhoward opened this issue Jul 22, 2020 · 0 comments · Fixed by #336
Assignees

Comments

@hannahhoward
Copy link
Collaborator

hannahhoward commented Jul 22, 2020

As a client (using StorageClient software) or a miner (StorageProvider) I would like to make sure that I have enough funds available in the market actor for all of my current known deals, so that if I make two simultaneous deals, they both succeed.

Background:
When money is put into the SMA, it is considered "Available"
When a deal is published, funds needed for the deal are locked, and are no longer available.
Currently we use EnsureFunds, which calls MarketEnsureAvailable, which insures the amount past to it is available in the SMA.
Currently, we only submit the value of the current deal to EnsureFunds, but actually, for all deals to go through, we need to have available funds for every deal that is in a state between New and Published (and not failed)

StorageClient & StorageProvider should maintain, in a datastore, a seperate value for total funds committed for our own deals.

Recommend writing a class like StoredAsk -- maybe FundsCommittedTotal

  • make sure it has a mutex lock (will be accessed by multiple deals)
  • propobly maintain cached value like StoredAsk to avoid datastore lookup on Get
  • Should have AddFundsCommitted, ReleaseFundsCommitted, Get (or something like that)

Client:

  • In StorageClient ensure funds states, add committed funds for current deal and then call node.EnsureFunds with total commited funds
  • Release committed funds probably right after VerifyDealPublished (i.e. at the beginning of VerifyDealActivated) and in any error state

Provider:

On Provider, repeat the same for the provider ensure funds steps and release funds in StorageDealStaged & error states (at the beginning of handoff deal probably)

Notes:

  • Should probably not require changes to statemachine for the most part
  • Should not require changes to node interface
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 a pull request may close this issue.

2 participants