Bump web3/kzg4844/nimbus-eth2 and related fixes (#2446)
This commit is contained in:
parent
b23795ab39
commit
d9e502bbc5
|
@ -14,7 +14,7 @@ import
|
|||
stew/base10,
|
||||
results,
|
||||
eth/p2p/discoveryv5/random2,
|
||||
beacon_chain/spec/datatypes/[phase0, altair, bellatrix, capella, deneb],
|
||||
beacon_chain/spec/datatypes/[phase0, altair, bellatrix, capella, deneb, electra],
|
||||
beacon_chain/spec/[forks_light_client, digest],
|
||||
beacon_chain/beacon_clock,
|
||||
beacon_chain/sync/light_client_sync_helpers,
|
||||
|
|
|
@ -86,9 +86,12 @@ template validatePayload(apiVersion, version, payload) =
|
|||
if payload.depositRequests.isNone:
|
||||
raise invalidParams("newPayload" & $apiVersion &
|
||||
"depositRequests is expected from execution payload")
|
||||
if payload.exits.isNone:
|
||||
if payload.withdrawalRequests.isNone:
|
||||
raise invalidParams("newPayload" & $apiVersion &
|
||||
"exits is expected from execution payload")
|
||||
"withdrawalRequests is expected from execution payload")
|
||||
if payload.consolidationRequests.isNone:
|
||||
raise invalidParams("newPayload" & $apiVersion &
|
||||
"consolidationRequests is expected from execution payload")
|
||||
|
||||
|
||||
proc newPayload*(ben: BeaconEngineRef,
|
||||
|
|
|
@ -18,6 +18,8 @@ import
|
|||
../constants,
|
||||
../common/common
|
||||
|
||||
from std/sequtils import mapIt
|
||||
|
||||
{.push raises: [].}
|
||||
|
||||
type
|
||||
|
@ -39,7 +41,7 @@ const
|
|||
|
||||
# kzgToVersionedHash implements kzg_to_versioned_hash from EIP-4844
|
||||
proc kzgToVersionedHash*(kzg: kzg.KzgCommitment): VersionedHash =
|
||||
result = sha256.digest(kzg)
|
||||
result = sha256.digest(kzg.bytes)
|
||||
result.data[0] = VERSIONED_HASH_VERSION_KZG
|
||||
|
||||
# pointEvaluation implements point_evaluation_precompile from EIP-4844
|
||||
|
@ -53,14 +55,18 @@ proc pointEvaluation*(input: openArray[byte]): Result[void, string] =
|
|||
if input.len != PrecompileInputLength:
|
||||
return err("invalid input length")
|
||||
|
||||
let
|
||||
versionedHash = KzgBytes32.initCopyFrom(input.toOpenArray(0, 31))
|
||||
z = KzgBytes32.initCopyFrom(input.toOpenArray(32, 63))
|
||||
y = KzgBytes32.initCopyFrom(input.toOpenArray(64, 95))
|
||||
commitment = KzgBytes48.initCopyFrom(input.toOpenArray(96, 143))
|
||||
kzgProof = KzgBytes48.initCopyFrom(input.toOpenArray(144, 191))
|
||||
template copyFrom(T: type, input, a, b): auto =
|
||||
type X = (type T().bytes)
|
||||
T(bytes: X.initCopyFrom(input.toOpenArray(a, b)))
|
||||
|
||||
if kzgToVersionedHash(commitment).data != versionedHash:
|
||||
let
|
||||
versionedHash = KzgBytes32.copyFrom(input, 0, 31)
|
||||
z = KzgBytes32.copyFrom(input, 32, 63)
|
||||
y = KzgBytes32.copyFrom(input, 64, 95)
|
||||
commitment = KzgBytes48.copyFrom(input, 96, 143)
|
||||
kzgProof = KzgBytes48.copyFrom(input, 144, 191)
|
||||
|
||||
if kzgToVersionedHash(commitment).data != versionedHash.bytes:
|
||||
return err("versionedHash should equal to kzgToVersionedHash(commitment)")
|
||||
|
||||
# Verify KZG proof
|
||||
|
@ -176,13 +182,14 @@ proc validateBlobTransactionWrapper*(tx: PooledTransaction):
|
|||
if not goodFormatted:
|
||||
return err("tx wrapper is ill formatted")
|
||||
|
||||
let commitments = tx.networkPayload.commitments
|
||||
let commitments = tx.networkPayload.commitments.mapIt(
|
||||
kzg.KzgCommitment(bytes: it))
|
||||
|
||||
# Verify that commitments match the blobs by checking the KZG proof
|
||||
let res = kzg.verifyBlobKzgProofBatch(
|
||||
tx.networkPayload.blobs,
|
||||
tx.networkPayload.blobs.mapIt(kzg.KzgBlob(bytes: it)),
|
||||
commitments,
|
||||
tx.networkPayload.proofs)
|
||||
tx.networkPayload.proofs.mapIt(kzg.KzgProof(bytes: it)))
|
||||
|
||||
if res.isErr:
|
||||
return err(res.error)
|
||||
|
|
|
@ -1 +1 @@
|
|||
Subproject commit f12616d0675d9f6346141ca95f0840ab227eb213
|
||||
Subproject commit c0cc7da5fc351d5c1548d168b847dfbed569eb46
|
|
@ -1 +1 @@
|
|||
Subproject commit fc226d4511199aa57a3fcd5cc44695c6b365a6bf
|
||||
Subproject commit 3ba859d8f11bf71e96161741f99b55206425968f
|
|
@ -1 +1 @@
|
|||
Subproject commit 7a8c1d818a835312cc661e941154556ace0d70b4
|
||||
Subproject commit 85c28509714664b2b16c0d0d8594a9dafc4907d4
|
Loading…
Reference in New Issue