Skip to content

Commit

Permalink
Add test for missed coverage
Browse files Browse the repository at this point in the history
  • Loading branch information
pdobacz committed May 7, 2024
1 parent 903dae2 commit dd5078b
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions test/unittests/state_transition_eof_create_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1107,6 +1107,24 @@ TEST_F(state_transition, creation_tx_nested_eofcreate)
expect.post[create_address_nested].nonce = 1;
}

TEST_F(state_transition, creation_tx_invalid_initcode_header)
{
rev = EVMC_PRAGUE;
const auto deploy_container = eof_bytecode(bytecode(OP_INVALID));

const auto init_code = returncontract(0, 0, 0);
bytes init_container = eof_bytecode(init_code, 2).container(deploy_container);

assert(init_container[3] == 0x01);
init_container[3] = 0x04; // Data section as first section in the header invalid.

tx.data = init_container;

expect.post[Sender].nonce = pre.get(Sender).nonce + 1;
expect.status = EVMC_FAILURE;
expect.gas_used = 53516;
}

TEST_F(state_transition, creation_tx_invalid_initcode)
{
rev = EVMC_PRAGUE;
Expand Down

0 comments on commit dd5078b

Please sign in to comment.