Skip to content

crypto: Move evmmax into evmone::crypto - #1652

Merged
chfast merged 1 commit into
masterfrom
crypto/ns-evmone-crypto
Aug 13, 2026
Merged

crypto: Move evmmax into evmone::crypto#1652
chfast merged 1 commit into
masterfrom
crypto/ns-evmone-crypto

Conversation

@chfast

@chfast chfast commented Aug 13, 2026

Copy link
Copy Markdown
Member

EVMMAX is dead, so the namespace named after it and the separate interface library carrying it
have no reason to stay. Mechanical change, no behaviour touched.

  • include/evmmax/evmmax.hpplib/evmone_precompiles/modarith.hpp
  • namespace evmmaxevmone::crypto (and evmmax::ecc, ::bn254, ::secp256k1,
    ::secp256r1 correspondingly), joining the other evmone::crypto primitives that use it
  • lib/evmmax/ and the evmone::evmmax target are deleted

Two consequences worth a look

A public installed header goes away. include/ is installed wholesale
(install(DIRECTORY ${include_dir}/)), so evmmax/evmmax.hpp was shipped. Nothing in the tree
consumed it and the evmone::evmmax target was never in install_targets, so there was no
supported way to use it — but it was technically reachable, and the header only ever served the
precompiles, so it does not belong in the public include directory.

intx becomes a public dependency of evmone_precompiles. It was PRIVATE evmone::evmmax
before, and the tests got intx by linking evmone::evmmax themselves. With that target gone,
modarith.hpp is a public header of evmone_precompiles that needs intx, hence
PUBLIC evmc::evmc_cpp intx::intx.

Renames beyond the namespace

Test and benchmark files carrying the dead name, plus the identifiers that show up in test and
benchmark output:

before after
evmmax_test.cpp modarith_test.cpp
evmmax_bn254_*.cpp bn254_*.cpp
evmmax_secp256k1_test.cpp secp256k1_test.cpp
evmmax_bench.cpp modarith_bench.cpp
TEST(evmmax, …) / evmmax_test suite TEST(crypto, …) / modarith_test
evmmax_add/sub/mul benchmarks modarith_add/sub/mul
evmmax_cpp benchmark label evmone_cpp, matching the label already used for p256verify

So ctest and benchmark names change; nothing else does.

Note the include form differs by location: ecc.hpp and modexp.cpp are siblings and use
"modarith.hpp", while the tests use <evmone_precompiles/modarith.hpp> — the .. include
directory is INTERFACE, so it is only available to consumers.

One consequence a reviewer will not spot in the diff

evmone::crypto already declared addmul() in mulmod.hpp (the span-based multiply-accumulate),
and modarith.hpp declares a different addmul() (the single-word one). These were previously in
separate namespaces; the move merges them into one overload set, and modexp.cpp includes both
headers. The signatures are unambiguous — a span cannot be built from a uint64_t — so nothing
resolves differently today, but two functions of the same name and different meaning now share a
namespace.

Verification

1219 tests pass. The diff is entirely renames, namespace edits, include paths and build wiring:
filtering the diff for anything that is not one of those leaves only the deleted
lib/evmmax/CMakeLists.txt and the benchmark label.

This is the first of a series; the rest of the modular arithmetic work sits on top of it. One
thing to watch there: intx::addmod() exists, so a follow-up introducing evmone::crypto::addmod
would create an ambiguity for any file doing using namespace intx; together with
using namespace evmone::crypto; — which modarith_test.cpp does. Not an issue in this PR, since
no such name is added here.

@codecov

codecov Bot commented Aug 13, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 97.72%. Comparing base (ebc25ef) to head (adc90f9).

Additional details and impacted files
@@           Coverage Diff           @@
##           master    #1652   +/-   ##
=======================================
  Coverage   97.72%   97.72%           
=======================================
  Files         171      171           
  Lines       15631    15631           
  Branches     3617     3617           
=======================================
  Hits        15275    15275           
  Misses        269      269           
  Partials       87       87           
Flag Coverage Δ
eest-develop 88.59% <100.00%> (ø)
eest-develop-gmp 26.51% <61.90%> (ø)
eest-legacy 17.14% <0.00%> (ø)
eest-libsecp256k1 28.81% <68.18%> (ø)
eest-stable 88.59% <100.00%> (ø)
evmone-unittests 93.44% <71.42%> (ø)

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

