GasMeter can now account for gas of Keccak-256

This commit is contained in:
hrkrshnn
2021-04-22 17:27:57 +02:00
parent 1f5b874eaf
commit dd6300a53e
2 changed files with 5 additions and 0 deletions
+3
View File
@@ -117,6 +117,9 @@ void GasMeterVisitor::instructionCostsInternal(evmasm::Instruction _instruction)
{
if (_instruction == evmasm::Instruction::EXP)
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
m_runGas += evmasm::GasMeter::runGas(_instruction);
m_dataGas += singleByteDataGas();
+2
View File
@@ -36,6 +36,8 @@ struct EVMDialect;
*
* Assumes that EXP is not used with exponents larger than a single byte.
* Is not particularly exact for anything apart from arithmetic.
*
* Assumes that Keccak-256 is computed on a single word (rounded up).
*/
class GasMeter
{