diff --git a/fluffy/network/beacon/beacon_light_client_manager.nim b/fluffy/network/beacon/beacon_light_client_manager.nim index 5deded937..36fc5db4c 100644 --- a/fluffy/network/beacon/beacon_light_client_manager.nim +++ b/fluffy/network/beacon/beacon_light_client_manager.nim @@ -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, diff --git a/nimbus/beacon/api_handler/api_newpayload.nim b/nimbus/beacon/api_handler/api_newpayload.nim index b52c998c9..1b7f18fcc 100644 --- a/nimbus/beacon/api_handler/api_newpayload.nim +++ b/nimbus/beacon/api_handler/api_newpayload.nim @@ -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, diff --git a/nimbus/core/eip4844.nim b/nimbus/core/eip4844.nim index c4ad6bba3..b7a0c64bd 100644 --- a/nimbus/core/eip4844.nim +++ b/nimbus/core/eip4844.nim @@ -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) diff --git a/vendor/nim-kzg4844 b/vendor/nim-kzg4844 index f12616d06..c0cc7da5f 160000 --- a/vendor/nim-kzg4844 +++ b/vendor/nim-kzg4844 @@ -1 +1 @@ -Subproject commit f12616d0675d9f6346141ca95f0840ab227eb213 +Subproject commit c0cc7da5fc351d5c1548d168b847dfbed569eb46 diff --git a/vendor/nim-web3 b/vendor/nim-web3 index fc226d451..3ba859d8f 160000 --- a/vendor/nim-web3 +++ b/vendor/nim-web3 @@ -1 +1 @@ -Subproject commit fc226d4511199aa57a3fcd5cc44695c6b365a6bf +Subproject commit 3ba859d8f11bf71e96161741f99b55206425968f diff --git a/vendor/nimbus-eth2 b/vendor/nimbus-eth2 index 7a8c1d818..85c285097 160000 --- a/vendor/nimbus-eth2 +++ b/vendor/nimbus-eth2 @@ -1 +1 @@ -Subproject commit 7a8c1d818a835312cc661e941154556ace0d70b4 +Subproject commit 85c28509714664b2b16c0d0d8594a9dafc4907d4