crypto: Move evmmax into evmone::crypto - #1652
Merged
Merged
Conversation
Codecov Report✅ All modified and coverable lines are covered by tests. 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
Flags with carried forward coverage won't be shown. Click here to find out more.
🚀 New features to boost your workflow:
|
chfast
force-pushed
the
crypto/ns-evmone-crypto
branch
from
August 13, 2026 15:52
8934242 to
77abde0
Compare
There was a problem hiding this comment.
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.hppasmodarith.hppand updates namespaces. - Removes the obsolete
evmone::evmmaxtarget 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
force-pushed
the
crypto/ns-evmone-crypto
branch
from
August 13, 2026 17:14
77abde0 to
ebf4da5
Compare
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
force-pushed
the
crypto/ns-evmone-crypto
branch
from
August 13, 2026 19:34
ebf4da5 to
adc90f9
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
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.hpp→lib/evmone_precompiles/modarith.hppevmmax→evmone::crypto(andevmmax::ecc,::bn254,::secp256k1,::secp256r1correspondingly), joining the otherevmone::cryptoprimitives that use itlib/evmmax/and theevmone::evmmaxtarget are deletedTwo consequences worth a look
A public installed header goes away.
include/is installed wholesale(
install(DIRECTORY ${include_dir}/)), soevmmax/evmmax.hppwas shipped. Nothing in the treeconsumed it and the
evmone::evmmaxtarget was never ininstall_targets, so there was nosupported 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 wasPRIVATE evmone::evmmaxbefore, and the tests got intx by linking
evmone::evmmaxthemselves. With that target gone,modarith.hppis a public header ofevmone_precompilesthat needs intx, hencePUBLIC 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:
evmmax_test.cppmodarith_test.cppevmmax_bn254_*.cppbn254_*.cppevmmax_secp256k1_test.cppsecp256k1_test.cppevmmax_bench.cppmodarith_bench.cppTEST(evmmax, …)/evmmax_testsuiteTEST(crypto, …)/modarith_testevmmax_add/sub/mulbenchmarksmodarith_add/sub/mulevmmax_cppbenchmark labelevmone_cpp, matching the label already used for p256verifySo ctest and benchmark names change; nothing else does.
Note the include form differs by location:
ecc.hppandmodexp.cppare siblings and use"modarith.hpp", while the tests use<evmone_precompiles/modarith.hpp>— the..includedirectory is INTERFACE, so it is only available to consumers.
One consequence a reviewer will not spot in the diff
evmone::cryptoalready declaredaddmul()inmulmod.hpp(the span-based multiply-accumulate),and
modarith.hppdeclares a differentaddmul()(the single-word one). These were previously inseparate namespaces; the move merges them into one overload set, and
modexp.cppincludes bothheaders. The signatures are unambiguous — a span cannot be built from a
uint64_t— so nothingresolves 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.txtand 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 introducingevmone::crypto::addmodwould create an ambiguity for any file doing
using namespace intx;together withusing namespace evmone::crypto;— whichmodarith_test.cppdoes. Not an issue in this PR, sinceno such name is added here.