-
Notifications
You must be signed in to change notification settings - Fork 12k
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
SafeMath - failed assert reason. #1506
Comments
A) As a result, Adding error strings to SafeMath will considerably increase the size of contracts implementing it. I would avoid making such basic functions so heavy. I won't mind a separate |
I think libraries address is inlined in the contract using it. Implementing
reason will of course increase size of library and cost of its deployment,
but will not increase size of contract using this library.
Please correct me if I am wrong.
Nvertheless I think size argument is pretty important and it might be a
good reason no to implement this change. It would however help me in
debugging.
…On Tue, Nov 20, 2018, 00:00 Mudit Gupta ***@***.*** wrote:
A) internal functions of libraries are inlined in the implementing smart
contract.
B) Strings cannot be compressed and hence take a good chunk of allowed
bytecode size for deployment.
As a result, Adding error strings to SafeMath will considerably increase
the size of contracts implementing it. I would avoid making such basic
functions so heavy.
I won't mind a separate SafeMathWithReasonStrings library though. Just
don't add reason strings to the default one.
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#1506 (comment)>,
or mute the thread
<https://github.com/notifications/unsubscribe-auth/AhG5LSVIilGICw8vEXcXlPf2fMaF6GOnks5uw4xTgaJpZM4YqNVU>
.
|
Library address is used for As address cannot be compressed either, making SafeMath functions public will increase deployment cost as well as (more importantly) execution cost as everytime the contract will have to make an external call. As I said earlier, I won't mind a separate |
@maxsam4 is right in that Regarding |
I would like to propose changing SafeMath library to use require instead of assert and also describe the reason why require failed. It will make testing in truffle much easier.
For example current sub function is using assert.
We can change it to require and provide error description which will be then displayed truffle test.
The text was updated successfully, but these errors were encountered: