Add a simple test of polynomial evaluation

The values are taken from one of the simple tests in bindings/python
This commit is contained in:
Ramana Kumar 2022-10-03 22:04:55 +01:00
parent 48634ea975
commit 67804099bc
No known key found for this signature in database
GPG Key ID: ED471C788B900433
2 changed files with 29 additions and 0 deletions

View File

@ -20,6 +20,23 @@ for p in powers:
p_check *= x
p_check %= 2**256
# Simple test of polynomial evaluation
ts = ckzg.load_trusted_setup("tiny_trusted_setup.txt")
lvals = [239807672958224171024, 239807672958224171018,
3465144826073652318776269530687742778510060141723586134027,
52435875175126190475982595682112313518914282969839895044573213904131443392524]
def int_to_bls_field(x):
return ckzg.bytes_to_bls_field(x.to_bytes(32, "little"))
poly = ckzg.alloc_polynomial(tuple(map(int_to_bls_field, lvals)))
y = ckzg.evaluate_polynomial_in_evaluation_form(poly, int_to_bls_field(2), ts)
assert ckzg.int_from_bls_field(y) == 239807672958224171036
# Commit to a few random blobs
BLOB_SIZE = 4096

View File

@ -0,0 +1,12 @@
8
2
a895d8f7f4f160ab3837d80b5f6aa743b28d22ed22116269f3857130709df107867ba7e0db0d5e171492fab0db2a635f
a7fb942f2b95eefd7986e08f7a59c6f45f0a1c51be0e3f6e33ad67cf8dbf1e243632d001c52f7b441447b1fd03b51a63
a76f84feba16773b55f23d2d66037e5c1a9c85647c8986a98200585ec2f9cb28158ef842fa61beb4c86a85c229692c20
b5e605081999c80ce61b53408d71a892ac1d6f1b177ab2dc7a18b03ab612d14c51bd990e5f4826f2ba4c0310e332a9d3
98e3d5a7bad4eb817838cadb18a7c2efc5d586a402f0b54b894366855018f316518eb2d0744e439ea0f40a83176eaf46
95e3d50c2686c92568f46c8aa3a0e7cb3d456cc532c4ea0d07d47dbbed678fca2976b0b28009a360a2fa3dcd2716a7dd
b7b60fc315983545150f0b6545509ffe3f38b5562574e640dd9c61d1a5db441855df9b0cab10096fbca09024fe076602
86836a32ca078c51b9e9012fd37cf6647bc4bc2b8331b8c51f0958aed321de1fe44c2ff374d34eba13fcac18f3061a63
a010bc4d0787706e474286e18d786e4d779a3434db592b7e6398b3de129af9f16251f4b929eae78509e3c0cd06caf82813fda1cc561cef36c1ca5ffe5521f29647e80b2ac0bb5ac953cbd83096627ad4c6d19c15249a7583ffa681a5b8203af9
877241b94fba746c0c9ea95c294604e5c6dfeab9e0ad7f31fc4bbb9e2610ffdaba310e5ea82404ce3b3e5618b2b336cc194eb0620c969dad9f9a681aefdaa4370bc1051c71719e551d1f1c51f4b1735bf5c706cff6612fc3c918ddb0061a208d