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

Retrieval Should Not Block on Chain Operations #69

Closed
hannahhoward opened this issue Jan 28, 2020 · 0 comments · Fixed by #190
Closed

Retrieval Should Not Block on Chain Operations #69

hannahhoward opened this issue Jan 28, 2020 · 0 comments · Fixed by #190
Assignees

Comments

@hannahhoward
Copy link
Collaborator

hannahhoward commented Jan 28, 2020

As a client or provider, I would like modification operations with the chain to return immediately, and deliver their results asynchronously


In:
The only chain modifying function in the retrieval market is GetOrCreatePaymentChannel -- and it's made complicated by the fact that it may create a channel or it may add funds to a channel -- both operations create a chain message, but one that is interpreted differently (create channel contains the address in the message receipt, where add funds just has an exit code)

The current signature is as follows:

GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, minerAddress address.Address, clientFundsAvailable abi.TokenAmount, tok shared.TipSetToken) (address.Address, error)

The new signature should be

GetOrCreatePaymentChannel(ctx context.Context, clientAddress address.Address, minerAddress address.Address, clientFundsAvailable abi.TokenAmount, tok shared.TipSetToken) (address.Address, cid.Cid, error)

Where cid is the message cid to wait for

If the returned address == address.Undef that means a payment channel had to be created. If returned address is not address.Undef, that means a payment channel exists, but we're waiting to add funds.

the retrieval client should transition in to one of two states (based on whether returned address = address.Undef):
DealStatusPaymentChannelCreating
DealStatusPaymentChannelAddingFunds

each state will wait on one of two new APIS:

WaitForPaymentChannelAddFudns(messageCID cid.CId) error
WaitForPaymentChannelCreation(messageCID cid.Cid) (address.Address, error)

DealStatusPaymentChannelCreated can be renamed DealStatusPaymentChannelReady since that makes more sense

Assuming the states succeed, they transition to DealStatusPaymentChannelReady and the deal proceeds.

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.

3 participants