Developer Finds Double-Counted 21,000 Gas Bug in Smart Contract Refund Logic
A developer building Legwork, a smart contract for recurring on-chain payments on Arc mainnet, discovered a gas refund miscalculation during a post-deployment audit. The contract was incorrectly crediting the 21,000 gas intrinsic transaction cost once per order execution call, rather than once per transaction, causing over-refunds when multiple orders were batched together. For a batch of K orders in a single transaction, executors were being overpaid by 21,000 × (K − 1) gas units, though no funds were exploited and refunds were bounded by each order's reserve. The bug was identified the day after the README claimed refunds were exact, and a fix was implemented by tracking whether the intrinsic cost had already been credited within a transaction. The corrected contract remains live on Arc mainnet, with the full audit trail and receipts preserved in the public MIT-licensed repository.
This is an AI-generated summary. ShortSingh links to the original source for the complete article.


Discussion (0)
Log in to join the discussion and vote.
Log in