aboutsummaryrefslogtreecommitdiffstats
path: root/libsolidity
diff options
context:
space:
mode:
authorchriseth <chris@ethereum.org>2016-09-06 17:13:31 +0800
committerGitHub <noreply@github.com>2016-09-06 17:13:31 +0800
commit114502f8adc39833427f4e16f27c4fac6e571cec (patch)
treeab6020c98c5bec6e590fb4074108078ebd0ee276 /libsolidity
parente2b787cdd0717bf074cc03634d580f7713568792 (diff)
parent69c175fe22fc876014ac7dcb7abc707be6dabb2c (diff)
downloaddexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.tar
dexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.tar.gz
dexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.tar.bz2
dexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.tar.lz
dexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.tar.xz
dexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.tar.zst
dexon-solidity-114502f8adc39833427f4e16f27c4fac6e571cec.zip
Merge pull request #1006 from ethereum/nenewaccountgas
Do not pay new account gas.
Diffstat (limited to 'libsolidity')
-rw-r--r--libsolidity/codegen/ExpressionCompiler.cpp4
1 files changed, 3 insertions, 1 deletions
diff --git a/libsolidity/codegen/ExpressionCompiler.cpp b/libsolidity/codegen/ExpressionCompiler.cpp
index 4a81e27d..7b6aa50a 100644
--- a/libsolidity/codegen/ExpressionCompiler.cpp
+++ b/libsolidity/codegen/ExpressionCompiler.cpp
@@ -1524,11 +1524,13 @@ void ExpressionCompiler::appendExternalFunctionCall(
m_context << u256(0);
m_context << dupInstruction(m_context.baseToCurrentStackOffset(contractStackPos));
+ bool existenceChecked = false;
// Check the the target contract exists (has code) for non-low-level calls.
if (funKind == FunctionKind::External || funKind == FunctionKind::CallCode || funKind == FunctionKind::DelegateCall)
{
m_context << Instruction::DUP1 << Instruction::EXTCODESIZE << Instruction::ISZERO;
m_context.appendConditionalJumpTo(m_context.errorTag());
+ existenceChecked = true;
}
if (_functionType.gasSet())
@@ -1540,7 +1542,7 @@ void ExpressionCompiler::appendExternalFunctionCall(
u256 gasNeededByCaller = eth::GasCosts::callGas + 10;
if (_functionType.valueSet())
gasNeededByCaller += eth::GasCosts::callValueTransferGas;
- if (!isCallCode && !isDelegateCall)
+ if (!isCallCode && !isDelegateCall && !existenceChecked)
gasNeededByCaller += eth::GasCosts::callNewAccountGas; // we never know
m_context <<
gasNeededByCaller <<