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
Fix set_total_deposit failure after channel is closed #4685
Conversation
If the channel was beyond OPEN state (Closed, Settled, Removed), then a withdraw operation is simply invalidated by a race condition. If the channel was not even OPEN (Non existent) then an Unrecoverable error is raised.
Codecov Report
@@ Coverage Diff @@
## develop #4685 +/- ##
===========================================
- Coverage 80.9% 80.89% -0.02%
===========================================
Files 118 118
Lines 14222 14234 +12
Branches 2193 2195 +2
===========================================
+ Hits 11506 11514 +8
Misses 2074 2074
- Partials 642 646 +4
Continue to review full report at Codecov.
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for the detailed PR description!
If an integration test is used, it could not be written as a unit test
The code changes could have been tested in a unit test, but the complete case from the bug report is covered more thoroughly by this integration test. So I'm not sure how to rate this item.
Changelog entry has been added
Does this count as user facing? I lean towards saying "yes".
@@ -1402,11 +1402,18 @@ def _set_total_withdraw( | |||
block_identifier=failed_at_blockhash, | |||
) | |||
|
|||
if detail.state != ChannelState.OPENED: | |||
if detail.state > ChannelState.OPENED: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why does the comparison work?
https://docs.python.org/3/library/enum.html#comparisons says:
Ordered comparisons between enumeration values are not supported. Enum members are not integers (but see IntEnum below)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ChannelState
is an IntEnum
so comparisons work.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I was never big fan of comparing int values of enums as if you are not careful and add some new value later on in the wrong place it can cause really hard to find bugs. That is just my experience.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ahh, I was looking at https://github.com/raiden-network/raiden/blob/develop/raiden/transfer/state.py#L70, which is a plain Enum
. Is there a reason for having both or is it just for historic reasons?
Anything proxy-related or raiden-service related isn't directly unit testable because of the whole bunch of dependencies that are required by those components. The option is to either mock them all (which is bad) or just write an integration test.
We need a better definition here IMO... i would lean towards no because the failure and the fix is a result of an automated process (recovery) after restart which the user did not trigger. |
We generally consider all bugs as changelog-worthy since users can inadvertedly hit them. |
Fixes: #4639
Description
Looking at the stacktrace posted in the issue, it was obvious that the node was being restarted and the withdraw transaction was being sent on-chain during the initialization phase.
What happened?
The problems that caused this were:
Solution implemented:
PR review check list
Quality check list that cannot be automatically verified.