Skip to content

Commit

Permalink
Add headers.
Browse files Browse the repository at this point in the history
Add compilation issue fixes.
  • Loading branch information
cheatfate committed Jul 26, 2022
1 parent b765562 commit 69741e9
Show file tree
Hide file tree
Showing 8 changed files with 44 additions and 9 deletions.
7 changes: 7 additions & 0 deletions beacon_chain/validator_client/api.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import chronicles
import ../spec/eth2_apis/eth2_rest_serialization,
../spec/datatypes/[phase0, altair]
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/validator_client/attestation_service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import std/sets
import chronicles
import metrics, chronicles
import "."/[common, api, block_service]

const
Expand Down Expand Up @@ -119,7 +119,7 @@ proc serveAttestation(service: AttestationServiceRef, adata: AttestationData,
let delay = vc.getDelay(adata.slot.attestation_deadline())
if res:
beacon_attestations_sent.inc()
beacon_attestation_sent_delay.observe(delay)
beacon_attestation_sent_delay.observe(delay.toFloatSeconds())
notice "Attestation published", attestation = shortLog(attestation),
validator = shortLog(validator),
validator_index = vindex,
Expand Down
13 changes: 10 additions & 3 deletions beacon_chain/validator_client/block_service.nim
Original file line number Diff line number Diff line change
@@ -1,7 +1,13 @@
import metrics
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import ".."/spec/forks
import common, api
import chronicles
import chronicles, metrics

logScope: service = "block_service"

Expand Down Expand Up @@ -121,8 +127,9 @@ proc publishBlock(vc: ValidatorClientRef, currentSlot, slot: Slot,
err_name = exc.name, err_msg = exc.msg
return
if res:
let delay = vc.getDelay(slot.block_deadline())
beacon_blocks_sent.inc()
beacon_blocks_sent_delay.observe(vc.getDelay(slot.block_deadline()))
beacon_blocks_sent_delay.observe(delay.toFloatSeconds())
notice "Block published", blockRoot = shortLog(blockRoot),
blck = shortLog(beaconBlock), signature = shortLog(signature),
validator = shortLog(validator)
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/validator_client/common.nim
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ const
TIME_DELAY_FROM_SLOT* = 79.milliseconds
SUBSCRIPTION_BUFFER_SLOTS* = 2'u64

const DelayBuckets* = [-Inf, -4.0, -2.0, -1.0, -0.5, -0.1, -0.05,
0.05, 0.1, 0.5, 1.0, 2.0, 4.0, 8.0, Inf]
DelayBuckets* = [-Inf, -4.0, -2.0, -1.0, -0.5, -0.1, -0.05,
0.05, 0.1, 0.5, 1.0, 2.0, 4.0, 8.0, Inf]

type
ServiceState* {.pure.} = enum
Expand Down
7 changes: 7 additions & 0 deletions beacon_chain/validator_client/duties_service.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import std/[sets, sequtils]
import chronicles
import common, api, block_service
Expand Down
7 changes: 7 additions & 0 deletions beacon_chain/validator_client/fallback_service.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import common

const
Expand Down
7 changes: 7 additions & 0 deletions beacon_chain/validator_client/fork_service.nim
Original file line number Diff line number Diff line change
@@ -1,3 +1,10 @@
# beacon_chain
# Copyright (c) 2021-2022 Status Research & Development GmbH
# Licensed and distributed under either of
# * MIT license (license terms in the root directory or at https://opensource.org/licenses/MIT).
# * Apache v2 license (license terms in the root directory or at https://www.apache.org/licenses/LICENSE-2.0).
# at your option. This file may not be copied, modified, or distributed except according to those terms.

import std/algorithm
import chronicles
import common, api
Expand Down
4 changes: 2 additions & 2 deletions beacon_chain/validator_client/sync_committee_service.nim
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@

import
std/sets,
chronicles,
metrics, chronicles,
"."/[common, api, block_service],
../spec/datatypes/[phase0, altair, bellatrix],
../spec/eth2_apis/rest_types
Expand Down Expand Up @@ -93,7 +93,7 @@ proc serveSyncCommitteeMessage*(service: SyncCommitteeServiceRef,
let delay = vc.getDelay(message.slot.sync_committee_message_deadline())
if res:
beacon_sync_committee_messages_sent.inc()
beacon_sync_committee_message_sent_delay.observe(delay)
beacon_sync_committee_message_sent_delay.observe(delay.toFloatSeconds())
notice "Sync committee message published",
message = shortLog(message),
validator = shortLog(validator),
Expand Down

0 comments on commit 69741e9

Please sign in to comment.