Skip to content

Commit

Permalink
Remove redundant checks
Browse files Browse the repository at this point in the history
  • Loading branch information
gumb0 committed Feb 17, 2025
1 parent e1c6ea8 commit a7dbe62
Showing 1 changed file with 9 additions and 27 deletions.
36 changes: 9 additions & 27 deletions test/statetest/statetest_loader.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -507,38 +507,20 @@ void validate_state(const TestState& state, evmc_revision rev)
!acc.storage.empty())
throw std::invalid_argument("empty account with non-empty storage at " + hex0x(addr));

Check warning on line 508 in test/statetest/statetest_loader.cpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest_loader.cpp#L507-L508

Added lines #L507 - L508 were not covered by tests

if (is_code_delegated(acc.code))
if (rev >= EVMC_PRAGUE && is_code_delegated(acc.code) &&
acc.code.size() != std::size(DELEGATION_MAGIC) + sizeof(evmc::address))

Check warning on line 511 in test/statetest/statetest_loader.cpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest_loader.cpp#L511

Added line #L511 was not covered by tests
{
if (rev >= EVMC_PRAGUE)
{
if (acc.code.size() != std::size(DELEGATION_MAGIC) + sizeof(evmc::address))
{
throw std::invalid_argument(
"EIP-7702 delegation designator at " + hex0x(addr) + " has invalid size");
}
}
else
{
throw std::invalid_argument(
"unexpected code with EIP-7702 delegation prefix at " + hex0x(addr));
}
throw std::invalid_argument(
"EIP-7702 delegation designator at " + hex0x(addr) + " has invalid size");

Check warning on line 514 in test/statetest/statetest_loader.cpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest_loader.cpp#L514

Added line #L514 was not covered by tests
}

if (is_eof_container(acc.code))
if (rev >= EVMC_OSAKA && is_eof_container(acc.code))
{
if (rev >= EVMC_OSAKA)
{
if (const auto result = validate_eof(rev, ContainerKind::runtime, acc.code);
result != EOFValidationError::success)
{
throw std::invalid_argument(
"EOF container at " + hex0x(addr) +
" is invalid: " + std::string(get_error_message(result)));
}
}
else
if (const auto result = validate_eof(rev, ContainerKind::runtime, acc.code);
result != EOFValidationError::success)
{
throw std::invalid_argument("unexpected code with EOF prefix at " + hex0x(addr));
throw std::invalid_argument("EOF container at " + hex0x(addr) + " is invalid: " +
std::string(get_error_message(result)));

Check warning on line 523 in test/statetest/statetest_loader.cpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest_loader.cpp#L522-L523

Added lines #L522 - L523 were not covered by tests
}
}

Expand Down

0 comments on commit a7dbe62

Please sign in to comment.