Gas: shadow pools are only required for burn types #12
Labels
bug
Warden finding
G (Gas Optimization)
sponsor confirmed
Sponsor agrees this is a problem and intends to fix it (OK to use w/ "disagree with severity")
Handle
cmichel
Vulnerability details
The
PoolCommiter.shadowPools
track commitments for all fourLong/Short Mint/Burn
types and uses these to reconstruct the initial total supply to correctly compute the token amounts for the sequence of commitments (as short/long tokens already get burned in the commitment phase and reduced the total supply).However, the two burn types
LongBurn
andShortBurn
are all that's needed for the reconstruction which can be seen from the fact thatshadowPools[.]
is only accessed with them.Recommendation
Only store
shadowPools
forLongBurn
andShortBurn
types, and remove theshadowPools[_commitType] = shadowPools[_commitType] - _commit.amount;
statement in_uncommit
which is unnecessary for the mints as it just pays out what's already tracked in the commitments (_commit
).The text was updated successfully, but these errors were encountered: