Make msize constant in yul interpreter.

This commit is contained in:
chriseth 2019-05-23 17:22:25 +02:00
parent 195a7ff61a
commit afa81ec562
3 changed files with 2 additions and 7 deletions

View File

@ -19,4 +19,4 @@
// Memory dump: // Memory dump:
// 0: 0001000000000000000000000000000000000000000000000000000000000000 // 0: 0001000000000000000000000000000000000000000000000000000000000000
// Storage dump: // Storage dump:
// 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000002 // 0000000000000000000000000000000000000000000000000000000000000000: 0000000000000000000000000000000000000000000000000000000000000001

View File

@ -284,7 +284,7 @@ u256 EVMInstructionInterpreter::eval(
case Instruction::PC: case Instruction::PC:
return 0x77; return 0x77;
case Instruction::MSIZE: case Instruction::MSIZE:
return m_state.msize; return 569;
case Instruction::GAS: case Instruction::GAS:
return 0x99; return 0x99;
case Instruction::LOG0: case Instruction::LOG0:
@ -468,7 +468,6 @@ bool EVMInstructionInterpreter::accessMemory(u256 const& _offset, u256 const& _s
if (((_offset + _size) >= _offset) && ((_offset + _size + 0x1f) >= (_offset + _size))) if (((_offset + _size) >= _offset) && ((_offset + _size + 0x1f) >= (_offset + _size)))
{ {
u256 newSize = (_offset + _size + 0x1f) & ~u256(0x1f); u256 newSize = (_offset + _size + 0x1f) & ~u256(0x1f);
m_state.msize = max(m_state.msize, newSize);
if (newSize < m_state.maxMemSize) if (newSize < m_state.maxMemSize)
{ {
if (m_state.memory.size() < newSize) if (m_state.memory.size() < newSize)
@ -476,8 +475,6 @@ bool EVMInstructionInterpreter::accessMemory(u256 const& _offset, u256 const& _s
return true; return true;
} }
} }
else
m_state.msize = u256(-1);
return false; return false;
} }

View File

@ -66,8 +66,6 @@ struct InterpreterState
dev::bytes returndata; dev::bytes returndata;
/// TODO turn this into "vector with holes" for the randomized testing /// TODO turn this into "vector with holes" for the randomized testing
dev::bytes memory; dev::bytes memory;
/// This is different than memory.size() because we ignore gas.
dev::u256 msize;
std::map<dev::h256, dev::h256> storage; std::map<dev::h256, dev::h256> storage;
dev::u160 address = 0x11111111; dev::u160 address = 0x11111111;
dev::u256 balance = 0x22222222; dev::u256 balance = 0x22222222;