@@ -247,6 +247,12 @@ const BLS12_381_VALID_PAIRING: u32 = 0;
247
247
/// Return code (error code) for an invalid pairing
248
248
const BLS12_381_INVALID_PAIRING : u32 = 1 ;
249
249
250
+ /// Return code (error code) if the aggregating the points on curve was successful
251
+ const BLS12_381_AGGREGATE_SUCCESS : u32 = 0 ;
252
+
253
+ /// Return code (error code) for success when hashing to the curve
254
+ const BLS12_381_HASH_TO_CURVE_SUCCESS : u32 = 0 ;
255
+
250
256
/// Maximum size of continous points passed to aggregate functions
251
257
const BLS12_381_MAX_AGGREGATE_SIZE : usize = 2 * MI ;
252
258
@@ -280,7 +286,7 @@ pub fn do_bls12_381_aggregate_g1<
280
286
Ok ( point) => {
281
287
let memory = data. memory ( & store) ;
282
288
write_region ( & memory, out_ptr, & point) ?;
283
- 0
289
+ BLS12_381_AGGREGATE_SUCCESS
284
290
}
285
291
Err ( err) => match err {
286
292
CryptoError :: InvalidPoint { .. } | CryptoError :: Aggregation { .. } => err. code ( ) ,
@@ -324,7 +330,7 @@ pub fn do_bls12_381_aggregate_g2<
324
330
Ok ( point) => {
325
331
let memory = data. memory ( & store) ;
326
332
write_region ( & memory, out_ptr, & point) ?;
327
- 0
333
+ BLS12_381_AGGREGATE_SUCCESS
328
334
}
329
335
Err ( err) => match err {
330
336
CryptoError :: InvalidPoint { .. } | CryptoError :: Aggregation { .. } => err. code ( ) ,
@@ -423,7 +429,7 @@ pub fn do_bls12_381_hash_to_g1<
423
429
let memory = data. memory ( & store) ;
424
430
write_region ( & memory, out_ptr, & point) ?;
425
431
426
- Ok ( 0 )
432
+ Ok ( BLS12_381_HASH_TO_CURVE_SUCCESS )
427
433
}
428
434
429
435
pub fn do_bls12_381_hash_to_g2 <
@@ -455,7 +461,7 @@ pub fn do_bls12_381_hash_to_g2<
455
461
let memory = data. memory ( & store) ;
456
462
write_region ( & memory, out_ptr, & point) ?;
457
463
458
- Ok ( 0 )
464
+ Ok ( BLS12_381_HASH_TO_CURVE_SUCCESS )
459
465
}
460
466
461
467
pub fn do_secp256k1_verify < A : BackendApi + ' static , S : Storage + ' static , Q : Querier + ' static > (
0 commit comments