diff options
author | chriseth <chris@ethereum.org> | 2016-09-06 21:37:05 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2016-09-06 21:37:05 +0800 |
commit | 5ade1bc20facd81f651548589a5e49ccfc71f14e (patch) | |
tree | 4ab9fa9f7133e558f425b993ac433048b61af4cd /test | |
parent | afca2acb779746fc3ee12391137a133cbcec8d3b (diff) | |
parent | 9ca7472089a9f4d8bfec20e9e55c4f7ed2fb502e (diff) | |
download | dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.tar dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.tar.gz dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.tar.bz2 dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.tar.lz dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.tar.xz dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.tar.zst dexon-solidity-5ade1bc20facd81f651548589a5e49ccfc71f14e.zip |
Merge pull request #1008 from ethereum/stipendwithsend
Provide gas stipend manually for send(0).
Diffstat (limited to 'test')
-rw-r--r-- | test/libsolidity/SolidityEndToEndTest.cpp | 20 |
1 files changed, 20 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp index 1ecd7a2c..3c85d8a8 100644 --- a/test/libsolidity/SolidityEndToEndTest.cpp +++ b/test/libsolidity/SolidityEndToEndTest.cpp @@ -4625,6 +4625,26 @@ BOOST_AUTO_TEST_CASE(failing_send) BOOST_REQUIRE(callContractFunction("callHelper(address)", c_helperAddress) == encodeArgs(true, 20)); } +BOOST_AUTO_TEST_CASE(send_zero_ether) +{ + // Sending zero ether to a contract should still invoke the fallback function + // (it previously did not because the gas stipend was not provided by the EVM) + char const* sourceCode = R"( + contract Receiver { + function () payable { + } + } + contract Main { + function s() returns (bool) { + var r = new Receiver(); + return r.send(0); + } + } + )"; + compileAndRun(sourceCode, 20, "Main"); + BOOST_REQUIRE(callContractFunction("s()") == encodeArgs(true)); +} + BOOST_AUTO_TEST_CASE(reusing_memory) { // Invoke some features that use memory and test that they do not interfere with each other. |