From c58348bd502052046fbed00c42029f699e4ffe42 Mon Sep 17 00:00:00 2001 From: Daniel Sanchez Quiros Date: Fri, 21 Jun 2024 10:37:06 +0200 Subject: [PATCH] Fix and beautify code --- da/kzg_rs/fk20.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/da/kzg_rs/fk20.py b/da/kzg_rs/fk20.py index 56f4bf3..3034f48 100644 --- a/da/kzg_rs/fk20.py +++ b/da/kzg_rs/fk20.py @@ -18,12 +18,11 @@ def __toeplitz1(global_parameters: List[G1], polynomial_degree: int) -> List[G1] :param polynomial_degree: :return: """ - assert len(global_parameters) >= polynomial_degree - global_parameters = global_parameters[:polynomial_degree] + assert len(global_parameters) == polynomial_degree # algorithm only works on powers of 2 for dft computations assert is_power_of_two(len(global_parameters)) roots_of_unity = compute_roots_of_unity(PRIMITIVE_ROOT, polynomial_degree*2, BLS_MODULUS) - vector_x_extended = global_parameters + [bls.multiply(bls.Z1(), 0) for _ in range(polynomial_degree)] + vector_x_extended = global_parameters + [bls.Z1() for _ in range(polynomial_degree)] vector_x_extended_fft = fft_g1(vector_x_extended, roots_of_unity, BLS_MODULUS) return vector_x_extended_fft @@ -60,7 +59,7 @@ def fk20_generate_proofs( # 1.2 z = dft([*[0 for _ in len(polynomial)], f1, f2, ..., fd]) # 1.3 u = y * v * roots_of_unity(len(polynomial)*2) roots_of_unity = compute_roots_of_unity(PRIMITIVE_ROOT, polynomial_degree, BLS_MODULUS) - global_parameters = list(reversed(global_parameters)) + global_parameters = list(reversed(global_parameters[:polynomial_degree])) extended_vector = __toeplitz1(global_parameters, polynomial_degree) # 2 - Build circulant matrix with the polynomial coefficients (reversed N..n, and padded) toeplitz_coefficients = [