What is the gas overhead of ReentrancyGuard?

status = 1 is only an SLOAD. But the value is read before for the require statement.

The cost breakdown will be:

  1. Warm up storage slot: 2000
  2. SLOAD: 100
  3. SSTORE: 2900
  4. SSTORE: 100, refunds 2800

So roughly it will be 2300 = 2000 + 100 + 2900 + 100 - 2800. However, the refund is capped at 20% of the total cost of a transaction, so -2800 may not fully realize and the net cost may be higher.

1 Like