Skip to content

test(light-client): port lightclient tests to test-loop#15971

Open
darioush wants to merge 2 commits into
near:masterfrom
darioush:light-client/port-to-test-loop
Open

test(light-client): port lightclient tests to test-loop#15971
darioush wants to merge 2 commits into
near:masterfrom
darioush:light-client/port-to-test-loop

Conversation

@darioush

Copy link
Copy Markdown
Contributor

Ports lightclient_test.py and rpc_light_client_execution_outcome_proof.py from pytest to the test-loop framework, and removes the originals along with the now-unused pytest/lib/lightclient.py.

The new test-loop-tests/src/tests/light_client.rs covers:

  • test_next_light_client_block: walks next_light_client_block across several epochs, validating each returned block per NEP-25 (recomputed block hash matches the canonical chain, approval signatures verify against the epoch's block producers, >2/3 stake threshold, next_bp_hash on epoch change), and asserts the walk advances one epoch per step and climbs all the way to the head's final block.
  • test_next_light_client_block_epoch_boundary: for a fixed last-known block, the light client block lags in the previous epoch until the head's final block crosses the boundary, and the returned block shares the epoch of the block two heights onward.
  • test_light_client_execution_outcome_proof: deploys a contract, runs a succeeding and a failing call, and verifies the light client proof merkle paths for the transaction and each receipt outcome.

The execution-outcome-proof test is ignored under protocol_feature_spice (matching the original's commented-out spice run); the two walk tests run under spice as before.

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Ports the legacy pytest light-client sanity tests to the Rust test-loop framework, consolidating light-client block walking and light-client execution outcome proof verification into test-loop-tests and removing the now-obsolete Python test implementations.

Changes:

  • Add test-loop-tests/src/tests/light_client.rs with test-loop equivalents of the light-client block-walk and execution-outcome-proof tests.
  • Wire the new module into the test-loop test suite.
  • Remove the old pytest tests and helper module, and drop them from the nightly pytest sanity list.

Reviewed changes

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

Show a summary per file
File Description
test-loop-tests/src/tests/mod.rs Registers the new light_client test module in the test-loop test suite.
test-loop-tests/src/tests/light_client.rs Implements light-client tests in Rust test-loop: NEP-25 validation during next_light_client_block walking, epoch-boundary behavior, and light_client_proof verification.
pytest/tests/sanity/rpc_light_client_execution_outcome_proof.py Removes the legacy pytest execution-outcome-proof test after porting to test-loop.
pytest/tests/sanity/lightclient_test.py Removes the legacy pytest light-client block walking test after porting to test-loop.
pytest/lib/lightclient.py Removes the unused pytest light-client helper library.
nightly/pytest-sanity.txt Removes the deleted pytest light-client tests from the nightly pytest sanity run list.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@darioush darioush requested a review from pugachAG June 24, 2026 18:04
@darioush darioush marked this pull request as ready for review June 24, 2026 18:04
@darioush darioush requested a review from a team as a code owner June 24, 2026 18:04
@codecov

codecov Bot commented Jun 24, 2026

Copy link
Copy Markdown

Codecov Report

✅ All modified and coverable lines are covered by tests.
✅ Project coverage is 72.62%. Comparing base (ae46722) to head (410dd91).
⚠️ Report is 5 commits behind head on master.

Additional details and impacted files
@@            Coverage Diff             @@
##           master   #15971      +/-   ##
==========================================
+ Coverage   72.49%   72.62%   +0.13%     
==========================================
  Files         946      948       +2     
  Lines      204277   205021     +744     
  Branches   204277   205021     +744     
==========================================
+ Hits       148094   148904     +810     
+ Misses      51215    51143      -72     
- Partials     4968     4974       +6     
Flag Coverage Δ
pytests-nightly 1.10% <ø> (-0.01%) ⬇️
unittests 69.58% <ø> (+0.10%) ⬆️
unittests-nightly 69.58% <ø> (+0.13%) ⬆️
unittests-spice 67.00% <ø> (+0.13%) ⬆️

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

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

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