Skip to content

Commit

Permalink
Merge branch 'unstable' into dev/etan/df-7514
Browse files Browse the repository at this point in the history
  • Loading branch information
etan-status authored Sep 20, 2023
2 parents 060e47d + aacb853 commit 5a4a0ae
Show file tree
Hide file tree
Showing 39 changed files with 109 additions and 56 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ jobs:
if: ${{ !cancelled() }} && github.event_name == 'pull_request'
run: |
excluded_files="config.yaml"
excluded_extensions="ans|json|md|png|ssz|txt"
excluded_extensions="ans|json|md|png|service|ssz|txt"
current_year=$(date +"%Y")
outdated_files=()
Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -321,7 +321,7 @@ consensus_spec_tests_minimal: | build deps
MAKE="$(MAKE)" V="$(V)" $(ENV_SCRIPT) scripts/compile_nim_program.sh \
$@ \
"tests/consensus_spec/consensus_spec_tests_preset.nim" \
$(NIM_PARAMS) -d:const_preset=minimal $(TEST_MODULES_FLAGS) && \
$(NIM_PARAMS) -d:const_preset=minimal -d:FIELD_ELEMENTS_PER_BLOB=4 $(TEST_MODULES_FLAGS) && \
echo -e $(BUILD_END_MSG) "build/$@"

