mirror of
https://github.com/status-im/nimbus-eth2.git
synced 2025-01-17 01:51:09 +00:00
remove extraneous length checks in KZG batch proofs (#5744)
* remove extraneous length checks in KZG batch proofs * re-add winservice import but only for Windows, to avoid UnusedImport warning * also uses establishWindowsService
This commit is contained in:
parent
52ed0d6aa1
commit
3541cfe020
@ -23,8 +23,7 @@ import
|
||||
./validators/[keystore_management, beacon_validators],
|
||||
"."/[
|
||||
beacon_node, beacon_node_light_client, deposits,
|
||||
nimbus_binary_common, statusbar, trusted_node_sync, wallets,
|
||||
winservice]
|
||||
nimbus_binary_common, statusbar, trusted_node_sync, wallets]
|
||||
|
||||
when defined(posix):
|
||||
import system/ansi_c
|
||||
@ -1508,6 +1507,9 @@ func syncStatus(node: BeaconNode, wallSlot: Slot): string =
|
||||
else:
|
||||
"synced"
|
||||
|
||||
when defined(windows):
|
||||
from winservice import establishWindowsService, reportServiceStatusSuccess
|
||||
|
||||
proc onSlotStart(node: BeaconNode, wallTime: BeaconTime,
|
||||
lastSlot: Slot): Future[bool] {.async.} =
|
||||
## Called at the beginning of a slot - usually every slot, but sometimes might
|
||||
|
@ -7,10 +7,10 @@
|
||||
|
||||
# State transition - block processing, as described in
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/phase0/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/altair/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/altair/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/bellatrix/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/capella/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/beacon-chain.md#block-processing
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.5/specs/deneb/beacon-chain.md#block-processing
|
||||
#
|
||||
# The entry point is `process_block` which is at the bottom of this file.
|
||||
#
|
||||
@ -726,22 +726,14 @@ func kzg_commitment_to_versioned_hash*(
|
||||
res[1 .. 31] = eth2digest(kzg_commitment).data.toOpenArray(1, 31)
|
||||
res
|
||||
|
||||
# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/deneb/fork-choice.md#validate_blobs
|
||||
proc validate_blobs*(expected_kzg_commitments: seq[KzgCommitment],
|
||||
blobs: seq[KzgBlob],
|
||||
proofs: seq[KzgProof]):
|
||||
Result[void, cstring] =
|
||||
if expected_kzg_commitments.len != blobs.len:
|
||||
return err("validate_blobs: different commitment and blob lengths")
|
||||
|
||||
if proofs.len != blobs.len:
|
||||
return err("validate_blobs: different proof and blob lengths")
|
||||
|
||||
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:
|
||||
return err("validate_blobs: proof verification error")
|
||||
return err("validate_blobs proof verification error: " & error())
|
||||
|
||||
if not res:
|
||||
return err("validate_blobs: proof verification failed")
|
||||
return err("validate_blobs proof verification failed")
|
||||
|
||||
ok()
|
||||
|
||||
|
@ -82,7 +82,7 @@ template blockProcessor(router: MessageRouter): ref BlockProcessor =
|
||||
template getCurrentBeaconTime(router: MessageRouter): BeaconTime =
|
||||
router.processor[].getCurrentBeaconTime()
|
||||
|
||||
type RouteBlockResult = Result[Opt[BlockRef], cstring]
|
||||
type RouteBlockResult = Result[Opt[BlockRef], string]
|
||||
proc routeSignedBeaconBlock*(
|
||||
router: ref MessageRouter, blck: ForkySignedBeaconBlock,
|
||||
blobsOpt: Opt[seq[BlobSidecar]]): Future[RouteBlockResult] {.async.} =
|
||||
@ -101,7 +101,7 @@ proc routeSignedBeaconBlock*(
|
||||
warn "Block failed validation",
|
||||
blockRoot = shortLog(blck.root), blck = shortLog(blck.message),
|
||||
signature = shortLog(blck.signature), error = res.error()
|
||||
return err(res.error()[1])
|
||||
return err($(res.error()[1]))
|
||||
|
||||
when typeof(blck).kind >= ConsensusFork.Deneb:
|
||||
if blobsOpt.isSome:
|
||||
|
Loading…
x
Reference in New Issue
Block a user