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 retrieval of revert reason by using the same weiAmount in the call. #1656

Merged
merged 3 commits into from
Apr 27, 2022

Conversation

alexdupre
Copy link
Contributor

What does this PR do?

It fixes the retrieval of the tx revert reason, by using the same weiValue amount that was used in the failed transaction.

Where should the reviewer start?

Consider this simplified test case contract:

contract Test {

    function test(uint n) external payable {
        require(msg.value > 0, 'msg.value must be positive');
        require(msg.value == n, 'msg.value must be equal to n');
    }
}

Then call it with n == 2 and weiAmount == 1, and you'll get a super misleading msg.value must be positive error message.

Why is it needed?

Because it drove me crazy for 24h to debug a complex smart contract when the thrown errors were in completely different code locations.

@alexdupre alexdupre requested a review from conor10 as a code owner March 10, 2022 12:05
@stale
Copy link

stale bot commented Apr 16, 2022

This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.

@stale stale bot added the stale no activity for 21 days label Apr 16, 2022
@alexdupre
Copy link
Contributor Author

This bot is annoying, the PR is still valid and just needs to be merged.

@stale stale bot removed the stale no activity for 21 days label Apr 20, 2022
@andrii-kl andrii-kl self-requested a review April 27, 2022 16:14
…n-fix

# Conflicts:
#	core/src/main/java/org/web3j/tx/Contract.java
@andrii-kl andrii-kl self-assigned this Apr 27, 2022
@andrii-kl andrii-kl merged commit f9eeacc into hyperledger-web3j:master Apr 27, 2022
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.

4 participants