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
Hi EthersJs Team,
We have a hardhat deployed inside a docker locally and we have tests that are connecting to the deployed hardhat and issue transactions. The provider we are using is JsonRpcProvider, when we issue multiple transaction one after the other sometimes the nonce is not correct. We also checked if we request the nonce from the hardhat network using the JSON-RPC request ("eth_getTransactionCount") and request the transaction count using the provider we get different outcomes.
Do you have some cache setup, because we are getting the nonce from the prev transaction.
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
The text was updated successfully, but these errors were encountered:
There is a caching layer which can affect providers that behave synchronously or with near-immediate results.
The GanacheProvider includes code to disable the caching which may be useful as a base for creating a sub-class, but basically when instantiating the provider you can use:
classMyProviderextendsJsonRpcApiProvider{constructor(network: Network){super(network,{staticNetwork: true,// Ensure we never ask for eth_chainId; optionalbatchStallTime: 0,// Don't batch requests, send them immediatelycacheTimeout: -1// Do not employ result caching});}}
You can of course pass the same parameters along to a JsonRpcProvider without sub-classing. :)
Ethers Version
6.8.1
Search Terms
nonce, provider doesn't get correct nonce,
Describe the Problem
Hi EthersJs Team,
We have a hardhat deployed inside a docker locally and we have tests that are connecting to the deployed hardhat and issue transactions. The provider we are using is JsonRpcProvider, when we issue multiple transaction one after the other sometimes the nonce is not correct. We also checked if we request the nonce from the hardhat network using the JSON-RPC request ("eth_getTransactionCount") and request the transaction count using the provider we get different outcomes.
Do you have some cache setup, because we are getting the nonce from the prev transaction.
Code Snippet
No response
Contract ABI
No response
Errors
No response
Environment
No response
Environment (Other)
No response
The text was updated successfully, but these errors were encountered: