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(receipt): use from address #9998

Merged
merged 2 commits into from
Mar 4, 2025

Conversation

MaxMustermann2
Copy link
Contributor

Motivation

When calling cast receipt, the failure reason is generated via eth_call. However, the from address during this call is not correctly set to the one in the transaction. This leads to spurious "Ownable: caller is not the owner" errors, which do not represent the true failure reason for the transaction.

Solution

This PR fixes the above issue by setting the from value correctly, before invoking eth_call. Included is a unit test for a transaction on Sepolia to demonstrate the difference. Without the PR, the revert reason was incorrectly reported as "Ownable: caller is not the owner" instead of the actual revert reason "Counter is too large".

PR Checklist

  • Added Tests
    - [ ] Added Documentation
    - [ ] Breaking changes

When calling `cast receipt`, the failure reason is generated via
`eth_call`. However, the `from` address during this call is not
correctly set to the one in the transaction. This leads to spurious
"Ownable: caller is not the owner" errors, which do not represent the
true failure reason for the transaction. This PR fixes that issue.

Added a unit test for a Sepolia transaction to capture this case.
Without the PR, the revert reason was incorrectly reported as "Ownable:
caller is not the owner" instead of the actual revert reason "Counter is
too large"
Copy link
Member

@zerosnacks zerosnacks left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Makes sense! Thanks

@zerosnacks zerosnacks merged commit e7a840f into foundry-rs:master Mar 4, 2025
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
Status: No status
Development

Successfully merging this pull request may close these issues.

2 participants