-
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
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.
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 and the ones without 0x
are actually decimal.
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.
Didn't find anything wrong, just a few nitpicks and suggestions
ce8ca0a
to
f1723b6
Compare
@cameel question about the settings: I'm trying to change the expected runs, but it's not working as I expect. What am I doing wrong here?
(at a high run, the last one should be a PUSH32) |
@moh-eulith It's because the top-level object contains the initcode, which runs only once so the compiler uses Right now it's still possible to test this, but you have to use the full JSON syntax (see |
f1723b6
to
fe39551
Compare
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.