hardening: add static assertion for WASM mavros stub type layout
Nobody has claimed this yet.
- Dominant language
- Noir
- Stars
- 138
- Forks
- 47
- Avg merge
- 1d 34m
- Merged PRs (30d)
- 6
Description
Context
From PR #246 review: the WASM stub types for WitnessLayout and ConstraintsLayout in provekit/common/src/mavros.rs must exactly mirror the real mavros_vm types for postcard serialization compatibility. Currently enforced only by a comment.
If mavros_vm adds a field, the stubs silently diverge and deserialization fails with a confusing error instead of the clean "Mavros prover is not supported on WASM" message.
Proposed Fix
Add a compile-time size assertion on native targets:
#[cfg(not(target_arch = "wasm32"))]
const _: () = {
assert!(std::mem::size_of::<mavros_vm::WitnessLayout>() == 5 * std::mem::size_of::<usize>());
assert!(std::mem::size_of::<mavros_vm::ConstraintsLayout>() == 3 * std::mem::size_of::<usize>());
};
Or a test that roundtrips both real and stub types through postcard to verify wire compatibility.
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start in provekit/common/src/mavros.rs, where the WASM stub types for WitnessLayout and ConstraintsLayout are defined, and compare them with the native mavros_vm types. Add the requested native-target compile-time layout checks or a postcard roundtrip test; done means layout divergence is caught clearly while WASM remains unsupported.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust, wasm
- Domain
- backend
- Issue type
- Bug
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 68/100