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
  • Loading branch information
bkchr authored Jan 18, 2024
1 parent a7285c0 commit bf9513b
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 @@ -1228,6 +1228,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 @@ -1243,9 +1246,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 bf9513b

Please sign in to comment.