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 data property is overwritten between provider and hardhat-web3 adapter #1910

Open
nazarhussain opened this issue Sep 27, 2021 · 4 comments
Labels
area:hardhat-web3 status:ready This issue is ready to be worked on type:bug Something isn't working

Comments

@nazarhussain
Copy link

In case of an error been return by the client that error represented as following json rpc response object.

{
  id: 4,
  jsonrpc: '2.0',
  error: {
    code: 3,
    message: 'execution reverted: speed invalid',
    data: '0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d737065656420696e76616c696400000000000000000000000000000000000000'
  }
}

The error response is identified and then thrown as an error object.

https://github.com/nomiclabs/hardhat/blob/fe38c5d12626e4d3b1c0038ed984e7acb8ae0b42/packages/hardhat-core/src/internal/core/providers/http.ts#L57-L62

But the adapter catches this error overwrite the data property of the error and return the response.

https://github.com/nomiclabs/hardhat/blob/fe38c5d12626e4d3b1c0038ed984e7acb8ae0b42/packages/hardhat-web3/src/web3-provider-adapter.ts#L87-L93

which result in invalid handling of the error on the abi coder.

@nazarhussain
Copy link
Author

The issue been identified during discussion of web3/web3.js#3742

@nazarhussain nazarhussain changed the title Error data property is lost between provider and adapter Error data property is overwritten between provider and adapter Sep 27, 2021
@fvictorio
Copy link
Member

Possibly related to #1882 (not sure).

@github-actions
Copy link
Contributor

This issue was marked as stale because it didn't have any activity in the last 30 days. If you think it's still relevant, please leave a comment indicating so. Otherwise, it will be closed in 7 days.

@github-actions github-actions bot added the Stale label Jul 18, 2022
@github-actions
Copy link
Contributor

This issue was closed because it has been stalled for 7 days with no activity.

@fvictorio fvictorio added not-stale and removed Stale labels Aug 3, 2022
@fvictorio fvictorio reopened this Aug 3, 2022
@fvictorio fvictorio added type:bug Something isn't working priority:low status:ready This issue is ready to be worked on area:hardhat-web3 and removed not-stale labels Dec 22, 2022
@fvictorio fvictorio changed the title Error data property is overwritten between provider and adapter Error data property is overwritten between provider and hardhat-web3 adapter Dec 29, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
area:hardhat-web3 status:ready This issue is ready to be worked on type:bug Something isn't working
Projects
Status: No status
Development

No branches or pull requests

2 participants