refactor: rename blob_gas_price to blob_base_fee (#6721)

This commit is contained in:
Abner Zheng
2024-02-23 22:49:10 +08:00
committed by GitHub
parent 4c439e0b9a
commit 761c707e41
5 changed files with 12 additions and 12 deletions

View File

@@ -209,9 +209,9 @@ pub trait EthApi {
#[method(name = "maxPriorityFeePerGas")]
async fn max_priority_fee_per_gas(&self) -> RpcResult<U256>;
/// Introduced in EIP-4844, returns the current blob gas price in wei.
#[method(name = "blobGasPrice")]
async fn blob_gas_price(&self) -> RpcResult<U256>;
/// Introduced in EIP-4844, returns the current blob base fee in wei.
#[method(name = "blobBaseFee")]
async fn blob_base_fee(&self) -> RpcResult<U256>;
/// Returns the Transaction fee history
///

View File

@@ -34,11 +34,11 @@ where
Ok(suggested_tip + U256::from(base_fee))
}
/// Returns a suggestion for a gas price for blob transactions.
pub(crate) async fn blob_gas_price(&self) -> EthResult<U256> {
/// Returns a suggestion for a base fee for blob transactions.
pub(crate) async fn blob_base_fee(&self) -> EthResult<U256> {
self.block(BlockNumberOrTag::Latest)
.await?
.and_then(|h| h.next_block_blob_fee())
.and_then(|h: reth_primitives::SealedBlock| h.next_block_blob_fee())
.ok_or(EthApiError::ExcessBlobGasNotSet)
.map(U256::from)
}

View File

@@ -298,10 +298,10 @@ where
return Ok(EthApi::gas_price(self).await?)
}
/// Handler for: `eth_blobGasPrice`
async fn blob_gas_price(&self) -> Result<U256> {
trace!(target: "rpc::eth", "Serving eth_blobGasPrice");
return Ok(EthApi::blob_gas_price(self).await?)
/// Handler for: `eth_blobBaseFee`
async fn blob_base_fee(&self) -> Result<U256> {
trace!(target: "rpc::eth", "Serving eth_blobBaseFee");
return Ok(EthApi::blob_base_fee(self).await?)
}
/// Handler for: `eth_maxPriorityFeePerGas`

View File

@@ -1088,7 +1088,7 @@ where
pub(crate) async fn eip4844_blob_fee(&self, blob_fee: Option<U256>) -> EthResult<U256> {
match blob_fee {
Some(blob_fee) => Ok(blob_fee),
None => self.blob_gas_price().await,
None => self.blob_base_fee().await,
}
}
}

View File

@@ -342,7 +342,7 @@ pub enum RpcInvalidTransactionError {
/// hardfork.
#[error("blob_versioned_hashes is not supported for blocks before the Cancun hardfork")]
BlobVersionedHashesNotSupported,
/// Block `blob_gas_price` is greater than tx-specified `max_fee_per_blob_gas` after Cancun.
/// Block `blob_base_fee` is greater than tx-specified `max_fee_per_blob_gas` after Cancun.
#[error("max fee per blob gas less than block blob gas fee")]
BlobFeeCapTooLow,
/// Blob transaction has a versioned hash with an invalid blob