diff options
author | Alex Beregszaszi <alex@rtfs.hu> | 2017-06-15 04:03:32 +0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-06-15 04:03:32 +0800 |
commit | 42b61171d981ceccd5f79af5508db92b4f2ad54b (patch) | |
tree | 8ab6ee34bb8f15fa40e2509a8eda06f3d867d761 /libevmasm/GasMeter.cpp | |
parent | f008ddf83646f6002a61a123cc94ad195a35dce4 (diff) | |
parent | c20cdd0a0574c350b5cde7b38e87321479cecab3 (diff) | |
download | dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.gz dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.bz2 dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.lz dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.xz dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.tar.zst dexon-solidity-42b61171d981ceccd5f79af5508db92b4f2ad54b.zip |
Merge pull request #2192 from winsvega/develop
add STATICCALL instruction
Diffstat (limited to 'libevmasm/GasMeter.cpp')
-rw-r--r-- | libevmasm/GasMeter.cpp | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp index c2e4f01d..c96c6ca5 100644 --- a/libevmasm/GasMeter.cpp +++ b/libevmasm/GasMeter.cpp @@ -129,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. @@ -142,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); |