Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions libevmasm/GasMeter.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -223,6 +223,10 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _
break;
case Instruction::NATIVEVOTE:
gas = GasCosts::voteGas;
// NATIVEVOTE reads two memory ranges (see SemanticInformation::readWriteOperations).
// With args == 4, the ranges are (offset, size) = (-3, -2) and (-1, 0) on the stack.
gas += memoryGas(-3, -2);
gas += memoryGas(-1, 0);
break;
case Instruction::NATIVEWITHDRAWREWARD:
gas = GasCosts::withdrawGas;
Expand All @@ -231,9 +235,12 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _
case Instruction::NATIVEUNFREEZEBALANCEV2:
case Instruction::NATIVECANCELALLUNFREEZEV2:
case Instruction::NATIVEWITHDRAWEXPIREUNFREEZE:
gas = GasCosts::freezeV2Gas;
break;
case Instruction::NATIVEDELEGATERESOURCE:
case Instruction::NATIVEUNDELEGATERESOURCE:
gas = GasCosts::freezeV2Gas;
gas += GasCosts::callNewAccountGas; // Delegating to a non-existent address may create a new account.
break;
case Instruction::CHAINID:
gas = runGas(Instruction::CHAINID, m_evmVersion);
Expand Down