Skip to content

Better safeguard against incompatible builtin handles between dialects #15961

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions libevmasm/SemanticInformation.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -317,7 +317,7 @@ bool SemanticInformation::isDupInstruction(AssemblyItem const& _item)
if (_item.type() != evmasm::Operation)
return false;
auto inst = _item.instruction();
return Instruction::DUP1 <= inst && inst <= Instruction::DUP16;
return (Instruction::DUP1 <= inst && inst <= Instruction::DUP16) || inst == Instruction::DUPN;
}

bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item)
Expand All @@ -327,7 +327,7 @@ bool SemanticInformation::isSwapInstruction(AssemblyItem const& _item)
if (_item.type() != evmasm::Operation)
return false;
auto inst = _item.instruction();
return Instruction::SWAP1 <= inst && inst <= Instruction::SWAP16;
return (Instruction::SWAP1 <= inst && inst <= Instruction::SWAP16) || inst == Instruction::SWAPN;
}

bool SemanticInformation::altersControlFlow(AssemblyItem const& _item)
Expand Down
16 changes: 7 additions & 9 deletions liblangutil/EVMVersion.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,6 @@
#include <string>
#include <vector>

#include <boost/operators.hpp>


namespace solidity::evmasm
{
Expand All @@ -44,13 +42,13 @@ namespace solidity::langutil
* A version specifier of the EVM we want to compile to.
* Defaults to the latest version deployed on Ethereum Mainnet at the time of compiler release.
*/
class EVMVersion:
boost::less_than_comparable<EVMVersion>,
boost::equality_comparable<EVMVersion>
class EVMVersion
{
public:
EVMVersion() = default;

static EVMVersion current() { return {currentVersion}; }

static EVMVersion homestead() { return {Version::Homestead}; }
static EVMVersion tangerineWhistle() { return {Version::TangerineWhistle}; }
static EVMVersion spuriousDragon() { return {Version::SpuriousDragon}; }
Expand Down Expand Up @@ -96,11 +94,10 @@ class EVMVersion:
static EVMVersion firstWithEOF() { return {Version::Osaka}; }

bool isExperimental() const {
return *this > EVMVersion{};
return m_version > currentVersion;
}

bool operator==(EVMVersion const& _other) const { return m_version == _other.m_version; }
bool operator<(EVMVersion const& _other) const { return m_version < _other.m_version; }
auto operator<=>(EVMVersion const&) const = default;

std::string name() const
{
Expand Down Expand Up @@ -164,10 +161,11 @@ class EVMVersion:
Prague,
Osaka,
};
static auto constexpr currentVersion = Version::Cancun;

EVMVersion(Version _version): m_version(_version) {}

Version m_version = Version::Cancun;
Version m_version = currentVersion;
};

}
Loading