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

tests: Add tests for NoopExecutionEngine mock API #4114

Merged
merged 3 commits into from
Feb 3, 2025

Conversation

bshastry
Copy link
Contributor

This PR adds test coverage for the mock Engine API interface methods in NoopExecutionEngine across multiple forks (Bellatrix, Deneb, Electra). The tests verify that each fork's implementation maintains its specific interface contract while providing mock behaviors for CL-EL interaction in test scenarios.

The Engine API interface has evolved across forks:

  • Bellatrix: Basic interface (notify_new_payload, is_valid_block_hash, get_payload, etc.)
  • Deneb: Added parent_beacon_block_root parameter
  • Electra: Added execution_requests_list parameter

Add fork-specific test files:

  • tests/core/pyspec/eth2spec/test/bellatrix/execution_engine/test_execution_engine_interface.py
  • tests/core/pyspec/eth2spec/test/deneb/execution_engine/test_execution_engine_interface.py
  • tests/core/pyspec/eth2spec/test/electra/execution_engine/test_execution_engine_interface.py

Improves coverage by 5 SLoC in CL-EL mock implementation, with proper fork-specific interface testing.

@jtraglia
Copy link
Member

Hey @bshastry, these are great, thank you!

Could you please move these to the unittests (eg unittests for bellatrix)directory? Like this:

  • tests/core/pyspec/eth2spec/test/bellatrix/unittests/test_execution_engine_interface.py

The reason I'm asking for this is because these directories (block_processing, fork, fork_choice, etc) are associated with a test format (see formats) which are exported and run by clients. unittests is the exception here, this directory contains tests which are not exported.

@bshastry bshastry force-pushed the add-tests-mock-execution-engine branch from 9347ee8 to c7ed324 Compare February 3, 2025 08:37
@bshastry
Copy link
Contributor Author

bshastry commented Feb 3, 2025

Hey @bshastry, these are great, thank you!

Could you please move these to the unittests (eg unittests for bellatrix)directory? Like this:

  • tests/core/pyspec/eth2spec/test/bellatrix/unittests/test_execution_engine_interface.py

The reason I'm asking for this is because these directories (block_processing, fork, fork_choice, etc) are associated with a test format (see formats) which are exported and run by clients. unittests is the exception here, this directory contains tests which are not exported.

Thank you for your review! I have moved the tests to the respective forks' unittests directory. 🙏

Copy link
Member

@jtraglia jtraglia left a comment

Choose a reason for hiding this comment

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

LGTM, thanks!

@jtraglia jtraglia merged commit 3b5084c into ethereum:dev Feb 3, 2025
23 checks passed
@bshastry bshastry deleted the add-tests-mock-execution-engine branch February 4, 2025 08:56
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