In the event that transferring tokens during a claim reverts, emitting the MerkleAirdrop::Claimed
event raises gas costs for reverted transactions. Emitting the event before reverting incurs an extra 1,320 gas units. To mitigate this, emit the event after attempting to transfer tokens during a claim; no extra gas cost is incurred for successful calls.
In the event that transferring tokens during a claim reverts, emitting the MerkleAirdrop::Claimed
event raises gas costs for reverted transactions.
MerkleAirdrop.sol
Temporarily add the following functions to the MerkleAirdrop
contract.
MerkleAirdropTest.t.sol
Gas cost to emit the event, then revert: 8,096
Gas cost to revert before emitting: 6,776
Savings in the event of a revert: 1,320
Emitting the event before reverting incurs an extra 1,320 gas units.
Manual Analysis, Foundry Tests
Emit the event after attempting to transfer tokens during a claim; no extra gas cost is incurred for successful calls.
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.