When user has consumed a lot of gas and value of gasUsed
is high, they are incorectly charged a very less gasFee due to unsafe typecasting from uint256
to uint88
. As per protocol comments: By basing gasFee off of baseFee instead of priority, adversaries are prevent from draining the TAPP
- this is violated in such cases.
m.gasFee
is calculated as:
Data types of these variables are:
uint88
m.gasFee
uint256
gasUsedblock.basefee is
uint256
block.basefee
is set as 1_000_000_000 on local chain (is even higher on mainnet). For any value of around gasUsed >= 0.30949 ether
, the value of m.gasFee
would be calculated as disproportionately low.
Note that these lines of code are inside the _performForcedBid()
function which calls createForcedBid()
on Line 239 which has a shortHintArray
param. An attacker could pass a large array here and cause such high gas usage.
Create a new file under test/
folder named MathCastingGasFee.t.sol
and run the following code via forge test --mt test_casting_gas -vv
:
Output:
gasFee256
is the actual value while gasFee88
is the down-casted one used by the protocol.
By basing gasFee off of baseFee instead of priority, adversaries are prevent from draining the TAPP
- this protocol objective is violated when adversary consumes a lot of gas.
Manual inspection.
Use a safe typecasting library or a custom function which reverts in such cases. Example of such a function could be:
And then use it in code:
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.