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

[PDE-586] audit remediations 2 #150

Merged
merged 10 commits into from
Jan 13, 2025
Merged

[PDE-586] audit remediations 2 #150

merged 10 commits into from
Jan 13, 2025

Conversation

ungaro
Copy link
Member

@ungaro ungaro commented Jan 9, 2025

What's new in this PR?

  • In YieldToken, it seems that in the current receiveYield implementation, when the YieldToken receives currency as yield, not only does the accrued yield increase, but the users' share values also inflated due to the conversion dependency on totalAssets held by YieldToken. This means users get additional value from the yield beyond what they should receive.

  • In AggregateToken, during buyVaultToken, it seems that the approval should be granted to the vault instead of the teller based on the BoringVault.enter source code.

  • Additionally, we recommend you not to trust user-provided address inputs. For example, during buyVaultToken, if the price off-chain calculation depends on the totalAsset held by the AggregateToken, users could pass a dummy teller address to inflate their share values. After redemption, due to the unused approval, users could still recover their asset.
    Another thing to consider is whether it would make sense to limit this function to just MANAGER_ROLE, similar to buyComponentToken?

  • It seems that the current implementation of withdraw is using rounding down during calculating the shares. Users might be able to withdraw assets while burning fewer shares than they should. This can lead to loss of funds, especially when dealing with large share values.

  • It seems that in the NestStaking contract, users can deploy as many aggregate tokens as they want via createAggregateToken. If the list grows larger, the gas cost of the unfeatureToken function might increase significantly during iteration to find the correct item to remove.

@ungaro ungaro requested a review from eyqs January 9, 2025 19:56
Copy link
Member

@eyqs eyqs left a comment

Choose a reason for hiding this comment

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

LGTM

nest/src/ComponentToken.sol Outdated Show resolved Hide resolved
nest/src/NestStaking.sol Outdated Show resolved Hide resolved
nest/src/NestStaking.sol Show resolved Hide resolved
nest/src/ComponentToken.sol Outdated Show resolved Hide resolved
@ungaro ungaro merged commit 223af8d into main Jan 13, 2025
1 check passed
@ungaro ungaro deleted the alp/PDE-586 branch January 13, 2025 05:06
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.

2 participants