-
Notifications
You must be signed in to change notification settings - Fork 6.1k
evmasm test case #16012
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
base: develop
Are you sure you want to change the base?
evmasm test case #16012
Conversation
// TODO: Enable when assembly import for EOF is implemented. | ||
if (CommonOptions::get().eofVersion().has_value()) | ||
m_shouldRun = false; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The test case can easily be extended support EOF, but we need to implement assembly import for EOF first.
d712f7f
to
1fd7f7d
Compare
1fd7f7d
to
ce8ca0a
Compare
if (!immediateArgument.starts_with("0x")) | ||
BOOST_THROW_EXCEPTION(std::runtime_error(formatError("The immediate argument to PUSH must be a hex number prefixed with '0x'."))); | ||
|
||
immediateArgument.remove_prefix("0x"s.size()); | ||
codeJSON.push_back({{"name", "PUSH"}, {"value", immediateArgument}}); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's quite annoying that the JSON format accepts only hex numbers here but without the 0x
prefix. On the other hand for tag
it accepts both both and the ones without 0x
are actually decimal.
Adds a new custom test case that accepts EVM assembly as input, which allows inspecting the results of assembly import and evmasm optimizer. It should replace the Boost-based optimizer tests from
test/libevmasm/Optimiser.cpp
as well as the command-line tests for assembly import.The test case can take the assembly in JSON format as well as a simplified text format that can be easily post-processed into JSON ("plain assembly"). Plain assembly is currently very limited, but should still be enough to cover #15935. It allows using all opcodes as well as tags and jumps. It does not yet support subassemblies, data, metadata or the less common types of assembly items, but the format is designed to accommodate them and I'm going to add them in subsequent PRs.