Skip to content

Commit

Permalink
remove comments in annotation
Browse files Browse the repository at this point in the history
  • Loading branch information
olga24912 committed Nov 17, 2023
1 parent 80adcc7 commit cc448df
Showing 1 changed file with 1 addition and 207 deletions.
208 changes: 1 addition & 207 deletions neps/nep-0488.md
Original file line number Diff line number Diff line change
Expand Up @@ -780,29 +780,6 @@ We can use all the tests for addition for Ethereum[^47],[^48] to check the case
***Annotation:***

```rust
/// Computes sum for signed elements on BLS12-381 curve
/// \sum_i (-1)^{s_i} p_i should be the equal result.
///
/// # Arguments
///
/// * `value` - sequence of (si, pi) where pi is point(x:Fp, y:Fp) on BLS-381 curve and si is sign (0 for +, and 1 for -)
/// BLS12-381 is Y^2 = X^3 + 4 curve over Fp.
///
/// `value` is encoded as packed, big-endian
/// `[(u8, ([u8; 48], [u8; 48]))]` slice.
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns `MemoryAccessViolation`.
///
/// If (1) `value.len()%97 != 0` or (2) value of sign is not 0 or 1
/// the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_g1_sum_base + bls12381_g1_sum_element * num_elements`
pub fn bls12381_g1_sum(&mut self,
value_len: u64,
value_ptr: u64,
Expand Down Expand Up @@ -859,29 +836,6 @@ We can use all the tests for addition for Ethereum[^47],[^48] to check the case
***Annotation:***

```rust
/// Computes sum for signed elements on BLS12-381 curve
/// \sum_i (-1)^{s_i} p_i should be the equal result.
///
/// # Arguments
///
/// * `value` - sequence of (si, pi), where pi is point(x:Fp^2, y:Fp^2) on BLS-381 curve and si is sign (0 for +, 1 for -)
/// BLS12-381 is Y^2 = X^3 + 4(i + 1) curve over Fp^2.
///
/// `value` is encoded as packed, big-endian
/// `[(u8, ([u8; 96], [u8; 96]))]` slice.
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns `MemoryAccessViolation`.
///
/// If (1) `value.len()%193 != 0` or (2) sign is not 0 or 1,
/// the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_g2_sum_base + bls12381_g2_sum_element * num_elements`
pub fn bls12381_g2_sum(&mut self,
value_len: u64,
value_ptr: u64,
Expand Down Expand Up @@ -954,31 +908,6 @@ The EIP-2537 contains the same function, so we can reuse test vectors from Ether
***Annotation:***

```rust
/// Computes multiexp on BLS12-381 curve using Pippenger's algorithm
///\sum_i si*pi should be equal result.
///
/// # Arguments
///
/// * `value` - sequence of (pi, si), where
/// pi is point (x:Fp, y:Fp) on BLS12-381, and si is u256.
/// BLS12-381 is Y^2 = X^3 + 4 curve over Fp.
///
/// `value` is encoded as packed, big-endian
/// `[(([u8; 48], [u8; 48]), u256)]` slice.
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns
/// `MemoryAccessViolation`.
///
/// If `value.len()%128!=0`, the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_g1_multiexp_base +
/// bls12381_g1_multiexp_element * num_elements
pub fn bls12381_g1_multiexp(
&mut self,
value_len: u64,
Expand Down Expand Up @@ -1051,31 +980,6 @@ The EIP-2537 contains the same function, so we can reuse test vectors from Ether
***Annotation:***

```rust
/// Computes multiexp on BLS12-381 curve using Pippenger's algorithm
///\sum_i si*pi should be equal result.
///
/// # Arguments
///
/// * `value` - sequence of (pi, si), where
/// pi is point (x:Fp^2, y:Fp^2) on BLS12-381, and si is u256.
/// BLS12-381 is Y^2 = X^3 + 4(i + 1) curve over Fp^2.
///
/// `value` is encoded as packed, big-endian
/// `[(([u8; 96], [u8; 96]), u256)]` slice.
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns
/// `MemoryAccessViolation`.
///
/// If `value.len()%224!=0`, the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_g2_multiexp_base +
/// bls12381_g2_multiexp_element * num_elements
pub fn bls12381_g2_multiexp(
&mut self,
value_len: u64,
Expand Down Expand Up @@ -1121,24 +1025,6 @@ The gas consumption is a constant calculated empirically.
***Annotation:***

```rust
/// Map elements from Fp to G1 subset of BLS12-381 curve
///
/// # Arguments
///
/// * `value` - 48 bytes, the element from Fp -- unsigned integer < p
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns
/// `MemoryAccessViolation`.
///
/// If value_len != 48 the function return `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_map_fp_to_g1_base`
pub fn bls12381_map_fp_to_g1(
&mut self,
value_len: u64,
Expand Down Expand Up @@ -1184,24 +1070,6 @@ The gas consumption is a constant calculated empirically.
***Annotation:***

```rust
/// Map elements from Fp2 to G2 subset of E'(Fp2) BLS12-381 curve
///
/// # Arguments
///
/// * `value` - 96 bytes, the element from Fp2 -- two unsigned integer < p
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns
/// `MemoryAccessViolation`.
///
/// If value_len != 96 the function return `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_map_fp2_to_g2_base`
pub fn bls12381_map_fp2_to_g2(
&mut self,
value_len: u64,
Expand Down Expand Up @@ -1282,34 +1150,7 @@ Here you can find benchmark test vectors for EIP-2537[^46].
***Annotation:***

```rust
/// Computes pairing check on BLS12-381 curve.
/// \prod_i e(g_{1 i}, g_{2 i}) should be equal one, e(g1, g2) is pairing
///
/// # Arguments
///
/// * `value` - sequence of (g1:G1, g2:G2), where
/// G2 is subgroup point (x:Fp2, y:Fp2) on BLS12-381 twist,
/// BLS12-381 twist is Y^2 = X^3 + 4(i + 1) curve over Fp2
/// Fp2 is complex field element (re: Fp, im: Fp)
/// G1 is point (x:Fp, y:Fp) on BLS12-381,
/// BLS12-381 is Y^2 = X^3 + 4 curve over Fp
///
/// `value` is encoded a as packed, big-endian
/// `[(([u8; 48], [u8; 48]), ([u8; 96], [u8; 96]))]` slice.
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory than
/// the function returns `MemoryAccessViolation`.
///
/// If point coordinates are not on curve `value.len()%288!=0`,
/// the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_pairing_check_base + bls12381_pairing_check_element * num_elements`
pub fn bls12381_pairing_check(&mut self, value_len: u64, value_ptr: u64) -> Result<u64> {
pub fn bls12381_pairing_check(&mut self, value_len: u64, value_ptr: u64) -> Result<u64>;
```

#### bls12381_decompress_g1
Expand Down Expand Up @@ -1358,29 +1199,6 @@ A and B are constants calculated empirically.
***Annotation:***

```rust
/// Decompress points on BLS12-381 curve.
///
/// # Arguments
///
/// * `value` - sequence of pi points (x:Fp) on BLS-381 curve
/// BLS12-381 is Y^2 = X^3 + 4 curve over Fp.
///
/// `value` is encoded as packed `[[u8; 48]]` slice.
///
/// # Output
/// sequence of pi points (x: Fp; y: Fp) in decompress format: [([u8; 48], [u8; 48])]
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns `MemoryAccessViolation`.
///
/// If `value.len()%48 != 0` the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_decompress_g1_base + bls12381_decompress_g1_element * num_elements`
pub fn bls12381_decompress_g1(&mut self,
value_len: u64,
value_ptr: u64,
Expand Down Expand Up @@ -1433,30 +1251,6 @@ A and B are constants calculated empirically.
***Annotation:***

```rust
/// Decompress points on twisted BLS12-381 curve.
///
/// # Arguments
///
/// * `value` - sequence of pi points (x:Fp2) on twisted BLS-381 curve
/// BLS12-381 is Y^2 = X^3 + (4 + i) curve over Fp2.
///
/// `value` is encoded as packed `[[u8; 96]]` slice.
///
/// # Output
/// sequence of pi points (x: Fp2; y: Fp2) in decompress format: [([u8; 96], [u8; 96])]
///
/// # Errors
///
/// If `value_len + value_ptr` points outside the memory or the registers
/// use more memory than the limit, the function returns `MemoryAccessViolation`.
///
/// If `value.len()%96 != 0`,
/// the function returns `BLS12381InvalidInput`.
///
/// # Cost
///
/// `base + write_register_base + write_register_byte * num_bytes +
/// bls12381_decompress_g2_base + bls12381_decompress_g2_element * num_elements`
pub fn bls12381_decompress_g2(&mut self,
value_len: u64,
value_ptr: u64,
Expand Down

0 comments on commit cc448df

Please sign in to comment.