Skip to main content

What Is the Overhead of Using a Reentrancy Guard?

The overhead of using a reentrancy guard is the additional gas cost associated with reading and writing a boolean state variable to storage for every protected function call. Storing and retrieving data from the EVM's storage is one of the most expensive operations.

While the security benefit vastly outweighs the cost, the overhead is a factor that developers must consider, especially for high-frequency functions. Modern Solidity and compiler optimizations have reduced this overhead, but it remains a cost for enhanced security.

How Can a Reentrancy Guard Modifier Offer a Simpler Alternative to This Pattern?
Can a Reentrancy Guard Be Bypassed?
What Are the Differences between Single-Function and Cross-Function Reentrancy Attacks?
What Is a Mutex in Traditional Programming, and How Does It Relate to a Reentrancy Guard?