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

multicall: bubble up revert reason #236

Merged
merged 15 commits into from
Aug 4, 2024
Merged

multicall: bubble up revert reason #236

merged 15 commits into from
Aug 4, 2024

Conversation

saucepoint
Copy link
Collaborator

Related Issue

Closes #175

Description of changes

Modify Multicall.sol to bubble up custom reverts with arguments

@@ -20,7 +26,7 @@ abstract contract Multicall is IMulticall {
}
}
// Next 5 lines from https://ethereum.stackexchange.com/a/83577
if (result.length < 68) revert();
if (result.length < 68) CallFailed.selector.bubbleUpAndRevertWith();
Copy link
Member

Choose a reason for hiding this comment

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

not sure about this 68 length check.. but why wouldnt we want to bubble up if > 68 ?

Copy link
Contributor

Choose a reason for hiding this comment

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

because in old-solidity errors couldnt be less than 68 bytes, so it meant there was no error to bubble

@saucepoint saucepoint added the posm position manager label Aug 1, 2024
@saucepoint saucepoint marked this pull request as ready for review August 1, 2024 21:59
Copy link
Member

@snreynolds snreynolds left a comment

Choose a reason for hiding this comment

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

i think once you merge the other bubble reverts into this PR would be nice to test with those Wrapped reverts to make sure we're surfacing those properly in the multicall

src/base/Multicall.sol Outdated Show resolved Hide resolved
Copy link
Member

@snreynolds snreynolds left a comment

Choose a reason for hiding this comment

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

noice looks good to me

// confirm expected length of the revert
try multicall.revertWithBytes(data) {}
catch (bytes memory reason) {
// errors with 0 bytes are by default 64 bytes of data (length & pointer?) + 4 bytes of selector
Copy link
Member

Choose a reason for hiding this comment

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

errors with 0 bytes of data outside the selector? thats super interesting.. didnt know that i guess that explains the 68 number

@saucepoint saucepoint merged commit 86b5ea3 into main Aug 4, 2024
3 checks passed
@saucepoint saucepoint deleted the posm-bubble-reverts branch August 4, 2024 01:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
posm position manager
Projects
None yet
Development

Successfully merging this pull request may close these issues.

[posm]: Bubble up reverts
3 participants