diff options
author | chriseth <chris@ethereum.org> | 2017-07-03 20:52:29 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-07-03 20:52:29 +0800 |
commit | 76d3b7c5a160e1f550c710e6850ee6f116142ca1 (patch) | |
tree | 93c96f7073617b4f56c8c355cdc30701aec4818b /libevmasm/GasMeter.cpp | |
parent | 78969364608ba60d1654f4d1738886d13112b6cd (diff) | |
parent | 2222ddecf49b5b901f63b9e7449ee76c9f51c47a (diff) | |
download | dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.tar dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.tar.gz dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.tar.bz2 dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.tar.lz dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.tar.xz dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.tar.zst dexon-solidity-76d3b7c5a160e1f550c710e6850ee6f116142ca1.zip |
Merge pull request #2510 from ethereum/develop
Version 0.4.12
Diffstat (limited to 'libevmasm/GasMeter.cpp')
-rw-r--r-- | libevmasm/GasMeter.cpp | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp index f5fd00ea..c96c6ca5 100644 --- a/libevmasm/GasMeter.cpp +++ b/libevmasm/GasMeter.cpp @@ -96,13 +96,14 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _ classes.find(AssemblyItem(1)) })); break; - case Instruction::SHA3: - gas = GasCosts::sha3Gas; - gas += wordGas(GasCosts::sha3WordGas, m_state->relativeStackElement(-1)); + case Instruction::KECCAK256: + gas = GasCosts::keccak256Gas; + gas += wordGas(GasCosts::keccak256WordGas, m_state->relativeStackElement(-1)); gas += memoryGas(0, -1); break; case Instruction::CALLDATACOPY: case Instruction::CODECOPY: + case Instruction::RETURNDATACOPY: gas += memoryGas(0, -2); gas += wordGas(GasCosts::copyGas, m_state->relativeStackElement(-2)); break; @@ -128,6 +129,7 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _ case Instruction::CALL: case Instruction::CALLCODE: case Instruction::DELEGATECALL: + case Instruction::STATICCALL: { if (_includeExternalCosts) // We assume that we do not know the target contract and thus, the consumption is infinite. @@ -141,8 +143,10 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _ gas = GasConsumption::infinite(); if (_item.instruction() == Instruction::CALL) gas += GasCosts::callNewAccountGas; // We very rarely know whether the address exists. - int valueSize = _item.instruction() == Instruction::DELEGATECALL ? 0 : 1; - if (!classes.knownZero(m_state->relativeStackElement(-1 - valueSize))) + int valueSize = 1; + if (_item.instruction() == Instruction::DELEGATECALL || _item.instruction() == Instruction::STATICCALL) + valueSize = 0; + else if (!classes.knownZero(m_state->relativeStackElement(-1 - valueSize))) gas += GasCosts::callValueTransferGas; gas += memoryGas(-2 - valueSize, -3 - valueSize); gas += memoryGas(-4 - valueSize, -5 - valueSize); @@ -154,6 +158,7 @@ GasMeter::GasConsumption GasMeter::estimateMax(AssemblyItem const& _item, bool _ gas += GasCosts::callNewAccountGas; // We very rarely know whether the address exists. break; case Instruction::CREATE: + case Instruction::CREATE2: if (_includeExternalCosts) // We assume that we do not know the target contract and thus, the consumption is infinite. gas = GasConsumption::infinite(); |