Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

evmmax: Initial implementation of EVMMAX instructions (EIP-6690) #742

Open
wants to merge 8 commits into
base: master
Choose a base branch
from

Conversation

rodiazet
Copy link
Contributor

@rodiazet rodiazet commented Dec 5, 2023

Based on EIP-6690

  • Support new instruction implementation signature. code_iterator (*instr_fn)(StackTop, ExecutionState&, code_iterator, int64_t&)
  • Add EVMMAXstate to evm execution state interface
  • Add EVMMAX modulus interface and implementation for different UintT types
  • Add unit tests.
  • Comparing to the EIP this implementation is simplified by assumption that there can be only one exiting modulus. Calling setupx once for the second time remove the previous one and always creates a new one.

Copy link

codecov bot commented Dec 5, 2023

Codecov Report

Attention: Patch coverage is 4.00000% with 288 lines in your changes missing coverage. Please review.

Project coverage is 18.69%. Comparing base (9d28979) to head (da87a62).

Files with missing lines Patch % Lines
lib/evmmax/evmmax.cpp 4.16% 92 Missing ⚠️
test/unittests/evmmax_test.cpp 4.22% 68 Missing ⚠️
lib/evmone/instructions.hpp 0.00% 62 Missing ⚠️
test/unittests/evmmax_instructions_test.cpp 5.35% 53 Missing ⚠️
test/utils/bytecode.hpp 0.00% 12 Missing ⚠️
lib/evmone/baseline_execution.cpp 0.00% 1 Missing ⚠️

❗ There is a different number of reports uploaded between BASE (9d28979) and HEAD (da87a62). Click for more details.

HEAD has 4 uploads less than BASE
Flag BASE (9d28979) HEAD (da87a62)
unittests 1 0
eof_execution_spec_tests 1 0
execution_spec_tests 1 0
ethereum_tests 1 0
Additional details and impacted files
@@             Coverage Diff             @@
##           master     #742       +/-   ##
===========================================
- Coverage   94.29%   18.69%   -75.61%     
===========================================
  Files         159      160        +1     
  Lines       17325    15636     -1689     
===========================================
- Hits        16337     2923    -13414     
- Misses        988    12713    +11725     
Flag Coverage Δ
eof_execution_spec_tests ?
ethereum_tests ?
ethereum_tests_silkpre 18.69% <4.00%> (-0.29%) ⬇️
execution_spec_tests ?
unittests ?

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

Files with missing lines Coverage Δ
include/evmmax/evmmax.hpp 100.00% <100.00%> (ø)
lib/evmone/advanced_instructions.cpp 2.43% <ø> (-97.57%) ⬇️
lib/evmone/execution_state.hpp 87.23% <100.00%> (-7.51%) ⬇️
test/unittests/eof_validation_test.cpp 0.00% <ø> (-99.42%) ⬇️
test/unittests/instructions_test.cpp 0.00% <ø> (-89.59%) ⬇️
lib/evmone/baseline_execution.cpp 63.04% <0.00%> (-36.96%) ⬇️
test/utils/bytecode.hpp 13.77% <0.00%> (-83.58%) ⬇️
test/unittests/evmmax_instructions_test.cpp 5.35% <5.35%> (ø)
lib/evmone/instructions.hpp 69.55% <0.00%> (-30.45%) ⬇️
test/unittests/evmmax_test.cpp 2.47% <4.22%> (-92.84%) ⬇️
... and 1 more

... and 137 files with indirect coverage changes

@rodiazet rodiazet force-pushed the evmmax-intructions branch 27 times, most recently from 7d36325 to 3f42dd5 Compare December 11, 2023 12:49
@rodiazet rodiazet force-pushed the evmmax-intructions branch from 89aa150 to ed0056e Compare January 5, 2024 14:16
@rodiazet rodiazet marked this pull request as ready for review January 5, 2024 14:21
@rodiazet rodiazet force-pushed the evmmax-intructions branch from ed0056e to 67808c1 Compare January 5, 2024 14:21
@rodiazet rodiazet requested a review from chfast January 5, 2024 14:22
@chfast chfast added EVMMAX and removed precompiles Related to EVM precompiles labels Jan 6, 2024
@chfast chfast changed the title Evmmax instructions in evmone Initial implementation of EVMMAX instructions (EIP-6690) Jan 8, 2024

[[nodiscard]] bool addmodx(size_t dst_idx, size_t x_idx, size_t y_idx) noexcept override
{
if (dst_idx < values.size() && x_idx < values.size() && y_idx < values.size())
Copy link
Member

Choose a reason for hiding this comment

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

I think we should assume the indexes are valid (because they are going to be validated by EOF). Debug asserts are fine obviously.

@rodiazet rodiazet force-pushed the evmmax-intructions branch 2 times, most recently from e55c458 to e156a5a Compare January 9, 2024 12:07
@rodiazet rodiazet changed the title Initial implementation of EVMMAX instructions (EIP-6690) evmmax: Initial implementation of EVMMAX instructions (EIP-6690) Jan 9, 2024
@rodiazet rodiazet requested a review from chfast January 9, 2024 12:09
@rodiazet rodiazet force-pushed the evmmax-intructions branch 3 times, most recently from 92b00a1 to 4136a08 Compare January 9, 2024 14:27
@rodiazet rodiazet force-pushed the evmmax-intructions branch 4 times, most recently from 81eaef0 to ab38a8d Compare January 11, 2024 10:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants