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

fix(rpc): show data in when cast send result in custom error #1129

Merged
merged 4 commits into from
Aug 6, 2024

Conversation

cuiweixie
Copy link
Contributor

Motivation

➜  foundry_test git:(master) ✗ cast send 0x5FbDB2315678afecb367f032d93F642f64180aa3  "customError()" --private-key $PK
Error:
server returned an error response: error code 3: execution reverted:

cast send result in execution revert with out reason(data) is hard to debug.

old version of cast send result would be like:

(code: 3, message: execution reverted: CustomError3333, data: Some(String("0x8d6ea8be0000000000000000000000000000000000000000000000000000000000000020000000000000000000000000000000000000000000000000000000000000000f437573746f6d4572726f72333333330000000000000000000000000000000000"))) 

it's good to make cast send print data like "0x8d6ea8be...".

Solution

add data to print in fmt

PR Checklist

  • Added Tests
  • Added Documentation
  • Breaking changes

@cuiweixie
Copy link
Contributor Author

crates/json-rpc/src/response/error.rs Outdated Show resolved Hide resolved
@cuiweixie cuiweixie requested a review from mattsse August 6, 2024 13:37
@cuiweixie
Copy link
Contributor Author

cargo_test_workspace.log

cargo test --workspace

run successfully in local machine, please rerun the workflows.

@mattsse
Copy link
Member

mattsse commented Aug 6, 2024

needs cargo +nightly fmt and clippy

@cuiweixie
Copy link
Contributor Author

cuiweixie commented Aug 6, 2024

needs cargo +nightly fmt and clippy

done. please rerun the workflows.

@mattsse mattsse merged commit 512c8ad into alloy-rs:main Aug 6, 2024
22 checks passed
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.

2 participants