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

Coop-Settle channel-state logic #7233

Merged
merged 22 commits into from
Aug 11, 2021

Conversation

ezdac
Copy link
Contributor

@ezdac ezdac commented Jul 16, 2021

Implement the Coop-Settle logic built on-top of the Withdraw protocol.

This PR implements the logic as specified in this proposal.
It leverages the internal locking of channels with the NettingChannelEndState.withdraws_pending checks, that are
already in place for the withdraws.
The most important additional verification for coop-settle is:

  • we don't accept any coop-settle related withdraws when there are pending payments (locks) for us or the partner
  • we don't emit withdraw-specific events (especially contract calls) from the state-transition for coop-settle related withdraw messages.

This PR lacks:

  • Changes to the withdraw-message schema
  • new API endpoint or integration in existing API endpoint that would trigger a ActionInitCoopSettle
  • processing of the ContractSendCoopSettle event
  • thus no blockchain interaction is implemented
  • Integration tests (since the full coop-settle lifecycle is not implemented)

@ezdac ezdac force-pushed the feature/coop-settle branch 3 times, most recently from f3fa686 to 904b9f7 Compare July 21, 2021 15:20
@ezdac ezdac changed the title WIP: Coop-Settle Coop-Settle channel-state logic Jul 22, 2021
@ezdac ezdac marked this pull request as ready for review July 22, 2021 11:15
@auto-assign auto-assign bot requested a review from netcriptus July 22, 2021 11:15
@ezdac ezdac added this to In progress in Raiden Berlin Sprint via automation Jul 22, 2021
@ezdac ezdac moved this from In progress to Review in progress in Raiden Berlin Sprint Jul 22, 2021
raiden/tests/unit/channel_state/test_coop_settle.py Outdated Show resolved Hide resolved
raiden/tests/unit/channel_state/test_coop_settle.py Outdated Show resolved Hide resolved
raiden/tests/unit/channel_state/test_coop_settle.py Outdated Show resolved Hide resolved
raiden/transfer/channel.py Outdated Show resolved Hide resolved
@fredo
Copy link
Contributor

fredo commented Jul 27, 2021

new API endpoint or integration in existing API endpoint that would trigger a ActionInitCoopSettle

Did we agree on having a specific endpoint for it? Or couldn't we optimisticly try to coop settle and if not possible do the old settlement process?

@ezdac
Copy link
Contributor Author

ezdac commented Jul 27, 2021

Did we agree on having a specific endpoint for it? Or couldn't we optimisticly try to coop settle and if not possible do the old settlement process?

That's the plan - reuse the channel-close endpoint: there try a coop-settle first and if that expires go with the traditional close/settle cycle.

raiden/transfer/channel.py Outdated Show resolved Hide resolved
ezdac and others added 19 commits August 10, 2021 11:17
The single file testing the state-machine for
the NettingChannelState and NettingChannelEndstate
was very large and was testing a lot of different
state-changes.

In this commit, the file is split up in a separate module,
roughly grouped by the type of state-changes that are
tested
Before, the logic to handle the `ActionChannelCoopSettle` was there,
but the channels state machine would not process the event.
Now, the dynamic type-checking of incoming events will forward
the action to the appropriate handler-function.
And drop the unneded type annotation.
@istankovic istankovic merged commit db24de3 into raiden-network:develop Aug 11, 2021
Raiden Berlin Sprint automation moved this from Review in progress to Done Aug 11, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants