mirror of
https://github.com/logos-co/nomos-specs.git
synced 2025-01-10 07:35:45 +00:00
09c9b7e4ec
* Implement generator polynomial and rs encoding * Implement encode/decode+test using fft. Non-working * Use lagrange for interpolation * Remove fft, use evaluations instead * Move and rename kzg and rs test modules * Update docs
16 lines
569 B
Python
16 lines
569 B
Python
from unittest import TestCase
|
|
|
|
from da.kzg_rs.common import BLS_MODULUS, ROOTS_OF_UNITY
|
|
from da.kzg_rs.poly import Polynomial
|
|
from da.kzg_rs.rs import encode, decode
|
|
|
|
|
|
class TestFFT(TestCase):
|
|
def test_encode_decode(self):
|
|
poly = Polynomial(list(range(10)), modulus=BLS_MODULUS)
|
|
encoded = encode(poly, 2, ROOTS_OF_UNITY)
|
|
decoded = decode(encoded, ROOTS_OF_UNITY, len(poly))
|
|
self.assertEqual(poly, decoded)
|
|
for i in range(len(poly)):
|
|
self.assertEqual(poly.eval(ROOTS_OF_UNITY[i]), decoded.eval(ROOTS_OF_UNITY[i]))
|