Skip to content

test(cli/mev): add integration tests for MEV test command#329

Open
varex83agent wants to merge 16 commits intomainfrom
feat/mev-tests
Open

test(cli/mev): add integration tests for MEV test command#329
varex83agent wants to merge 16 commits intomainfrom
feat/mev-tests

Conversation

@varex83agent
Copy link
Copy Markdown
Collaborator

Summary

Follow-up to #300. Adds the integration tests missing from the initial MEV test implementation, as noted in the review thread.

  • default scenario: healthy mocked MEV node → Ping OK, PingMeasure Good, CreateBlock Skip
  • connection refused: two unreachable endpoints → Ping Fail, PingMeasure Fail, CreateBlock Skip with error messages
  • timeout: 100ns timeout → all network tests fail with timeout/interrupted verdict
  • quiet mode: --quiet produces no stdout output
  • unsupported test case: unknown test name returns "test case not supported" error
  • custom test cases: --test-cases=Ping runs only Ping per endpoint
  • write to file: --output-json produces valid JSON with mev key

Tests ported from testmev_internal_test.go. The default load scenario and flag-parsing tests are deferred to a further follow-up since they require a live beacon node or deeper CLI wiring.

Test plan

  • cargo test --package pluto-cli --bin pluto -- commands::test::mev::tests passes (9/9)
  • cargo clippy clean
  • cargo +nightly fmt clean
  • cargo deny check clean

🤖 Generated with Claude Code

PoulavBhowmick03 and others added 16 commits March 28, 2026 13:09
- Follow the `test validator` approach (enum + impl block)
- Simplify error handling for timeouts
- Test is already cancelled by caller appropriately
- Workaround for false positive
- Use tokio::time::Instant instead of std::time::Instant in async code
- Replace CliError::Other string literals with typed variants
  TimeoutInterrupted and TestCaseNotSupported
- Remove TestResultError from imports; use CliError::TimeoutInterrupted directly
- Simplify latest_beacon_block and fetch_proposers_for_epoch to use ?
  operator, leveraging existing From impls on CliError
- Simplify get_block_header error conversions with .map_err(MevError::from)
  and .map_err(|e| MevError::Cli(e.into()))

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
RUSTSEC-2026-0097: rand 0.8.x unsoundness (transitive dep)
RUSTSEC-2026-0098: rustls-webpki URI name constraint bypass (transitive dep)

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
These features are absent from Charon v1.7.1:
- Remove x-timeout-ms CLI flag and x_timeout_ms field from TestMevArgs
- Remove X-Timeout-Ms and Date-Milliseconds headers from get_block_header
- Remove credential parsing (parse_endpoint_credentials / apply_basic_auth)
  from mev_ping_test, latest_beacon_block, fetch_proposers_for_epoch,
  and get_block_header
- Replace x_timeout_ms-based thresholds in mev_create_block_test with
  fixed 500ms/800ms constants matching Go reference thresholds

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
Resolve conflicts:
- deny.toml: adopt main's detailed reason comment for RUSTSEC-2026-0097, keep RUSTSEC-2026-0098
- crates/cli/Cargo.toml: add chrono from main
- crates/cli/src/commands/test/mod.rs: accept main's refactor (helpers/constants modules)
- crates/cli/src/commands/test/mev.rs: update imports for helpers/constants split,
  use SLOTS_IN_EPOCH.get() for NonZero<u64>

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
Port tests from testmev_internal_test.go covering:
- default scenario: healthy MEV node returns Ping OK, PingMeasure Good, CreateBlock Skip
- connection refused: Ping and PingMeasure fail with error, CreateBlock skips
- timeout: very short timeout causes Fail verdicts for network tests
- quiet mode: no stdout output when quiet=true
- unsupported test case: returns "test case not supported" error
- custom test cases filter: only specified tests are run
- write to file: output_json path produces valid JSON with mev key

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
rustls-webpki wildcard name constraint bypass — transitive dep,
cannot upgrade immediately.

Co-Authored-By: Bohdan Ohorodnii <35969035+varex83@users.noreply.github.com>
Base automatically changed from poulav/mev_test to main April 16, 2026 15:23
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.

3 participants