Components Coverage Δ
core 96.10% <100.00%> (ø)
tooling 91.92% <ø> (ø)
tests 99.80% <100.00%> (ø)
Files with missing lines Coverage Δ
lib/evmone_precompiles/bn254.cpp 100.00% <ø> (ø)
lib/evmone_precompiles/ecc.hpp 97.24% <ø> (ø)
lib/evmone_precompiles/modarith.hpp 100.00% <ø> (ø)
lib/evmone_precompiles/modexp.cpp 99.68% <100.00%> (ø)
lib/evmone_precompiles/pairing/bn254/fields.hpp 100.00% <ø> (ø)
lib/evmone_precompiles/pairing/bn254/pairing.cpp 100.00% <ø> (ø)
lib/evmone_precompiles/pairing/bn254/utils.hpp 100.00% <ø> (ø)
lib/evmone_precompiles/pairing/field_template.hpp 100.00% <ø> (ø)
lib/evmone_precompiles/secp256k1.cpp 100.00% <ø> (ø)
lib/evmone_precompiles/secp256r1.cpp 100.00% <ø> (ø)
... and 11 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@chfast
chfast force-pushed the crypto/ns-evmone-crypto branch from 8934242 to 77abde0 Compare August 13, 2026 15:52
@chfast
chfast requested a balanced review from Copilot August 13, 2026 16:04

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

Moves EVMMAX modular arithmetic and elliptic-curve code into the existing evmone::crypto namespace and precompiles library without behavioral changes.

Changes:

  • Relocates evmmax.hpp as modarith.hpp and updates namespaces.
  • Removes the obsolete evmone::evmmax target and exposes intx transitively.
  • Renames affected tests, benchmarks, and source references.

Reviewed changes

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

Show a summary per file
File Description
test/unittests/state_rlp_decode_test.cpp Updates secp256k1 namespace references.
test/unittests/secp256k1_test.cpp Updates crypto namespaces and test suites.
test/unittests/precompiles_secp256r1_test.cpp Updates secp256r1 namespace.
test/unittests/modarith_test.cpp Renames and rewires modular-arithmetic tests.
test/unittests/CMakeLists.txt Updates renamed test sources and linkage.
test/unittests/bn254_pairing_test.cpp Updates BN254 namespaces and test names.
test/unittests/bn254_mul_test.cpp Updates BN254 and ECC references.
test/unittests/bn254_from_bytes.cpp Updates BN254 namespace and test names.
test/unittests/bn254_add_test.cpp Updates BN254 namespace and test name.
test/state/transaction.cpp Updates transaction recovery references.
test/state/precompiles.cpp Updates precompile crypto references.
test/state/authorization.cpp Updates authorization recovery references.
test/precompiles_bench/precompiles_bench.cpp Renames benchmark labels.
test/internal_benchmarks/modarith_bench.cpp Renames modular-arithmetic benchmarks.
test/internal_benchmarks/CMakeLists.txt Updates benchmark source and linkage.
lib/evmone_precompiles/secp256r1.hpp Moves secp256r1 declarations into evmone::crypto.
lib/evmone_precompiles/secp256r1.cpp Updates secp256r1 implementation namespace.
lib/evmone_precompiles/secp256k1.hpp Moves secp256k1 declarations into evmone::crypto.
lib/evmone_precompiles/secp256k1.cpp Updates secp256k1 implementation namespace.
lib/evmone_precompiles/pairing/field_template.hpp Moves field templates into the crypto namespace.
lib/evmone_precompiles/pairing/bn254/utils.hpp Updates BN254 utility namespace.
lib/evmone_precompiles/pairing/bn254/pairing.cpp Updates pairing implementation namespace.
lib/evmone_precompiles/pairing/bn254/fields.hpp Updates BN254 field namespace.
lib/evmone_precompiles/modexp.cpp Uses the relocated modular-arithmetic header.
lib/evmone_precompiles/modarith.hpp Relocates modular arithmetic into evmone::crypto.
lib/evmone_precompiles/ecc.hpp Updates header dependency and ECC namespace.
lib/evmone_precompiles/CMakeLists.txt Adds modarith and exposes intx publicly.
lib/evmone_precompiles/bn254.hpp Moves BN254 declarations into evmone::crypto.
lib/evmone_precompiles/bn254.cpp Updates BN254 implementation namespace.
lib/evmmax/CMakeLists.txt Deletes the obsolete interface target.
lib/CMakeLists.txt Removes the obsolete subdirectory.

💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.

@chfast
chfast force-pushed the crypto/ns-evmone-crypto branch from 77abde0 to ebf4da5 Compare August 13, 2026 17:14
The EVMMAX proposal is dead, so the namespace named after it and the separate
interface library carrying it have no reason to stay. Move the modular
arithmetic to evmone_precompiles as evmone::crypto, next to the other
cryptographic primitives using it, and rename the tests accordingly.

This drops the installed evmmax/evmmax.hpp header and the evmone::evmmax
target. Nothing in the tree consumed either, and the header only ever served
the precompiles, so it does not belong in the public include directory.
@chfast
chfast force-pushed the crypto/ns-evmone-crypto branch from ebf4da5 to adc90f9 Compare August 13, 2026 19:34
@chfast
chfast requested a balanced review from Copilot August 13, 2026 20:30

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

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

@chfast
chfast merged commit 2e86dd0 into master Aug 13, 2026
24 checks passed
@chfast
chfast deleted the crypto/ns-evmone-crypto branch August 13, 2026 21:18
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