mirror of
https://github.com/ethereum/go-ethereum.git
synced 2026-07-21 20:26:41 +00:00
Renames & comments
This commit is contained in:
parent
ad43b92d97
commit
d6915b4d0b
1 changed files with 7 additions and 8 deletions
|
|
@ -49,7 +49,7 @@ uint64_t getStepCost(dev::eth::Instruction inst) // TODO: Add this function to F
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
bool isCommitTrigger(Instruction _inst)
|
bool isCostBlockEnd(Instruction _inst)
|
||||||
{
|
{
|
||||||
switch (_inst)
|
switch (_inst)
|
||||||
{
|
{
|
||||||
|
|
@ -101,17 +101,16 @@ void GasMeter::check(Instruction _inst)
|
||||||
{
|
{
|
||||||
if (!m_checkCall)
|
if (!m_checkCall)
|
||||||
{
|
{
|
||||||
|
// Create gas check call with mocked block cost at begining of current cost-block
|
||||||
m_checkCall = m_builder.CreateCall(m_gasCheckFunc, m_builder.getIntN(256, 0));
|
m_checkCall = m_builder.CreateCall(m_gasCheckFunc, m_builder.getIntN(256, 0));
|
||||||
}
|
}
|
||||||
|
|
||||||
auto stepCost = getStepCost(_inst);
|
m_blockCost += getStepCost(_inst);
|
||||||
m_blockCost += stepCost;
|
|
||||||
|
|
||||||
auto isTrigger = isCommitTrigger(_inst);
|
if (isCostBlockEnd(_inst))
|
||||||
if (isTrigger)
|
{
|
||||||
{
|
m_checkCall->setArgOperand(0, m_builder.getIntN(256, m_blockCost)); // Update block cost in gas check call
|
||||||
m_checkCall->setArgOperand(0, m_builder.getIntN(256, m_blockCost));
|
m_checkCall = nullptr; // End cost-block
|
||||||
m_checkCall = nullptr;
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue