Skip to content

Commit

Permalink
Ensure that global context is not reused with a mismatched evm version
Browse files Browse the repository at this point in the history
  • Loading branch information
r0qs committed Jan 18, 2024
1 parent b7c4131 commit 652696a
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions libsolidity/interface/CompilerStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -235,6 +235,9 @@ void CompilerStack::setEVMVersion(langutil::EVMVersion _version)
if (m_stackState >= ParsedAndImported)
solThrow(CompilerError, "Must set EVM version before parsing.");
m_evmVersion = _version;
// GlobalContext depends on evmVersion since the Cancun hardfork.
// Therefore, we reset it whenever we set a new EVM version, ensuring that the context is never reused with a mismatched version.
m_globalContext.reset();
}

void CompilerStack::setEOFVersion(std::optional<uint8_t> _version)
Expand Down

0 comments on commit 652696a

Please sign in to comment.