Skip to content

Commit

Permalink
Merge branch 'main' into validate_against_parent_4844
Browse files Browse the repository at this point in the history
  • Loading branch information
tcoratger authored Oct 26, 2024
2 parents 96382be + ea5eb7d commit 1a48dca
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 8 deletions.
19 changes: 12 additions & 7 deletions crates/provider/src/provider/trait.rs
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
///
/// This function returns [`EthCall`] which can be used to execute the
/// call, or to add [`StateOverride`] or a [`BlockId`]. If no overrides
/// or block ID is provided, the call will be executed on the latest block
/// or block ID is provided, the call will be executed on the pending block
/// with the current state.
///
/// [`StateOverride`]: alloy_rpc_types_eth::state::StateOverride
Expand All @@ -153,7 +153,7 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
#[doc(alias = "eth_call")]
#[doc(alias = "call_with_overrides")]
fn call<'req>(&self, tx: &'req N::TransactionRequest) -> EthCall<'req, T, N, Bytes> {
EthCall::new(self.weak_client(), tx)
EthCall::new(self.weak_client(), tx).block(BlockNumberOrTag::Pending.into())
}

/// Executes an arbitrary number of transactions on top of the requested state.
Expand Down Expand Up @@ -185,18 +185,23 @@ pub trait Provider<T: Transport + Clone = BoxTransport, N: Network = Ethereum>:
self.client().request("eth_createAccessList", request).into()
}

/// This function returns an [`EthCall`] which can be used to get a gas estimate,
/// or to add [`StateOverride`] or a [`BlockId`]. If no overrides
/// or block ID is provided, the gas estimate will be computed for the latest block
/// with the current state.
/// Create an [`EthCall`] future to estimate the gas required for a
/// transaction.
///
/// The future can be used to specify a [`StateOverride`] or [`BlockId`]
/// before dispatching the call. If no overrides or block ID is provided,
/// the gas estimate will be computed for the pending block with the
/// current state.
///
/// [`StateOverride`]: alloy_rpc_types_eth::state::StateOverride
///
/// # Note
///
/// Not all client implementations support state overrides for eth_estimateGas.
fn estimate_gas<'req>(&self, tx: &'req N::TransactionRequest) -> EthCall<'req, T, N, U64, u64> {
EthCall::gas_estimate(self.weak_client(), tx).map_resp(utils::convert_u64)
EthCall::gas_estimate(self.weak_client(), tx)
.block(BlockNumberOrTag::Pending.into())
.map_resp(utils::convert_u64)
}

/// Estimates the EIP1559 `maxFeePerGas` and `maxPriorityFeePerGas` fields.
Expand Down
2 changes: 1 addition & 1 deletion crates/rpc-types-engine/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ jsonwebtoken = { workspace = true, optional = true }
default = ["jwt", "std", "serde"]
std = ["alloy-consensus/std", "derive_more/std", "strum/std"]
serde = ["dep:serde", "dep:alloy-serde"]
jwt = ["dep:jsonwebtoken", "dep:rand"]
jwt = ["std", "dep:jsonwebtoken", "dep:rand"]
jsonrpsee-types = ["dep:jsonrpsee-types"]
ssz = ["std", "dep:ethereum_ssz", "dep:ethereum_ssz_derive", "alloy-eips/ssz"]
kzg = ["alloy-consensus/kzg"]
Expand Down

0 comments on commit 1a48dca

Please sign in to comment.