celo-org / celo-blockchain

Official repository for the golang Celo Blockchain
https://celo.org
GNU Lesser General Public License v3.0
560 stars 198 forks source link

Error: invalid value for value.difficulty #2171

Closed tab00 closed 1 year ago

tab00 commented 1 year ago

Expected Behavior

JavaScript running ethers completes without the error.

Actual Behavior

Script terminates with error message:

Error: invalid value for value.difficulty (invalid BigNumberish value (argument="value", value=null, code=INVALID_ARGUMENT, version=6.7.0))

This doesn't happen on other blockchains.

Steps to reproduce the behavior

Run a script that has this JavaScript code:

  const feeData = await ethers.provider.getFeeData()

Backtrace

Error: invalid value for value.difficulty (invalid BigNumberish value (argument="value", value=null, code=INVALID_ARGUMENT, version=6.7.0)) (value={ "baseFeePerGas": "0x12a05f200", "epochSnarkData": null, "extraData": "0xd983010702846765746889676f312e31372e3133856c696e7578000000000000f8b2c0c080b8411f26d8c5801139f5aa4a69561c061d06904ccd786f2c084c840b64702eb2aeb521a5e40463a2aa7cc1e67cd187708738a47874364eab8d1f0edec1d160c29a3e00f58201d7b02ea53f2d4978baf18a306f780262759924474a77b82099562c63c5ab2546adf253cdcd5cddf8fb941d0af787bf2f8e0080f58203ffb085ad0cf77bc4206904cb7f7a1c1fc53e18bfaab5a550eb4aa2d31713506e76ed4333bcfbaab9b514b453e0c9b71e3e0180", "gasLimit": "0x2160ec0", "gasUsed": "0x0", "hash": "0xf60259371b991de351a8494e22febb3a49ab92b343c5d0a64163a89e297bfcdb", "logsBloom": "0x00000000000200000000000000008000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000400000000000000000000000000000000000000000000000000000000000080000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000040000000000000000000000000000000001000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000", "miner": "0xa0bd1e055822ab837a58649bcec5dc850d59d75d", "number": "0x125a3b9", "parentHash": "0x7838bdce66572c2e5365299f9f10ab93f7eea651213f9a8307593f7be8f7e378", "randomness": 

System Information

ethers 6.7.0

Chain/Network: Alfajores

palango commented 1 year ago

Hi @tab00 ,

thanks for reporting this. Do you run your own node or do you use forno?

tab00 commented 1 year ago

I'm using RPC https://alfajores-forno.celo-testnet.org

karlb commented 1 year ago

I can reproduce this:

Here's the whole snippet:

// const provider = new ethers.JsonRpcProvider("https://forno.celo.org");
const provider = new ethers.JsonRpcProvider("https://alfajores-forno.celo-testnet.org");
// const provider = new ethers.JsonRpcProvider("https://baklava-forno.celo-testnet.org");
// const provider = new ethers.JsonRpcProvider("https://forno.cannoli.celo-testnet.org");
// const provider = new ethers.JsonRpcProvider("http://localhost:8545");
const feeData = await provider.getFeeData()
console.log(feeData)

Do we just need to update the blockchain nodes, or is there a specific reason why alfajores and baklava fail? Why does alfajores have the problem but not mainnet?

karlb commented 1 year ago

This problem has been fixed in https://github.com/celo-org/celo-blockchain/commit/6043494d72d000e10cb6105a35f650d5b7de12e6 and will be resolved on alfajores as soon as the node is updated.