mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Fixed gas calculation for CALL.
This commit is contained in:
parent
6fea41abd8
commit
0e50ef1ee0
@ -1052,8 +1052,9 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
|
|||||||
if (_functionType.gasSet())
|
if (_functionType.gasSet())
|
||||||
m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
|
m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
|
||||||
else
|
else
|
||||||
// send all gas except for the 41 / 6741 needed to execute "SUB" and "CALL"
|
// send all gas except the amount needed to execute "SUB" and "CALL"
|
||||||
m_context << u256(41 + (_functionType.valueSet() ? 6700 : 0)) << eth::Instruction::GAS << eth::Instruction::SUB;
|
// @todo this retains too much gas for now, needs to be fine-tuned.
|
||||||
|
m_context << u256(50 + (_functionType.valueSet() ? 9000 : 0)) << eth::Instruction::GAS << eth::Instruction::SUB;
|
||||||
m_context << eth::Instruction::CALL;
|
m_context << eth::Instruction::CALL;
|
||||||
auto tag = m_context.appendConditionalJump();
|
auto tag = m_context.appendConditionalJump();
|
||||||
m_context << eth::Instruction::STOP << tag; // STOP if CALL leaves 0.
|
m_context << eth::Instruction::STOP << tag; // STOP if CALL leaves 0.
|
||||||
|
Loading…
Reference in New Issue
Block a user