Added fallback function to gas estimation and fixed mix gas estimation.

Fixes #2156
This commit is contained in:
chriseth 2015-06-18 17:38:26 +02:00
parent f9bbe3279e
commit ffb7d94035
2 changed files with 7 additions and 0 deletions

View File

@ -273,6 +273,11 @@ void CommandLineInterface::handleGasEstimation(string const& _contract)
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, sig);
cout << " " << sig << ":\t" << gas << endl;
}
if (contract.getFallbackFunction())
{
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, "INVALID");
cout << " fallback:\t" << gas << endl;
}
cout << "internal:" << endl;
for (auto const& it: contract.getDefinedFunctions())
{

View File

@ -91,6 +91,8 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
string sig = it.second->externalSignature();
externalFunctions[sig] = gasToJson(GasEstimator::functionalEstimation(*items, sig));
}
if (contract.getFallbackFunction())
externalFunctions[""] = gasToJson(GasEstimator::functionalEstimation(*items, "INVALID"));
gasEstimates["external"] = externalFunctions;
Json::Value internalFunctions(Json::objectValue);
for (auto const& it: contract.getDefinedFunctions())