The PerpetualVault
contract lacks event emissions for important state changes.
Affected functions: cancelOrder()
, claimCollateralRebates()
, afterOrderExecution()
, afterLiquidationExecution()
, and afterOrderCancellation()
.
cancelOrder()
claimCollateralRebates()
afterOrderExecution()
afterLiquidationExecution()
afterOrderCancellation()
The following functions lack event emissions:
Order cancellations (cancelOrder()
)
Collateral rebate claims (claimCollateralRebates()
)
Execution state transitions (afterOrderExecution()
)
Liquidation events (afterLiquidationExecution()
)
Order cancellation events (afterOrderCancellation()
)
The absence of these events breaks the guarantees of transparency and auditability, as key state changes in the contract cannot be tracked off-chain.
Impact: Medium.
Missing events reduce visibility into critical state changes, such as order cancellations, collateral claims, executions, and liquidations.
This impacts off-chain monitoring systems and dApp functionalities, making it difficult for users and external services to track these events.
Likelihood: Medium.
The lack of events does not cause immediate contract failure, but it compromises the contract's transparency and monitoring in the long term.
As the contract scales and more actions are processed, the impact of this issue will increase.
No Event Emission Example:
After an order cancellation (cancelOrder()
), no event is emitted to notify external systems about the state change.
No event for collateral rebate claims in claimCollateralRebates()
, leaving external systems unaware of when a user claims their rebate.
State changes during order execution in afterOrderExecution()
are not logged, making it impossible for external monitoring systems to track these executions.
No event emitted during liquidation in afterLiquidationExecution()
, leaving no external way to detect liquidation events.
Fix: Add event emissions for the following key functions in PerpetualVault
contract:
cancelOrder()
: Emit an OrderCancelled
event.
claimCollateralRebates()
: Emit a CollateralRebateClaimed
event.
afterOrderExecution()
: Emit an OrderExecuted
event.
afterLiquidationExecution()
: Emit a LiquidationExecuted
event.
afterOrderCancellation()
: Emit an OrderCancelled
event.
Fixed Code Example:
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.
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.
The contest is live. Earn rewards by submitting a finding.
This is your time to appeal against judgements on your submissions.
Appeals are being carefully reviewed by our judges.