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

Ensure addr.call.value() is invoked #697

Closed
aakilfernandes opened this issue Jul 1, 2016 · 7 comments
Closed

Ensure addr.call.value() is invoked #697

aakilfernandes opened this issue Jul 1, 2016 · 7 comments

Comments

@aakilfernandes
Copy link

aakilfernandes commented Jul 1, 2016

contract Test {
function Test(){
msg.sender.call.value(0);
msg.sender.call.value(0)();
}
}

My understanding is the first call doesn't actually do anything. If so, it shouldn't compile

@chriseth
Copy link
Contributor

chriseth commented Jul 5, 2016

Are you recommending a warning? It is not a compiler error, because you could do things like:

contract Test {
  function test() {
    var x = msg.sender.call.value(0);
    x();
  }
}

@redsquirrel
Copy link
Contributor

I think this would be a good place for a warning, since we're ignoring a return value from a low-level function. Related: #677

@aakilfernandes
Copy link
Author

@chriseth didn't realize you could store it as a variable. I think a warning would be apt.

@chriseth chriseth added this to the 2-non-breaking-saftey-changes milestone Aug 11, 2016
@axic
Copy link
Member

axic commented Sep 6, 2016

Is it useful storing it is a variable, though?

@chriseth
Copy link
Contributor

chriseth commented Sep 7, 2016

@axic Solidity should not impose artificial restrictions. It is useful to store functions in variables and the ether amount and gas sent together with a function is part of it.

@axic
Copy link
Member

axic commented Sep 30, 2016

So if msg.sender.call.value(0) is not assigned to a variable and is not executed, then the compiler should emit a warning.

@chriseth chriseth added the soon label Oct 4, 2016
@chriseth chriseth removed this from the 2-non-breaking-saftey-changes milestone Jul 2, 2018
@chriseth chriseth removed the soonish label Jul 2, 2018
@chriseth
Copy link
Contributor

I don't think this is an issue anymore with the new syntax.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants