Skip to content

Conversation

@saucepoint
Copy link
Collaborator

@saucepoint saucepoint commented Aug 5, 2024

Related Issue

Some tasks from #265

Description of changes

A new helper function getFuzzySingleEncoded which randomly returns an encoded call for a single operation -- mint, increase, decrease, and burn.

  • modifyLiquiditesWithoutUnlock fails on external calls without PM being unlocked
  • test that all liquidity operations fail for all subscriber re-entrancy -- on-subscribe, on-unsubscribe, on-notifyModifyLiquidity, on-notifyTransferFrom
  • test that all liquidity operations fail for all liquidity hooks -- beforeAdd, beforeRemove, afterAdd, afterRemove

@saucepoint saucepoint marked this pull request as ready for review August 5, 2024 16:30
@saucepoint saucepoint requested a review from snreynolds August 14, 2024 18:07
// subscriber did not modify liquidity
assertEq(lpm.ownerOf(tokenId), address(this)); // owner still owns the position
assertEq(lpm.nextTokenId(), tokenId + 1); // no new token minted
assertEq(lpm.getPositionLiquidity(tokenId, config), 100e18); // liquidity unchanged
Copy link
Member

Choose a reason for hiding this comment

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

assert subscriber is addr 0 and hasSubscriber is false?

}

/// @dev subscribers cannot re-enter posm on-unsubscribe since PM is not unlocked
function test_fuzz_subscriber_unsubscribe_reenter_revert(uint256 seed) public {
Copy link
Member

Choose a reason for hiding this comment

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

not a revert test?

}
}

function notifyModifyLiquidity(uint256, PositionConfig memory, int256) external onlyByPosm {
Copy link
Member

Choose a reason for hiding this comment

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

update interface

@saucepoint saucepoint requested a review from snreynolds August 21, 2024 15:27
Comment on lines +291 to +297
abi.encodeWithSelector(
CustomRevert.WrappedError.selector,
address(hookModifyLiquidities),
IHooks.beforeRemoveLiquidity.selector,
abi.encodeWithSelector(ReentrancyLock.ContractLocked.selector),
abi.encodeWithSelector(Hooks.HookCallFailed.selector)
)
Copy link
Member

Choose a reason for hiding this comment

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

lol this is the craziest revert

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.

3 participants