Merge pull request #1546 from chriseth/sol_assumeContractNotCreated

Retain more gas for the case that the called contract is not yet created
This commit is contained in:
Gav Wood 2015-04-08 22:45:13 +02:00
commit e1b20fb3a1

View File

@ -1054,7 +1054,7 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
else else
// send all gas except the amount needed to execute "SUB" and "CALL" // 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. // @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 << u256(50 + (_functionType.valueSet() ? 9000 : 0) + 25000) << 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.