Skip to content

Commit edf93f4

Browse files
committed
improving formatting
1 parent 1e699fa commit edf93f4

File tree

1 file changed

+90
-12
lines changed

1 file changed

+90
-12
lines changed

main.py

Lines changed: 90 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2449,38 +2449,116 @@ def case17_fail_msm_G2():
24492449
"Name": "bls_g2msm_empty_input"
24502450
},
24512451
{
2452-
"Input": int_to_hex(int(G2[0].coeffs[0]), 63) + int_to_hex(int(G2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64) + int_to_hex(
2453-
int(2), 32) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(2), 32),
2452+
"Input": ""
2453+
# G2 point (short x coordinate)
2454+
+ int_to_hex(int(G2[0].coeffs[0]), 63)
2455+
+ int_to_hex(int(G2[0].coeffs[1]), 64)
2456+
+ int_to_hex(int(G2[1].coeffs[0]), 64)
2457+
+ int_to_hex(int(G2[1].coeffs[1]), 64)
2458+
# scalar
2459+
+ int_to_hex(int(2), 32)
2460+
# P2 point
2461+
+ int_to_hex(int(P2[0].coeffs[0]), 64)
2462+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2463+
+ int_to_hex(int(P2[1].coeffs[0]), 64)
2464+
+ int_to_hex(int(P2[1].coeffs[1]), 64)
2465+
# scalar
2466+
+ int_to_hex(int(2), 32),
24542467
"ExpectedError": "invalid input length",
24552468
"Name": "bls_g2msm_short_input"
24562469
},
24572470
{
2458-
"Input": int_to_hex(int(G2[0].coeffs[0]), 65) + int_to_hex(int(G2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64) + int_to_hex(
2459-
int(2), 32) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(2), 32),
2471+
"Input": ""
2472+
# G2 point (long x coordinate)
2473+
+ int_to_hex(int(G2[0].coeffs[0]), 65)
2474+
+ int_to_hex(int(G2[0].coeffs[1]), 64)
2475+
+ int_to_hex(int(G2[1].coeffs[0]), 64)
2476+
+ int_to_hex(int(G2[1].coeffs[1]), 64)
2477+
# scalar
2478+
+ int_to_hex(int(2), 32)
2479+
# P2 point
2480+
+ int_to_hex(int(P2[0].coeffs[0]), 64)
2481+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2482+
+ int_to_hex(int(P2[1].coeffs[0]), 64)
2483+
+ int_to_hex(int(P2[1].coeffs[1]), 64)
2484+
# scalar
2485+
+ int_to_hex(int(2), 32),
24602486
"ExpectedError": "invalid input length",
24612487
"Name": "bls_g2msm_long_input"
24622488
},
24632489
{
2464-
"Input": "10" + int_to_hex(int(G2[0].coeffs[0]), 63) + int_to_hex(int(G2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64) + int_to_hex(
2465-
int(2), 32) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(2), 32),
2490+
# G2 point (wrong element top bytes)
2491+
"Input": "10"
2492+
+ int_to_hex(int(G2[0].coeffs[0]), 63)
2493+
+ int_to_hex(int(G2[0].coeffs[1]), 64)
2494+
+ int_to_hex(int(G2[1].coeffs[0]), 64)
2495+
+ int_to_hex(int(G2[1].coeffs[1]), 64)
2496+
# scalar
2497+
+ int_to_hex(int(2), 32)
2498+
# P2 point
2499+
+ int_to_hex(int(P2[0].coeffs[0]), 64)
2500+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2501+
+ int_to_hex(int(P2[1].coeffs[0]), 64)
2502+
+ int_to_hex(int(P2[1].coeffs[1]), 64)
2503+
# scalar
2504+
+ int_to_hex(int(2), 32),
24662505
"ExpectedError": "invalid field element top bytes",
24672506
"Name": "bls_g2msm_violate_top_bytes"
24682507
},
24692508
{
2470-
"Input": int_to_hex(int(G2[0].coeffs[0]) + q, 64) + int_to_hex(int(G2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64) + int_to_hex(
2471-
int(2), 32) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(2), 32),
2509+
"Input": ""
2510+
# G2 point (wrong encoding)
2511+
+ int_to_hex(int(G2[0].coeffs[0]) + q, 64)
2512+
+ int_to_hex(int(G2[0].coeffs[1]), 64)
2513+
+ int_to_hex(int(G2[1].coeffs[0]), 64)
2514+
+ int_to_hex(int(G2[1].coeffs[1]), 64)
2515+
# scalar
2516+
+ int_to_hex(int(2), 32)
2517+
# P2 point
2518+
+ int_to_hex(int(P2[0].coeffs[0]), 64)
2519+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2520+
+ int_to_hex(int(P2[1].coeffs[0]), 64)
2521+
+ int_to_hex(int(P2[1].coeffs[1]), 64)
2522+
# scalar
2523+
+ int_to_hex(int(2), 32),
24722524
"ExpectedError": "invalid fp.Element encoding",
24732525
"Name": "bls_g2msm_invalid_field_element"
24742526
},
24752527
{
2476-
"Input": int_to_hex(int(G2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(G2[1].coeffs[0]), 64) + int_to_hex(int(G2[1].coeffs[1]), 64) + int_to_hex(
2477-
int(2), 32) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(2), 32),
2528+
"Input": ""
2529+
# G2 point (not on curve)
2530+
+ int_to_hex(int(G2[0].coeffs[0]), 64)
2531+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2532+
+ int_to_hex(int(G2[1].coeffs[0]), 64)
2533+
+ int_to_hex(int(G2[1].coeffs[1]), 64)
2534+
# scalar
2535+
+ int_to_hex(int(2), 32)
2536+
# P2 point
2537+
+ int_to_hex(int(P2[0].coeffs[0]), 64)
2538+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2539+
+ int_to_hex(int(P2[1].coeffs[0]), 64)
2540+
+ int_to_hex(int(P2[1].coeffs[1]), 64)
2541+
# scalar
2542+
+ int_to_hex(int(2), 32),
24782543
"ExpectedError": "invalid point: not on curve",
24792544
"Name": "bls_g2msm_point_not_on_curve"
24802545
},
24812546
{
2482-
"Input": int_to_hex(int(G2_wrong_order[0].coeffs[0]), 64) + int_to_hex(int(G2_wrong_order[0].coeffs[1]), 64) + int_to_hex(int(G2_wrong_order[1].coeffs[0]), 64) + int_to_hex(int(G2_wrong_order[1].coeffs[1]), 64) + int_to_hex(
2483-
int(2), 32) + int_to_hex(int(P2[0].coeffs[0]), 64) + int_to_hex(int(P2[0].coeffs[1]), 64) + int_to_hex(int(P2[1].coeffs[0]), 64) + int_to_hex(int(P2[1].coeffs[1]), 64) + int_to_hex(int(2), 32),
2547+
"Input": ""
2548+
# G2 point (not in the correct subgroup)
2549+
+ int_to_hex(int(G2_wrong_order[0].coeffs[0]), 64)
2550+
+ int_to_hex(int(G2_wrong_order[0].coeffs[1]), 64)
2551+
+ int_to_hex(int(G2_wrong_order[1].coeffs[0]), 64)
2552+
+ int_to_hex(int(G2_wrong_order[1].coeffs[1]), 64)
2553+
# scalar
2554+
+ int_to_hex(int(2), 32)
2555+
# P2 point
2556+
+ int_to_hex(int(P2[0].coeffs[0]), 64)
2557+
+ int_to_hex(int(P2[0].coeffs[1]), 64)
2558+
+ int_to_hex(int(P2[1].coeffs[0]), 64)
2559+
+ int_to_hex(int(P2[1].coeffs[1]), 64)
2560+
# scalar
2561+
+ int_to_hex(int(2), 32),
24842562
"ExpectedError": "g2 point is not in the correct subgroup",
24852563
"Name": "bls_pairing_g2_not_in_correct_subgroup"
24862564
}

0 commit comments

Comments
 (0)