Skip to content

Move the create address computation to lib/evmone#1591

Merged
chfast merged 1 commit into
masterfrom
evm/create-address-move
Jul 14, 2026
Merged

Move the create address computation to lib/evmone#1591
chfast merged 1 commit into
masterfrom
evm/create-address-move

Conversation

@chfast

@chfast chfast commented Jul 14, 2026

Copy link
Copy Markdown
Member

compute_create_address() and compute_create2_address() are defined in the testing host (test/state/host.{hpp,cpp}) although they are not Host-specific, and the VM itself will need them once it computes the create address instead of the Host (#1589).

Move them to the new TU lib/evmone/create_address.{hpp,cpp} in the evmone namespace. The implementations are unchanged except the keccak256() host-utils wrapper being replaced by the direct ethash::keccak256() call. The functions are marked EVMC_EXPORT so the testing code can still reach them across the libevmone shared-library boundary.

compute_create_address() and compute_create2_address() are defined in
the testing host (test/state/host.{hpp,cpp}) although they are not
Host-specific, and the VM itself will need them once it computes the
create address instead of the Host (#1589).

Move them to the new TU lib/evmone/create_address.{hpp,cpp} in the
evmone namespace. The implementations are unchanged except the
keccak256() host-utils wrapper being replaced by the direct
ethash::keccak256() call. The functions are marked EVMC_EXPORT so the
testing code can still reach them across the libevmone shared-library
boundary (same as get_delegate_address()).

Also rename state_new_account_address_test.cpp (and its test suite) to
create_address_test.cpp to match.

Claude-Session: https://claude.ai/code/session_01R8uyb9z8VwgRrEKRanDPP8

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR relocates compute_create_address() / compute_create2_address() from the testing host implementation into lib/evmone, making them available to the VM (and still usable by tests) as exported symbols in the evmone namespace.

Changes:

  • Introduces lib/evmone/create_address.{hpp,cpp} with the (unchanged) CREATE/CREATE2 address derivation logic, switching hashing to ethash::keccak256().
  • Removes the duplicated helpers from test/state/host.{hpp,cpp} and updates host code to use the library implementation.
  • Updates and renames unit tests to include and call the new evmone::compute_create_* APIs, and adjusts the unit test source list.

Reviewed changes

Copilot reviewed 7 out of 7 changed files in this pull request and generated no comments.

Show a summary per file
File Description
test/unittests/create_address_test.cpp Switches tests from test/state/host.hpp helpers to <evmone/create_address.hpp> and updates test suite naming.
test/unittests/CMakeLists.txt Adds create_address_test.cpp to unit tests and removes the old state_new_account_address_test.cpp entry.
test/state/host.hpp Drops local declarations of create-address helpers and includes the new library header.
test/state/host.cpp Removes the local helper implementations; host now calls the library functions.
lib/evmone/create_address.hpp Adds exported declarations for CREATE/CREATE2 address computation in namespace evmone.
lib/evmone/create_address.cpp Adds the implementations using ethash::keccak256().
lib/evmone/CMakeLists.txt Registers the new TU (create_address.cpp/.hpp) in the evmone library build.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov

codecov Bot commented Jul 14, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.39%. Comparing base (2af500b) to head (c18be37).
⚠️ Report is 1 commits behind head on master.

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1591   +/-   ##
=======================================
  Coverage   97.39%   97.39%           
=======================================
  Files         163      164    +1     
  Lines       14666    14666           
  Branches     3390     3390           
=======================================
  Hits        14284    14284           
  Misses        282      282           
  Partials      100      100           
Flag Coverage Δ
eest-develop 89.44% <100.00%> (ø)
eest-develop-gmp 26.11% <91.66%> (ø)
eest-legacy 17.52% <75.00%> (ø)
eest-libsecp256k1 27.74% <91.66%> (ø)
eest-stable 89.42% <100.00%> (ø)
evmone-unittests 92.63% <100.00%> (ø)

Flags with carried forward coverage won't be shown. Click here to find out more.

Components Coverage Δ
core 95.92% <100.00%> (ø)
tooling 90.33% <ø> (ø)
tests 99.80% <100.00%> (ø)
Files with missing lines Coverage Δ
lib/evmone/create_address.cpp 100.00% <100.00%> (ø)
test/state/host.cpp 99.12% <ø> (-0.12%) ⬇️
test/state/host.hpp 100.00% <ø> (ø)
test/unittests/create_address_test.cpp 100.00% <100.00%> (ø)
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast chfast merged commit b176de0 into master Jul 14, 2026
24 checks passed
@chfast chfast deleted the evm/create-address-move branch July 14, 2026 12:15
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants