Non Reentrant

Overview

This policy prevents a consumer from re-entering the same method of a your smart contracts in a single transaction - which is a well-known attack vector called Reentrancy.

Protected Attack Vector

This policy protects agains reentrancy attacks.

How It Works

  1. When a transaction reaches the policy, it keeps track of the fact that the consumer has visited the method currently being executed.

  2. If the method is called again by the consumer before exiting, the policy will block the transaction.

  3. If not, once the currently-executing method has finished, we clear the visitation count for the consumer.

Properties

NameTypeDescription

hasEnteredConsumer

mapping

(address => bool)

a mapping of consumers that have visited the currently-executing method

Security Lifecycle

This policy runs during both the Firewall's Pre Execution and the Post Execution hooks.

Source Code

On our GitHub repository: NonReentrantPolicy.sol

Last updated