aboutsummaryrefslogtreecommitdiffstats
path: root/ExpressionCompiler.cpp
diff options
context:
space:
mode:
authorchriseth <c@ethdev.com>2015-03-06 23:23:39 +0800
committerchriseth <c@ethdev.com>2015-03-06 23:23:39 +0800
commit0e50ef1ee0b2ecec1596c1aba0809a843652da43 (patch)
tree08aa27cc3c926369b9a3e167ce42d9ac65bd375b /ExpressionCompiler.cpp
parent6fea41abd8db5b60c8c42d98db234c038e577a49 (diff)
downloaddexon-solidity-0e50ef1ee0b2ecec1596c1aba0809a843652da43.tar.gz
dexon-solidity-0e50ef1ee0b2ecec1596c1aba0809a843652da43.tar.zst
dexon-solidity-0e50ef1ee0b2ecec1596c1aba0809a843652da43.zip
Fixed gas calculation for CALL.
Diffstat (limited to 'ExpressionCompiler.cpp')
-rw-r--r--ExpressionCompiler.cpp5
1 files changed, 3 insertions, 2 deletions
diff --git a/ExpressionCompiler.cpp b/ExpressionCompiler.cpp
index 6b797887..3d7a2531 100644
--- a/ExpressionCompiler.cpp
+++ b/ExpressionCompiler.cpp
@@ -1052,8 +1052,9 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
if (_functionType.gasSet())
m_context << eth::dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
else
- // send all gas except for the 41 / 6741 needed to execute "SUB" and "CALL"
- m_context << u256(41 + (_functionType.valueSet() ? 6700 : 0)) << eth::Instruction::GAS << eth::Instruction::SUB;
+ // send all gas except the amount needed to execute "SUB" and "CALL"
+ // @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;
auto tag = m_context.appendConditionalJump();
m_context << eth::Instruction::STOP << tag; // STOP if CALL leaves 0.