Part 2

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

Missing Events in clear::CreditDelegation.sol

Summary

The CreditDelegation library is missing event emissions in its clear() function, which makes it difficult to track when credit delegations are cleared off-chain.

Vulnerability Details

The clear() function in CreditDelegation.sol deletes all storage variables related to a credit delegation but does not emit any event to record this action. This makes it challenging for off-chain applications and monitoring systems to track when credit delegations are cleared.
Location: src/market-making/leaves/CreditDelegation.sol, line 54

Impact

  • Lack of event emission makes it difficult to track and audit credit delegation clearing operations

  • Off-chain applications cannot easily monitor when credit delegations are cleared

  • Reduced transparency in the system's operation

Tools Used

  • Manual code review

Recommendations

Add an event declaration and emit it in the clear() function. Here's the suggested modification:

// ... existing code ...
library CreditDelegation {
using SafeCast for int256;
// Add event declaration
event CreditDelegationCleared(uint128 vaultId, uint128 marketId);
// ... existing code ...
function clear(Data storage self) internal {
emit CreditDelegationCleared(self.vaultId, self.marketId);
delete self.vaultId;
delete self.marketId;
delete self.weight;
delete self.valueUsd;
delete self.lastVaultDistributedRealizedDebtUsdPerShare;
delete self.lastVaultDistributedUnrealizedDebtUsdPerShare;
delete self.lastVaultDistributedUsdcCreditPerShare;
delete self.lastVaultDistributedWethRewardPerShare;
}
// ... existing code ...
}

This change will allow off-chain applications to track when credit delegations are cleared, improving the system's transparency and auditability.

Updates

Lead Judging Commences

inallhonesty Lead Judge 7 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.