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

Use ABI V2 to shorten settle arg list #1392

Merged
merged 5 commits into from
Jun 9, 2020

Conversation

karlb
Copy link
Contributor

@karlb karlb commented Jun 2, 2020

This allows us to add additional arguments for hash salts and signatures
that allow settling on behalf of other users.

I kept compatibility with the existing signature and introduced a new
settle function using structs. Is this a good idea? Also a better name
than settleChannel2 would be nice.

Closes #1129

This allows us to add additional arguments for hash salts and signatures
that allow settling on behalf of other users.

I kept compatibility with the existing signature and introduced a new
settle function using structs. Is this a good idea? Also a better name
than `settleChannel2` would be nice.

Closes raiden-network#1129
@codecov
Copy link

codecov bot commented Jun 2, 2020

Codecov Report

Merging #1392 into master will decrease coverage by 0.33%.
The diff coverage is n/a.

Impacted file tree graph

@@            Coverage Diff             @@
##           master    #1392      +/-   ##
==========================================
- Coverage   80.76%   80.43%   -0.34%     
==========================================
  Files          21       21              
  Lines        1508     1503       -5     
  Branches      193      183      -10     
==========================================
- Hits         1218     1209       -9     
- Misses        249      251       +2     
- Partials       41       43       +2     
Impacted Files Coverage Δ
raiden_contracts/utils/signature.py 84.84% <0.00%> (-6.33%) ⬇️
raiden_contracts/deploy/contract_deployer.py 89.16% <0.00%> (-2.24%) ⬇️
raiden_contracts/constants.py 100.00% <0.00%> (ø)
raiden_contracts/utils/versions.py 100.00% <0.00%> (ø)
raiden_contracts/utils/type_aliases.py 100.00% <0.00%> (ø)
raiden_contracts/deploy/__main__.py 92.48% <0.00%> (+0.04%) ⬆️
raiden_contracts/utils/proofs.py 92.68% <0.00%> (+0.37%) ⬆️

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 bd66979...ad0a198. Read the comment docs.

@karlb karlb marked this pull request as ready for review June 2, 2020 09:07
@auto-assign auto-assign bot requested a review from konradkonrad June 2, 2020 09:08
@@ -124,6 +125,13 @@ contract TokenNetwork is Utils {
uint256 locked_amount;
}

struct ParticipantSettleInput {
Copy link
Contributor

Choose a reason for hiding this comment

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

imho we could go with a shorter name here:
SettleInput (having a mandatory participant argument) should be completely self-explanatory :)

@@ -692,6 +700,30 @@ contract TokenNetwork is Utils {
bytes32 participant2_locksroot
)
public
Copy link
Contributor

Choose a reason for hiding this comment

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

why wouldn't we change the signature for settleChannel as well?

function settleChannel(
  uint256 channel_identifier,
  SettleInput participant1,
  SettleInput participant2
) ...

Copy link
Contributor

Choose a reason for hiding this comment

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

ah, expand-contract pattern...I see.

@@ -725,16 +759,16 @@ contract TokenNetwork is Utils {

require(verifyBalanceHashData(
Copy link
Contributor

Choose a reason for hiding this comment

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

verifyBalanceHashData is also never used outside the context of settlement, right? So it could use (Participant)SettleInput as the sole argument.

Copy link
Contributor

@konradkonrad konradkonrad left a comment

Choose a reason for hiding this comment

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

I can approve this, as-is.

However, a more thorough refactoring, that makes use of the newly introduced struct in all signatures that share the arguments, would make sense imho.

Unless, of course, this minimal refactoring was done intentionally. In this case I'd like to know the rationale.

@karlb
Copy link
Contributor Author

karlb commented Jun 9, 2020

If you can spot any additional refactoring opportunities related to SettleInput, let me know! @konradkonrad

@konradkonrad konradkonrad merged commit 84743b0 into raiden-network:master Jun 9, 2020
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.

Use V2 ABI in the settlement function
2 participants