When the execution fees are refunded the Solidity transfer function is used which uses a fixed stipend of 2300 gas. If this is insufficient then this error is caught and ignored, and consequently the refund will never be received.
On GmxProxy:343, the owner of the deposit is sent back the refund amount using transfer. It is possible this might revert due to insufficient gas. Then in PerpetualVault (lines 783, 1148, 1226, 1232) this error is caught and ignored.
To verify this, you can add the following contract to PerpetualVault.t.sol:
Also add the below test case to PerpetualVaultTest and run using
forge test --mp test/PerpetualVault.t.sol --match-test test_failedRefund --via-ir --rpc-url arbitrum -vvv .
If a contract is used to deposit or withdraw then it will not receive the required refund if it uses more than 2300 gas.
Foundry
Consider adding refund amounts into a mapping rather than returning directly to the deposit owners. Create a separate function through which deposit owners can claim the refunds themselves and delete them from the mapping.
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.