-
Notifications
You must be signed in to change notification settings - Fork 5k
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
Misleading error message: "Can not send value to non-payable contract method or constructor" #2488
Comments
This error message does not exist in the web3.js project the error message would be:
The difference between version beta.48 and beta.47 is just a fix for the custom provider handling and the return value handling of a contract call. I've tested it with a freshly deployed contract and called several methods without any error popping up. |
I can confirm this behavior. @gskapka did misread the test result. The error is in fact `Expected ${expErr} but got ${e.message} instead!` I tested with |
Oops! Hoisted by my own petard! Glad @OFRBG could confirm the behavioural difference however. The problem clarified:Receive |
Thanks for the additional details! I will fix and release it asap. |
Description
Receive
"Can not send value to non-payable contract method or constructor instead!"
error when calling a function that is definitelypayable
.Also, the error itself grammatically makes no sense.Also, the error itself makes no sense since the method is payable.Expected behavior
Shouldn't receive error about non-payable method or constructor if the method or constructor is payable.
Actual behavior
Returns above error.
Steps to reproduce the behavior
Works fine with
web3@1.0.0-beta.47
, but throws aforementioned error in...-beta.48
.Using the following solidity in order to query an offchain API using Provable (Oraclize):
And the following javascript to test that the
update()
function should fail if the contract's balance is zero (because Provable [Oraclize]) requires a fee):...results in the above error. Tests pass as expected with
beta47
but notbeta48
. Worse, the error message makes no sense since it's clear there is:methods.update().send(...params)
functionupdate()
method in the contract is payable.Error Logs
"Can not send value to non-payable contract method or constructor instead!"
Full Example
You can find the above Provable (Oraclize) example with Truffle tests in the repo here. Simply pull it, install its dependencies and then install
web3@1.0.0-beta.48
& follow theREADME
to run the tests.Versions
-beta.48
10.15.0
Ganache/TestRPC
The text was updated successfully, but these errors were encountered: