diff --git a/emulator/src/state.rs b/emulator/src/state.rs index b8595f6b..b8f30de1 100644 --- a/emulator/src/state.rs +++ b/emulator/src/state.rs @@ -543,10 +543,8 @@ impl InstrumentedState { u32::from_be_bytes(core::array::from_fn(|j| result[i * 4 + j])) }); assert!(result.len() == 8); - for i in 0..result.len() { - self.state - .memory - .set_memory(a2 + ((i << 2) as u32), result[i]); + for (i, data) in result.iter().enumerate() { + self.state.memory.set_memory(a2 + ((i << 2) as u32), *data); } } 0xF0 => { diff --git a/runtime/precompiles/src/io.rs b/runtime/precompiles/src/io.rs index 2f730293..68f08c40 100644 --- a/runtime/precompiles/src/io.rs +++ b/runtime/precompiles/src/io.rs @@ -117,10 +117,11 @@ pub fn keccak(data: &[u8]) -> [u8; 32] { let mut u32_array = Vec::new(); if len == 0 { - return [0xC5, 0xD2, 0x46, 0x01, 0x86, 0xF7, 0x23, 0x3C, - 0x92, 0x7E, 0x7D, 0xB2, 0xDC, 0xC7, 0x03, 0xC0, - 0xE5, 0 , 0xB6, 0x53, 0xCA, 0x82, 0x27, 0x3B, - 0x7B, 0xFA, 0xD8, 0x04, 0x5D, 0x85, 0xA4, 0x70]; + return [ + 0xC5, 0xD2, 0x46, 0x01, 0x86, 0xF7, 0x23, 0x3C, 0x92, 0x7E, 0x7D, 0xB2, 0xDC, 0xC7, + 0x03, 0xC0, 0xE5, 0, 0xB6, 0x53, 0xCA, 0x82, 0x27, 0x3B, 0x7B, 0xFA, 0xD8, 0x04, 0x5D, + 0x85, 0xA4, 0x70, + ]; } // 每 4 个字节转换为一个 u32