Light Protocol SDK Macros
A collection of procedural macros for the Light Protocol SDK.
LightHasher
The LightHasher
derive macro implements cryptographic hashing for struct types,
providing implementations of the ToByteArray
and DataHasher
traits.
Attributes
#[hash]
: Truncates field data to BN254 field size (for large types)#[skip]
: Ignores field during hashing
Example
Debug
RUST_BACKTRACE=1
Prints DataHasher::hash() inputs.
Testing
This crate includes a comprehensive test suite:
# Run all tests
# Run fuzzing tests
Fuzzing
For deep, comprehensive fuzzing with cargo-fuzz:
# Install cargo-fuzz (requires nightly Rust)
# Run the structure generator fuzzer (tests runtime behavior)
# Run the macro input fuzzer (tests parsing various struct definitions)
For more details, see the fuzzing documentation.