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-251] [Fix] ottersec advisory check issues #128

Merged
merged 9 commits into from
Dec 19, 2024
Merged

[PDE-251] [Fix] ottersec advisory check issues #128

merged 9 commits into from
Dec 19, 2024

Conversation

ungaro
Copy link
Contributor

@ungaro ungaro commented Dec 18, 2024

What's new in this PR?

  1. accrueYield iterates through potentially all of YieldDistributionTokenStorage::deposits to calculate the amount of yield a user is owed. there’s a hacky gasleft to break out of the loop, but it seems unstable and creates a dependency on gas costs. importantly, it also means that the yield might not be fully up to date after accrueYield, creating a strange edgecase. can you use a more traditional yield per token model to calculate the amount of yield owed?
    Using yield per token model now.

  2. do you expect AssetTokenStorage::{whitelist, holders} to ever contain a non-trivial amount of addresses?
    removed arrays and loops, added events so they can be indexed

some other general questions:

  1. what’s the intention of using the from.call(abi.encodeWithSelector(…)) pattern? why not just cast from to ISmartWallet and do the function call directly?
    The Solidity compiler adds a check that the target address has extcodesize > 0 and otherwise reverts for high-level calls, so we have to use a low-level call here

  2. is there sample code using _notifyRedeem and _notifyDeposit? the example USDT.sol doesn’t use these functions, and they seem unused throughout the rest of the codebase

  3. it seems like whitelist isn’t used anywhere in the code. would it make sense to use.
    removed whitelist array

@ungaro ungaro requested a review from eyqs December 18, 2024 08:59
smart-wallets/src/interfaces/IYieldDistributionToken.sol Outdated Show resolved Hide resolved
smart-wallets/src/token/AssetToken.sol Show resolved Hide resolved
smart-wallets/src/token/AssetToken.sol Show resolved Hide resolved
smart-wallets/src/token/AssetToken.sol Show resolved Hide resolved
Copy link
Member

Choose a reason for hiding this comment

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

Is this file severely out of date?

Copy link
Contributor Author

@ungaro ungaro Dec 18, 2024

Choose a reason for hiding this comment

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

check
#91
#54
#67 (deleted, keeping here for comments)
#129 (new 67)

@eyqs
Copy link
Member

eyqs commented Dec 18, 2024

Discussed offline - better to make the smart contract smaller and rely on offchain event indexing.

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

@eyqs eyqs merged commit d0fb773 into main Dec 19, 2024
1 check passed
@eyqs eyqs deleted the alp/PDE-251 branch December 19, 2024 04:33
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