-
Notifications
You must be signed in to change notification settings - Fork 2
Fix XMSS signature vector tests #62
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
| .join(spec_file); | ||
|
|
||
| TestRunner::run_verify_signatures_test(test_path).unwrap(); | ||
| TestRunner::run_verify_signatures_test(test_path)?; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why? just unwrap error, no need to handle them gracefully
| "tests/consensus/devnet/verify_signatures/test_invalid_signatures.py::test_invalid_signature[fork_Devnet][fork_devnet-verify_signatures_test]": { | ||
| "network": "Devnet", | ||
| "leanEnv": "test", | ||
| "leanEnv": "prod", |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't generate tests by hand, update makefile script & use it instead:
.PHONY: generate-test-vectors
generate-test-vectors:
@rm -rf spec && \
mkdir -p spec && \
cd spec && \
git init && \
git remote add origin https://github.com/leanEthereum/leanSpec.git && \
git fetch --depth 1 origin $(LEAN_SPEC_COMMIT) && \
git switch --detach FETCH_HEAD
- cd spec && uv run fill --clean --fork=devnet
+ cd spec && uv run fill --clean --fork=devnet --scheme prod
rm -rf ./test_vectors && mkdir -p ./test_vectors
cp -r ./spec/fixtures/consensus/* ./test_vectors/| let expect_exception = raw | ||
| .get("tests") | ||
| .and_then(|t| t.as_object()) | ||
| .and_then(|obj| obj.values().next()) | ||
| .and_then(|tc| tc.get("expectException")) | ||
| .and_then(|v| v.as_str()) | ||
| .map(|s| s.to_owned()); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
don't handle json by hand, just update "VerifySignaturesTestVectorFile" struct
| .map(|s| s.to_owned()); | ||
|
|
||
| // Phase 2: parse into the typed structure. | ||
| let test_file: VerifySignaturesTestVectorFile = match serde_json::from_str(&json_content) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
no need to handle json errors - nobody structures invalid json as spec test failure. Spec test must always be parsed, if it is not - then it is test failure, not "expected error".
|
let's merge this now, and do style fixes later |
Co-authored-by: noopur23 <82257577+noopur23@users.noreply.github.com>
After this update, the vector tests run with
cargo test -p containers --features xmss-verify test_vectors::verify_signaturesnow pass