# Tests we only run for the default preset
Expand Down
8 changes: 6 additions & 2 deletions beacon_chain/fork_choice/fork_choice.nim
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ proc init*(
version: version,
justified: BalanceCheckpoint(
checkpoint: checkpoint,
total_active_balance: epochRef.total_active_balance,
balances: epochRef.effective_balances),
finalized: checkpoint,
best_justified: checkpoint))
Expand All @@ -98,6 +99,7 @@ proc update_justified(
store = self.justified.checkpoint, state = justified
self.justified = BalanceCheckpoint(
checkpoint: Checkpoint(root: blck.root, epoch: epochRef.epoch),
total_active_balance: epochRef.total_active_balance,
balances: epochRef.effective_balances)

proc update_justified(
Expand Down Expand Up @@ -321,10 +323,11 @@ proc process_block*(self: var ForkChoice,

ok()

func find_head*(
func find_head(
self: var ForkChoiceBackend,
current_epoch: Epoch,
checkpoints: FinalityCheckpoints,
justified_total_active_balance: Gwei,
justified_state_balances: seq[Gwei],
proposer_boost_root: Eth2Digest
): FcResult[Eth2Digest] =
Expand All @@ -343,7 +346,7 @@ func find_head*(
# Apply score changes
? self.proto_array.applyScoreChanges(
deltas, current_epoch, checkpoints,
justified_state_balances, proposer_boost_root)
justified_total_active_balance, proposer_boost_root)

self.balances = justified_state_balances

Expand All @@ -367,6 +370,7 @@ proc get_head*(self: var ForkChoice,
FinalityCheckpoints(
justified: self.checkpoints.justified.checkpoint,
finalized: self.checkpoints.finalized),
self.checkpoints.justified.total_active_balance,
self.checkpoints.justified.balances,
self.checkpoints.proposer_boost_root)

Expand Down
1 change: 1 addition & 0 deletions beacon_chain/fork_choice/fork_choice_types.nim
Original file line number Diff line number Diff line change
Expand Up @@ -113,6 +113,7 @@ type

BalanceCheckpoint* = object
checkpoint*: Checkpoint
total_active_balance*: Gwei
balances*: seq[Gwei]

Checkpoints* = object
Expand Down
13 changes: 5 additions & 8 deletions beacon_chain/fork_choice/proto_array.nim
Original file line number Diff line number Diff line change
Expand Up @@ -126,18 +126,15 @@ iterator realizePendingCheckpoints*(
self.currentEpochTips.clear()

# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#get_weight
func calculateProposerBoost(validatorBalances: openArray[Gwei]): uint64 =
var total_balance: uint64
for balance in validatorBalances:
total_balance += balance
let committee_weight = total_balance div SLOTS_PER_EPOCH
func calculateProposerBoost(justifiedTotalActiveBalance: Gwei): Gwei =
let committee_weight = justifiedTotalActiveBalance div SLOTS_PER_EPOCH
(committee_weight * PROPOSER_SCORE_BOOST) div 100

func applyScoreChanges*(self: var ProtoArray,
deltas: var openArray[Delta],
currentEpoch: Epoch,
checkpoints: FinalityCheckpoints,
newBalances: openArray[Gwei],
justifiedTotalActiveBalance: Gwei,
proposerBoostRoot: Eth2Digest): FcResult[void] =
## Iterate backwards through the array, touching all nodes and their parents
## and potentially the best-child of each parent.
Expand Down Expand Up @@ -169,7 +166,7 @@ func applyScoreChanges*(self: var ProtoArray,
self.nodes.buf[nodePhysicalIdx]

# Default value, if not otherwise set in first node loop
var proposerBoostScore: uint64
var proposerBoostScore: Gwei

# Iterate backwards through all the indices in `self.nodes`
for nodePhysicalIdx in countdown(self.nodes.len - 1, 0):
Expand All @@ -194,7 +191,7 @@ func applyScoreChanges*(self: var ProtoArray,
#
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/fork-choice.md#get_weight
if (not proposerBoostRoot.isZero) and proposerBoostRoot == node.bid.root:
proposerBoostScore = calculateProposerBoost(newBalances)
proposerBoostScore = calculateProposerBoost(justifiedTotalActiveBalance)
if nodeDelta >= 0 and
high(Delta) - nodeDelta < proposerBoostScore.int64:
return err ForkChoiceError(
Expand Down
7 changes: 4 additions & 3 deletions beacon_chain/gossip_processing/gossip_validation.nim
Original file line number Diff line number Diff line change
Expand Up @@ -99,9 +99,10 @@ func check_propagation_slot_range(
# The spec value of ATTESTATION_PROPAGATION_SLOT_RANGE is 32, but it can
# retransmit attestations on the cusp of being out of spec, and which by
# the time they reach their destination might be out of spec.
const ATTESTATION_PROPAGATION_SLOT_RANGE = 28

if msgSlot + ATTESTATION_PROPAGATION_SLOT_RANGE < pastSlot.slot:
const TIME_IN_FLIGHT_BUFFER = 4
static: doAssert ATTESTATION_PROPAGATION_SLOT_RANGE > TIME_IN_FLIGHT_BUFFER
if msgSlot + (ATTESTATION_PROPAGATION_SLOT_RANGE - TIME_IN_FLIGHT_BUFFER) <
pastSlot.slot:
return errIgnore("Attestation slot in the past")
else:
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/deneb/p2p-interface.md#beacon_attestation_subnet_id
Expand Down
1 change: 1 addition & 0 deletions beacon_chain/spec/datatypes/constants.nim
Original file line number Diff line number Diff line change
Expand Up @@ -66,6 +66,7 @@ const
# https://github.com/ethereum/consensus-specs/blob/v1.4.0-beta.1/specs/phase0/p2p-interface.md#configuration
MAX_REQUEST_BLOCKS* = 1024'u64
RESP_TIMEOUT* = 10'u64
ATTESTATION_PROPAGATION_SLOT_RANGE*: uint64 = 32

# https://github.com/ethereum/consensus-specs/blob/v1.3.0/specs/bellatrix/p2p-interface.md#configuration
GOSSIP_MAX_SIZE* = 10'u64 * 1024 * 1024 # bytes
Expand Down
1 change: 1 addition & 0 deletions beacon_chain/spec/presets.nim
Original file line number Diff line number Diff line change
Expand Up @@ -604,6 +604,7 @@ proc readRuntimeConfig*(
checkCompatibility TTFB_TIMEOUT
checkCompatibility MESSAGE_DOMAIN_INVALID_SNAPPY
checkCompatibility MAX_REQUEST_BLOCKS_DENEB
checkCompatibility ATTESTATION_PROPAGATION_SLOT_RANGE

# Isn't being used as a preset in the usual way: at any time, there's one correct value
checkCompatibility PROPOSER_SCORE_BOOST
Expand Down
5 changes: 4 additions & 1 deletion beacon_chain/spec/state_transition_block.nim
Original file line number Diff line number Diff line change
Expand Up @@ -791,7 +791,10 @@ proc validate_blobs*(expected_kzg_commitments: seq[KzgCommitment],
if proofs.len != blobs.len:
return err("validate_blobs: different proof and blob lengths")

if verifyProofs(blobs, expected_kzg_commitments, proofs).isErr():
let res = verifyProofs(blobs, expected_kzg_commitments, proofs).valueOr:
return err("validate_blobs: proof verification error")

if not res:
return err("validate_blobs: proof verification failed")

ok()
Expand Down
2 changes: 1 addition & 1 deletion docs/the_nimbus_book/src/developers.md
Original file line number Diff line number Diff line change
Expand Up @@ -217,7 +217,7 @@ USE_MULTITAIL="yes" make local-testnet-minimal

You’ll get something like this (click for full size):

[![](https://i.imgur.com/Pc99VDO.png)](https://i.imgur.com/Pc99VDO.png)
[![](./img/developers_01.png)](./img/developers_01.png)


You can find out more about the beacon node simulation [here](https://our.status.im/nimbus-development-update-03/#beaconsimulation).
Expand Down
8 changes: 4 additions & 4 deletions docs/the_nimbus_book/src/email-notifications.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@ You can create an account on [beaconcha.in](https://beaconcha.in/) to set up ema

### 1. Sign up at [beaconcha.in/register](https://beaconcha.in/register)

### 2. Type your validator's public key into the searchbar
### 2. Type your validator's public key into the search bar

![](https://i.imgur.com/jHjkySK.png)
![](./img/email_01.png)

### 3. Click on the bookmark icon

![](https://i.imgur.com/O7zgE0k.png)
![](./img/email_02.png)

### 4. Tick the boxes and select *Add To Watchlist*

![](https://i.imgur.com/7ff4Ta7.png)
![](./img/email_03.png)



2 changes: 1 addition & 1 deletion docs/the_nimbus_book/src/health.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ As long as your validator is within the allowed inclusion distance, you will get

You can verify your validator's effectiveness on the [beaconcha.in](https://beaconcha.in/) website.

![](https://i.imgur.com/u80Ub2j.png)
![](./img/health.png)

Ideally you want to see a value above 95%.

Expand Down
10 changes: 9 additions & 1 deletion docs/the_nimbus_book/src/holesky.md
Original file line number Diff line number Diff line change
@@ -1,10 +1,18 @@
# Holešky testnet

`holesky` will be launched on 15h of September to succeed Prater as the main long-running Ethereum testnet.
`holesky` is the main long-running Ethereum staking, infrastructure and protocol-developer testnet.
For testing decentralized applications, smart contracts, and other EVM functionality, please use Sepolia testnet!
`holesky` replaces the Prater/Görli network which has been deprecated since early 2023.


It provides an opportunity to verify your setup works as expected through the proof-of-stake transition and in a post-merge context as well as to safely practice node operations such as adding and removing validators, migrating between clients, and performing upgrades and backups.
If you come across any issues, please [report them here](https://github.com/status-im/nimbus-eth2/issues).






## General Preparation

1. Generate the JWT secret with `openssl rand -hex 32 | tr -d "\n" > "/opt/jwtsecret"`. This file needs to be passed to both the execution client and the consensus client.
Expand Down
Binary file added docs/the_nimbus_book/src/img/developers_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/email_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/email_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/email_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/health.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_03.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_04.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_05.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_06.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_07.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_08.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_09.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_10.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_11.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_12.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added docs/the_nimbus_book/src/img/metrics_13.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
26 changes: 13 additions & 13 deletions docs/the_nimbus_book/src/metrics-pretty-pictures.md
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@ Follow [the instructions for your platform](https://grafana.com/docs/grafana/lat
Go to [http://localhost:3000/](http://localhost:3000/), you should see a Grafana login screen that looks like this:


![](https://i.imgur.com/jcP1qWl.png)
![](./img/metrics_01.png)

Type in `admin` for both the username and password.
You'll be asked to change the password (and we recommend you do so).
Expand All @@ -134,48 +134,48 @@ You'll be asked to change the password (and we recommend you do so).

Hover your mouse over the gear icon in the left menu bar, and click on the `Data Sources` option in the sub-menu that pops up.

![](https://i.imgur.com/0Xsgx61.png)
![](./img/metrics_02.png)

Now click on the `Add Data Source` button in the center of the screen

![](https://i.imgur.com/YRVJjdD.png)
![](./img/metrics_03.png)

Select `Prometheus`

![](https://i.imgur.com/YpwThOr.png)
![](./img/metrics_04.png)

Enter `http://localhost:9090` in the URL field

![](https://i.imgur.com/PtVOnur.png)
![](./img/metrics_05.png)

Set the "Scrape interval" field to the same value you used in the Prometheus config ("15s" in our example below).

Scroll to the bottom and click on `Save and Test`

![](https://i.imgur.com/GJVdwaK.png)
![](./img/metrics_06.png)

If everything is working correctly you should see a green `Data source is working` box pop up

![](https://i.imgur.com/vf5ahNA.png)
![](./img/metrics_07.png)


#### 8. Import a dashboard

Now, let's import a dashboard; hover your mouse over the `+` icon in the left menu bar and select `import` from the pop-up menu

![](https://i.imgur.com/WnnAcUR.png)
![](./img/metrics_08.png)

Click on `Upload JSON file`

![](https://i.imgur.com/l65ICZ2.png)
![](./img/metrics_09.png)

Select the `beacon_nodes_Grafana_dashboard.json` from the `nimbus-eth2/grafana/` folder and click on `Import`

![](https://i.imgur.com/SoU5Isz.png)
![](./img/metrics_10.png)

You'll be directed to the dashboard where you'll be able to gain insights into the performance of `nimbus-eth2` and your validators

![](https://i.imgur.com/aIfJ1iT.png)
![](./img/metrics_11.png)

!!! note
The dashboard is very much a work in progress.
Expand All @@ -190,7 +190,7 @@ And voilà! That's all there is to it :)

### Joe Clapis

![](https://i.imgur.com/05eJeBr.png)
![](./img/metrics_12.png)

Joe — who’s done some brilliant work [integrating Nimbus with Rocket Pool](https://our.status.im/rocket-pool-integration/) — has created a [wonderful guide](https://github.com/jclapis/rp-pi-guide/blob/main/Grafana.md) where he takes you through how to set up a Grafana server on your Pi, using his dashboard as an example.

Expand All @@ -203,7 +203,7 @@ Whether or not you're running a Pi, we recommend you check out [his guide]( http

### Metanull

![](https://i.imgur.com/OlvNGlq.jpg)
![](./img/metrics_13.png)

A dashboard aimed primarily at users rather than developers.

Expand Down
4 changes: 2 additions & 2 deletions grafana/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,10 +19,10 @@ In order to use it locally, you would have to make some changes:

Click the small "share" icon on the top-left of the Grafana dashboard:

![share icon](https://i.imgur.com/ds3BJoj.png)
![share icon](./img/grafana_01.png)

Go to the "Export" tab and enable "Export for sharing externally":

![export tab](https://i.imgur.com/sxgrThb.png)
![export tab](./img/grafana_02.png)

Now you can either "Save to file" or "View JSON" and copy/paste into the destination file, whichever is faster for you.
Binary file added grafana/img/grafana_01.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added grafana/img/grafana_02.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading

0 comments on commit 5a4a0ae

Please sign in to comment.