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

Revert reason not sent back in reverted contract call #492

Closed
CoveMB opened this issue Sep 6, 2022 · 3 comments · Fixed by #604
Closed

Revert reason not sent back in reverted contract call #492

CoveMB opened this issue Sep 6, 2022 · 3 comments · Fixed by #604
Assignees
Labels
bug Something isn't working limechain
Milestone

Comments

@CoveMB
Copy link

CoveMB commented Sep 6, 2022

Description

When sending a call to a contract that would revert the relayer respond with a "Unknown error invoking RPC" instead of responding that the query result ended up in a revert with the revert reason. The json-relayer is actually aware that the error from the query is due to a contract call reverted it seem, in the log I see the following error
transaction [email protected] failed precheck with status CONTRACT_REVERT_EXECUTED status: 33
but this information is not returned.

Example call

curl https://node_endpoint/ \
  -X POST \
  -H "Content-Type: application/json" \
  --data '{"method":"eth_call","params":[{"to":"0x1b68bA912B7AC0Cf771F36ac356Bbceda299fbcf","data":"0x20965255"}, "latest"],"id":1,"jsonrpc":"2.0"}'

response:

{"code":3,"data":"0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d53657420746f2072657665727400000000000000000000000000000000000000","message":"execution reverted: Set to revert"}}

0x08c379a00000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000d53657420746f2072657665727400000000000000000000000000000000000000
which indicate that the call was reverted and includes the revert reason

Steps to reproduce

  • Send a call on a contract that would revert to the json relayer

Additional context

No response

Hedera network

testnet

Version

testnet

Operating system

No response

@CoveMB CoveMB added the bug Something isn't working label Sep 6, 2022
@Nana-EC
Copy link
Collaborator

Nana-EC commented Sep 13, 2022

@BjMrq thanks for the ticket.

Notably, revert reasons can happen for different reasons and at different points in the flow.
In terms of the flow, the revert reason is not returned as part of the consensus node call.
So though you see the log in the relay, it's only telling you the type of error but not the revert reason.

For eth_call since it's a local node query the details actually don't make it off that node.

Could you provide more context including

  • which tool you're using and the call
  • sample contract for your case.

I'm also not sure where you got that response from (with code, data and message) either so that context would also be helpful.

@Nana-EC Nana-EC added this to the 0.9.0 milestone Sep 20, 2022
@Nana-EC Nana-EC moved this to In Progress in Smart Contract Sprint Board Sep 20, 2022
@Nana-EC Nana-EC moved this from In Progress to Todo in Smart Contract Sprint Board Sep 20, 2022
@Nana-EC
Copy link
Collaborator

Nana-EC commented Sep 26, 2022

Depends on hiero-ledger/hiero-sdk-js#1261

@Nana-EC Nana-EC modified the milestones: 0.9.0, 0.10 Oct 4, 2022
@Nana-EC
Copy link
Collaborator

Nana-EC commented Oct 4, 2022

sdk-js has released https://github.com/hashgraph/hedera-sdk-js/releases/tag/v2.18.3 which should expose ContractFunctionResult.
Let's verify it provides the needed info

@Ivo-Yankov Ivo-Yankov self-assigned this Oct 5, 2022
Repository owner moved this from Sprint BackLog to Done in Smart Contract Sprint Board Oct 12, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working limechain
Projects
Archived in project
Development

Successfully merging a pull request may close this issue.

3 participants