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

Bug in response-handling for post-processing on etherscan-provider #4782

Open
MatsThijssen opened this issue Jul 10, 2024 · 0 comments
Open
Assignees
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6

Comments

@MatsThijssen
Copy link

Ethers Version

6.7.1

Search Terms

json, unexpected token, <, SyntaxError

Describe the Problem

Error in post-processing function stemming from a syntax-error in JSON.parse() was thrown when calling broadcastTransaction on an EtherScan-provider. Not sure how to reproduce, have never seen this before.

I believe the error is associated with this line: https://github.com/ethers-io/ethers.js/blob/main/src.ts/providers/provider-etherscan.ts#L258 where I guess the response is not properly sanitized for some specific cases, though I am not 100% sure what happened here.

What makes the error quite severe is that the transaction was still broadcast onto the network, which is obviously unexpected if the function throws.

Code Snippet

No response

Contract ABI

No response

Errors

Error: error in post-processing function (request={  }, response={  }, error={  }, code=SERVER_ERROR, version=6.7.1)
    at makeError (/home/node/node_modules/ethers/lib.commonjs/utils/errors.js:125:21)
    at assert (/home/node/node_modules/ethers/lib.commonjs/utils/errors.js:142:15)
    at FetchResponse.assertOk (/home/node/node_modules/ethers/lib.commonjs/utils/fetch.js:789:32)
    at #send (/home/node/node_modules/ethers/lib.commonjs/utils/fetch.js:470:90)
    at process.processTicksAndRejections (node:internal/process/task_queues:95:5)
    at async EtherscanProvider.fetch (/home/node/node_modules/ethers/lib.commonjs/providers/provider-etherscan.js:203:26)
    at async #perform (/home/node/node_modules/ethers/lib.commonjs/providers/abstract-provider.js:265:16)
    at async EtherscanProvider.getBlockNumber (/home/node/node_modules/ethers/lib.commonjs/providers/abstract-provider.js:373:55)
    at async Promise.all (index 0)
    at async resolveProperties (/home/node/node_modules/ethers/lib.commonjs/utils/properties.js:36:21)

Environment

node.js (v12 or newer)

Environment (Other)

No response

@MatsThijssen MatsThijssen added investigate Under investigation and may be a bug. v6 Issues regarding v6 labels Jul 10, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
investigate Under investigation and may be a bug. v6 Issues regarding v6
Projects
None yet
Development

No branches or pull requests

2 participants