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

[POC] Demo: Standard Error Wrapping #244

Closed
wants to merge 1 commit into from

Conversation

saucepoint
Copy link
Collaborator

Related Issue

Exploring the ergonomics of wrapped error handling

Description of changes

constructor(IPoolManager _poolManager) SafeCallback(_poolManager) {}

/// @notice internal function that triggers the execution of a set of actions on v4
/// @dev inheriting contracts should call this function to trigger execution
function _executeActions(bytes calldata unlockData) internal {
poolManager.unlock(unlockData);
try poolManager.unlock(unlockData) {}
catch (bytes memory error) {
Copy link
Contributor

Choose a reason for hiding this comment

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

I would suggest renaming error because it's a reserved keyword

Copy link
Member

Choose a reason for hiding this comment

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

we usually use reason... and it will also match the input in the bubble up error definitions

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.

this is just bubbling up from modify? are we not doing multicall as well>

constructor(IPoolManager _poolManager) SafeCallback(_poolManager) {}

/// @notice internal function that triggers the execution of a set of actions on v4
/// @dev inheriting contracts should call this function to trigger execution
function _executeActions(bytes calldata unlockData) internal {
poolManager.unlock(unlockData);
try poolManager.unlock(unlockData) {}
catch (bytes memory error) {
Copy link
Member

Choose a reason for hiding this comment

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

we usually use reason... and it will also match the input in the bubble up error definitions

try poolManager.unlock(unlockData) {}
catch (bytes memory error) {
if (bytes4(error) == IPoolManager.CurrencyNotSettled.selector) {
revert Wrap__CurrencyNotSettled(address(poolManager), error);
Copy link
Contributor

Choose a reason for hiding this comment

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

why are we calling out this one in particular as different? even though its being bubbled too?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

just picked this one as an easy revert to catch individually, gonna confer with daniel on whether we need to individually handle reverts as best as we can vs using the generic catchall handler

@saucepoint
Copy link
Collaborator Author

upon further discussions, we agreed that a contract should only Wrap__ and revert if the call was made to an arbitrary/non-static address

taking a look at posm, we are not making any calls to arbitrary addresses until subscriber is merged in. closing for now, but will reference in the future

@saucepoint saucepoint closed this Aug 2, 2024
@saucepoint saucepoint deleted the poc-standard-wrapping branch August 5, 2024 06:27
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