-
Notifications
You must be signed in to change notification settings - Fork 19
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
Fixe underflow uint256 sub #146
Conversation
|
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.
For the link_available_for_payment
fn, if the result is expected to be negative number in situations of contract debt, then there is no issue but this should be properly documented:
However, since the felt type in Cairo is not signed, whoever calls this function will have to interpret the result as the correct negative value.
@qperrot please add in-line docs to the function, and also the line where the subtraction happens so we explain what's expected here.
@@ -1001,6 +1002,11 @@ func withdraw_funds{syscall_ptr : felt*, pedersen_ptr : HashBuiltin*, range_chec | |||
) | |||
|
|||
let (link_due_uint256 : Uint256) = felt_to_uint256(link_due) | |||
let (res) = uint256_le(link_due_uint256, balance) | |||
with_attr error_message("Total amount due exceeds the 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.
We should prefix all error messages with contract/namespace like so:
with_attr error_message("Total amount due exceeds the balance"): | |
with_attr error_message("Aggregator: Total amount due exceeds the 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.
No need to do in this PR. I've created a separate issue for it: #156
No description provided.