Repository navigation
Conversation
KernelSlots skipped any field whose type did not parse as exactly Box<dyn PrepareKernel<F, R>>, so a slot with an extra bound, a wrapper or a wrong argument count vanished from the registry and surfaced as a missing-bound error at a distant stage impl. Fields that name PrepareKernel in another shape are now a derive error at the field, with every such field reported at once. Fields that never name it are still skipped.
Contributor
📏 PR diffNote Actual code changed: 61 lines🟢 +44 added 🔴 −17 removed Tests, docs, fixtures, and helper scripts excluded.
Every changed line is classified once. |
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
#[derive(KernelSlots)]now rejects a malformedPrepareKernelslot at its declaration instead of skipping it.Why
The derive emitted one
PrepareKernel<F, R>impl per field of type exactlyBox<dyn PrepareKernel<F, R>>and skipped every other field. A slot written with an extra object bound (+ Send), a wrapper (Option<Box<…>>) or the wrong number of type arguments was skipped too, so the registry silently lost that impl. The error then appeared as an unsatisfiedPrepareKernelbound at whichever stage impl needed the slot, far from the field that caused it.What
jolt-kernels-derive: a field whose type mentions the identifierPrepareKernelanywhere but is not exactlyBox<dyn PrepareKernel<F, R>>is a derive error spanned at that field's type: "a KernelSlots slot must be exactlyBox<dyn PrepareKernel<F, R>>". All such fields are reported in one pass (syn::Error::combine). Fields that never mentionPrepareKernel(commit,joint_opening, the fronts) are still skipped. The emitted impls for valid slots are unchanged.PrepareKernel, so it is still skipped and still surfaces as a missing bound. The crate docs, thePrepareKerneltrait docs andspecs/prover-stage-drivers.mdnow say this.Tests
crates/jolt-kernels-derive/src/tests.rs(new) callsexpanddirectly. It checks that an extra object bound, anOptionwrapper and a one-element tuple are each rejected with the message above, and that a struct with one valid slot, a three-argument slot, a barePrepareKernelfield and an ordinary field reports exactly two errors. It also checks that a valid slot next to a&'static strfield and a bespoke boxed trait field expands to exactly onePrepareKernel<F, R>impl.Verification
cargo fmt --all --check;cargo clippy -p jolt-kernels-derive -p jolt-kernels -p jolt-prover --all-targets -- -D warnings(JoltBackendinjolt-kernelsuses the derive);cargo nextest run -p jolt-kernels-derive(5 passed) and-p jolt-kernels(152 passed).