Skip to content
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
13 changes: 10 additions & 3 deletions libevmasm/Assembly.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -589,7 +589,8 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
Json const& _json,
std::vector<std::string> const& _sourceList,
size_t _level,
std::optional<uint8_t> _eofVersion
std::optional<uint8_t> _eofVersion,
EVMVersion _evmVersion
)
{
solRequire(_json.is_object(), AssemblyImportException, "Supplied JSON is not an object.");
Expand Down Expand Up @@ -620,7 +621,7 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
"Member 'sourceList' may only be present in the root JSON object."
);

auto result = std::make_shared<Assembly>(EVMVersion{}, _level == 0 /* _creation */, _eofVersion, "" /* _name */);
auto result = std::make_shared<Assembly>(_evmVersion, _level == 0 /* _creation */, _eofVersion, "" /* _name */);
std::vector<std::string> parsedSourceList;
if (_json.contains("sourceList"))
{
Expand Down Expand Up @@ -687,7 +688,13 @@ std::pair<std::shared_ptr<Assembly>, std::vector<std::string>> Assembly::fromJSO
solThrow(AssemblyImportException, "The key '" + key + "' inside '.data' is out of the supported integer range.");
}

auto [subAssembly, emptySourceList] = Assembly::fromJSON(value, _level == 0 ? parsedSourceList : _sourceList, _level + 1, _eofVersion);
auto [subAssembly, emptySourceList] = Assembly::fromJSON(
value,
_level == 0 ? parsedSourceList : _sourceList,
_level + 1,
_eofVersion,
_evmVersion
);
solAssert(subAssembly);
solAssert(emptySourceList.empty());
solAssert(subAssemblies.count(index) == 0);
Expand Down
3 changes: 2 additions & 1 deletion libevmasm/Assembly.h
Original file line number Diff line number Diff line change
Expand Up @@ -211,7 +211,8 @@ class Assembly
Json const& _json,
std::vector<std::string> const& _sourceList = {},
size_t _level = 0,
std::optional<uint8_t> _eofVersion = std::nullopt
std::optional<uint8_t> _eofVersion = std::nullopt,
langutil::EVMVersion _evmVersion = {}
);

/// Mark this assembly as invalid. Calling ``assemble`` on it will throw.
Expand Down
2 changes: 1 addition & 1 deletion libevmasm/EVMAssemblyStack.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ void EVMAssemblyStack::analyze(std::string const& _sourceName, Json const& _asse
{
solAssert(!m_evmAssembly);
m_name = _sourceName;
std::tie(m_evmAssembly, m_sourceList) = evmasm::Assembly::fromJSON(_assemblyJson, {}, 0, m_eofVersion);
std::tie(m_evmAssembly, m_sourceList) = evmasm::Assembly::fromJSON(_assemblyJson, {}, 0, m_eofVersion, m_evmVersion);
solRequire(m_evmAssembly != nullptr, AssemblyImportException, "Could not create evm assembly object.");
}

Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
".code": [
{"name": "PUSH", "value": "0"}
]
}
// ====
// EVMVersion: =paris
// outputs: Bytecode,Opcodes
// ----
// Bytecode: 6000
// Opcodes: PUSH1 0x0
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
{
".code": [
{"name": "PUSH", "value": "0"}
]
}
// ====
// EVMVersion: =shanghai
// outputs: Bytecode,Opcodes
// ----
// Bytecode: 5f
// Opcodes: PUSH0