fixes for new simpler nim bindings
This commit is contained in:
parent
0c8b8f3b63
commit
f263e99dc6
|
@ -214,7 +214,7 @@
|
|||
path = vendor/nim-kzg4844
|
||||
url = https://github.com/agnxsh/nim-kzg4844.git
|
||||
ignore = untracked
|
||||
branch = ckzg-7594/upstream
|
||||
branch = ckzg-jt-test
|
||||
[submodule "vendor/nim-results"]
|
||||
path = vendor/nim-results
|
||||
url = https://github.com/arnetheduck/nim-results.git
|
||||
|
|
|
@ -22,7 +22,7 @@ import
|
|||
eth/p2p/discoveryv5/enr,
|
||||
json_serialization, web3/[primitives, confutils_defs],
|
||||
chronos/transports/common,
|
||||
kzg4844/kzg_ex,
|
||||
kzg4844/kzg,
|
||||
./spec/[engine_authentication, keystore, network, crypto],
|
||||
./spec/datatypes/base,
|
||||
./networking/network_metadata,
|
||||
|
@ -1508,11 +1508,11 @@ proc loadKzgTrustedSetup*(): Result[void, string] =
|
|||
vendorDir & "/nim-kzg4844/kzg4844/csources/src/trusted_setup.txt")
|
||||
|
||||
static: doAssert const_preset in ["mainnet", "gnosis", "minimal"]
|
||||
Kzg.loadTrustedSetupFromString(trustedSetup, 0)
|
||||
loadTrustedSetupFromString(trustedSetup, 0)
|
||||
|
||||
proc loadKzgTrustedSetup*(trustedSetupPath: string): Result[void, string] =
|
||||
try:
|
||||
Kzg.loadTrustedSetupFromString(readFile(trustedSetupPath), 0)
|
||||
loadTrustedSetupFromString(readFile(trustedSetupPath), 0)
|
||||
except IOError as err:
|
||||
err(err.msg)
|
||||
|
||||
|
|
|
@ -14,6 +14,7 @@ import
|
|||
json_rpc/[client, errors],
|
||||
web3, web3/[engine_api, primitives, conversions],
|
||||
eth/common/eth_types,
|
||||
kzg4844/[kzg_abi, kzg],
|
||||
results,
|
||||
stew/[assign2, byteutils, objects],
|
||||
# Local modules:
|
||||
|
|
|
@ -11,6 +11,7 @@ import
|
|||
# Status
|
||||
chronicles, chronos, metrics,
|
||||
results,
|
||||
kzg4844/[kzg, kzg_abi],
|
||||
stew/byteutils,
|
||||
# Internals
|
||||
../spec/[
|
||||
|
@ -458,7 +459,7 @@ proc validateBlobSidecar*(
|
|||
# [REJECT] The sidecar's blob is valid as verified by `verify_blob_kzg_proof(
|
||||
# blob_sidecar.blob, blob_sidecar.kzg_commitment, blob_sidecar.kzg_proof)`.
|
||||
block:
|
||||
let ok = verifyProof(
|
||||
let ok = verifyBlobKzgProof(
|
||||
KzgBlob(bytes: blob_sidecar.blob),
|
||||
blob_sidecar.kzg_commitment,
|
||||
blob_sidecar.kzg_proof).valueOr:
|
||||
|
|
|
@ -29,7 +29,7 @@ import
|
|||
../extras,
|
||||
./datatypes/[phase0, altair, bellatrix, deneb],
|
||||
"."/[beaconstate, eth2_merkleization, helpers, validator, signatures],
|
||||
kzg4844/kzg_abi, kzg4844/kzg_ex
|
||||
kzg4844/kzg_abi, kzg4844/kzg
|
||||
|
||||
from std/algorithm import fill, sorted
|
||||
from std/sequtils import count, filterIt, mapIt
|
||||
|
@ -1091,7 +1091,7 @@ func kzg_commitment_to_versioned_hash*(
|
|||
proc validate_blobs*(
|
||||
expected_kzg_commitments: seq[KzgCommitment], blobs: seq[KzgBlob],
|
||||
proofs: seq[KzgProof]): Result[void, string] =
|
||||
let res = verifyProofs(blobs, expected_kzg_commitments, proofs).valueOr:
|
||||
let res = verifyBlobKzgProofBatch(blobs, expected_kzg_commitments, proofs).valueOr:
|
||||
return err("validate_blobs proof verification error: " & error())
|
||||
|
||||
if not res:
|
||||
|
|
|
@ -128,7 +128,7 @@ proc unblindAndRouteBlockMEV*(
|
|||
if blindedBlock.message.body.blob_kzg_commitments !=
|
||||
bundle.data.blobs_bundle.commitments:
|
||||
return err("unblinded blobs bundle has unexpected commitments")
|
||||
let ok = verifyProofs(
|
||||
let ok = verifyBlobKzgProofBatch(
|
||||
blobs_bundle.blobs.mapIt(KzgBlob(bytes: it)),
|
||||
asSeq blobs_bundle.commitments,
|
||||
asSeq blobs_bundle.proofs).valueOr:
|
||||
|
|
|
@ -11,7 +11,7 @@
|
|||
import
|
||||
std/json,
|
||||
yaml/tojson,
|
||||
kzg4844/kzg_ex,
|
||||
kzg4844/kzg,
|
||||
stew/byteutils,
|
||||
../testutil,
|
||||
./fixtures_utils, ./os_ops
|
||||
|
@ -31,7 +31,7 @@ func fromHex[N: static int](s: string): Opt[array[N, byte]] =
|
|||
|
||||
block:
|
||||
template sourceDir: string = currentSourcePath.rsplit(DirSep, 1)[0]
|
||||
doAssert Kzg.loadTrustedSetup(
|
||||
doAssert loadTrustedSetup(
|
||||
sourceDir &
|
||||
"/../../vendor/nim-kzg4844/kzg4844/csources/src/trusted_setup.txt", 0).isOk
|
||||
|
||||
|
@ -75,7 +75,7 @@ proc runVerifyKzgProofTest(suiteName, suitePath, path: string) =
|
|||
if commitment.isNone or z.isNone or y.isNone or proof.isNone:
|
||||
check output.kind == JNull
|
||||
else:
|
||||
let v = verifyProof(
|
||||
let v = verifyKzgProof(
|
||||
KzgCommitment(bytes: commitment.get),
|
||||
KzgBytes32(bytes: z.get), KzgBytes32(bytes: y.get),
|
||||
KzgBytes48(bytes: proof.get))
|
||||
|
@ -237,4 +237,4 @@ suite suiteName:
|
|||
for kind, path in walkDir(testsDir, relative = true, checkDir = true):
|
||||
runComputeBlobKzgProofTest(suiteName, testsDir, testsDir / path)
|
||||
|
||||
doAssert Kzg.freeTrustedSetup().isOk
|
||||
doAssert freeTrustedSetup().isOk
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit e576c9bab93c425c6c8c0f3603d98a149599d942
|
||||
Subproject commit b602f5684c6aa535bb5aae8619df67527dd369e5
|
Loading…
Reference in New Issue