Skip to content

Check chain data when performing settle#2468

Merged
LefterisJP merged 1 commit into
raiden-network:masterfrom
pcppcp:test_balance_proof
Sep 14, 2018
Merged

Check chain data when performing settle#2468
LefterisJP merged 1 commit into
raiden-network:masterfrom
pcppcp:test_balance_proof

Conversation

@pcppcp
Copy link
Copy Markdown
Contributor

@pcppcp pcppcp commented Sep 13, 2018

[ci integration]

@pcppcp pcppcp force-pushed the test_balance_proof branch 4 times, most recently from dd90a30 to 0a80d37 Compare September 13, 2018 12:37
@coveralls
Copy link
Copy Markdown

coveralls commented Sep 13, 2018

Coverage Status

Coverage remained the same at 77.852% when pulling 47452d6 on pcppcp:test_balance_proof into 8899541 on raiden-network:master.

Comment thread raiden/raiden_event_handler.py Outdated

if our_balance_proof:
our_balance_hash = channel_details.participants_data.our_details.balance_hash
if our_balance_proof and our_balance_hash != bytes(32):
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.

Can you use the raiden.constants.EMPTY_HASH constant here.

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.

I agree; fixed

Comment thread raiden/raiden_event_handler.py Outdated

if partner_balance_proof:
partner_balance_hash = channel_details.participants_data.partner_details.balance_hash
if partner_balance_proof and partner_balance_hash != bytes(32):
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.

same here

app0,
app1,
token_network_identifier,
1,
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.

would be nice to add keywords for all parameters

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.

yeah it would, but there're no kwargs for this call :)

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.

Hu? Why can't you write amount=1?

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.

plz add kwargs as @palango suggested. We want to make it a habit. Helps readability and avoid errors.

Edit: what he means is:

direct_transfer(
    initiator_app=app0,
    target_app=app1,
     ...
)

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.

Also please do the same to all the function calls in this test

Copy link
Copy Markdown
Contributor

@palango palango left a comment

Choose a reason for hiding this comment

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

Last comment is about readability, lets get this merged afterwards.

args=args,
)

def decode_transaction_input(self, transaction_hash):
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.

add types

app0,
app1,
token_network_identifier,
1,
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.

plz add kwargs as @palango suggested. We want to make it a habit. Helps readability and avoid errors.

Edit: what he means is:

direct_transfer(
    initiator_app=app0,
    target_app=app1,
     ...
)

app0,
app1,
token_network_identifier,
1,
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.

Also please do the same to all the function calls in this test

)
channel_identifier = get_channelstate(app0, app1, token_network_identifier).identifier

# make a transfer
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.

Add a bit more commentary here to explain what's happening:

-# make a transfer
+# make a transfer from app0 to app1 so that app1 is supposed to have a non empty balance hash

app1.stop()
token_network_contract = TokenNetwork(app1.raiden.chain.client, token_network_identifier)

# app1 closes the channel
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.

Add more info on the comment.

- # app1 closes the channel
+ # app1 closes the channel with an empty hash instead of the expected hash of the transferred amount from app0

)
channel_identifier = get_channelstate(app0, app1, token_network_identifier).identifier

# make a transfer
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.

Same comments as in the above test apply.

  • Add kwargs in the function calls
  • Expand comments a bit so that the future readers easily understand what's happening

@pcppcp pcppcp force-pushed the test_balance_proof branch 6 times, most recently from 47452d6 to 11d3131 Compare September 14, 2018 09:41
- checks on-chain state of the channel balance_proof state in order to
  use ensure consistent settle call even if partner used empty hash to
  `close` the channel or if he didn't call `updateTransfer`
- fixes raiden-network#2410
- fix webargs' `handle_request_parsing_error`

[ci integration]
@LefterisJP
Copy link
Copy Markdown
Contributor

The stress test fails. But locally when I check out your branch it passes.

@LefterisJP
Copy link
Copy Markdown
Contributor

merging since all pass except a flaky test.

@LefterisJP LefterisJP merged commit 03ab8d2 into raiden-network:master Sep 14, 2018
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.

Check if partner submitted balance proof before settling

4 participants