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

UNI-1020 safe downcasting arithmetic operation. #78

Merged
merged 6 commits into from
Jan 17, 2023

Conversation

twygod
Copy link
Contributor

@twygod twygod commented Dec 5, 2022

No description provided.

@twygod twygod requested review from maxweng and GeraldHost December 5, 2022 08:21
Copy link
Member

@maxweng maxweng left a comment

Choose a reason for hiding this comment

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

LGTM

Copy link

@dmitriia dmitriia left a comment

Choose a reason for hiding this comment

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

Looks ok, but here safecast still needs to be added:

uint256 remaining = IAssetManager(assetManager).withdraw(stakingToken, msg.sender, amount);
if (uint96(remaining) > amount) {
revert AssetManagerWithdrawFailed();
}
uint96 actualAmount = amount - uint96(remaining);

        uint256 remaining = IAssetManager(assetManager).withdraw(stakingToken, msg.sender, amount);
        if (uint96(remaining) > amount) {
            revert AssetManagerWithdrawFailed();
        }
        uint96 actualAmount = amount - uint96(remaining);

@maxweng maxweng deleted the findings/uni-1020-96-unsafe-downcasting-arithmetic branch February 17, 2023 04:01
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