ethers.js: SERVER_ERROR and INVALID_ARGUMENT errors for version 5.4.1
but the same code works fine with ethers version 5.3.1
The code
const provider = new ethers.providers.JsonRpcProvider('https://kovan.infura.io/v3/37d...');
const providerContract = new ethers.Contract(contractAddress, abi, provider);
const wallet = new ethers.Wallet('1234....')
const providerWallet = wallet.connect(provider)
const signerContract = providerContract.connect(providerWallet);
let txHash = await signerContract['safeTransferFrom(address,address,uint256)'](from, to, tokenId, { gasPrice: ethers.utils.parseUnits(30, "gwei") })
await txHash.wait()
About this issue
- Original URL
- State: closed
- Created 3 years ago
- Comments: 41 (15 by maintainers)
Commits related to this issue
- Forward some missing EIP-1559 fields to call and estimateGas (#1766). — committed to ethers-io/ethers.js by ricmoo 3 years ago
- Fixed JsonRpcProvider for pre-EIP-2930 chains (#1766). — committed to ethers-io/ethers.js by ricmoo 3 years ago
Hey there, I’m “the alchemy engineer” 😃 Just updated our
eth_estimateGasendpoint so the legacy type0x0should now work. Sorry for all of this inconvenience and thanks for everyone’s patience. Also thanks to @ricmoo for diagnosing.This has been fixed in 5.4.3.
For future reference, anyone who happens across this issue, the cause was an bug in the JsonRpcProvider for
estimateGasandcallon networks which did not implement EIP-2930 (Berlin), which is why it only showed up on Kovan (which at this time has not implemented the Berlin hard fork from earlier this year).For a network that supports Berlin, the
typefield is allowed incallandestimateGascalls and the JsonRpcProvider would use atypeof 0 to indicate legacy operation. Before Berlin though,typewas extraneous and therefore error out.The
EtherscanProviderworked fine though (I guess they ignore random other properties), which is why the default provider also worked; all the JSON-RPC backed providers would throw an error, but the EtherscanProvider in the mix picked up the slack.Anyhoo, it should be fixed. But please let me know if you continue to experience any issues. 😃
Oh, interesting. I didn’t realize the consensus engine wasn’t available in Geth, but that kinda makes sense.
Ok, I’ll reach out. Thanks! 😃
aight an alchemy engineer let me know he thinks its a parity bug 👍
Can you please include the full error?
here’s your concise example lmao: