DeFiFoundry
50,000 USDC
View results
Submission Details
Severity: low
Invalid

"Burn Event Emitted Before Actual Burn Operation, Causing Potential Inconsistencies

Summary:

In the contract 'PerpetualVault.sol' in the function '_handleReturn' these lines have incorrect order

emit Burned(depositId, depositInfo[depositId].recipient, depositInfo[depositId].shares, amount);
_burn(depositId);

Vulnerability Details:

Currently, the function emits the Burned event before calling _burn(depositId). If _burn somehow fails, for example due to a revert in its implementation, then the event Burned would still be emitted even though the actual burn operation did not happen.

This could lead to inaccurate accounting and misleading logs, making debugging and tracking of burned deposits more difficult.

Impact:

Incorrect event logging: Off-chain systems or developers relying on logs may incorrectly assume the deposit was burned.

Harder debugging: If _burn fails, the logs will not reflect the actual contract state.

Tools Used:

Manual review

Recommendations:

To ensure correctness, swap the order:

  1. First, execute _burn(depositId); to guarantee that the burn operation is successful.

  2. Then emit the Burned event only if the burn has actually occurred.

corrected code:

_burn(depositId);
emit Burned(depositId, depositInfo[depositId].recipient, depositInfo[depositId].shares, amount);
Updates

Lead Judging Commences

n0kto Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Suppositions

There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.

n0kto Lead Judge 8 months ago
Submission Judgement Published
Invalidated
Reason: Incorrect statement
Assigned finding tags:

Informational or Gas

Please read the CodeHawks documentation to know which submissions are valid. If you disagree, provide a coded PoC and explain the real likelihood and the detailed impact on the mainnet without any supposition (if, it could, etc) to prove your point.

Suppositions

There is no real proof, concrete root cause, specific impact, or enough details in those submissions. Examples include: "It could happen" without specifying when, "If this impossible case happens," "Unexpected behavior," etc. Make a Proof of Concept (PoC) using external functions and realistic parameters. Do not test only the internal function where you think you found something.

Support

FAQs

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