mirror of
https://github.com/status-im/c-kzg-4844.git
synced 2025-01-26 01:49:21 +00:00
Run both tests by default
This commit is contained in:
parent
a66f39f2a2
commit
e60b5c2d77
@ -1,6 +1,10 @@
|
||||
INCLUDE_DIRS = .. ../../min-src ../../inc
|
||||
INCLUDE_PY = $(shell python -c 'import sysconfig; print(sysconfig.get_config_var("INCLUDEPY"))')
|
||||
|
||||
.PHONY: all
|
||||
|
||||
all: test ecc_test
|
||||
|
||||
test: tests.py ckzg.so
|
||||
python $<
|
||||
|
||||
|
@ -1,11 +1,9 @@
|
||||
import atexit
|
||||
import ckzg
|
||||
import kzg_proofs
|
||||
import random
|
||||
from py_ecc import optimized_bls12_381 as b
|
||||
from py_ecc.bls.point_compression import compress_G1, decompress_G1, decompress_G2
|
||||
|
||||
|
||||
polynomial = [random.randint(0, kzg_proofs.MODULUS) for i in range(4096)]
|
||||
n = len(polynomial)
|
||||
|
||||
@ -74,3 +72,5 @@ proof_pyecc = kzg_proofs.compute_proof_single(polynomial, x, ts_pyecc)
|
||||
proof_ckzg = ckzg.compute_kzg_proof(ckzg_poly, ckzg.bytes_to_bls_field(x.to_bytes(32, "little")), ts)
|
||||
|
||||
assert compress_G1(proof_pyecc).to_bytes(48, "big") == ckzg.bytes_from_g1(proof_ckzg)
|
||||
|
||||
print('comparison to py_ecc passed')
|
||||
|
@ -7,6 +7,8 @@ import ssz
|
||||
bs = (329).to_bytes(32, "little")
|
||||
assert 329 == ckzg.int_from_bls_field(ckzg.bytes_to_bls_field(bs))
|
||||
|
||||
del bs
|
||||
|
||||
# Simple test of compute_powers
|
||||
|
||||
x = 32930439
|
||||
@ -20,6 +22,8 @@ for p in powers:
|
||||
p_check *= x
|
||||
p_check %= 2**256
|
||||
|
||||
del x, n, powers, p_check
|
||||
|
||||
# Simple test of polynomial evaluation
|
||||
|
||||
ts = ckzg.load_trusted_setup("tiny_trusted_setup.txt")
|
||||
@ -45,7 +49,10 @@ MAX_BLOBS_PER_BLOCK = 16
|
||||
blobs_sedes = ssz.List(ssz.Vector(ssz.uint256, BLOB_SIZE), MAX_BLOBS_PER_BLOCK)
|
||||
kzg_commitments_sedes = ssz.List(ssz.bytes48, MAX_BLOBS_PER_BLOCK)
|
||||
|
||||
blobs = [[ckzg.bytes_to_bls_field(random.randbytes(32)) for _ in range(BLOB_SIZE)] for _ in range(3)]
|
||||
blobs = [
|
||||
[ckzg.bytes_to_bls_field(random.randbytes(32)) for _ in range(BLOB_SIZE)]
|
||||
for _ in range(3)
|
||||
]
|
||||
|
||||
ts = ckzg.load_trusted_setup("../../src/trusted_setup.txt")
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user