An implementation issue has been identified where large but valid trades could be unnecessarily rejected due to an overly restrictive type constraint in the position size calculations.
The function performs a conversion from SD59x18
to int128
through an intermediate int256
. Under Solidity 0.8.25, which includes built-in overflow checks, this creates a hard limitation where trades will revert if the position size doesn't fit within int128 bounds (approximately ±1.7e38).
The int128 constraint creates a functional limitation rather than a security risk. Large but otherwise valid trades will revert due to the type conversion, not because they exceed any intended business limits. The reversion occurs at the type conversion level rather than at a meaningful business logic check. This creates an artificial ceiling on position sizes that isn't driven by market requirements.
Given a large but valid trade size:
Modify the Position library to accept SD59x18
directly:
This allows position sizes to be limited by actual business rules rather than type constraints:
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.