Skip to content

Commit 0e124a0

Browse files
authored
pallet-contracts: Fix compilation on latest nightly (#2986)
Apparently they changed detection for visibility identifiers on traits, which broke more than it should. There is an issue open: rust-lang/rust#119924 The easy solution for us is to move the declaration of the global variable outside of the trait. Closes: #2960
1 parent dcc7652 commit 0e124a0

File tree

1 file changed

+3
-3
lines changed
  • substrate/frame/contracts/src

1 file changed

+3
-3
lines changed

substrate/frame/contracts/src/lib.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1228,6 +1228,9 @@ struct InternalOutput<T: Config, O> {
12281228
result: Result<O, ExecError>,
12291229
}
12301230

1231+
// Set up a global reference to the boolean flag used for the re-entrancy guard.
1232+
environmental!(executing_contract: bool);
1233+
12311234
/// Helper trait to wrap contract execution entry points into a single function
12321235
/// [`Invokable::run_guarded`].
12331236
trait Invokable<T: Config>: Sized {
@@ -1243,9 +1246,6 @@ trait Invokable<T: Config>: Sized {
12431246
/// We enforce a re-entrancy guard here by initializing and checking a boolean flag through a
12441247
/// global reference.
12451248
fn run_guarded(self, common: CommonInput<T>) -> InternalOutput<T, Self::Output> {
1246-
// Set up a global reference to the boolean flag used for the re-entrancy guard.
1247-
environmental!(executing_contract: bool);
1248-
12491249
let gas_limit = common.gas_limit;
12501250

12511251
// Check whether the origin is allowed here. The logic of the access rules

0 commit comments

Comments
 (0)