PerpetualVault.sol -> afterOrderExecution() function
The protocol's state machine can become permanently corrupted during Arbitrum chain reorganizations due to the following critical issues:
Asynchronous State Updates:
The vault updates its state in response to GMX callbacks
These updates occur across multiple blocks and transactions
During a chain reorg, some transactions may be dropped while others remain
Incomplete State Recovery:
When a chain reorg occurs, the vault has no mechanism to detect that its state is now inconsistent
The state machine assumes all previous transactions were successful
No rollback mechanism exists for partially completed operations
Race Conditions During Reorgs:
Multiple keepers can attempt to handle the same position during a reorg
The vault cannot distinguish between legitimate and reorged callbacks
This leads to state corruption when handling concurrent operations
Permanent State Corruption Scenarios:
If GMX execution succeeds but callback fails due to reorg
If callback succeeds but position update fails due to reorg
If keeper operations are split across the reorg boundary
An attacker could exploit this by:
Monitoring the network for signs of instability or high reorg probability
Opening a large position when network instability is detected
Using the reorg to manipulate which transactions get included
Forcing the vault into an unrecoverable state
Permanent vault lockup requiring contract upgrade
Complete loss of functionality for all users
Stuck funds with no recovery mechanism
System-wide denial of service
Implement the following safeguards to protect against chain reorganizations:
Transaction Ordering and State Verification:
Reorg Detection and Recovery:
State Checkpointing System:
Additional recommendations:
Implement proper monitoring for chain reorganizations
Add automated circuit breaker triggers
Consider using a timelock for sensitive operations
Maintain comprehensive state checkpoints
Add emergency shutdown capabilities for extreme cases
Implement proper logging and monitoring of reorg events
Consider using a more conservative confirmation threshold for L2s
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.
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.