mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
GasMeter can now account for gas of Keccak-256
This commit is contained in:
parent
1f5b874eaf
commit
dd6300a53e
@ -117,6 +117,9 @@ void GasMeterVisitor::instructionCostsInternal(evmasm::Instruction _instruction)
|
|||||||
{
|
{
|
||||||
if (_instruction == evmasm::Instruction::EXP)
|
if (_instruction == evmasm::Instruction::EXP)
|
||||||
m_runGas += evmasm::GasCosts::expGas + evmasm::GasCosts::expByteGas(m_dialect.evmVersion());
|
m_runGas += evmasm::GasCosts::expGas + evmasm::GasCosts::expByteGas(m_dialect.evmVersion());
|
||||||
|
else if (_instruction == evmasm::Instruction::KECCAK256)
|
||||||
|
// Assumes that Keccak-256 is computed on a single word (rounded up).
|
||||||
|
m_runGas += evmasm::GasCosts::keccak256Gas + evmasm::GasCosts::keccak256WordGas;
|
||||||
else
|
else
|
||||||
m_runGas += evmasm::GasMeter::runGas(_instruction);
|
m_runGas += evmasm::GasMeter::runGas(_instruction);
|
||||||
m_dataGas += singleByteDataGas();
|
m_dataGas += singleByteDataGas();
|
||||||
|
@ -36,6 +36,8 @@ struct EVMDialect;
|
|||||||
*
|
*
|
||||||
* Assumes that EXP is not used with exponents larger than a single byte.
|
* Assumes that EXP is not used with exponents larger than a single byte.
|
||||||
* Is not particularly exact for anything apart from arithmetic.
|
* Is not particularly exact for anything apart from arithmetic.
|
||||||
|
*
|
||||||
|
* Assumes that Keccak-256 is computed on a single word (rounded up).
|
||||||
*/
|
*/
|
||||||
class GasMeter
|
class GasMeter
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user