The KeeperProxy validates both indexToken
and longToken
prices separately even though they are currently the same
token in GMX markets. This causes unnecessary gas consumption, but could serve as a safety check for future market
implementations.
Current Documentation on the PerpetualVault:
This was stated in there
Price Validation:
Each _check
operation:
which takes more time and since if token are same and the longToken price is not been used in the Perpetualvault then
this is a redundant check and can be removed to save gas.
LOW/Gas Optimization because:
Extra gas cost from redundant validations
Current duplication serves as safety check for future markets
No security risk, just efficiency concern
May be intentional for upgrade-proofing
Gas Cost Per Validation:
Chainlink Oracle call
Storage reads for maxTimeWindow
Price conversion operations
Multiple require checks
Keep current implementation but use correct price fields:
This way even if longToken is different then the currect calculation is done
Add flag with proper price fields:
Add flag to validate longToken separately if still in Gmx market
Add documentation for future upgrades:
This approach:
Maintains separate validations for future-proofing
Uses correct price fields for each token
Allows for future markets where indexToken ≠ longToken
No need to update validation logic during upgrades
The key change is using prices.longTokenPrice
instead of prices.indexTokenPrice
for longToken validation, making the
code more robust for future markets.
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.