Merge pull request #3863 from ethereum/fixGasEstimation

Correctly ignore costs of fallback for other functions.
This commit is contained in:
chriseth
2018-04-11 21:53:41 +02:00
committed by GitHub
3 changed files with 22 additions and 1 deletions
+13
View File
@@ -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()
}