mirror of
https://github.com/ethereum/solidity
synced 2023-10-03 13:03:40 +00:00
Complete POC.
This commit is contained in:
parent
ffb3a2bdd9
commit
6cfe620f43
@ -175,8 +175,8 @@ enum class Instruction: uint8_t
|
|||||||
LOG3, ///< Makes a log entry; 3 topics.
|
LOG3, ///< Makes a log entry; 3 topics.
|
||||||
LOG4, ///< Makes a log entry; 4 topics.
|
LOG4, ///< Makes a log entry; 4 topics.
|
||||||
|
|
||||||
SWAP_N = 0xB0,
|
DUP_N = 0xB3,
|
||||||
DUP_N,
|
SWAP_N,
|
||||||
|
|
||||||
CREATE = 0xf0, ///< create a new account with associated code
|
CREATE = 0xf0, ///< create a new account with associated code
|
||||||
CALL, ///< message-call into an account
|
CALL, ///< message-call into an account
|
||||||
|
@ -57,10 +57,12 @@ public:
|
|||||||
static EVMVersion berlin() { return {Version::Berlin}; }
|
static EVMVersion berlin() { return {Version::Berlin}; }
|
||||||
static EVMVersion london() { return {Version::London}; }
|
static EVMVersion london() { return {Version::London}; }
|
||||||
static EVMVersion paris() { return {Version::Paris}; }
|
static EVMVersion paris() { return {Version::Paris}; }
|
||||||
|
static EVMVersion shanghai() { return {Version::Shanghai}; }
|
||||||
|
static EVMVersion cancun() { return {Version::Cancun}; }
|
||||||
|
|
||||||
static std::optional<EVMVersion> fromString(std::string const& _version)
|
static std::optional<EVMVersion> fromString(std::string const& _version)
|
||||||
{
|
{
|
||||||
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris()})
|
for (auto const& v: {homestead(), tangerineWhistle(), spuriousDragon(), byzantium(), constantinople(), petersburg(), istanbul(), berlin(), london(), paris(), shanghai(), cancun()})
|
||||||
if (_version == v.name())
|
if (_version == v.name())
|
||||||
return v;
|
return v;
|
||||||
return std::nullopt;
|
return std::nullopt;
|
||||||
@ -83,6 +85,8 @@ public:
|
|||||||
case Version::Berlin: return "berlin";
|
case Version::Berlin: return "berlin";
|
||||||
case Version::London: return "london";
|
case Version::London: return "london";
|
||||||
case Version::Paris: return "paris";
|
case Version::Paris: return "paris";
|
||||||
|
case Version::Shanghai: return "shanghai";
|
||||||
|
case Version::Cancun: return "cancun";
|
||||||
}
|
}
|
||||||
return "INVALID";
|
return "INVALID";
|
||||||
}
|
}
|
||||||
@ -104,7 +108,7 @@ public:
|
|||||||
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
|
bool canOverchargeGasForCall() const { return *this >= tangerineWhistle(); }
|
||||||
|
|
||||||
private:
|
private:
|
||||||
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris };
|
enum class Version { Homestead, TangerineWhistle, SpuriousDragon, Byzantium, Constantinople, Petersburg, Istanbul, Berlin, London, Paris, Shanghai, Cancun };
|
||||||
|
|
||||||
EVMVersion(Version _version): m_version(_version) {}
|
EVMVersion(Version _version): m_version(_version) {}
|
||||||
|
|
||||||
|
@ -65,6 +65,7 @@ CompilabilityChecker::CompilabilityChecker(
|
|||||||
|
|
||||||
for (StackTooDeepError const& error: transform.stackErrors())
|
for (StackTooDeepError const& error: transform.stackErrors())
|
||||||
{
|
{
|
||||||
|
yulAssert(false, "Still stack too deeps??");
|
||||||
unreachableVariables[error.functionName].emplace(error.variable);
|
unreachableVariables[error.functionName].emplace(error.variable);
|
||||||
int& deficit = stackDeficit[error.functionName];
|
int& deficit = stackDeficit[error.functionName];
|
||||||
deficit = std::max(error.depth, deficit);
|
deficit = std::max(error.depth, deficit);
|
||||||
|
@ -76,7 +76,7 @@ void EVMObjectCompiler::run(Object& _object, bool _optimize)
|
|||||||
yulAssert(_object.code, "No code.");
|
yulAssert(_object.code, "No code.");
|
||||||
if (m_eofVersion.has_value())
|
if (m_eofVersion.has_value())
|
||||||
yulAssert(
|
yulAssert(
|
||||||
_optimize && (m_dialect.evmVersion() == langutil::EVMVersion()),
|
_optimize && (m_dialect.evmVersion() >= langutil::EVMVersion()),
|
||||||
"Experimental EOF support is only available for optimized via-IR compilation and the most recent EVM version."
|
"Experimental EOF support is only available for optimized via-IR compilation and the most recent EVM version."
|
||||||
);
|
);
|
||||||
if (_optimize && m_dialect.evmVersion().canOverchargeGasForCall())
|
if (_optimize && m_dialect.evmVersion().canOverchargeGasForCall())
|
||||||
|
@ -82,6 +82,7 @@ void StackToMemoryMover::run(
|
|||||||
Block& _block
|
Block& _block
|
||||||
)
|
)
|
||||||
{
|
{
|
||||||
|
yulAssert(_numRequiredSlots == 0, "NEEDED STACK TO MEMORY AFTER ALL???");
|
||||||
VariableMemoryOffsetTracker memoryOffsetTracker(_reservedMemory, _memorySlots, _numRequiredSlots);
|
VariableMemoryOffsetTracker memoryOffsetTracker(_reservedMemory, _memorySlots, _numRequiredSlots);
|
||||||
StackToMemoryMover stackToMemoryMover(
|
StackToMemoryMover stackToMemoryMover(
|
||||||
_context,
|
_context,
|
||||||
|
@ -148,7 +148,7 @@ void CommonOptions::validate() const
|
|||||||
if (enforceGasTest)
|
if (enforceGasTest)
|
||||||
{
|
{
|
||||||
assertThrow(
|
assertThrow(
|
||||||
evmVersion() == langutil::EVMVersion{},
|
evmVersion() >= langutil::EVMVersion{},
|
||||||
ConfigException,
|
ConfigException,
|
||||||
"Gas costs can only be enforced on latest evm version."
|
"Gas costs can only be enforced on latest evm version."
|
||||||
);
|
);
|
||||||
|
@ -124,6 +124,10 @@ EVMHost::EVMHost(langutil::EVMVersion _evmVersion, evmc::VM& _vm):
|
|||||||
m_evmRevision = EVMC_LONDON;
|
m_evmRevision = EVMC_LONDON;
|
||||||
else if (_evmVersion == langutil::EVMVersion::paris())
|
else if (_evmVersion == langutil::EVMVersion::paris())
|
||||||
m_evmRevision = EVMC_PARIS;
|
m_evmRevision = EVMC_PARIS;
|
||||||
|
else if (_evmVersion == langutil::EVMVersion::shanghai())
|
||||||
|
m_evmRevision = EVMC_SHANGHAI;
|
||||||
|
else if (_evmVersion == langutil::EVMVersion::cancun())
|
||||||
|
m_evmRevision = EVMC_CANCUN;
|
||||||
else
|
else
|
||||||
assertThrow(false, Exception, "Unsupported EVM version");
|
assertThrow(false, Exception, "Unsupported EVM version");
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user