Skip to content

Commit

Permalink
pallet-contracts: Fix compilation on latest nightly (paritytech#2986)
Browse files Browse the repository at this point in the history
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: paritytech#2960
(cherry picked from commit 0e124a0)
  • Loading branch information
bkchr authored and pmikolajczyk41 committed Feb 21, 2024
1 parent 23ee3cb commit 82803c9
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions substrate/frame/contracts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1153,6 +1153,9 @@ struct InternalOutput<T: Config, O> {
result: Result<O, ExecError>,
}

// 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<T: Config>: Sized {
Expand All @@ -1168,9 +1171,6 @@ trait Invokable<T: Config>: 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<T>) -> InternalOutput<T, Self::Output> {
// 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
Expand Down

0 comments on commit 82803c9

Please sign in to comment.