Skip to content

Fixed initiator fail events#3024

Merged
LefterisJP merged 5 commits into
raiden-network:masterfrom
hackaugusto:fix_initiator_event
Jan 29, 2019
Merged

Fixed initiator fail events#3024
LefterisJP merged 5 commits into
raiden-network:masterfrom
hackaugusto:fix_initiator_event

Conversation

@hackaugusto
Copy link
Copy Markdown
Contributor

When a transfer fails because a lock expired the corresponding events
must be emitted. This moves the event from the invalid secret request
together with the lock expiration to avoid emitting the same event
twice.


if lock_has_expired:
if initiator_state.received_secret_request:
reason = 'bad secret request message from target'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling this here means that a payment that failed because of an invalid secret request will take one block longer till it's cancelled!?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Handling this here means that a payment that failed because of an invalid secret request will take one block longer till it's cancelled!?

It may be way more blocks, up to lock timeout, as the off-chain secret request can be sent at any point in time.

This change however makes the failure event consistent with the update in balance, since the byzantine node is the target, which is not necessarily the next hop, and we need to wait for the lock to expire before removing it.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're point makes sense, but on the other hand it might be nice to be able to inform the user as early as possible that the payment failed, even if the funds are still locked.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Both things make sense. I really think we should target a consistent view of the state as much as possible, the system is hard enough to understand when things are consistent. However, it can be definitely useful to inform a user that a transfer will not be completely because of ByzantineBehavior, so my suggestion would have two different events, keep this one here, which exposes a consistent view, and add a new one to inform the user when something unexpected happened (like the target sending the wrong secret request).

If you agree with me, I think we should do that in another PR.

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you agree with me, I think we should do that in another PR.

That sounds like a plan!

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a plan!

So can one of you make an issue for this (so that we don't forget the other PR)?
If I understand correctly you mean to add an event that the payment will fail here ?

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Added #3044

Comment thread raiden/tests/unit/transfer/mediated_transfer/test_initiatorstate.py Outdated
Comment thread raiden/tests/unit/transfer/mediated_transfer/test_initiatorstate.py Outdated
Comment thread raiden/transfer/mediated_transfer/initiator.py Outdated

if lock_has_expired:
if initiator_state.received_secret_request:
reason = 'bad secret request message from target'
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That sounds like a plan!

So can one of you make an issue for this (so that we don't forget the other PR)?
If I understand correctly you mean to add an event that the payment will fail here ?

@hackaugusto hackaugusto force-pushed the fix_initiator_event branch 4 times, most recently from 666c12e to 94cb24a Compare January 25, 2019 14:17
@codecov-io
Copy link
Copy Markdown

codecov-io commented Jan 28, 2019

Codecov Report

❗ No coverage uploaded for pull request base (master@1c4a2a1). Click here to learn what that means.
The diff coverage is 100%.

Impacted file tree graph

@@            Coverage Diff            @@
##             master    #3024   +/-   ##
=========================================
  Coverage          ?   74.82%           
=========================================
  Files             ?       94           
  Lines             ?    12401           
  Branches          ?     1735           
=========================================
  Hits              ?     9279           
  Misses            ?     2474           
  Partials          ?      648
Impacted Files Coverage Δ
raiden/transfer/mediated_transfer/initiator.py 90.76% <100%> (ø)

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 1c4a2a1...01799f8. Read the comment docs.

@LefterisJP
Copy link
Copy Markdown
Contributor

Rebasing and reviewing this.

hackaugusto and others added 5 commits January 29, 2019 10:31
When a transfer fails because a lock expired the corresponding events
must be emitted. This moves the event from the invalid secret request
together with the lock expiration to avoid emitting the same event
twice.
Copy link
Copy Markdown
Contributor

@LefterisJP LefterisJP left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good to me. I fixed some minor problems after rebasing. We can merge as soon as all tests are green.

@LefterisJP LefterisJP merged commit 367394d into raiden-network:master Jan 29, 2019
@hackaugusto hackaugusto deleted the fix_initiator_event branch January 29, 2019 15:39
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.

4 participants