Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 4 additions & 2 deletions beacon_chain/nimbus_beacon_node.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down
22 changes: 7 additions & 15 deletions beacon_chain/spec/state_transition_block.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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.
#
Expand Down Expand Up @@ -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()

Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/validators/message_router.nim
Original file line number Diff line number Diff line change
Expand Up @@ -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.} =
Expand All @@ -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:
Expand Down