Skip to content

Coop-Settle channel-state logic#7233

Merged
istankovic merged 22 commits into
raiden-network:developfrom
ezdac:feature/coop-settle
Aug 11, 2021
Merged

Coop-Settle channel-state logic#7233
istankovic merged 22 commits into
raiden-network:developfrom
ezdac:feature/coop-settle

Conversation

@ezdac
Copy link
Copy Markdown
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
Comment thread raiden/tests/unit/channel_state/test_coop_settle.py Outdated
Comment thread raiden/tests/unit/channel_state/test_coop_settle.py Outdated
Comment thread raiden/tests/unit/channel_state/test_coop_settle.py Outdated
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/tests/unit/channel_state/test_channel_deposit.py
@ezdac ezdac force-pushed the feature/coop-settle branch from 904b9f7 to ec30b5f Compare July 26, 2021 08:23
@fredo
Copy link
Copy Markdown
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
Copy Markdown
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.

Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/channel.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/events.py Outdated
Comment thread raiden/transfer/events.py Outdated
Comment thread raiden/transfer/channel.py
Comment thread raiden/transfer/events.py Outdated
Comment thread raiden/transfer/events.py Outdated
@istankovic istankovic force-pushed the feature/coop-settle branch 2 times, most recently from 5b76a2f to 8f6e7f8 Compare August 9, 2021 17:17
Comment thread raiden/transfer/channel.py Outdated
@istankovic istankovic force-pushed the feature/coop-settle branch from 8f6e7f8 to 739348f Compare August 10, 2021 08:35
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 force-pushed the feature/coop-settle branch from 739348f to 0919ec7 Compare August 10, 2021 09:30
@istankovic istankovic force-pushed the feature/coop-settle branch from 0919ec7 to e31db23 Compare August 10, 2021 11:25
@istankovic istankovic merged commit db24de3 into raiden-network:develop 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

None yet

Development

Successfully merging this pull request may close these issues.

5 participants