# Censorship resistance is undermined and bridging of assets can be DOSed at low cost

ResourceMetering's per-block prevBoughtGas cap lets an attacker front-run a victim's depositTransaction with an 8M-gas deposit, reverting the victim's L1->L2 bridge for ~$12.80.

- Payout: Contest reward
- Severity: medium
- Program: Optimism
- Credited: obront
- Disclosed: 2023-01-19
- Write-up quality: 6/10
- Original: https://github.com/sherlock-audit/2023-01-optimism-judging/issues/277
- Library page: https://bugbountylibrary.com/r/sherlock%3A2023-01-optimism%3AM-2
- Tags: domain:web3 impact:dos kind:contest platform:sherlock sev:medium tech:evm tech:solidity technique:source-review vuln:business-logic vuln:dos

**Target:** OptimismPortal.depositTransaction / ResourceMetering metered modifier
**Root cause:** prevBoughtGas is reset each block and capped at MAX_RESOURCE_LIMIT; a single max-gas deposit consumes the whole per-block budget, so any subsequent deposit in the same block reverts.
**Steps:**
1. Observe victim's depositTransaction in mempool.
2. Submit flashbot bundle: attacker depositTransaction with gasLimit = 8M (MAX_RESOURCE_LIMIT) first, victim TX second.
3. Attacker TX sets params.prevBoughtGas to MAX_RESOURCE_LIMIT; victim TX fails the `prevBoughtGas <= MAX_RESOURCE_LIMIT` require and reverts.
4. Cost = 8e6 * 1e9 / basefee * basefee ≈ 8e15 wei ≈ $12.80 at $1600 ETH.
**How found:** Code review of ResourceMetering's per-block prevBoughtGas accounting; noticed the cap is reset per block and that a single max-gas deposit exhausts it, then computed the ETH cost of buying 8M gas.
**Exploitation:** Mempool sniping with a flashbot bundle ordering a max-resource deposit ahead of the victim's deposit, causing the victim's L1->L2 transaction to revert; repeatable each block to censor deposits.
**Insight:** When a per-block resource budget is reset each block and consumed by a single max-size request, the cost to exhaust it equals the cost of one max deposit — compare attacker cost to victim cost; if similar, griefing is cheap.
