aboutsummaryrefslogtreecommitdiffstats
path: root/docs
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-04 22:31:25 +0800
committerGitHub <noreply@github.com>2018-09-04 22:31:25 +0800
commitcc7daf7b476f498c4dcde7bdb342974097ffe9bf (patch)
tree707656e46a626f93bb24d45710ebda7ab31a013f /docs
parentd88e5039ccc768f810f7882aa1f9ae338bc27dd3 (diff)
parente3097b30dace9bbd88a5a74e6507baad0bc12cc4 (diff)
downloaddexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.tar
dexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.tar.gz
dexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.tar.bz2
dexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.tar.lz
dexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.tar.xz
dexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.tar.zst
dexon-solidity-cc7daf7b476f498c4dcde7bdb342974097ffe9bf.zip
Merge pull request #4829 from ethereum/callBytesReturn
Add return data to bare calls.
Diffstat (limited to 'docs')
-rw-r--r--docs/contracts.rst6
-rw-r--r--docs/security-considerations.rst3
2 files changed, 6 insertions, 3 deletions
diff --git a/docs/contracts.rst b/docs/contracts.rst
index 669a374f..8fd1c89e 100644
--- a/docs/contracts.rst
+++ b/docs/contracts.rst
@@ -406,7 +406,8 @@ inheritable properties of contracts and may be overridden by derived contracts.
/// The `return 7` statement assigns 7 to the return value but still
/// executes the statement `locked = false` in the modifier.
function f() public noReentrancy returns (uint) {
- require(msg.sender.call(""));
+ (bool success,) = msg.sender.call("");
+ require(success);
return 7;
}
}
@@ -645,7 +646,8 @@ Like any function, the fallback function can execute complex operations as long
contract Caller {
function callTest(Test test) public returns (bool) {
- require(address(test).call(abi.encodeWithSignature("nonExistingFunction()")));
+ (bool success,) = address(test).call(abi.encodeWithSignature("nonExistingFunction()"));
+ require(success);
// results in test.x becoming == 1.
// If someone sends ether to that contract,
diff --git a/docs/security-considerations.rst b/docs/security-considerations.rst
index 066a31ea..3bcd9566 100644
--- a/docs/security-considerations.rst
+++ b/docs/security-considerations.rst
@@ -86,7 +86,8 @@ as it uses ``call`` which forwards all remaining gas by default:
mapping(address => uint) shares;
/// Withdraw your share.
function withdraw() public {
- if (msg.sender.call.value(shares[msg.sender])(""))
+ (bool success,) = msg.sender.call.value(shares[msg.sender])("");
+ if (success)
shares[msg.sender] = 0;
}
}