diff --git a/ethers-providers/src/provider.rs b/ethers-providers/src/provider.rs index 7d36041b5..6b5727d66 100644 --- a/ethers-providers/src/provider.rs +++ b/ethers-providers/src/provider.rs @@ -574,8 +574,14 @@ impl Middleware for Provider

{ block: Option, ) -> Result { let tx = utils::serialize(tx); - let block = utils::serialize(&block.unwrap_or_else(|| BlockNumber::Latest.into())); - self.request("eth_estimateGas", [tx, block]).await + // Some chains (e.g. Optimism) don't support a block ID being passed as a param, + // so refrain from defaulting to BlockNumber::Latest. + let params = if let Some(block_id) = block { + vec![tx, utils::serialize(&block_id)] + } else { + vec![tx] + }; + self.request("eth_estimateGas", params).await } async fn create_access_list( diff --git a/ethers-providers/src/transports/quorum.rs b/ethers-providers/src/transports/quorum.rs index eecbcc653..8bc776817 100644 --- a/ethers-providers/src/transports/quorum.rs +++ b/ethers-providers/src/transports/quorum.rs @@ -227,6 +227,7 @@ impl QuorumProvider { "eth_getStorageAt" | "eth_getCode" | "eth_getProof" | + "eth_estimateGas" | "trace_call" | "trace_block" => { // calls that include the block number in the params at the last index of json array @@ -401,7 +402,7 @@ impl WeightedProvider { #[derive(Error, Debug)] /// Error thrown when sending an HTTP request pub enum QuorumError { - #[error("No Quorum reached.")] + #[error("No Quorum reached. (Values: {:?}, Errors: {:?})", values, errors)] NoQuorumReached { values: Vec, errors: Vec }, }