Skip to content
Merged
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
10 changes: 1 addition & 9 deletions crates/networking/rpc/eth/block.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use ethrex_blockchain::find_parent_header;
use ethrex_rlp::encode::RLPEncode;
use serde_json::Value;
use tracing::debug;
Expand Down Expand Up @@ -311,14 +310,9 @@ impl RpcHandler for GetBlobBaseFee {
Some(header) => header,
_ => return Err(RpcErr::Internal("Could not get block header".to_owned())),
};
let parent_header = match find_parent_header(&header, &context.storage) {
Ok(option_header) => option_header,
Err(error) => return Err(RpcErr::Internal(error.to_string())),
};

let config = context.storage.get_chain_config();
let blob_base_fee = calculate_base_fee_per_blob_gas(
parent_header.excess_blob_gas.unwrap_or_default(),
header.excess_blob_gas.unwrap_or_default(),
Copy link
Collaborator

Choose a reason for hiding this comment

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

config
.get_fork_blob_schedule(header.timestamp)
.map(|schedule| schedule.base_fee_update_fraction)
Expand All @@ -341,8 +335,6 @@ pub async fn get_all_block_rpc_receipts(
if header.parent_hash.is_zero() {
return Ok(receipts);
}
Comment on lines 335 to 337
Copy link
Contributor

Choose a reason for hiding this comment

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

I think this check might also be wrong. Doesn't the genesis block also include its own transactions which might create receipts?

Copy link
Contributor

Choose a reason for hiding this comment

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

i think genesis blocks don't have receipts

Copy link
Collaborator

Choose a reason for hiding this comment

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

This. We don't have a way to accept a genesis block with transactions:

fn get_block_body(&self) -> BlockBody {
BlockBody {
transactions: vec![],
ommers: vec![],
withdrawals: Some(vec![]),
}
}

It'd be good to add a comment here.

// TODO: Here we are calculating the base_fee_per_blob_gas with the current header.
// Check if we should be passing the parent header instead
let config = storage.get_chain_config();
let blob_base_fee = calculate_base_fee_per_blob_gas(
header.excess_blob_gas.unwrap_or_default(),
Expand Down
Loading