Part 2

Zaros
PerpetualsDEXFoundrySolidity
70,000 USDC
View results
Submission Details
Severity: medium
Invalid

Missing Reward Accrual Before Critical Parameter Updates Leading to Unfair Reward Distribution

summary/impact:

Updating parameters (e.g., lockedCreditRatio, swap strategies, fees) in Vault.sol without first accruing pending rewards/debt allows new parameters to retroactively affect historical rewards, unfairly penalizing users.

lockedCreditRatio (credit locking %) and swap strategies are updated without accruing pending rewards.

Increasing lockedCreditRatio without accruing rewards recalculates locked funds using the new ratio, reducing claimable rewards.

POC:

// Add to Vault.t.sol
function test_UnfairRewardsAfterRatioChange() public {
// 1. Deploy vault with lockedCreditRatio = 10%
vault.update(Vault.UpdateParams({
vaultId: 1,
lockedCreditRatio: 0.1e18, // 10%
// ... other params
}));
// 2. Simulate rewards accrual (100 WETH)
_simulateRewards(vaultId, 100e18);
// 3. Update ratio to 20% WITHOUT accruing
vault.update(Vault.UpdateParams({
vaultId: 1,
lockedCreditRatio: 0.2e18, // 20%
// ... other params
}));
// 4. User claims rewards: receives 80 WETH instead of 90
uint256 claimed = vault.claimFees(user);
assertLt(claimed, 90e18); // Fails (shows loss)
}

Tools Used- manual review

Recommendations-Modify the update() function to accrue all pending rewards/debt before applying the new lockedCreditRatio

function update(UpdateParams memory params) internal {
Data storage self = load(params.vaultId);
// 1. ACCRUE: Force update of all pending rewards/debt using CURRENT lockedCreditRatio
uint256[] memory vaultIds = new uint256[](1);
vaultIds[0] = params.vaultId;
recalculateVaultsCreditCapacity(vaultIds); // 🛡️ Accrues pending values
// 2. UPDATE: Now safely apply the new ratio to FUTURE rewards/debt
self.lockedCreditRatio = params.lockedCreditRatio;
self.depositCap = params.depositCap;
// ... rest of the updates
}
Updates

Lead Judging Commences

inallhonesty Lead Judge
7 months ago
inallhonesty Lead Judge 7 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Appeal created

1stephen Submitter
6 months ago
inallhonesty Lead Judge
6 months ago
inallhonesty Lead Judge 6 months ago
Submission Judgement Published
Invalidated
Reason: Non-acceptable severity

Support

FAQs

Can't find an answer? Chat with us on Discord, Twitter or Linkedin.