-
Notifications
You must be signed in to change notification settings - Fork 35
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
Update vault.accountAppBalanceDelta
logic flow from app
#203
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.
lgtm
BalanceDelta delta, | ||
BalanceDelta hookDelta, | ||
address settler | ||
) internal { |
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.
Still thinking if we add a new function accountAppBalanceDelta in vault, pass all delta once , will reduce call times , maybe will save some gas
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.
yeh, will check on this after all tests added
vault.accountAppBalanceDelta
logic flow from app vault.accountAppBalanceDelta
logic flow from app
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.
lgtm
applied #205 on this PR as we prefer making the changes on vault (gas savings) |
library VaultAppDeltaSettlement { | ||
/// @notice helper method to call `vault.accountAppBalanceDelta` | ||
/// @dev Vault maintains a `reserveOfApp` to protect against exploits in one app from accessing funds in another. | ||
/// To prevent underflow in `reserveOfApp`, it is essential to handle `appDelta` and `hookDelta` in a specific order. |
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.
do we still need this comments ,"it is essential to handle ...."?
because now no order logic.
_accountDeltaForApp(currency0, delta0 + hookDelta0);
_accountDeltaForApp(currency1, delta1 + hookDelta1);
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.
thanks, cleaned up
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.
lgtm
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.
LGTM
f224fa6
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.
lgtm
Description:
hookDelta
anddelta
are sent tovault.accountAppBalanceDelta
hookDelta
thendelta
-- however this might lead tounderflow
scenario onreservesOfApp
This PR fixes it by ensuring we send the delta or hookDelta which increases reserveOfApp before deducting reserveOfApp