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 Revert message propagation #163

Merged
merged 2 commits into from
Nov 22, 2023
Merged

Fix Revert message propagation #163

merged 2 commits into from
Nov 22, 2023

Conversation

nlordell
Copy link
Collaborator

@nlordell nlordell commented Nov 21, 2023

This PR fixes a revert message propagation issue where the length of revert bytes was the offset of the return data in memory and not its actual length 🤦. It turns out that because of how ABI encoding works, the tests were not catching this issue since in that particular test the offset was alway larger than the actual length of the revert message. In theory, this is UB (as the offset it not guaranteed to be larger than the message, although, in practice it is not a serious issue, as it appears the compiler is allocating memory for the raw call result and then copying with a loop the ABI-decoded returnData memory bytes after it, so the offset of returnData will always be greater than its size, and the current implementation just returns too many bytes).

Adjusted tests to ensure the exact revert data is propagated.

@nlordell nlordell requested a review from a team as a code owner November 21, 2023 16:00
@nlordell nlordell requested review from rmeissner, akshay-ap, mmv08 and remedcu and removed request for a team November 21, 2023 16:00
Copy link
Member

@mmv08 mmv08 left a comment

Choose a reason for hiding this comment

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

I knew there was something wrong 🤦 Great catch!

@nlordell nlordell merged commit 307a3b4 into master Nov 22, 2023
@nlordell nlordell deleted the fix-revert-propagation branch November 22, 2023 10:11
@github-actions github-actions bot locked and limited conversation to collaborators Nov 22, 2023
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants