From a17c6231a712046a2e2933cfe784ecc1e4a2c3d1 Mon Sep 17 00:00:00 2001 From: Robin Salen Date: Fri, 7 Apr 2023 18:26:55 -0400 Subject: [PATCH] Impl timestamp opcode for interpreter --- evm/src/cpu/kernel/interpreter.rs | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/evm/src/cpu/kernel/interpreter.rs b/evm/src/cpu/kernel/interpreter.rs index 3242df6b..b9938552 100644 --- a/evm/src/cpu/kernel/interpreter.rs +++ b/evm/src/cpu/kernel/interpreter.rs @@ -349,7 +349,7 @@ impl<'a> Interpreter<'a> { 0x3f => todo!(), // "EXTCODEHASH", 0x40 => todo!(), // "BLOCKHASH", 0x41 => todo!(), // "COINBASE", - 0x42 => todo!(), // "TIMESTAMP", + 0x42 => self.run_timestamp(), // "TIMESTAMP", 0x43 => todo!(), // "NUMBER", 0x44 => todo!(), // "DIFFICULTY", 0x45 => todo!(), // "GASLIMIT", @@ -659,6 +659,10 @@ impl<'a> Interpreter<'a> { } } + fn run_timestamp(&mut self) { + self.push(self.get_global_metadata_field(GlobalMetadata::BlockTimestamp)) + } + fn run_prover_input(&mut self) -> anyhow::Result<()> { let prover_input_fn = self .prover_inputs_map