From 928ce088456987431143262dcde2d02553b68192 Mon Sep 17 00:00:00 2001 From: chriseth Date: Wed, 11 Apr 2018 18:30:20 +0200 Subject: Correctly ignore costs of fallback for other functions. --- test/libsolidity/GasMeter.cpp | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'test') 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{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{encodeArgs()}); +} BOOST_AUTO_TEST_SUITE_END() } -- cgit v1.2.3