Skip to content

Commit

Permalink
eof: Do not pad code for EOF
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Sep 28, 2022
1 parent 9cd510a commit c1eca5b
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 3 deletions.
5 changes: 2 additions & 3 deletions lib/evmone/baseline.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,8 @@ CodeAnalysis analyze_legacy(bytes_view code)

CodeAnalysis analyze_eof1(bytes_view eof_container, const EOF1Header& header)
{
// TODO: Padding code for EOF is not needed.
const auto code = eof_container.substr(header.code_begin(), header.code_size);
return {pad_code(code), analyze_jumpdests(code)};
const auto executable_code = eof_container.substr(header.code_begin(), header.code_size);
return {executable_code.data(), analyze_jumpdests(executable_code)};
}
} // namespace

Expand Down
4 changes: 4 additions & 0 deletions lib/evmone/baseline.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,10 @@ class CodeAnalysis
jumpdest_map{std::move(map)},
m_padded_code{std::move(padded_code)}
{}

CodeAnalysis(const uint8_t* code, JumpdestMap map)
: executable_code{code}, jumpdest_map{std::move(map)}
{}
};
static_assert(std::is_move_constructible_v<CodeAnalysis>);
static_assert(std::is_move_assignable_v<CodeAnalysis>);
Expand Down

0 comments on commit c1eca5b

Please sign in to comment.