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

Iteration in fee approximation #565

Merged
merged 3 commits into from
Oct 4, 2019
Merged

Conversation

karlb
Copy link
Contributor

@karlb karlb commented Oct 4, 2019

Use fee_receiver and fee_sender from raiden to get the latest fee calculation. Those are currently in a test utils package and should be moved in a following PR.

Closes #563.

@karlb karlb requested a review from Dominik1999 October 4, 2019 09:29
@karlb
Copy link
Contributor Author

karlb commented Oct 4, 2019

The PR needs the corresponding raiden PR merged first. I'll update it as soon as that PR is ready.

@@ -8,7 +8,7 @@

from pathfinding_service.constants import DEFAULT_REVEAL_TIMEOUT
from pathfinding_service.exceptions import InvalidPFSFeeUpdate
from raiden.exceptions import UndefinedMediationFee
from raiden.tests.utils.mediation_fees import fee_receiver, fee_sender
Copy link
Contributor

Choose a reason for hiding this comment

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

ok what I understand is that you take the fee calculation from the Raiden repo to do it in the pfs, now. Is that correct?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, exactly.

Copy link
Contributor

Choose a reason for hiding this comment

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

but why do you take this crucial function from the Raiden tests?

Copy link
Contributor

Choose a reason for hiding this comment

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

I am happy if that works, but we might need to refactor that anytime after the RC, right?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yes, we need to do that (see commit message).

Copy link
Contributor

@Dominik1999 Dominik1999 left a comment

Choose a reason for hiding this comment

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

ok that looks good to me

@@ -8,7 +8,7 @@

from pathfinding_service.constants import DEFAULT_REVEAL_TIMEOUT
from pathfinding_service.exceptions import InvalidPFSFeeUpdate
from raiden.exceptions import UndefinedMediationFee
from raiden.tests.utils.mediation_fees import fee_receiver, fee_sender
Copy link
Contributor

Choose a reason for hiding this comment

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

but why do you take this crucial function from the Raiden tests?

@@ -8,7 +8,7 @@

from pathfinding_service.constants import DEFAULT_REVEAL_TIMEOUT
from pathfinding_service.exceptions import InvalidPFSFeeUpdate
from raiden.exceptions import UndefinedMediationFee
from raiden.tests.utils.mediation_fees import fee_receiver, fee_sender
Copy link
Contributor

Choose a reason for hiding this comment

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

I am happy if that works, but we might need to refactor that anytime after the RC, right?

tn.set_fee(2, 1, imbalance_penalty=[(TA(0), FA(0)), (TA(200), FA(200))])
assert tn.estimate_fee(1, 3) == 10
tn.set_fee(2, 1, imbalance_penalty=[(TA(0), FA(0)), (TA(2000), FA(200))])
assert tn.estimate_fee(1, 3) == 10 + 1
Copy link
Contributor

Choose a reason for hiding this comment

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

can you add a comment that + 1 is due to the iteration?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I wrote When approximation iterations matter, those are given as sums of the steps. in line 125. But apparently this is easily missed.

@codecov
Copy link

codecov bot commented Oct 4, 2019

Codecov Report

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

Impacted file tree graph

@@           Coverage Diff            @@
##             master    #565   +/-   ##
========================================
  Coverage          ?   90.7%           
========================================
  Files             ?      36           
  Lines             ?    2346           
  Branches          ?     297           
========================================
  Hits              ?    2128           
  Misses            ?     163           
  Partials          ?      55
Impacted Files Coverage Δ
src/pathfinding_service/model/channel.py 97.11% <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 f916ed9...4490d28. Read the comment docs.

@karlb karlb merged commit 4850def into raiden-network:master Oct 4, 2019
@karlb karlb deleted the iteration-in-fee branch October 4, 2019 12:05
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.

Add as many iterations into PFS imbalance fee calculation as we use in the Raiden client
2 participants