You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
This makes client code make an eth_chainId call before every use of the provider.
See: ethers-io/ethers.js#901
Given hardhat tasks and scripts usually run in the same network (or at least that's my case, and kind if implied by the --network option in most commands), consider changing inheritance to StaticJsonRpcProvider, which only performs the eth_chainId call at the beginning. This could potentially save lots of requests in most cases. I managed to get my infura requests down 50% by using my own StaticJsonRpcProvider instead of relying on hardhat's .
The text was updated successfully, but these errors were encountered:
This makes a lot of sense. I think this is a somewhat new provider, so we should check when it was added and how we should bump the ethers peer dependency of the plugin.
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.
Bumping the priority on this as it greatly impacts our running cost, as you could see the top 1 RPC call is chainId which can be removed as it's running on the same network and it would greatly reduce everyone's running cost.
Currently,
EthersProviderWrapper
inherits fromJsonRpcProvider
. See: https://github.com/nomiclabs/hardhat/blob/51cb14a5d8bdb90c11529322bc76b45adbab2e20/packages/hardhat-core/test/internal/hardhat-network/helpers/ethers-provider-wrapper.ts#L8This makes client code make an
eth_chainId
call before every use of the provider.See: ethers-io/ethers.js#901
Given hardhat tasks and scripts usually run in the same network (or at least that's my case, and kind if implied by the
--network
option in most commands), consider changing inheritance toStaticJsonRpcProvider
, which only performs theeth_chainId
call at the beginning. This could potentially save lots of requests in most cases. I managed to get my infura requests down 50% by using my ownStaticJsonRpcProvider
instead of relying on hardhat's .The text was updated successfully, but these errors were encountered: