aboutsummaryrefslogtreecommitdiffstats
path: root/libevmasm/GasMeter.cpp
diff options
context:
space:
mode:
authorDimitry <winsvega@mail.ru>2017-06-08 22:44:03 +0800
committerchriseth <chris@ethereum.org>2017-06-15 00:18:12 +0800
commitc20cdd0a0574c350b5cde7b38e87321479cecab3 (patch)
tree5e7bc76cba1ec47124eb3bba453a2c994c0d766a /libevmasm/GasMeter.cpp
parentd693822a6fce5d1c853e50f4c7758bc003542644 (diff)
downloaddexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.tar
dexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.tar.gz
dexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.tar.bz2
dexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.tar.lz
dexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.tar.xz
dexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.tar.zst
dexon-solidity-c20cdd0a0574c350b5cde7b38e87321479cecab3.zip
add new opcode instructions to the parser
STATICCALL 0xfa 6 inputs (gas address mem1 mem2 mem3 mem4)
Diffstat (limited to 'libevmasm/GasMeter.cpp')
-rw-r--r--libevmasm/GasMeter.cpp7
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);