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

feat(cast): cast send tries to decode custom errors #8860

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rplusq
Copy link
Contributor

@rplusq rplusq commented Sep 12, 2024

Co-authored-by: Howard [email protected]

Motivation

Even though issue #8606 is partially solved, this would be an improvement over the UX. Only applies this for ch

Nightly cast send:

cast send 0x5FbDB2315678afecb367f032d93F642f64180aa3 "setValue(uint256)" 101 --private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80
Error:
server returned an error response: error code 3: execution reverted: custom error 7a0e1985:ed, data: "0x7a0e198500000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000064"

Our PR:

cast send 0x5FbDB2315678afecb367f032d93F642f64180aa3 "setValue(uint256)" 101 --private-key=0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80

Error: 
Reverted with custom error: 
 Possible methods:
 - ValueTooHigh(uint256,uint256)
 ------------
 [000]: 0000000000000000000000000000000000000000000000000000000000000065
 [020]: 0000000000000000000000000000000000000000000000000000000000000064


Context:
- server returned an error response: error code 3: execution reverted: custom error 7a0e1985:ed, data: "0x7a0e198500000000000000000000000000000000000000000000000000000000000000650000000000000000000000000000000000000000000000000000000000000064"

Solution

Using pretty_calldata to decode the custom error.

@rplusq
Copy link
Contributor Author

rplusq commented Sep 17, 2024

Thinking it solves #8603 as well

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant