iotex-core icon indicating copy to clipboard operation
iotex-core copied to clipboard

[ Web3 API ] Custom Errors are not correctly returned

Open simonerom opened this issue 1 year ago • 3 comments

What version of iotex-core image (or code branch) are you using?

N/A

What operating system and processor architecture are you using?

Mac M1

What did you do? If possible, provide a recipe for reproducing the error.

Unzip hardhat-starter.zip

cd hardhat-starter
echo PRIVATE_KEY=[YOUR IOTEX DEV ACCOUNT] > .env
npm install
npx hardhat run scripts/deploy_and_reproduce.ts --network iotex_testnet

What did you expect to see?

Custom Errors have been introduced in Solidity 0.8.4. The script execution deploys a contract that reverts with a custom error and it should catch and log the custom error with its data.

What did you see instead?

The script is failing with a Provider Error: "ProviderError: execution simulation failed: status = 106"

Run npx hardhat run scripts/deploy_and_reproduce.ts to see the correct behavior in the local Hardhat VM

simonerom avatar Aug 09 '23 20:08 simonerom

This bug cause by eth_estimategas api doesn't return correct error data.

ququzone avatar Aug 10 '23 10:08 ququzone

This bug cause by eth_estimategas api doesn't return correct error data.

There are two bugs here, in addition to this, there is one eth_call will be returned as a normal call(revert reason was no caught), not return custom error with its data, fix it later

millken avatar Aug 10 '23 11:08 millken

This bug cause by eth_estimategas api doesn't return correct error data.

@ququzone I tested 'eth_estimategas' with ganache and it also return 'revert' message, Can you confirm it's a bug and need to fix?

millken avatar Aug 10 '23 12:08 millken