Skip to content

Commit

Permalink
Validate EOF code before execution in evm fixture
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Apr 13, 2023
1 parent 4caa839 commit d7eb5d5
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions test/unittests/evm_fixture.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
// SPDX-License-Identifier: Apache-2.0
#pragma once

#include "evmone/eof.hpp"
#include <evmc/mocked_host.hpp>
#include <gtest/gtest.h>
#include <intx/intx.hpp>
Expand Down Expand Up @@ -79,6 +80,12 @@ class evm : public testing::TestWithParam<evmc::VM*>
host.access_account(msg.recipient);
}

if (rev >= EVMC_CANCUN && is_eof_container(code))
{
ASSERT_EQ(get_error_message(validate_eof(rev, code)),
get_error_message(EOFValidationError::success));
}

result = vm.execute(host, rev, msg, code.data(), code.size());
output = {result.output_data, result.output_size};
gas_used = msg.gas - result.gas_left;
Expand Down

0 comments on commit d7eb5d5

Please sign in to comment.