Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@

### 2025-11-12

- Avoid copying while reading account code [#5289](https://github.com/lambdaclass/ethrex/pull/5289)
- Cache `BLOBBASEFEE` opcode value [#5288](https://github.com/lambdaclass/ethrex/pull/5288)

### 2025-11-11
Expand Down
9 changes: 6 additions & 3 deletions crates/storage/store_db/rocksdb.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1306,11 +1306,14 @@ impl StoreEngine for Store {
}

fn get_account_code(&self, code_hash: H256) -> Result<Option<Code>, StoreError> {
let hash_key = code_hash.as_bytes().to_vec();
let Some(bytes) = self.read_sync(CF_ACCOUNT_CODES, hash_key)? else {
let cf = self.cf_handle(CF_ACCOUNT_CODES)?;
let Some(bytes) = self
.db
.get_pinned_cf(&cf, code_hash.as_bytes())
.map_err(|e| StoreError::Custom(format!("RocksDB read error: {}", e)))?
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: is there no StoreError::ReadError or similar already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is a ReadError but it's error message is "Could not open DB for reading" which implies a different kind of error, and doesn't pass-through the message.

else {
return Ok(None);
};
let bytes = Bytes::from_owner(bytes);
let (bytecode, targets) = decode_bytes(&bytes)?;
let code = Code {
hash: code_hash,
Expand Down