This commit is contained in:
Nicholas Ward 2022-09-29 23:35:02 -07:00
parent 10f4a0d0ba
commit ea135341e8

View File

@ -263,7 +263,7 @@ impl<'a> Interpreter<'a> {
0x56 => self.run_jump(), // "JUMP",
0x57 => self.run_jumpi(), // "JUMPI",
0x58 => todo!(), // "GETPC",
0x59 => todo!(), // "MSIZE",
0x59 => self.run_msize(), // "MSIZE",
0x5a => todo!(), // "GAS",
0x5b => self.run_jumpdest(), // "JUMPDEST",
0x5c => todo!(), // "GET_STATE_ROOT",
@ -511,6 +511,14 @@ impl<'a> Interpreter<'a> {
}
}
fn run_msize(&mut self) {
let num_u256s = self.memory.context_memory[0].segments[Segment::MainMemory as usize]
.content
.len();
let num_bytes = num_u256s * 32;
self.push(U256::from(num_bytes));
}
fn run_jumpdest(&mut self) {
assert!(!self.kernel_mode, "JUMPDEST is not needed in kernel code");
}