test: backfill negative properties, error branches, and non-zero DKG ctx - #684
Open
iamquang95 wants to merge 3 commits into
Open
test: backfill negative properties, error branches, and non-zero DKG ctx#684iamquang95 wants to merge 3 commits into
iamquang95 wants to merge 3 commits into
Conversation
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.
Fix #646
Test-only. 7 files, every hunk inside a
#[cfg(test)]module. No production change. 111 -> 191 tests (pluto-crypto44->91,pluto-frost49->64,pluto-k1util18->36).The existing suites assert mostly positive round trips and operator
relationships —
scalar * scalar.invert() == ONEholds for any consistentlywrong pair of operations, and a
verifyhard-wired toOk(true)passes everytest that only feeds it good signatures. These are the assertions that can fail.
crates/k1util/src/k1util.rs(+18)verify_64/verify_65_returns_false_for_wrong_signature— wrong key, wrong hash, corruptedRverify_64/recover/sign_rejects_wrong_length_*— expected and actual length assertedrecover_maps_compact_recovery_ids_to_ethereum_ids— 27/28 pinned onto 0/1, withassert_ne!as the non-vacuity guardpublic_key_from_libp2p_round_trips_secp256k1_key/..._rejects_non_secp256k1_keycrates/crypto/src/tbls/math.rs(+20, from one test)evaluate_polynomial_matches_hand_computed_values— f(x)=7+11x+13x² at x=1,2,5 -> 31,81,387evaluate_polynomial_rejects_empty_polynomial,evaluate_polynomial_degree_zero_ignores_xlagrange_interpolate_secret_recovers_constant_term—{1,2,3},{2,4,5}, descending{5,4,2}(thescalar_negatebranch)lagrange_interpolate_secret_below_threshold_yields_wrong_scalar— pins the exact wrong valuer-19, not just "differs"lagrange_interpolate_signature_recovers_group_signature, plus duplicate-index and length-mismatch guards on both pathsaggregate_public_keys_is_additively_homomorphic/..._of_single_key_is_that_keyscalar_div_multiplies_by_modular_inverse,scalar_div_rejects_zero_denominator,scalar_negate_computes_additive_inversecrates/crypto/src/tbls.rs(+11)generate_insecure_secret_is_deterministic/..._returns_raw_rng_draw/..._exhausts_retry_budget— driven by aConstantRng, not a lucky seedgenerate_secret_key_derives_from_rng_drawempty_inputs_reject_with_distinct_errors— three inputs, three variantsthreshold_aggregate_below_threshold_does_not_verifyall_entry_points_reject_malformed_signature— the three parse sites that had no coverageverify_rejects_malformed_public_key,verify_rejects_identity_signatureverify_reports_off_subgroup_key_as_verify_failurecrates/crypto/src/types.rs(+16)bls_error_from_blst_error— exhaustive 8-row table,BLST_SUCCESSincluded so the_arm is pinnederror_display_carries_wrapped_bls_error,invalid_threshold_display_does_not_swap_fields,conv_error_display_does_not_swap_expected_and_got,threshold_overflow_display_carries_thresholdcrates/frost/src/curve.rs(+10)scalar_arithmetic_matches_hand_computed_values/scalar_arithmetic_wraps_at_field_edgesscalar_from_bytes_rejects_field_order_but_wide_reduces_itscalar_from_bytes_wide_reduces_modulo_field_order/..._reduces_largest_inputg1_arithmetic_matches_independently_computed_points—Add/Sub/Mulagainst compressed2G/3G/5Gcomputed outside this crateg1_group_laws_hold_for_identity,g1_affine_accepts_identity_that_projective_rejectsg1_from_compressed_rejects_off_subgroup_point/..._rejects_malformed_encodingscrates/frost/src/frost_core.rs(+2)from_commitments_rejects_off_subgroup_point_at_any_position—collect::<Option<_>>()short-circuits, so a single-element test cannot see positionfrom_commitments_rejects_identitycrates/frost/src/kryptology.rs(+3) — the non-zero DKG contextEvery pre-existing DKG test pinned
ctx = 0, where a dropped context byte isindistinguishable from one that is used.
bls_round_trip_2_of_3now runs atctx = 0x2a;bls_round_trip_3_of_3keepsctx = 0.ctx_binds_schnorr_proof_but_not_polynomial— same seed, two contexts: identical Feldman commitments, differentci/wiround2_rejects_broadcast_from_different_ctx—InvalidProof { culprit: 2 }challenge_preimage_is_id_ctx_commitment_nonce— 98 bytes pinned against a hand-built preimage; this is the interop surface with Go kryptology