Browse Source

Merge pull request #1546 from chriseth/sol_assumeContractNotCreated

Retain more gas for the case that the called contract is not yet created
cl-refactor
Gav Wood 10 years ago
parent
commit
31501e8306
  1. 2
      libsolidity/ExpressionCompiler.cpp
  2. 4
      test/SolidityEndToEndTest.cpp

2
libsolidity/ExpressionCompiler.cpp

@ -1054,7 +1054,7 @@ void ExpressionCompiler::appendExternalFunctionCall(FunctionType const& _functio
else
// 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 << u256(50 + (_functionType.valueSet() ? 9000 : 0) + 25000) << 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.

4
test/SolidityEndToEndTest.cpp

@ -1468,8 +1468,6 @@ BOOST_AUTO_TEST_CASE(sha3)
testSolidityAgainstCpp("a(bytes32)", f, u256(-1));
}
#ifdef PRECOMPILED_CONTRACTS_GAS_FIXED_IN_SOLIDITY
BOOST_AUTO_TEST_CASE(sha256)
{
char const* sourceCode = "contract test {\n"
@ -3685,5 +3683,3 @@ BOOST_AUTO_TEST_SUITE_END()
}
}
} // end namespaces
#endif

Loading…
Cancel
Save