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

AUDIT: 36903 #192

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

AUDIT: 36903 #192

wants to merge 4 commits into from

Conversation

coachchucksol
Copy link
Contributor

  • Call process_update_vault first thing in the mint_to function. This is the least invasive way of solving this issue, at the cost of some double checking of accounts

Entry:
36903 (High) "The vault reward mechanism can be sandwiched by MEV"

UpdateVaultBalance is not strictly required before mint, or other actions involving vault.deposited_tokens, so new depositors can claim an unfairly large portion of rewards. The reports describe a scenario where rewards have been deposited, but the vault balance has not yet been updated. If a new depositor mints tokens before the balance update, they are included in the reward distribution calculation. In this way, they can claim a share of rewards that they did not contribute to.

The following are duplicates of this submission:

37311 "Attackers can steal rewards by depositing, updating vault balance and withdrawing immediately after a large reward is deposited"

27295 "Rewards can be stolen by depositing immediately after reward tokens get sent to vault"

37315 "Theft of Unclaimed Yields Due to Improper Reward Distribution in Vault Program"

Copy link

codecov bot commented Jan 24, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Project coverage is 80.71%. Comparing base (c736bca) to head (0fd6ce2).

Additional details and impacted files
@@            Coverage Diff             @@
##           master     #192      +/-   ##
==========================================
+ Coverage   80.70%   80.71%   +0.01%     
==========================================
  Files          91       91              
  Lines        9944     9953       +9     
==========================================
+ Hits         8025     8034       +9     
  Misses       1919     1919              

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@ebatsell
Copy link
Contributor

Need to remove overlap code from #191

vault_fee_token_account.clone(),
token_program.clone(),
];
process_update_vault_balance(program_id, &accounts)?;
Copy link
Contributor

Choose a reason for hiding this comment

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

this can brick minting if gets in state where effective rate isn't ok?

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