mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Add PathGasMeter.estimateMax helper
This commit is contained in:
parent
9be058eb70
commit
d64be90497
@ -57,6 +57,16 @@ public:
|
|||||||
|
|
||||||
GasMeter::GasConsumption estimateMax(size_t _startIndex, std::shared_ptr<KnownState> const& _state);
|
GasMeter::GasConsumption estimateMax(size_t _startIndex, std::shared_ptr<KnownState> const& _state);
|
||||||
|
|
||||||
|
static GasMeter::GasConsumption estimateMax(
|
||||||
|
AssemblyItems const& _items,
|
||||||
|
solidity::EVMVersion _evmVersion,
|
||||||
|
size_t _startIndex,
|
||||||
|
std::shared_ptr<KnownState> const& _state
|
||||||
|
)
|
||||||
|
{
|
||||||
|
return PathGasMeter(_items, _evmVersion).estimateMax(_startIndex, _state);
|
||||||
|
}
|
||||||
|
|
||||||
private:
|
private:
|
||||||
/// Adds a new path item to the queue, but only if we do not already have
|
/// Adds a new path item to the queue, but only if we do not already have
|
||||||
/// a higher gas usage at that point.
|
/// a higher gas usage at that point.
|
||||||
|
@ -160,8 +160,7 @@ GasEstimator::GasConsumption GasEstimator::functionalEstimation(
|
|||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
PathGasMeter meter(_items, m_evmVersion);
|
return PathGasMeter::estimateMax(_items, m_evmVersion, 0, state);
|
||||||
return meter.estimateMax(0, state);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
GasEstimator::GasConsumption GasEstimator::functionalEstimation(
|
GasEstimator::GasConsumption GasEstimator::functionalEstimation(
|
||||||
@ -183,7 +182,7 @@ GasEstimator::GasConsumption GasEstimator::functionalEstimation(
|
|||||||
if (parametersSize > 0)
|
if (parametersSize > 0)
|
||||||
state->feedItem(swapInstruction(parametersSize));
|
state->feedItem(swapInstruction(parametersSize));
|
||||||
|
|
||||||
return PathGasMeter(_items, m_evmVersion).estimateMax(_offset, state);
|
return PathGasMeter::estimateMax(_items, m_evmVersion, _offset, state);
|
||||||
}
|
}
|
||||||
|
|
||||||
set<ASTNode const*> GasEstimator::finestNodesAtLocation(
|
set<ASTNode const*> GasEstimator::finestNodesAtLocation(
|
||||||
|
Loading…
Reference in New Issue
Block a user