Add cross-client XMSS compatibility tests (ream)#177
Conversation
Verify that XMSS signatures produced by the ream client can be decoded and verified by ethlambda. Test vectors come from leanSpec PR #433.
🤖 Kimi Code ReviewReview SummaryThe PR adds cross-client XMSS compatibility tests to verify that signatures produced by the ream client can be decoded and verified by ethlambda. Overall, the implementation is solid with good test coverage. Issues Found
Positive Aspects
Suggested Changes// Line 326: Update comment
/// 3114-byte XMSS signature produced by ream (epoch 5, message all-zeros).
// Lines 334-335: Better error handling
fn ream_pubkey() -> ValidatorPublicKey {
let bytes = hex::decode(REAM_PUBLIC_KEY_HEX)
.unwrap_or_else(|_| panic!("invalid public key hex: {}", REAM_PUBLIC_KEY_HEX));
ValidatorPublicKey::from_bytes(&bytes)
.unwrap_or_else(|_| panic!("failed to decode ream public key"))
}The PR is ready to merge after addressing the minor issues above. Automated review by Kimi (Moonshot AI) · custom prompt |
🤖 Codex Code ReviewNo blocking findings in the diff.
Residual gap:
Automated review by OpenAI Codex · custom prompt |
Greptile SummaryThis PR adds five cross-client XMSS compatibility tests to Key changes:
Two minor style issues were found: the wrong-epoch constant is a magic literal rather than Confidence Score: 5/5
|
| Filename | Overview |
|---|---|
| crates/common/crypto/src/lib.rs | Adds 5 cross-client XMSS compatibility tests (decode roundtrip for pubkey and signature, verify with correct params, reject wrong message, reject wrong epoch) plus two helper functions; only minor style issues (magic epoch number, source attribution comment). |
| crates/common/crypto/Cargo.toml | Correctly adds hex as a [dev-dependencies] entry (workspace-pinned), scoping it to test builds only. |
| Cargo.lock | Lock file updated to include hex in the ethlambda-crypto dependency set; no other changes. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A[Hex-encoded test vectors\nfrom ream client] -->|hex::decode| B[Raw byte slices]
B -->|from_bytes| C[ValidatorPublicKey\nValidatorSignature]
C -->|to_bytes| D{Roundtrip\nmatch?}
D -->|yes| T1[test_decode_public_key PASS]
D -->|yes| T2[test_decode_signature PASS]
C --> E{is_valid\ncorrect epoch+msg}
E -->|true| T3[test_verify PASS]
C --> F{is_valid\nwrong message}
F -->|false| T4[test_rejects_wrong_message PASS]
C --> G{is_valid\nwrong epoch}
G -->|false| T5[test_rejects_wrong_epoch PASS]
Last reviewed commit: bac7004
🤖 Claude Code ReviewHere is the review: PR Review: Add cross-client XMSS compatibility tests (ream)SummaryClean, focused PR. The test vectors have correct sizes (52-byte pubkey, 3112-byte signature matching ObservationsTest vector source attribution is ambiguous
The comment says "Test vectors come from leanSpec PR #433" but the vectors are ream-produced; leanSpec PR #433 references them. A future maintainer can't easily audit these constants without knowing which ream commit or test file generated them. Consider adding a direct reference: // Vectors generated by ream — see:
// https://github.com/ReamLabs/ream/.../<specific file or commit>
// Cross-verified by leanSpec PR #433.No negative test for wrong public key The suite covers wrong message ( Redundant hex decode in The roundtrip tests decode inline (good — they're self-contained). The verification tests call the helpers, which parse the raw hex on every invocation. For five fast tests this is inconsequential, but if more tests are added later, consider Minor:
let wrong_epoch = 6;
assert!(!sig.is_valid(&pk, wrong_epoch, &H256::ZERO), ...);The local variable is a matter of taste; VerdictNo correctness or security issues. The two substantive points are the source attribution (important for auditability of cross-client test vectors) and the missing wrong-key negative test (increases confidence in the Automated review by Claude (Anthropic) · custom prompt |
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Co-authored-by: greptile-apps[bot] <165735046+greptile-apps[bot]@users.noreply.github.com>
Motivation
Multi-client interoperability is critical for the lean consensus ecosystem. leanSpec PR #433 introduces cross-client XMSS compatibility tests that verify ream-produced signatures can be decoded and verified by leanSpec's Python implementation. This PR adds the equivalent tests to ethlambda, ensuring our Rust client can also verify ream-generated XMSS signatures.
Description
Adds 5 cross-client XMSS compatibility tests to
crates/common/crypto/src/lib.rsusing test vectors from ream (epoch 5, all-zeros message):test_cross_client_decode_ream_public_keytest_cross_client_decode_ream_signaturetest_cross_client_verify_ream_signaturetest_cross_client_ream_signature_rejects_wrong_message0xff...ff)test_cross_client_ream_signature_rejects_wrong_epochThese tests only do deserialization + verification (no keygen, no aggregation), so they run fast (~50ms) and don't need
#[ignore].Also adds
hexas a dev-dependency toethlambda-cryptofor decoding the test vectors.How to test
cargo test -p ethlambda-crypto -- cross_clientRelated