Skip to content

Commit 60cd478

Browse files
committed
fix: use eth_maxPriorityFeePerGas for determing gas
Update `getFeeData` to match the `ethers` algorithm, specifically don't just assume `1_000_000_000n` as the `maxPriorityFeePerGas`. Instead call `eth_maxPriorityFeePerGas`, and only fall back to `1_000_000_000n`, if there is no response. Fixes #5093
1 parent c7890f0 commit 60cd478

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

packages/hardhat-ethers/src/internal/hardhat-ethers-provider.ts

+7-1
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,13 @@ export class HardhatEthersProvider implements ethers.Provider {
153153
const latestBlock = await this.getBlock("latest");
154154
const baseFeePerGas = latestBlock?.baseFeePerGas;
155155
if (baseFeePerGas !== undefined && baseFeePerGas !== null) {
156-
maxPriorityFeePerGas = 1_000_000_000n;
156+
try {
157+
maxPriorityFeePerGas = await this._hardhatProvider.send(
158+
"eth_maxPriorityFeePerGas"
159+
);
160+
} catch {}
161+
162+
maxPriorityFeePerGas = maxPriorityFeePerGas ?? 1_000_000_000n;
157163
maxFeePerGas = 2n * baseFeePerGas + maxPriorityFeePerGas;
158164
}
159165

0 commit comments

Comments
 (0)