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

TRUST H2 #1013

Merged
merged 12 commits into from
Nov 30, 2023
Merged

TRUST H2 #1013

merged 12 commits into from
Nov 30, 2023

Conversation

jankjr
Copy link
Contributor

@jankjr jankjr commented Nov 10, 2023

  • Write tests to test for inflation attacks.
  • Implement fix

@jankjr jankjr changed the title add unit test for base RewardableVault and AaveTokenizedDeposit vault… Trust H-2. Inflate shares before claiming rewards for contract. Nov 10, 2023
@jankjr jankjr changed the title Trust H-2. Inflate shares before claiming rewards for contract. Trust H2 Nov 10, 2023
Copy link
Collaborator

@pmckelvy1 pmckelvy1 left a comment

Choose a reason for hiding this comment

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

let's document the current plan and reasoning at the top of the morpho collateral plugin / wrapper

test/plugins/RewardableERC20.test.ts Outdated Show resolved Hide resolved
…s to check if it's possible to frontrun claiming rewards
Copy link

Trust H2

Generated at commit: 02e87a650944efb5435f2d348204e2d0ce3a9012

🚨 Vulnerabilities Summary

Process Issues Results
Contract Inspector high
note
low
critical
Total
1
37
18
2
58
Dependency Checker Total 0

For more details view the full report in OpenZeppelin Code

Copy link
Collaborator

@pmckelvy1 pmckelvy1 left a comment

Choose a reason for hiding this comment

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

i think this pr is moving the right direction, but the new linear-reward-stream accounting seems to just be in parallel to the old accounting, and not actually affecting anything.

i think we should add a bunch of tests proving that the linear stream works, and then make them pass by integrating it correctly.

@jankjr jankjr changed the title Trust H2 WIP: Trust H2 Nov 22, 2023
@jankjr jankjr changed the title WIP: Trust H2 draft: Trust H2 Nov 22, 2023
@pmckelvy1 pmckelvy1 changed the title draft: Trust H2 TRUST H2 Nov 29, 2023
Copy link
Member

@akshatmittal akshatmittal left a comment

Choose a reason for hiding this comment

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

So, something I see in this implementation is that the rewards aren't quite streaming but rather calling sync() updates how much of the rewards are 'unlocked'. I don't hate it, but I feel like if sync isn't called for a while we'd be locking rewards for quite some time. Maybe worth calling sync on withdraw/deposit just to make sure it's a bit more frequent. (Edit: nvm, seems _claimAndSyncRewards() is called on every transfer anyway, forgot about that)

Additionally, I was originally imagining this would work like Convex or StakeDAO on how they stream rewards over a week. To me, that makes more sense but I also see why it's done this way since it's extending the RewardableERC20 contract.

Looks good to me!

@pmckelvy1 pmckelvy1 merged commit abf9f46 into 3.1.0 Nov 30, 2023
9 checks passed
@pmckelvy1 pmckelvy1 deleted the audit/trust-h2 branch November 30, 2023 02:09
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.

3 participants