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

function call with bytes parameters cannot pass the quicktest #25

Closed
mbrock opened this issue Jun 13, 2018 · 4 comments
Closed

function call with bytes parameters cannot pass the quicktest #25

mbrock opened this issue Jun 13, 2018 · 4 comments
Labels
bug Something isn't working

Comments

@mbrock
Copy link
Contributor

mbrock commented Jun 13, 2018

Issue by HackFisher
Thursday Nov 16, 2017 at 08:22 GMT
Originally opened as dapphub/dapp#65


Following code is in the solidity contract, where the "_data" is type of bytes.

receiver.call.value(0)(bytes4(keccak256(_custom_fallback)), msg.sender, _amount, _data);

Fail when running "dapp test" with tests run this code.

/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/bn.js/lib/bn.js:6
    if (!val) throw new Error(msg || 'Assertion failed');
              ^

Error: Number can only safely store up to 53 bits
    at assert (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/bn.js/lib/bn.js:6:21)
    at BN.toNumber (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/bn.js/lib/bn.js:506:7)
    at decodeSingle (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/ethereumjs-abi/lib/index.js:250:54)
    at Function.ABI.rawDecode (/Users/user/github.com/dapphub/dapp/libexec/dapp/node_modules/ethereumjs-abi/lib/index.js:367:14)
    at formatMethodCall (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:277:44)
    at formatTrace (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:292:152)
    at Array.forEach (<anonymous>)
    at failedTest.results.forEach.x (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:214:43)
    at Array.forEach (<anonymous>)
    at printFailure (/Users/user/github.com/dapphub/dapp/libexec/dapp/dapp-quicktest:214:22)
make: *** [test] Error 1
@mbrock mbrock added the bug Something isn't working label Jun 13, 2018
@mbrock
Copy link
Contributor Author

mbrock commented Jun 13, 2018

Comment by nmushegian
Sunday Nov 19, 2017 at 17:12 GMT


This might have to do with the way solidity interprets multiple data arguments in .call. If all your tools are up to date then you'll have to tell the solidity guys to add support for this, and then pack your calldata manually.

Can you give some more context?

@mbrock
Copy link
Contributor Author

mbrock commented Jun 13, 2018

Comment by dbrock
Friday Nov 24, 2017 at 03:09 GMT


Also you might want to try disabling ethrun using DAPP_NO_ETHRUN=1 dapp test to run the test using only hevm

@mbrock
Copy link
Contributor Author

mbrock commented Jun 13, 2018

Comment by HackFisher
Friday Nov 24, 2017 at 05:54 GMT


Here is one information might be helpful:

ATNIO/atn-contracts@e284911

In the above commit, we can see that if the bytes data is "", it do not work, but if we change it to "0x", it pass the test without above error.

@mbrock
Copy link
Contributor Author

mbrock commented Jun 13, 2018

Comment by dbrock
Saturday Nov 25, 2017 at 09:56 GMT


Could you please make a minimal test case demonstrating this problem?

That would make it much easier for us to know what is going on here.

In other words, make a new project and add as little code as possible to trigger this problem.

Thanks!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants