mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Added fallback function to gas estimation and fixed mix gas estimation.
Fixes #2156
This commit is contained in:
parent
f9bbe3279e
commit
ffb7d94035
@ -273,6 +273,11 @@ void CommandLineInterface::handleGasEstimation(string const& _contract)
|
|||||||
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, sig);
|
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, sig);
|
||||||
cout << " " << sig << ":\t" << gas << endl;
|
cout << " " << sig << ":\t" << gas << endl;
|
||||||
}
|
}
|
||||||
|
if (contract.getFallbackFunction())
|
||||||
|
{
|
||||||
|
GasEstimator::GasConsumption gas = GasEstimator::functionalEstimation(*items, "INVALID");
|
||||||
|
cout << " fallback:\t" << gas << endl;
|
||||||
|
}
|
||||||
cout << "internal:" << endl;
|
cout << "internal:" << endl;
|
||||||
for (auto const& it: contract.getDefinedFunctions())
|
for (auto const& it: contract.getDefinedFunctions())
|
||||||
{
|
{
|
||||||
|
@ -91,6 +91,8 @@ Json::Value estimateGas(CompilerStack const& _compiler, string const& _contract)
|
|||||||
string sig = it.second->externalSignature();
|
string sig = it.second->externalSignature();
|
||||||
externalFunctions[sig] = gasToJson(GasEstimator::functionalEstimation(*items, sig));
|
externalFunctions[sig] = gasToJson(GasEstimator::functionalEstimation(*items, sig));
|
||||||
}
|
}
|
||||||
|
if (contract.getFallbackFunction())
|
||||||
|
externalFunctions[""] = gasToJson(GasEstimator::functionalEstimation(*items, "INVALID"));
|
||||||
gasEstimates["external"] = externalFunctions;
|
gasEstimates["external"] = externalFunctions;
|
||||||
Json::Value internalFunctions(Json::objectValue);
|
Json::Value internalFunctions(Json::objectValue);
|
||||||
for (auto const& it: contract.getDefinedFunctions())
|
for (auto const& it: contract.getDefinedFunctions())
|
||||||
|
Loading…
Reference in New Issue
Block a user