Skip to content

feat(spice): fallback validators fetch missing contract code (6/6) - #15942

Merged
darioush merged 1 commit into
masterfrom
darioush/spice/all-stake-fallback-contract-code
Aug 7, 2026
Merged

feat(spice): fallback validators fetch missing contract code (6/6)#15942
darioush merged 1 commit into
masterfrom
darioush/spice/all-stake-fallback-contract-code

Conversation

@darioush

Copy link
Copy Markdown
Contributor

A non-designated validator that pulls a chunk's witness to endorse it for the all-stake fallback may need contract code the witness omits (the SPICE witness ships only the contract-accesses hash, not the bytecode). handle_spice_contract_code_request now admits a non-designated epoch validator's SpiceContractCodeRequest once the chunk is past the fallback window; designated validators may always request as before.

Adds a disable_compiled_contract_cache test-loop builder flag that gives every node a NoContractRuntimeCache, so validators must actually request contract code rather than reuse a precompiled copy. Without it the code-request gate is never exercised.

e2e: certifies-chunk-accessing-contract-code deploys a contract, calls it under a total designated-endorsement outage, and asserts the certified frontier reaches the call chunk via the fallback (which requires a cold non-designated validator to fetch the code).

@darioush darioush changed the title feat(spice): fallback validators fetch missing contract code feat(spice): fallback validators fetch missing contract code (6/6) Jun 17, 2026
@darioush
darioush requested a review from Copilot June 17, 2026 23:41

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

This PR updates SPICE all-stake fallback behavior so that non-designated (but still epoch) validators can fetch missing contract bytecode needed to endorse chunks via the fallback once the chunk becomes fallback-eligible. It also extends the test-loop harness and adds an e2e-style test to ensure this path is exercised by forcing validators to fetch contract code rather than reuse precompiled artifacts.

Changes:

  • Allow SpiceContractCodeRequest from non-designated epoch validators when fallback_eligible(...) is true (designated validators still allowed unconditionally).
  • Add a disable_compiled_contract_cache flag to the test-loop builder/shared state to use NoContractRuntimeCache across nodes.
  • Add a SPICE fallback test that deploys + calls a contract during a designated-endorsement outage and waits for the certified frontier to reach the call chunk.

Reviewed changes

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

Show a summary per file
File Description
test-loop-tests/src/tests/spice/all_stake_fallback.rs Adds a new fallback certification test that requires cold contract code fetching, plus a small genesis-builder extension for adding user accounts.
test-loop-tests/src/setup/state.rs Adds shared-state flag to disable the compiled contract cache across all nodes.
test-loop-tests/src/setup/setup.rs Switches runtime contract cache between FilesystemContractRuntimeCache and NoContractRuntimeCache based on the new shared-state flag.
test-loop-tests/src/setup/builder.rs Plumbs the new builder flag into SharedState and exposes a builder method to enable it.
chain/client/src/spice/data_distributor_actor.rs Relaxes contract-code request gating to admit fallback-eligible requests from non-designated epoch validators.

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

@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-tracked branch from 6a76fe9 to 3e11f03 Compare June 17, 2026 23:46
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-contract-code branch from 87c2f07 to e2fa737 Compare June 17, 2026 23:46
@darioush
darioush requested a review from pugachAG June 17, 2026 23:51
@darioush
darioush marked this pull request as ready for review June 17, 2026 23:51
@darioush
darioush requested a review from a team as a code owner June 17, 2026 23:51
@codecov

codecov Bot commented Jun 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 80.00000% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 73.64%. Comparing base (ed95ce9) to head (cb024bf).

Files with missing lines Patch % Lines
chain/client/src/spice/data_distributor_actor.rs 60.00% 3 Missing and 1 partial ⚠️
Additional details and impacted files
@@           Coverage Diff           @@
##           master   #15942   +/-   ##
=======================================
  Coverage   73.64%   73.64%           
=======================================
  Files         865      865           
  Lines      191987   192004   +17     
  Branches   191987   192004   +17     
=======================================
+ Hits       141380   141408   +28     
+ Misses      46122    46106   -16     
- Partials     4485     4490    +5     
Flag Coverage Δ
pytests-nightly 1.20% <0.00%> (-0.01%) ⬇️
unittests 70.01% <25.00%> (-0.02%) ⬇️
unittests-nightly 70.07% <25.00%> (+<0.01%) ⬆️
unittests-spice 65.99% <80.00%> (+0.03%) ⬆️

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.

@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-tracked branch from 3e11f03 to d27c336 Compare June 26, 2026 15:55
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-contract-code branch from e2fa737 to b1bf16b Compare June 26, 2026 15:55
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-tracked branch from d27c336 to a7561bf Compare August 5, 2026 23:30
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-contract-code branch from b1bf16b to 5067638 Compare August 5, 2026 23:30
@greptile-apps

greptile-apps Bot commented Aug 5, 2026

Copy link
Copy Markdown

Greptile Summary

This PR allows authenticated non-designated epoch validators to request omitted contract code after a chunk enters the all-stake fallback window.

  • Adds fallback-aware authorization for Spice contract-code requests.
  • Adds a test-loop option that disables compiled-contract caching.
  • Adds an end-to-end fallback test involving contract deployment and execution under a designated-endorsement outage.

Confidence Score: 5/5

The PR appears safe to merge.

No blocking failure remains.

Sequence Diagram

sequenceDiagram
    participant V as Non-designated epoch validator
    participant D as SpiceDataDistributorActor
    participant E as Epoch manager
    participant C as Spice core reader
    participant S as Contract storage
    V->>D: Signed contract-code request
    D->>E: Resolve validator and verify signature
    E-->>D: Authenticated epoch validator
    D->>C: Check chunk fallback eligibility
    C-->>D: Eligible after fallback window
    D->>S: Load requested contract code
    S-->>D: Contract bytecode
    D-->>V: SpiceContractCodeResponse
Loading

Reviews (3): Last reviewed commit: "feat(spice): fallback validators fetch m..." | Re-trigger Greptile

@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-tracked branch from a7561bf to c0ee20f Compare August 6, 2026 13:20
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-contract-code branch from 5067638 to b73716a Compare August 6, 2026 13:20
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-tracked branch 2 times, most recently from c11155d to d040454 Compare August 7, 2026 02:33
Base automatically changed from darioush/spice/all-stake-fallback-tracked to master August 7, 2026 03:01
@darioush
darioush force-pushed the darioush/spice/all-stake-fallback-contract-code branch from b73716a to cb024bf Compare August 7, 2026 03:03
@darioush
darioush added this pull request to the merge queue Aug 7, 2026
Merged via the queue into master with commit 72cbd65 Aug 7, 2026
33 checks passed
@darioush
darioush deleted the darioush/spice/all-stake-fallback-contract-code branch August 7, 2026 03:36
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