Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error in deser of non-1559 blocks #2107

Closed
prestwich opened this issue Sep 28, 2021 · 6 comments
Closed

Error in deser of non-1559 blocks #2107

prestwich opened this issue Sep 28, 2021 · 6 comments
Labels
discussion Questions, feedback and general information.

Comments

@prestwich
Copy link

prestwich commented Sep 28, 2021

Resurfacing a point from here

Describe the bug
Ethers Provider.getBlock fails block deser in certain networks, as not all networks return gasLimit

Resolution would be to allowNull here

Reproduction steps

import { ethers } from 'ethers';

const rpc = "https://forno.celo.org";
const provider = new ethers.providers.JsonRpcProvider(rpc);

provider.getBlock(10000).then(console.log);
james@Sisyphus ~/devel/optics-monorepo/typescript/optics-provider                                                                                                                                                                                                             [11:31:24] 
> $ npx ts-node ./src/minimal.ts                                                                                                                                                                                                                                      ⬡ 16.6.2 [±main ●]
/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/logger/src.ts/index.ts:225
        const error: any = new Error(message);
                           ^
Error: invalid BigNumber value (argument="value", value=undefined, code=INVALID_ARGUMENT, version=bignumber/5.4.1)
    at Logger.makeError (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/logger/src.ts/index.ts:225:28)
    at Logger.throwError (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/logger/src.ts/index.ts:237:20)
    at Logger.throwArgumentError (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/logger/src.ts/index.ts:241:21)
    at Function.BigNumber.from (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/bignumber/src.ts/bignumber.ts:291:23)
    at Formatter.bigNumber (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/providers/src.ts/formatter.ts:200:26)
    at Function.Formatter.check (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/providers/src.ts/formatter.ts:445:42)
    at Formatter._block (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/providers/src.ts/formatter.ts:298:26)
    at Formatter.block (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/providers/src.ts/formatter.ts:302:21)
    at JsonRpcProvider.<anonymous> (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/providers/src.ts/base-provider.ts:1397:35)
    at step (/Users/james/devel/optics-monorepo/typescript/optics-provider/node_modules/@ethersproject/providers/lib/base-provider.js:48:23) {
  reason: 'invalid BigNumber value',
  code: 'INVALID_ARGUMENT',
  argument: 'value',
  value: undefined,
  checkKey: 'gasLimit',
  checkValue: undefined
}                        
@prestwich prestwich added the investigate Under investigation and may be a bug. label Sep 28, 2021
@prestwich
Copy link
Author

pls disregard pre-edit version with wrong rpc string lol

@ricmoo
Copy link
Member

ricmoo commented Sep 28, 2021

Adding allowNull would break backwards compatibility. You may need to sub-class the provider for your network to make this change possible in v5. In v6 the formatted is part of the network, so a custom network will suffice.

For examples, see the exchain ancillary package.

What network are you dealing with? A grant from Chainlink is enabling me to make more ancillary packages, so if your network lines up with the networks they are paying for, you might be in luck. ;)

@ricmoo ricmoo added discussion Questions, feedback and general information. and removed investigate Under investigation and may be a bug. labels Sep 28, 2021
@prestwich
Copy link
Author

@ricmoo
Copy link
Member

ricmoo commented Oct 14, 2021

Awesome. I can link to this from the docs.

In v6 you won’t need to subclass the Provider, just the Network, which should make things easier too. :)

@prestwich
Copy link
Author

appreciate the pointer to the ancillary package 👍

@ricmoo
Copy link
Member

ricmoo commented Oct 16, 2021

I think it is safe to close this issue now? If not, please re-open.

Thanks! :)

@ricmoo ricmoo closed this as completed Oct 16, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion Questions, feedback and general information.
Projects
None yet
Development

No branches or pull requests

2 participants