Skip to content

Commit 4cef807

Browse files
authored
Use correct bn254 cost type (stellar#1609)
### What Fixed by Jay in stellar#1608.
1 parent 6f6d8a5 commit 4cef807

File tree

2 files changed

+31
-31
lines changed

2 files changed

+31
-31
lines changed

soroban-env-host/observations/24/test__bn254__test_bn254_multi_pairing_check.json

Lines changed: 29 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -19,27 +19,27 @@
1919
" 17 call bn254_multi_pairing_check(Vec(obj#27), Vec(obj#35))": "",
2020
" 18 call vec_len(Vec(obj#27))": "cpu:22941",
2121
" 19 ret vec_len -> Ok(U32(3))": "cpu:23063",
22-
" 20 ret bn254_multi_pairing_check -> Err(Error(Crypto, InvalidInput))": "cpu:29304, mem:3080",
23-
" 21 call vec_new_from_slice(3)": "cpu:34311, mem:3560, objs:-/21@7838672b",
24-
" 22 ret vec_new_from_slice -> Ok(Vec(obj#43))": "cpu:35463, mem:3680, objs:-/22@34d8cdf3",
25-
" 23 call vec_new_from_slice(3)": "cpu:39443, mem:4576, objs:-/26@50d71014",
26-
" 24 ret vec_new_from_slice -> Ok(Vec(obj#53))": "cpu:40595, mem:4696, objs:-/27@5235ac78",
22+
" 20 ret bn254_multi_pairing_check -> Err(Error(Crypto, InvalidInput))": "cpu:27152, mem:3080",
23+
" 21 call vec_new_from_slice(3)": "cpu:32159, mem:3560, objs:-/21@7838672b",
24+
" 22 ret vec_new_from_slice -> Ok(Vec(obj#43))": "cpu:33311, mem:3680, objs:-/22@34d8cdf3",
25+
" 23 call vec_new_from_slice(3)": "cpu:37291, mem:4576, objs:-/26@50d71014",
26+
" 24 ret vec_new_from_slice -> Ok(Vec(obj#53))": "cpu:38443, mem:4696, objs:-/27@5235ac78",
2727
" 25 call bn254_multi_pairing_check(Vec(obj#43), Vec(obj#53))": "",
28-
" 26 call vec_len(Vec(obj#43))": "cpu:40839",
29-
" 27 ret vec_len -> Ok(U32(3))": "cpu:40961",
30-
" 28 call vec_len(Vec(obj#53))": "cpu:50063, mem:4904",
31-
" 29 ret vec_len -> Ok(U32(3))": "cpu:50185",
32-
" 30 ret bn254_multi_pairing_check -> Err(Error(Crypto, InvalidInput))": "cpu:5927742, mem:5304",
28+
" 26 call vec_len(Vec(obj#43))": "cpu:38687",
29+
" 27 ret vec_len -> Ok(U32(3))": "cpu:38809",
30+
" 28 call vec_len(Vec(obj#53))": "cpu:44683, mem:4904",
31+
" 29 ret vec_len -> Ok(U32(3))": "cpu:44805",
32+
" 30 ret bn254_multi_pairing_check -> Err(Error(Crypto, InvalidInput))": "cpu:5915804, mem:5304",
3333
" 31 call vec_new_from_slice(3)": "cpu:8108, mem:992, objs:-/32@bb310705",
3434
" 32 ret vec_new_from_slice -> Ok(Vec(obj#65))": "cpu:9260, mem:1112, objs:-/33@81d5c760",
3535
" 33 call vec_new_from_slice(3)": "",
3636
" 34 ret vec_new_from_slice -> Ok(Vec(obj#67))": "cpu:10412, mem:1232, objs:-/34@6a607331",
3737
" 35 call bn254_multi_pairing_check(Vec(obj#65), Vec(obj#67))": "",
3838
" 36 call vec_len(Vec(obj#65))": "cpu:10656",
3939
" 37 ret vec_len -> Ok(U32(3))": "cpu:10778",
40-
" 38 call vec_len(Vec(obj#67))": "cpu:19880, mem:1440",
41-
" 39 ret vec_len -> Ok(U32(3))": "cpu:20002",
42-
" 40 ret bn254_multi_pairing_check -> Ok(True)": "cpu:23284968, mem:149712",
40+
" 38 call vec_len(Vec(obj#67))": "cpu:16652, mem:1440",
41+
" 39 ret vec_len -> Ok(U32(3))": "cpu:16774",
42+
" 40 ret bn254_multi_pairing_check -> Ok(True)": "cpu:23271903, mem:149712",
4343
" 41 call bn254_g1_add(Bytes(obj#69), Bytes(obj#71))": "cpu:2940556, mem:768, objs:-/38@3d38193f",
4444
" 42 ret bn254_g1_add -> Ok(Bytes(obj#77))": "cpu:2949506, mem:928, objs:-/39@d695fd46",
4545
" 43 call vec_new_from_slice(3)": "",
@@ -49,9 +49,9 @@
4949
" 47 call bn254_multi_pairing_check(Vec(obj#79), Vec(obj#81))": "",
5050
" 48 call vec_len(Vec(obj#79))": "cpu:2952054",
5151
" 49 ret vec_len -> Ok(U32(3))": "cpu:2952176",
52-
" 50 call vec_len(Vec(obj#81))": "cpu:2961278, mem:1376",
53-
" 51 ret vec_len -> Ok(U32(3))": "cpu:2961400",
54-
" 52 ret bn254_multi_pairing_check -> Ok(True)": "cpu:26226366, mem:149648",
52+
" 50 call vec_len(Vec(obj#81))": "cpu:2958050, mem:1376",
53+
" 51 ret vec_len -> Ok(U32(3))": "cpu:2958172",
54+
" 52 ret bn254_multi_pairing_check -> Ok(True)": "cpu:26213301, mem:149648",
5555
" 53 call obj_from_u256_pieces(1010788071183958826, 11343673176685890334, 5321920092515675630, 13294342434574159125)": "cpu:0, mem:0",
5656
" 54 ret obj_from_u256_pieces -> Ok(U256(obj#83))": "cpu:503, mem:80, objs:-/42@1ef08dab",
5757
" 55 call obj_from_u256_pieces(2069246105850674101, 2198446477011941359, 661982898885800758, 4032643384944951997)": "",
@@ -71,38 +71,38 @@
7171
" 69 call bn254_multi_pairing_check(Vec(obj#107), Vec(obj#109))": "",
7272
" 70 call vec_len(Vec(obj#107))": "cpu:3142394",
7373
" 71 ret vec_len -> Ok(U32(4))": "cpu:3142516",
74-
" 72 call vec_len(Vec(obj#109))": "cpu:3154487, mem:2464",
75-
" 73 ret vec_len -> Ok(U32(4))": "cpu:3154609",
76-
" 74 ret bn254_multi_pairing_check -> Ok(True)": "cpu:32419916, mem:199544",
74+
" 72 call vec_len(Vec(obj#109))": "cpu:3150183, mem:2464",
75+
" 73 ret vec_len -> Ok(U32(4))": "cpu:3150305",
76+
" 74 ret bn254_multi_pairing_check -> Ok(True)": "cpu:32402496, mem:199544",
7777
" 75 call vec_new_from_slice(3)": "cpu:5007, mem:480, objs:-/58@13a45342",
7878
" 76 ret vec_new_from_slice -> Ok(Vec(obj#117))": "cpu:6159, mem:600, objs:-/59@e788809a",
7979
" 77 call vec_new_from_slice(3)": "cpu:9144, mem:1272, objs:-/62@c3c2a88",
8080
" 78 ret vec_new_from_slice -> Ok(Vec(obj#125))": "cpu:10296, mem:1392, objs:-/63@6fe5e24",
8181
" 79 call bn254_multi_pairing_check(Vec(obj#117), Vec(obj#125))": "",
8282
" 80 call vec_len(Vec(obj#117))": "cpu:10540",
8383
" 81 ret vec_len -> Ok(U32(3))": "cpu:10662",
84-
" 82 call vec_len(Vec(obj#125))": "cpu:19764, mem:1600",
85-
" 83 ret vec_len -> Ok(U32(3))": "cpu:19886",
86-
" 84 ret bn254_multi_pairing_check -> Ok(False)": "cpu:23284852, mem:149872",
84+
" 82 call vec_len(Vec(obj#125))": "cpu:16536, mem:1600",
85+
" 83 ret vec_len -> Ok(U32(3))": "cpu:16658",
86+
" 84 ret bn254_multi_pairing_check -> Ok(False)": "cpu:23271787, mem:149872",
8787
" 85 call vec_new_from_slice(3)": "cpu:5007, mem:480, objs:-/66@c109b6ce",
8888
" 86 ret vec_new_from_slice -> Ok(Vec(obj#133))": "cpu:6159, mem:600, objs:-/67@1722c54b",
8989
" 87 call vec_new_from_slice(3)": "cpu:9144, mem:1272, objs:-/70@bbdb09cd",
9090
" 88 ret vec_new_from_slice -> Ok(Vec(obj#141))": "cpu:10296, mem:1392, objs:-/71@99991e84",
9191
" 89 call bn254_multi_pairing_check(Vec(obj#133), Vec(obj#141))": "",
9292
" 90 call vec_len(Vec(obj#133))": "cpu:10540",
9393
" 91 ret vec_len -> Ok(U32(3))": "cpu:10662",
94-
" 92 call vec_len(Vec(obj#141))": "cpu:19764, mem:1600",
95-
" 93 ret vec_len -> Ok(U32(3))": "cpu:19886",
96-
" 94 ret bn254_multi_pairing_check -> Ok(False)": "cpu:23284852, mem:149872",
94+
" 92 call vec_len(Vec(obj#141))": "cpu:16536, mem:1600",
95+
" 93 ret vec_len -> Ok(U32(3))": "cpu:16658",
96+
" 94 ret bn254_multi_pairing_check -> Ok(False)": "cpu:23271787, mem:149872",
9797
" 95 call vec_new_from_slice(2)": "cpu:3338, mem:320, objs:-/73@d5c975db",
9898
" 96 ret vec_new_from_slice -> Ok(Vec(obj#147))": "cpu:4427, mem:432, objs:-/74@598dad8f",
9999
" 97 call vec_new_from_slice(2)": "cpu:6417, mem:880, objs:-/76@7c6b8e4a",
100100
" 98 ret vec_new_from_slice -> Ok(Vec(obj#153))": "cpu:7506, mem:992, objs:-/77@7903cbb2",
101101
" 99 call bn254_multi_pairing_check(Vec(obj#147), Vec(obj#153))": "",
102102
" 100 call vec_len(Vec(obj#147))": "cpu:7750",
103103
" 101 ret vec_len -> Ok(U32(2))": "cpu:7872",
104-
" 102 call vec_len(Vec(obj#153))": "cpu:14105, mem:1136",
105-
" 103 ret vec_len -> Ok(U32(2))": "cpu:14227",
106-
" 104 ret bn254_multi_pairing_check -> Ok(True)": "cpu:17278852, mem:100600",
107-
" 105 end": "cpu:17278852, mem:100600, prngs:-/-, objs:-/77@7903cbb2, vm:-/-, evt:-, store:-/-, foot:-, stk:-, auth:-/-"
104+
" 102 call vec_len(Vec(obj#153))": "cpu:11953, mem:1136",
105+
" 103 ret vec_len -> Ok(U32(2))": "cpu:12075",
106+
" 104 ret bn254_multi_pairing_check -> Ok(True)": "cpu:17270142, mem:100600",
107+
" 105 end": "cpu:17270142, mem:100600, prngs:-/-, objs:-/77@7903cbb2, vm:-/-, evt:-, store:-/-, foot:-, stk:-, auth:-/-"
108108
}

soroban-env-host/src/crypto/bn254.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ impl Host {
255255
) -> Result<Vec<G1Affine>, HostError> {
256256
self.bn254_affine_vec_from_vecobj::<BN254_G1_SERIALIZED_SIZE, G1Config>(
257257
vp,
258-
ContractCostType::Bls12381G1CheckPointOnCurve,
258+
ContractCostType::Bn254G1CheckPointOnCurve,
259259
false, // G1 subgroup check is not necessary
260260
"G1",
261261
)
@@ -267,7 +267,7 @@ impl Host {
267267
) -> Result<Vec<G2Affine>, HostError> {
268268
self.bn254_affine_vec_from_vecobj::<BN254_G2_SERIALIZED_SIZE, G2Config>(
269269
vp,
270-
ContractCostType::Bls12381G2CheckPointOnCurve,
270+
ContractCostType::Bn254G2CheckPointOnCurve,
271271
true,
272272
"G2",
273273
)

0 commit comments

Comments
 (0)