aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorYoichi Hirai <i@yoichihirai.com>2017-01-16 21:43:44 +0800
committerchriseth <chris@ethereum.org>2017-04-25 22:14:58 +0800
commitf2775f82d02336ef8ec64ec391e8433448b2afd8 (patch)
tree0d3127ad132e008fdb90e414adf8f92eea123e00
parent7da9ba68e9540314c6b51c119a14f3afde02a385 (diff)
downloaddexon-solidity-f2775f82d02336ef8ec64ec391e8433448b2afd8.tar.gz
dexon-solidity-f2775f82d02336ef8ec64ec391e8433448b2afd8.tar.zst
dexon-solidity-f2775f82d02336ef8ec64ec391e8433448b2afd8.zip
libevmadm: EIP150.a changes on EXTCODE, EXTCODESIZE and BALANCE
-rw-r--r--libevmasm/GasMeter.cpp2
-rw-r--r--libevmasm/GasMeter.h2
-rw-r--r--libevmasm/Instruction.cpp6
-rw-r--r--libevmasm/Instruction.h2
4 files changed, 9 insertions, 3 deletions
diff --git a/libevmasm/GasMeter.cpp b/libevmasm/GasMeter.cpp
index a0adc35d..5cb25a22 100644
--- a/libevmasm/GasMeter.cpp
+++ b/libevmasm/GasMeter.cpp
@@ -232,6 +232,8 @@ unsigned GasMeter::runGas(Instruction _instruction)
case Tier::High: return GasCosts::tier5Gas;
case Tier::Ext: return GasCosts::tier6Gas;
case Tier::Special: return GasCosts::tier7Gas;
+ case Tier::ExtCode: return GasCosts::extCodeGas;
+ case Tier::Balance: return GasCosts::balanceGas;
default: break;
}
assertThrow(false, OptimizerException, "Invalid gas tier.");
diff --git a/libevmasm/GasMeter.h b/libevmasm/GasMeter.h
index 8ade838a..7c6a04ce 100644
--- a/libevmasm/GasMeter.h
+++ b/libevmasm/GasMeter.h
@@ -44,6 +44,8 @@ namespace GasCosts
static unsigned const tier5Gas = 10;
static unsigned const tier6Gas = 20;
static unsigned const tier7Gas = 0;
+ static unsigned const extCodeGas = 700;
+ static unsigned const balanceGas = 400;
static unsigned const expGas = 10;
static unsigned const expByteGas = 10;
static unsigned const sha3Gas = 30;
diff --git a/libevmasm/Instruction.cpp b/libevmasm/Instruction.cpp
index de6630f3..87bdb643 100644
--- a/libevmasm/Instruction.cpp
+++ b/libevmasm/Instruction.cpp
@@ -191,7 +191,7 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ Instruction::SIGNEXTEND, { "SIGNEXTEND", 0, 2, 1, false, Tier::Low } },
{ Instruction::SHA3, { "SHA3", 0, 2, 1, false, Tier::Special } },
{ Instruction::ADDRESS, { "ADDRESS", 0, 0, 1, false, Tier::Base } },
- { Instruction::BALANCE, { "BALANCE", 0, 1, 1, false, Tier::Ext } },
+ { Instruction::BALANCE, { "BALANCE", 0, 1, 1, false, Tier::Balance } },
{ Instruction::ORIGIN, { "ORIGIN", 0, 0, 1, false, Tier::Base } },
{ Instruction::CALLER, { "CALLER", 0, 0, 1, false, Tier::Base } },
{ Instruction::CALLVALUE, { "CALLVALUE", 0, 0, 1, false, Tier::Base } },
@@ -201,8 +201,8 @@ static const std::map<Instruction, InstructionInfo> c_instructionInfo =
{ Instruction::CODESIZE, { "CODESIZE", 0, 0, 1, false, Tier::Base } },
{ Instruction::CODECOPY, { "CODECOPY", 0, 3, 0, true, Tier::VeryLow } },
{ Instruction::GASPRICE, { "GASPRICE", 0, 0, 1, false, Tier::Base } },
- { Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false, Tier::Ext } },
- { Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true, Tier::Ext } },
+ { Instruction::EXTCODESIZE, { "EXTCODESIZE", 0, 1, 1, false, Tier::ExtCode } },
+ { Instruction::EXTCODECOPY, { "EXTCODECOPY", 0, 4, 0, true, Tier::ExtCode } },
{ Instruction::BLOCKHASH, { "BLOCKHASH", 0, 1, 1, false, Tier::Ext } },
{ Instruction::COINBASE, { "COINBASE", 0, 0, 1, false, Tier::Base } },
{ Instruction::TIMESTAMP, { "TIMESTAMP", 0, 0, 1, false, Tier::Base } },
diff --git a/libevmasm/Instruction.h b/libevmasm/Instruction.h
index d79ec969..192fe090 100644
--- a/libevmasm/Instruction.h
+++ b/libevmasm/Instruction.h
@@ -237,6 +237,8 @@ enum class Tier : unsigned
Mid, // 8, Mid
High, // 10, Slow
Ext, // 20, Ext
+ ExtCode, // 700, Extcode
+ Balance, // 400, Balance
Special, // multiparam or otherwise special
Invalid // Invalid.
};