mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Do not retain any gas in external calls (except if EVM version is set to homestead).
This commit is contained in:
parent
f190b27431
commit
83fcf007bf
@ -3,6 +3,7 @@
|
|||||||
Features:
|
Features:
|
||||||
* C99/C++-style scoping rules (instead of JavaScript function scoping) take effect as experimental v0.5.0 feature.
|
* C99/C++-style scoping rules (instead of JavaScript function scoping) take effect as experimental v0.5.0 feature.
|
||||||
* Code Generator: Assert that ``k != 0`` for ``molmod(a, b, k)`` and ``addmod(a, b, k)`` as experimental 0.5.0 feature.
|
* Code Generator: Assert that ``k != 0`` for ``molmod(a, b, k)`` and ``addmod(a, b, k)`` as experimental 0.5.0 feature.
|
||||||
|
* Code Generator: Do not retain any gas in calls (except if EVM version is set to homestead).
|
||||||
* Interface: Provide ability to select target EVM version (homestead or byzantium, with byzantium being the default).
|
* Interface: Provide ability to select target EVM version (homestead or byzantium, with byzantium being the default).
|
||||||
* Standard JSON: Reject badly formatted invalid JSON inputs.
|
* Standard JSON: Reject badly formatted invalid JSON inputs.
|
||||||
* Type Checker: Disallow uninitialized storage pointers as experimental 0.5.0 feature.
|
* Type Checker: Disallow uninitialized storage pointers as experimental 0.5.0 feature.
|
||||||
|
@ -1671,16 +1671,19 @@ void ExpressionCompiler::appendExternalFunctionCall(
|
|||||||
utils().storeFreeMemoryPointer();
|
utils().storeFreeMemoryPointer();
|
||||||
}
|
}
|
||||||
|
|
||||||
// Touch the end of the output area so that we do not pay for memory resize during the call
|
if (!m_context.evmVersion().canOverchargeGasForCall())
|
||||||
// (which we would have to subtract from the gas left)
|
|
||||||
// We could also just use MLOAD; POP right before the gas calculation, but the optimizer
|
|
||||||
// would remove that, so we use MSTORE here.
|
|
||||||
if (!_functionType.gasSet() && retSize > 0)
|
|
||||||
{
|
{
|
||||||
m_context << u256(0);
|
// Touch the end of the output area so that we do not pay for memory resize during the call
|
||||||
utils().fetchFreeMemoryPointer();
|
// (which we would have to subtract from the gas left)
|
||||||
// This touches too much, but that way we save some rounding arithmetics
|
// We could also just use MLOAD; POP right before the gas calculation, but the optimizer
|
||||||
m_context << u256(retSize) << Instruction::ADD << Instruction::MSTORE;
|
// would remove that, so we use MSTORE here.
|
||||||
|
if (!_functionType.gasSet() && retSize > 0)
|
||||||
|
{
|
||||||
|
m_context << u256(0);
|
||||||
|
utils().fetchFreeMemoryPointer();
|
||||||
|
// This touches too much, but that way we save some rounding arithmetics
|
||||||
|
m_context << u256(retSize) << Instruction::ADD << Instruction::MSTORE;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Copy function identifier to memory.
|
// Copy function identifier to memory.
|
||||||
@ -1749,7 +1752,7 @@ void ExpressionCompiler::appendExternalFunctionCall(
|
|||||||
|
|
||||||
if (_functionType.gasSet())
|
if (_functionType.gasSet())
|
||||||
m_context << dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
|
m_context << dupInstruction(m_context.baseToCurrentStackOffset(gasStackPos));
|
||||||
else if (m_context.experimentalFeatureActive(ExperimentalFeature::V050))
|
else if (m_context.evmVersion().canOverchargeGasForCall())
|
||||||
// Send all gas (requires tangerine whistle EVM)
|
// Send all gas (requires tangerine whistle EVM)
|
||||||
m_context << Instruction::GAS;
|
m_context << Instruction::GAS;
|
||||||
else
|
else
|
||||||
|
Loading…
Reference in New Issue
Block a user