-
Notifications
You must be signed in to change notification settings - Fork 16
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
Fixed calculation of deposit_amount #249
Conversation
scenario_player/utils/token.py
Outdated
@@ -409,6 +414,6 @@ def deposit(self, target_address) -> Union[str, None]: | |||
return | |||
|
|||
log.debug("deposit call required - insufficient funds") | |||
deposit_amount = max_funding - balance | |||
deposit_amount = total_deposit + max(max_funding, min_deposit) - balance |
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.
max()
should not be necessary here - there should be a checksuggestion
in this class instead, that ensures that max_funding >= balance_per_node
when loading the scenario yaml.
Otherwise, this would silently use a value that may not be expected by the user.
def validate(self):
self.assert_option(self.max_funding < self.balance_per_node, "max_funding must be >= balance_per_node value!")
I trust you can write a test for that just fine. ;P
That would've taken me days to figure out - good catch! Just a small change required, then we're good to merge this. |
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.
Some leftovers, then you're good.
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.
Geht doch! >:D
Since jacobs scenario is the first one to use
balance_per_node
We never tested the calculation for depositing more tokens.
Since the UDC contract requires a deposit greater than the total_deposit
I needed to change the calculation of the amount that needs to be deposited
This is a fix for Issue #238