aboutsummaryrefslogtreecommitdiffstats
path: root/test
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2018-04-12 03:53:41 +0800
committerGitHub <noreply@github.com>2018-04-12 03:53:41 +0800
commitae3fca6db21e78ff8859a03929983570fe98570e (patch)
tree23780e2564b06c09394d39efc1e838898b5420e6 /test
parent8d355df14c0acd8846162790536b8d9992617d3c (diff)
parent928ce088456987431143262dcde2d02553b68192 (diff)
downloaddexon-solidity-ae3fca6db21e78ff8859a03929983570fe98570e.tar.gz
dexon-solidity-ae3fca6db21e78ff8859a03929983570fe98570e.tar.zst
dexon-solidity-ae3fca6db21e78ff8859a03929983570fe98570e.zip
Merge pull request #3863 from ethereum/fixGasEstimation
Correctly ignore costs of fallback for other functions.
Diffstat (limited to 'test')
-rw-r--r--test/libsolidity/GasMeter.cpp13
1 files changed, 13 insertions, 0 deletions
diff --git a/test/libsolidity/GasMeter.cpp b/test/libsolidity/GasMeter.cpp
index fd2017f9..0d66456c 100644
--- a/test/libsolidity/GasMeter.cpp
+++ b/test/libsolidity/GasMeter.cpp
@@ -294,6 +294,19 @@ BOOST_AUTO_TEST_CASE(extcodesize_gas)
testRunTimeGas("f()", vector<bytes>{encodeArgs()});
}
+BOOST_AUTO_TEST_CASE(regular_functions_exclude_fallback)
+{
+ // A bug in the estimator caused the costs for a specific function
+ // to always include the costs for the fallback.
+ char const* sourceCode = R"(
+ contract A {
+ uint public x;
+ function() { x = 2; }
+ }
+ )";
+ testCreationTimeGas(sourceCode);
+ testRunTimeGas("x()", vector<bytes>{encodeArgs()});
+}
BOOST_AUTO_TEST_SUITE_END()
}