aboutsummaryrefslogtreecommitdiffstats
path: root/test/libsolidity/SolidityEndToEndTest.cpp
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-09-05 16:32:10 +0800
committerGitHub <noreply@github.com>2018-09-05 16:32:10 +0800
commita996ea266c4542b37503c1d2261a17f3d5a55dbb (patch)
treec270b6634ff1bb1814ab5524e05ef841610007a4 /test/libsolidity/SolidityEndToEndTest.cpp
parente6aa15bae1839ce6761c75521e0166c06469dc2e (diff)
parentde9f566a7cda48a8a23f91be380e8cd917ecaf34 (diff)
downloaddexon-solidity-a996ea266c4542b37503c1d2261a17f3d5a55dbb.tar.gz
dexon-solidity-a996ea266c4542b37503c1d2261a17f3d5a55dbb.tar.zst
dexon-solidity-a996ea266c4542b37503c1d2261a17f3d5a55dbb.zip
Merge pull request #4590 from ethereum/msgValueModifier
Warn if modifier uses msg.value in non-payable function
Diffstat (limited to 'test/libsolidity/SolidityEndToEndTest.cpp')
-rw-r--r--test/libsolidity/SolidityEndToEndTest.cpp10
1 files changed, 10 insertions, 0 deletions
diff --git a/test/libsolidity/SolidityEndToEndTest.cpp b/test/libsolidity/SolidityEndToEndTest.cpp
index 63067b3c..85582ece 100644
--- a/test/libsolidity/SolidityEndToEndTest.cpp
+++ b/test/libsolidity/SolidityEndToEndTest.cpp
@@ -10537,11 +10537,18 @@ BOOST_AUTO_TEST_CASE(non_payable_throw)
contract C {
uint public a;
function f() public returns (uint) {
+ return msgvalue();
+ }
+ function msgvalue() internal returns (uint) {
return msg.value;
}
function() external {
+ update();
+ }
+ function update() internal {
a = msg.value + 1;
}
+
}
)";
compileAndRun(sourceCode, 0, "C");
@@ -10564,6 +10571,9 @@ BOOST_AUTO_TEST_CASE(no_nonpayable_circumvention_by_modifier)
if (false) _; // avoid the function, we should still not accept ether
}
function f() tryCircumvent public returns (uint) {
+ return msgvalue();
+ }
+ function msgvalue() internal returns (uint) {
return msg.value;
}
}