From 3680fd508e2bfb1e672d4834ebff523bd2bb9804 Mon Sep 17 00:00:00 2001 From: lightsing Date: Thu, 9 May 2024 18:19:52 +0800 Subject: [PATCH] fix clippy,test,docs --- crates/interpreter/src/interpreter.rs | 4 +++- crates/primitives/src/state.rs | 10 ++++++++-- crates/revm/src/scroll/l1block.rs | 2 +- 3 files changed, 12 insertions(+), 4 deletions(-) diff --git a/crates/interpreter/src/interpreter.rs b/crates/interpreter/src/interpreter.rs index 2a1e99a377..ffb125c872 100644 --- a/crates/interpreter/src/interpreter.rs +++ b/crates/interpreter/src/interpreter.rs @@ -217,7 +217,9 @@ impl Interpreter { let out_offset = call_outcome.memory_start(); let out_len = call_outcome.memory_length(); - self.return_data_buffer = call_outcome.output().to_owned(); + call_outcome + .output() + .clone_into(&mut self.return_data_buffer); let target_len = min(out_len, self.return_data_buffer.len()); match call_outcome.instruction_result() { diff --git a/crates/primitives/src/state.rs b/crates/primitives/src/state.rs index b3965d063b..e4f4beef6e 100644 --- a/crates/primitives/src/state.rs +++ b/crates/primitives/src/state.rs @@ -330,7 +330,7 @@ impl AccountInfo { #[cfg(test)] mod tests { - use crate::{Account, KECCAK_EMPTY, U256}; + use crate::{Account, U256}; #[test] fn account_is_empty_balance() { @@ -367,7 +367,13 @@ mod tests { account.info.code_hash = [0; 32].into(); assert!(account.is_empty()); - account.info.code_hash = KECCAK_EMPTY; + cfg_if::cfg_if! { + if #[cfg(feature = "scroll")] { + account.info.code_hash = crate::POSEIDON_EMPTY; + } else { + account.info.code_hash = crate::KECCAK_EMPTY; + } + } assert!(account.is_empty()); } diff --git a/crates/revm/src/scroll/l1block.rs b/crates/revm/src/scroll/l1block.rs index f9f5c49d28..bd13e7cdac 100644 --- a/crates/revm/src/scroll/l1block.rs +++ b/crates/revm/src/scroll/l1block.rs @@ -51,7 +51,7 @@ impl L1BlockInfo { })) } - /// Calculate the gas cost of a transaction based on L1 block data posted on L2, depending on the [SpecId] passed. + /// Calculate the gas cost of a transaction based on L1 block data posted on L2. pub fn calculate_tx_l1_cost(&self, input: &[u8]) -> U256 { let tx_l1_gas = self.data_gas(input); tx_l1_gas