hardhat
hardhat copied to clipboard
Allow custome maxPriorityFeePerGas in hardhat.config.js (@hardhat/ethers)
Ethers.js provider usually inherits from the abstract-provider class. This class includes a getFeeData() function, which sets the maxPriorityFeePerGas to 2.5gwei at the provider level. This can be overridden to change the value.
It is really useful to be able to set such values at the provider (or signer) level rather than in each transaction. This makes sure any oversight is covered, and also that these settings are applied if we pass the signer/provider to a module (like @openzeppelin/upgrades).
This works well with ethers alone, but the provider that comes with @hardhat/ethers is different:
- it is a proxy, which doesn't let us override functions like
getFeeData - for some reason, it doesn't use
getFeeData, and apply its ownmaxPriorityFeePerGasof 1gwei - AFAIK, and as far as the documentation is concerned, there is no way to change that priority fee in the config.
My solution has been to wrap network.provider into an ethers.provider.FallbackProvider, but then I lose control over the signer (JSONRPC signers cannot be connected to another provider easily) ... and its a huge mess
Request:
In hardhat.config.jon, allow setting a custom maxPriorityFee per network
module.exports = {
networks: {
mainnet: {
url: process.env.MAINNET_NODE,
accounts: { mnemonic: process.env.MAINNET_MNEMONIC },
maxPriorityFee: ethers.utils.parseUnits('2.51', 'gwei'). // ← THIS
}
}
}
Hi @Amxx, thanks for opening this.
This would be an interesting feature, but I'm not quite sure about the implementation. Is getFeeData meant to be be overridden? Or would it be monkey-patching? (We are already doing that for ethers, tbh, but we want to avoid doing it even more :sweat_smile: )
I'm not sure about overriding getFeeData.
If that can be set in the config file, overriding would not be require anyway
Agree this is needed.
Ideally I'd always deploy with high priority fees.
This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.
This issue was closed because it has been stalled for 7 days with no activity.