Skip to content

Commit de7695b

Browse files
authored
Merge pull request #319 from propeller-heads/ah/fix-tycho-db-panic
fix: return error instead of panic in code_by_hash_ref
2 parents 322ce08 + c5bd737 commit de7695b

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/evm/engine_db/tycho_db.rs

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,8 @@ pub enum PreCachedDBError {
3939
BlockNotSet(),
4040
#[error("Tycho Client error: {0}")]
4141
TychoClientError(#[from] TychoClientError),
42+
#[error("{0}")]
43+
Fatal(String),
4244
}
4345

4446
impl DBErrorMarker for PreCachedDBError {}
@@ -286,8 +288,8 @@ impl DatabaseRef for PreCachedDB {
286288
.ok_or(PreCachedDBError::MissingAccount(address))
287289
}
288290

289-
fn code_by_hash_ref(&self, _code_hash: B256) -> Result<Bytecode, Self::Error> {
290-
panic!("Code by hash is not implemented")
291+
fn code_by_hash_ref(&self, code_hash: B256) -> Result<Bytecode, Self::Error> {
292+
Err(PreCachedDBError::Fatal(format!("Code by hash not supported: {code_hash}")))
291293
}
292294

293295
/// Retrieves the storage value at the specified address and index.

0 commit comments

Comments
 (0)