feat(spice): fallback validators fetch missing contract code (6/6) - #15942
Conversation
There was a problem hiding this comment.
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
SpiceContractCodeRequestfrom non-designated epoch validators whenfallback_eligible(...)is true (designated validators still allowed unconditionally). - Add a
disable_compiled_contract_cacheflag to the test-loop builder/shared state to useNoContractRuntimeCacheacross 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.
6a76fe9 to
3e11f03
Compare
87c2f07 to
e2fa737
Compare
Codecov Report❌ Patch coverage is
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
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
3e11f03 to
d27c336
Compare
e2fa737 to
b1bf16b
Compare
d27c336 to
a7561bf
Compare
b1bf16b to
5067638
Compare
Greptile SummaryThis PR allows authenticated non-designated epoch validators to request omitted contract code after a chunk enters the all-stake fallback window.
Confidence Score: 5/5The PR appears safe to merge. No blocking failure remains.
|
a7561bf to
c0ee20f
Compare
5067638 to
b73716a
Compare
c11155d to
d040454
Compare
b73716a to
cb024bf
Compare
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_requestnow admits a non-designated epoch validator'sSpiceContractCodeRequestonce the chunk is past the fallback window; designated validators may always request as before.Adds a
disable_compiled_contract_cachetest-loop builder flag that gives every node aNoContractRuntimeCache, 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).