Skip to content
This repository has been archived by the owner on Oct 28, 2021. It is now read-only.

Commit

Permalink
Move "gas below stipend" check to the beginning of SSTORE instruction
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Sep 3, 2019
1 parent e1c073b commit d00a436
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions libevm/LegacyVM.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,9 @@ void LegacyVM::adjustStack(unsigned _removed, unsigned _added)

void LegacyVM::updateSSGas()
{
if (m_schedule->sstoreThrowsIfGasBelowCallStipend() && m_io_gas <= m_schedule->callStipend)
throwOutOfGas();

u256 const currentValue = m_ext->store(m_SP[0]);
u256 const newValue = m_SP[1];

Expand Down Expand Up @@ -1677,10 +1680,6 @@ void LegacyVM::interpretCases()
updateSSGas();
updateIOGas();

if (m_schedule->sstoreThrowsIfGasBelowCallStipend() &&
m_io_gas <= m_schedule->callStipend)
throwOutOfGas();

m_ext->setStore(m_SP[0], m_SP[1]);
}
NEXT
Expand Down

0 comments on commit d00a436

Please sign in to comment.