Skip to content
This repository was archived by the owner on Oct 4, 2019. It is now read-only.
Open
Changes from 1 commit
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
17 changes: 11 additions & 6 deletions libevm/VMCalls.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -153,15 +153,20 @@ bool VM::caseCallSetup(CallParameters *callParams)
updateIOGas();

// "Static" costs already applied. Calculate call gas.
u256 requestedCallGas = *m_sp;
u256 maxAllowedCallGas = *m_io_gas - *m_io_gas / 64;
u256 callGas = m_schedule->staticCallDepthLimit() ? requestedCallGas :
std::min(requestedCallGas, maxAllowedCallGas);
m_runGas = toUint64(callGas);
if (m_schedule->staticCallDepthLimit())
// With static call depth limit we just charge the provided gas amount.
callParams->gas = *m_sp;
else
{
// Apply "all but one 64th" rule.
u256 maxAllowedCallGas = *m_io_gas - *m_io_gas / 64;
callParams->gas = std::min(*m_sp, maxAllowedCallGas);
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what is the "all but one 64th" rule?

m_runGas = toUint64(callParams->gas);
onOperation();
updateIOGas();

callParams->gas = callGas;
if (m_op != Instruction::DELEGATECALL && *(m_sp - 2) > 0)
callParams->gas += m_schedule->callStipend;
--m_sp;
Expand Down