Skip to content

Commit 8e9a392

Browse files
add comments to clarify serialized size constants
1 parent c9f9190 commit 8e9a392

File tree

2 files changed

+4
-4
lines changed

2 files changed

+4
-4
lines changed

soroban-sdk-macros/src/map_type.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@ use syn::{
88
Type, TypePath, TypeTuple,
99
};
1010

11-
const G1_SERIALIZED_SIZE: u32 = 96;
12-
const G2_SERIALIZED_SIZE: u32 = 192;
11+
const G1_SERIALIZED_SIZE: u32 = 96; // Must match soroban_sdk::crypto::bls21_381::G1_SERIALIZED_SIZE.
12+
const G2_SERIALIZED_SIZE: u32 = 192; // Must match soroban_sdk::crypto::bls21_381::G2_SERIALIZED_SIZE.
1313

1414
#[allow(clippy::too_many_lines)]
1515
pub fn map_type(t: &Type, allow_hash: bool) -> Result<ScSpecTypeDef, Error> {

soroban-sdk/src/crypto/bls12_381.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ use core::{
1414

1515
pub const FP_SERIALIZED_SIZE: usize = 48; // Size in bytes of a serialized Fp element in BLS12-381. The field modulus is 381 bits, requiring 48 bytes (384 bits) with 3 bits reserved for flags.
1616
pub const FP2_SERIALIZED_SIZE: usize = FP_SERIALIZED_SIZE * 2;
17-
pub const G1_SERIALIZED_SIZE: usize = FP_SERIALIZED_SIZE * 2;
18-
pub const G2_SERIALIZED_SIZE: usize = FP2_SERIALIZED_SIZE * 2;
17+
pub const G1_SERIALIZED_SIZE: usize = FP_SERIALIZED_SIZE * 2; // Must match soroban_sdk_macro::map_type::G1_SERIALIZED_SIZE.
18+
pub const G2_SERIALIZED_SIZE: usize = FP2_SERIALIZED_SIZE * 2;// Must match soroban_sdk_macro::map_type::G2_SERIALIZED_SIZE.
1919

2020
/// Bls12_381 provides access to curve and field arithmetics on the BLS12-381
2121
/// curve.

0 commit comments

Comments
 (0)