Skip to content

Commit 6cef487

Browse files
committed
change suffix from LEN to SIZE
1 parent c536f9b commit 6cef487

File tree

2 files changed

+19
-19
lines changed

2 files changed

+19
-19
lines changed

sdk/pinocchio/src/curves/bn254/compression.rs

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -85,14 +85,14 @@ pub fn alt_bn128_g2_decompress_be(
8585
}
8686

8787
#[inline]
88-
fn alt_bn128_compression<const OUTPUT_DATA_LEN: usize>(
88+
fn alt_bn128_compression<const OUTPUT_DATA_SIZE: usize>(
8989
input: &[u8],
9090
op: u64,
91-
) -> Result<[u8; OUTPUT_DATA_LEN], ProgramError> {
91+
) -> Result<[u8; OUTPUT_DATA_SIZE], ProgramError> {
9292
// Call via a system call to perform the calculation
9393
#[cfg(target_os = "solana")]
9494
{
95-
let mut bytes = core::mem::MaybeUninit::<[u8; OUTPUT_DATA_LEN]>::uninit();
95+
let mut bytes = core::mem::MaybeUninit::<[u8; OUTPUT_DATA_SIZE]>::uninit();
9696

9797
let result = unsafe {
9898
sol_alt_bn128_compression(

sdk/pinocchio/src/curves/bn254/group_op.rs

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -6,21 +6,21 @@ use crate::program_error::ProgramError;
66
#[cfg(target_os = "solana")]
77
use crate::syscalls::sol_alt_bn128_group_op;
88

9-
/// Input length for the add operation.
10-
pub const ALT_BN128_ADDITION_INPUT_LEN: usize = ALT_BN128_G1_POINT_SIZE * 2; // 128
9+
/// Input size for the add operation.
10+
pub const ALT_BN128_ADDITION_INPUT_SIZE: usize = ALT_BN128_G1_POINT_SIZE * 2; // 128
1111

12-
/// Input length for the multiplication operation.
13-
pub const ALT_BN128_MULTIPLICATION_INPUT_LEN: usize =
12+
/// Input size for the multiplication operation.
13+
pub const ALT_BN128_MULTIPLICATION_INPUT_SIZE: usize =
1414
ALT_BN128_G1_POINT_SIZE + ALT_BN128_FIELD_SIZE; // 96
1515

16-
/// Pair element length.
17-
pub const ALT_BN128_PAIRING_ELEMENT_LEN: usize = ALT_BN128_G1_POINT_SIZE + ALT_BN128_G2_POINT_SIZE; // 192
16+
/// Pair element size.
17+
pub const ALT_BN128_PAIRING_ELEMENT_SIZE: usize = ALT_BN128_G1_POINT_SIZE + ALT_BN128_G2_POINT_SIZE; // 192
1818

19-
/// Output length for the add operation.
20-
pub const ALT_BN128_ADDITION_OUTPUT_LEN: usize = ALT_BN128_G1_POINT_SIZE; // 64
19+
/// Output size for the add operation.
20+
pub const ALT_BN128_ADDITION_OUTPUT_SIZE: usize = ALT_BN128_G1_POINT_SIZE; // 64
2121

22-
/// Output length for the multiplication operation.
23-
pub const ALT_BN128_MULTIPLICATION_OUTPUT_LEN: usize = ALT_BN128_G1_POINT_SIZE; // 64
22+
/// Output size for the multiplication operation.
23+
pub const ALT_BN128_MULTIPLICATION_OUTPUT_SIZE: usize = ALT_BN128_G1_POINT_SIZE; // 64
2424

2525
const ALT_BN128_G1_ADD_BE: u64 = 0;
2626
#[allow(dead_code)]
@@ -44,7 +44,7 @@ const ALT_BN128_PAIRING_BE: u64 = 3;
4444
#[inline(always)]
4545
pub fn alt_bn128_g1_addition_be(
4646
input: &[u8],
47-
) -> Result<[u8; ALT_BN128_ADDITION_OUTPUT_LEN], ProgramError> {
47+
) -> Result<[u8; ALT_BN128_ADDITION_OUTPUT_SIZE], ProgramError> {
4848
alt_bn128_group_op(input, ALT_BN128_G1_ADD_BE)
4949
}
5050

@@ -65,7 +65,7 @@ pub fn alt_bn128_g1_addition_be(
6565
#[inline(always)]
6666
pub fn alt_bn128_g1_multiplication_be(
6767
input: &[u8],
68-
) -> Result<[u8; ALT_BN128_MULTIPLICATION_OUTPUT_LEN], ProgramError> {
68+
) -> Result<[u8; ALT_BN128_MULTIPLICATION_OUTPUT_SIZE], ProgramError> {
6969
alt_bn128_group_op(input, ALT_BN128_G1_MUL_BE)
7070
}
7171

@@ -81,7 +81,7 @@ pub fn alt_bn128_g1_multiplication_be(
8181
///
8282
/// Note: This function does **not** check if the input has the correct length.
8383
/// Currently, if the length is invalid, it will not return an error; instead it will use only
84-
/// multiples of [`ALT_BN128_PAIRING_ELEMENT_LEN`] bytes and discard the rest.
84+
/// multiples of [`ALT_BN128_PAIRING_ELEMENT_SIZE`] bytes and discard the rest.
8585
/// After SIMD-0334 is implemented, it will return an error if the length is invalid,
8686
/// incurring the cost of the syscall.
8787
#[inline(always)]
@@ -90,14 +90,14 @@ pub fn alt_bn128_pairing_be(input: &[u8]) -> Result<u8, ProgramError> {
9090
}
9191

9292
#[inline]
93-
fn alt_bn128_group_op<const OUTPUT_DATA_LEN: usize>(
93+
fn alt_bn128_group_op<const OUTPUT_DATA_SIZE: usize>(
9494
input: &[u8],
9595
op: u64,
96-
) -> Result<[u8; OUTPUT_DATA_LEN], ProgramError> {
96+
) -> Result<[u8; OUTPUT_DATA_SIZE], ProgramError> {
9797
// Call via a system call to perform the calculation
9898
#[cfg(target_os = "solana")]
9999
{
100-
let mut bytes = core::mem::MaybeUninit::<[u8; OUTPUT_DATA_LEN]>::uninit();
100+
let mut bytes = core::mem::MaybeUninit::<[u8; OUTPUT_DATA_SIZE]>::uninit();
101101

102102
let result = unsafe {
103103
sol_alt_bn128_group_op(

0 commit comments

Comments
 (0)