Allow resolution of base fee

This commit is contained in:
Omar Abdulla
2025-08-06 15:27:40 +03:00
parent 8619e7feb0
commit f9060772c3
5 changed files with 80 additions and 18 deletions
+16
View File
@@ -30,6 +30,7 @@ use alloy::{
},
signers::local::PrivateKeySigner,
};
use anyhow::Context;
use revive_dt_common::fs::clear_directory;
use revive_dt_format::traits::ResolverApi;
use serde::{Deserialize, Serialize};
@@ -468,6 +469,21 @@ impl ResolverApi for KitchensinkNode {
.map(|block| block.header.difficulty)
}
#[tracing::instrument(skip_all, fields(kitchensink_node_id = self.id))]
async fn block_base_fee(&self, number: BlockNumberOrTag) -> anyhow::Result<u64> {
self.provider()
.await?
.get_block_by_number(number)
.await?
.ok_or(anyhow::Error::msg("Blockchain has no blocks"))
.and_then(|block| {
block
.header
.base_fee_per_gas
.context("Failed to get the base fee per gas")
})
}
#[tracing::instrument(skip_all, fields(kitchensink_node_id = self.id))]
async fn block_hash(&self, number: BlockNumberOrTag) -> anyhow::Result<BlockHash> {
self.provider()