Skip to content

Commit

Permalink
eof: Optimize EOF validation by using std::move (#1036)
Browse files Browse the repository at this point in the history
Optimize `validate_instructions()` by using `std::move` on arguments to
returned `InstructionValidationResult`.
  • Loading branch information
chfast authored Sep 30, 2024
1 parent 46dc5ee commit 8e4a055
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions lib/evmone/eof.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -346,10 +346,11 @@ std::variant<InstructionValidationResult, EOFValidationError> validate_instructi
if (is_returning != declared_returning)
return EOFValidationError::invalid_non_returning_flag;

return InstructionValidationResult{subcontainer_references, accessed_code_sections};
return InstructionValidationResult{
std::move(subcontainer_references), std::move(accessed_code_sections)};
}

/// Validates that that we don't rjump inside an instruction's immediate.
/// Validates that we don't rjump inside an instruction's immediate.
/// Requires that the input is validated against truncation.
bool validate_rjump_destinations(bytes_view code) noexcept
{
Expand Down

0 comments on commit 8e4a055

Please sign in to comment.