diff --git a/substrate/frame/contracts/src/lib.rs b/substrate/frame/contracts/src/lib.rs index a15006e6388c0..533085f2b874f 100644 --- a/substrate/frame/contracts/src/lib.rs +++ b/substrate/frame/contracts/src/lib.rs @@ -1228,6 +1228,9 @@ struct InternalOutput { result: Result, } +// Set up a global reference to the boolean flag used for the re-entrancy guard. +environmental!(executing_contract: bool); + /// Helper trait to wrap contract execution entry points into a single function /// [`Invokable::run_guarded`]. trait Invokable: Sized { @@ -1243,9 +1246,6 @@ trait Invokable: Sized { /// We enforce a re-entrancy guard here by initializing and checking a boolean flag through a /// global reference. fn run_guarded(self, common: CommonInput) -> InternalOutput { - // Set up a global reference to the boolean flag used for the re-entrancy guard. - environmental!(executing_contract: bool); - let gas_limit = common.gas_limit; // Check whether the origin is allowed here. The logic of the access rules