add chainid and selfbalance to lllc

This commit is contained in:
Dimitry
2019-09-09 23:35:36 +03:00
committed by Dimitry Kh
parent 6596837e45
commit fd3ae0b24a
10 changed files with 37 additions and 0 deletions
+2
View File
@@ -299,6 +299,8 @@ BOOST_AUTO_TEST_CASE(valid_opcodes_functional)
"(NUMBER)",
"(DIFFICULTY)",
"(GASLIMIT)",
"(CHAINID)",
"(SELFBALANCE)",
"(POP 0)",
"(MLOAD 0)",
"(MSTORE 0 0)",
@@ -180,6 +180,8 @@ u256 EVMInstructionInterpreter::eval(
return m_state.address;
case Instruction::BALANCE:
return m_state.balance;
case Instruction::SELFBALANCE:
return m_state.selfbalance;
case Instruction::ORIGIN:
return m_state.origin;
case Instruction::CALLER:
@@ -208,6 +210,8 @@ u256 EVMInstructionInterpreter::eval(
return 0;
case Instruction::GASPRICE:
return m_state.gasprice;
case Instruction::CHAINID:
return m_state.chainid;
case Instruction::EXTCODESIZE:
return u256(keccak256(h256(arg[0]))) & 0xffffff;
case Instruction::EXTCODEHASH:
+2
View File
@@ -70,6 +70,7 @@ struct InterpreterState
std::map<dev::h256, dev::h256> storage;
dev::u160 address = 0x11111111;
dev::u256 balance = 0x22222222;
dev::u256 selfbalance = 0x22223333;
dev::u160 origin = 0x33333333;
dev::u160 caller = 0x44444444;
dev::u256 callvalue = 0x55555555;
@@ -81,6 +82,7 @@ struct InterpreterState
dev::u256 blockNumber = 1024;
dev::u256 difficulty = 0x9999999;
dev::u256 gaslimit = 4000000;
dev::u256 chainid = 0x01;
/// Log of changes / effects. Sholud be structured data in the future.
std::vector<std::string> trace;
/// This is actually an input parameter that more or less limits the runtime.