Skip to content

Commit

Permalink
create2 test
Browse files Browse the repository at this point in the history
  • Loading branch information
chfast committed Apr 12, 2023
1 parent d350363 commit dae0072
Showing 1 changed file with 13 additions and 0 deletions.
13 changes: 13 additions & 0 deletions test/unittests/state_transition_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,19 @@
using namespace evmc::literals;
using namespace evmone::test;

TEST_F(state_transition, create2_factory)
{
static constexpr auto create_address = 0xfd8e7707356349027a32d71eabc7cb0cf9d7cbb4_address;

const auto factory_code = calldatacopy() + create2().input(0, calldatasize());
const auto initcode = mstore8(0, push(0xFE)) + ret(0, 1);

pre.get(*tx.to).code = factory_code;
tx.data = initcode;
expect.post[*tx.to].nonce = pre.get(*tx.to).nonce + 1; // CREATE caller's nonce must be bumped
expect.post[create_address].code = bytes{0xFE};
}

TEST_F(state_transition, eof_invalid_initcode)
{
// TODO: Correction of this address is not verified.
Expand Down

0 comments on commit dae0072

Please sign in to comment.