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 client fails to resume after opening payment channel #517

Closed
dirkmc opened this issue Mar 25, 2021 · 0 comments
Closed

Retrieval client fails to resume after opening payment channel #517

dirkmc opened this issue Mar 25, 2021 · 0 comments
Labels
x/ignite Issues and PRs being tracked by Team Ignite at Protocol Labs

Comments

@dirkmc
Copy link
Contributor

dirkmc commented Mar 25, 2021

Background

When making a retrieval, the process is:

  1. Client opens data transfer channel
  2. Provider accepts
  3. Client opens payment channel
  4. Client sends funds
  5. Provider sends data

With the current markets release there is a bug where the client does not send funds in step 4. Instead, the retrieval gets stuck:

ClientEventOpen
ClientEventDealProposed
ClientEventDealAccepted
ClientEventPaymentChannelAddingFunds
ClientEventPaymentChannelReady
ClientEventLaneAllocated
  <no further events>

The provider does send a request for payment while the client is in the state DealStatusPaymentChannelAddingInitialFunds.
However the client ignores the event.

It seems the reason is because DealStatusPaymentChannelAddingInitialFunds is not included in the list of payment channel creation states:

var paymentChannelCreationStates = []fsm.StateKey{
rm.DealStatusWaitForAcceptance,
rm.DealStatusWaitForAcceptanceLegacy,
rm.DealStatusAccepted,
rm.DealStatusPaymentChannelCreating,
rm.DealStatusPaymentChannelAllocatingLane,
}

So when the provider requests payment, and the ClientEventPaymentRequested event is fired, the event is ignored:

fsm.Event(rm.ClientEventPaymentRequested).
FromMany(
rm.DealStatusOngoing,
rm.DealStatusBlocksComplete,
rm.DealStatusFundsNeeded).To(rm.DealStatusFundsNeeded).
FromMany(
paymentChannelCreationStates...).ToJustRecord().
Action(func(deal *rm.ClientDealState, paymentOwed abi.TokenAmount) error {
deal.PaymentRequested = big.Add(deal.PaymentRequested, paymentOwed)
return nil
}),

Solution

We just need to add DealStatusPaymentChannelAddingInitialFunds to paymentChannelCreationStates

@dirkmc dirkmc added the x/ignite Issues and PRs being tracked by Team Ignite at Protocol Labs label Mar 25, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
x/ignite Issues and PRs being tracked by Team Ignite at Protocol Labs
Projects
None yet
Development

No branches or pull requests

1 participant