-
Notifications
You must be signed in to change notification settings - Fork 12
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
test: bulker #765
test: bulker #765
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice !! 🔥
Some suggestions to improve the testing suite as I think it's not 100% complete:
- Add some random (or not if too complex) sequences of tx because we are only testing one tx at a time
- Make sure that it's not possible to borrow, withdraw on behalf of someone else. Example: Alice deposits some WETH as collateral, bob should be able to borrow, withdrawCollateral in any way
(actions[0], data[0]) = _getWrapStETHData(amount); | ||
|
||
bulker.execute(actions, data); | ||
assertEq(ERC20(sNative).balanceOf(address(bulker)), IWSTETH(sNative).getWstETHByStETH(amount), "bulker balance"); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
in general you also test that the stETH balance is zero
assertApproxEqAbs(morpho.borrowBalance(borrowedMarket.underlying, delegator), 0, 2, "onBehalf borrow balance"); | ||
} | ||
|
||
// asset amount receiver maxiterations |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
to remove I guess?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Whoops, yes. I put this as a note for myself so I wouldn't have to reference later haha.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Requesting changes then
I agree with your other points, but this particular one I'm not sure we can actually address. There is simply no entry point to ever do an action on behalf of anyone else in the bulker, as the parameters sent to Morpho are strictly based on msg.sender. So testing this would simply be testing msg.sender. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test suite could be extended with invariant tests in order to test several actions one after the others (I can work on it)
I think we can consider invariant tests to be in a different scope and can be completely separated into another PR. |
Separate PR for testing the bulker to prevent clutter in the feat PR while I work on this.