perf: query bytecodes with &B256 to avoid copying code hash (#13559)

This commit is contained in:
Hai | RISE
2024-12-26 21:58:56 +07:00
committed by GitHub
parent 951e2fd641
commit 56ce046317
13 changed files with 23 additions and 23 deletions

View File

@ -999,7 +999,7 @@ mod tests {
Ok(None)
}
fn bytecode_by_hash(&self, _code_hash: B256) -> ProviderResult<Option<Bytecode>> {
fn bytecode_by_hash(&self, _code_hash: &B256) -> ProviderResult<Option<Bytecode>> {
Ok(None)
}
}

View File

@ -228,9 +228,9 @@ impl<N: NodePrimitives> StateProvider for MemoryOverlayStateProviderRef<'_, N> {
self.historical.storage(address, storage_key)
}
fn bytecode_by_hash(&self, code_hash: B256) -> ProviderResult<Option<Bytecode>> {
fn bytecode_by_hash(&self, code_hash: &B256) -> ProviderResult<Option<Bytecode>> {
for block in &self.in_memory {
if let Some(contract) = block.execution_output.bytecode(&code_hash) {
if let Some(contract) = block.execution_output.bytecode(code_hash) {
return Ok(Some(contract));
}
}