Skip to content

Commit

Permalink
Fix format
Browse files Browse the repository at this point in the history
  • Loading branch information
hugo-dc committed May 21, 2024
1 parent dcd2850 commit d2b9c2a
Show file tree
Hide file tree
Showing 4 changed files with 18 additions and 16 deletions.
5 changes: 2 additions & 3 deletions test/statetest/statetest.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,18 +118,17 @@ inline std::string hex0x(const intx::uint256& v, const bool padding_zeros = true
{
std::string hexStr = intx::hex(v);
if (!padding_zeros)
hexStr.replace(0, hexStr.find_first_not_of('0'), "");
hexStr.replace(0, hexStr.find_first_not_of('0'), "");

Check warning on line 121 in test/statetest/statetest.hpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest.hpp#L119-L121

Added lines #L119 - L121 were not covered by tests

return "0x" + hexStr;

Check warning on line 123 in test/statetest/statetest.hpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest.hpp#L123

Added line #L123 was not covered by tests
}

/// Encodes bytes as hex with 0x prefix.
inline std::string hex0x(const bytes_view& v, const bool padding_zeros = true)

Check warning on line 127 in test/statetest/statetest.hpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest.hpp#L127

Added line #L127 was not covered by tests
{

std::string hexStr = evmc::hex(v);
if (!padding_zeros)
hexStr.replace(0, hexStr.find_first_not_of('0'), "");
hexStr.replace(0, hexStr.find_first_not_of('0'), "");

Check warning on line 131 in test/statetest/statetest.hpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest.hpp#L129-L131

Added lines #L129 - L131 were not covered by tests

return "0x" + hexStr;

Check warning on line 133 in test/statetest/statetest.hpp

View check run for this annotation

Codecov / codecov/patch

test/statetest/statetest.hpp#L133

Added line #L133 was not covered by tests
}
Expand Down
8 changes: 5 additions & 3 deletions test/unittests/state_transition.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -225,9 +225,11 @@ void state_transition::export_state_test(
jstorage_keys.emplace_back(hex0x(k));
ja.emplace_back(std::move(je));
}
} else {
if (rev >= EVMC_BERLIN)
jtx["accessLists"][0] = json::json::array();
}
else
{
if (rev >= EVMC_BERLIN)
jtx["accessLists"][0] = json::json::array();

Check warning on line 232 in test/unittests/state_transition.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition.cpp#L231-L232

Added lines #L231 - L232 were not covered by tests
}

auto& jpost = jt["post"][to_test_fork_name(rev)][0];
Expand Down
19 changes: 10 additions & 9 deletions test/unittests/state_transition_block_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@ TEST_F(state_transition, block_apply_withdrawal)
tx.to = To;
expect.post[withdrawal_address].balance = intx::uint256{3} * 1'000'000'000;

skip_generate_copier = true; // Skip ethereum test generation because the withdrawals are not available in
// retesteth.
skip_generate_copier = true; // Skip ethereum test generation because the withdrawals are not

Check warning on line 19 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L19

Added line #L19 was not covered by tests
// available in retesteth.
}

TEST_F(state_transition, known_block_hash)
Expand All @@ -34,8 +34,8 @@ TEST_F(state_transition, known_block_hash)
expect.post[To].storage[0x01_bytes32] =
0x0000000000000000000000000000000000000000000000000000000000000111_bytes32;

skip_generate_copier = true; // Skip generating test because the block hash is not available in
// retesteth.
skip_generate_copier = true; // Skip generating test because the block hash is not available in

Check warning on line 37 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L37

Added line #L37 was not covered by tests
// retesteth.
}

TEST_F(state_transition, known_block_hash_fake)
Expand All @@ -48,8 +48,8 @@ TEST_F(state_transition, known_block_hash_fake)
expect.post[To].storage[0x01_bytes32] =
0xc89efdaa54c0f20c7adf612882df0950f5a951637e0307cdcb4c672f298b8bc6_bytes32;

skip_generate_copier = true; // Skip generating test because evmone-t8n does not return the
// fake block hash
skip_generate_copier = true; // Skip generating test because evmone-t8n does not return the

Check warning on line 51 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L51

Added line #L51 was not covered by tests
// fake block hash
}

TEST_F(state_transition, block_apply_ommers_reward)
Expand All @@ -69,7 +69,8 @@ TEST_F(state_transition, block_apply_ommers_reward)
// Two ommers +1/32 * block_reward for each. +21000 cost of the tx goes to coinbase.
expect.post[Coinbase].balance = 21000 + intx::uint256{block_reward} + block_reward / 16;

skip_generate_copier = true; // Skip ethereum test generation because the ommers are not available in ethereum state tests.
skip_generate_copier = true; // Skip ethereum test generation because the ommers are not

Check warning on line 72 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L72

Added line #L72 was not covered by tests
// available in ethereum state tests.
}

TEST_F(state_transition, eip7516_blob_base_fee)
Expand All @@ -82,6 +83,6 @@ TEST_F(state_transition, eip7516_blob_base_fee)

expect.post[To].storage[0x4a_bytes32] = 0xabcd_bytes32;

skip_generate_copier = true; // Skip ethereum test generation because the blob base fee is not available in
// retesteth.
skip_generate_copier = true; // Skip ethereum test generation because the blob base fee is not

Check warning on line 86 in test/unittests/state_transition_block_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_block_test.cpp#L86

Added line #L86 was not covered by tests
// available in retesteth.
}
2 changes: 1 addition & 1 deletion test/unittests/state_transition_tx_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ TEST_F(state_transition, invalid_tx_non_existing_sender)
tx.max_gas_price = 1;
tx.max_priority_gas_price = 1;
tx.nonce = 0;
pre.insert(Coinbase, { .balance = 1 });
pre.insert(Coinbase, {.balance = 1});

Check warning on line 44 in test/unittests/state_transition_tx_test.cpp

View check run for this annotation

Codecov / codecov/patch

test/unittests/state_transition_tx_test.cpp#L44

Added line #L44 was not covered by tests
pre.get_accounts().erase(Sender);

expect.tx_error = INSUFFICIENT_FUNDS;
Expand Down

0 comments on commit d2b9c2a

Please sign in to comment.