Allow for the resolution of gas price

This commit is contained in:
Omar Abdulla
2025-08-06 17:34:30 +03:00
parent 5de7b161c5
commit 54d9f94134
5 changed files with 255 additions and 201 deletions
+13 -1
View File
@@ -17,11 +17,12 @@ use alloy::{
eips::BlockNumberOrTag,
genesis::{Genesis, GenesisAccount},
network::{Ethereum, EthereumWallet, NetworkWallet},
primitives::{Address, BlockHash, BlockNumber, BlockTimestamp, FixedBytes, U256},
primitives::{Address, BlockHash, BlockNumber, BlockTimestamp, FixedBytes, TxHash, U256},
providers::{
Provider, ProviderBuilder,
ext::DebugApi,
fillers::{CachedNonceManager, ChainIdFiller, FillProvider, NonceFiller, TxFiller},
layers::CacheLayer,
},
rpc::types::{
TransactionReceipt, TransactionRequest,
@@ -257,6 +258,7 @@ impl GethNode {
.filler(FallbackGasFiller::new(500_000_000, 500_000_000, 1))
.filler(ChainIdFiller::default())
.filler(NonceFiller::new(nonce_manager))
.layer(CacheLayer::new(10_000))
.wallet(wallet)
.connect(&connection_string)
.await
@@ -383,6 +385,16 @@ impl ResolverApi for GethNode {
.map_err(Into::into)
}
#[tracing::instrument(skip_all, fields(geth_node_id = self.id))]
async fn transaction_gas_price(&self, tx_hash: &TxHash) -> anyhow::Result<u128> {
self.provider()
.await?
.get_transaction_receipt(*tx_hash)
.await?
.context("Failed to get the transaction receipt")
.map(|receipt| receipt.effective_gas_price)
}
#[tracing::instrument(skip_all, fields(geth_node_id = self.id))]
async fn block_gas_limit(&self, number: BlockNumberOrTag) -> anyhow::Result<u128> {
self.provider()
+14 -1
View File
@@ -16,12 +16,14 @@ use alloy::{
TransactionBuilderError, UnbuiltTransactionError,
},
primitives::{
Address, B64, B256, BlockHash, BlockNumber, BlockTimestamp, Bloom, Bytes, FixedBytes, U256,
Address, B64, B256, BlockHash, BlockNumber, BlockTimestamp, Bloom, Bytes, FixedBytes,
TxHash, U256,
},
providers::{
Provider, ProviderBuilder,
ext::DebugApi,
fillers::{CachedNonceManager, ChainIdFiller, FillProvider, NonceFiller, TxFiller},
layers::CacheLayer,
},
rpc::types::{
TransactionReceipt,
@@ -371,6 +373,7 @@ impl KitchensinkNode {
))
.filler(ChainIdFiller::default())
.filler(NonceFiller::new(nonce_manager))
.layer(CacheLayer::new(10_000))
.wallet(wallet)
.connect(&connection_string)
.await
@@ -439,6 +442,16 @@ impl ResolverApi for KitchensinkNode {
.map_err(Into::into)
}
#[tracing::instrument(skip_all, fields(kitchensink_node_id = self.id))]
async fn transaction_gas_price(&self, tx_hash: &TxHash) -> anyhow::Result<u128> {
self.provider()
.await?
.get_transaction_receipt(*tx_hash)
.await?
.context("Failed to get the transaction receipt")
.map(|receipt| receipt.effective_gas_price)
}
#[tracing::instrument(skip_all, fields(kitchensink_node_id = self.id))]
async fn block_gas_limit(&self, number: BlockNumberOrTag) -> anyhow::Result<u128> {
self.provider()