Skip to content

Commit

Permalink
feat: add "disable_peer_scoring" global flag (#311)
Browse files Browse the repository at this point in the history
Closes: #304
  • Loading branch information
barnabasbusa committed Oct 19, 2023
1 parent d4bec9e commit 63f7ff3
Show file tree
Hide file tree
Showing 4 changed files with 68 additions and 0 deletions.
16 changes: 16 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -276,6 +276,12 @@ jobs:
- <<: *setup_kurtosis
- checkout
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/parallel-keystores-3.json)"
disable_peer_scoring:
executor: ubuntu_vm
steps:
- <<: *setup_kurtosis
- checkout
- run: kurtosis run ${PWD} "$(cat ./.circleci/tests/disable-peer-scoring.json)"

workflows:
check_latest_version:
Expand Down Expand Up @@ -318,11 +324,13 @@ workflows:
branches:
ignore:
- main

- run_starlark:
filters:
branches:
ignore:
- main

- run_starlark_arm64:
filters:
branches:
Expand Down Expand Up @@ -363,13 +371,21 @@ workflows:
branches:
ignore:
- main

- parallel_key_store_generation_2:
filters:
branches:
ignore:
- main

- parallel_key_store_generation_3:
filters:
branches:
ignore:
- main

- disable_peer_scoring:
filters:
branches:
ignore:
- main
30 changes: 30 additions & 0 deletions .circleci/tests/disable-peer-scoring.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"participants": [
{
"el_client_type": "geth",
"cl_client_type": "teku"
},
{
"el_client_type": "besu",
"cl_client_type": "lighthouse"
},
{
"el_client_type": "reth",
"cl_client_type": "lodestar"
},
{
"el_client_type": "erigon",
"cl_client_type": "nimbus"
},
{
"el_client_type": "nethermind",
"cl_client_type": "prysm"
},
{
"el_client_type": "ethereumjs",
"cl_client_type": "teku"
}
],
"launch_additional_services": false,
"disable_peer_scoring": true
}
3 changes: 3 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -286,6 +286,9 @@ To configure the package behaviour, you can modify your `network_params.json` fi
// This will result in a large number of containers being spun up than normal. We advise users to only enable this on a sufficiently large machine or in the cloud as it can be resource consuming on a single machine.
"parallel_keystore_generation": false,

// Disable peer scoring to prevent nodes impacted by faults from being permanently ejected from the network
// Default to false
"disable_peer_scoring": false,

// Supports three valeus
// Default: "None" - no mev boost, mev builder, mev flood or relays are spun up
Expand Down
19 changes: 19 additions & 0 deletions src/package_io/parse_input.star
Original file line number Diff line number Diff line change
Expand Up @@ -69,6 +69,7 @@ def parse_input(plan, input_args):
result["grafana_additional_dashboards"] = []
result["tx_spammer_params"] = get_default_tx_spammer_params()
result["custom_flood_params"] = get_default_custom_flood_params()
result["disable_peer_scoring"] = False

for attr in input_args:
value = input_args[attr]
Expand All @@ -89,6 +90,9 @@ def parse_input(plan, input_args):
sub_value = input_args["custom_flood_params"][sub_attr]
result["custom_flood_params"][sub_attr] = sub_value

if result.get("disable_peer_scoring"):
result = enrich_disable_peer_scoring(result)

if result.get("mev_type") in ("mock", "full"):
result = enrich_mev_extra_params(
result,
Expand Down Expand Up @@ -199,6 +203,7 @@ def parse_input(plan, input_args):
snooper_enabled=result["snooper_enabled"],
parallel_keystore_generation=result["parallel_keystore_generation"],
grafana_additional_dashboards=result["grafana_additional_dashboards"],
disable_peer_scoring=result["disable_peer_scoring"],
)


Expand Down Expand Up @@ -352,6 +357,7 @@ def default_input_args():
"global_client_log_level": "info",
"snooper_enabled": False,
"parallel_keystore_generation": False,
"disable_peer_scoring": False,
}


Expand Down Expand Up @@ -433,6 +439,19 @@ def get_default_custom_flood_params():
return {"interval_between_transactions": 1}


def enrich_disable_peer_scoring(parsed_arguments_dict):
for index, participant in enumerate(parsed_arguments_dict["participants"]):
if participant["cl_client_type"] == "lighthouse":
participant["beacon_extra_params"].append("--disable-peer-scoring")
if participant["cl_client_type"] == "prysm":
participant["beacon_extra_params"].append("--disable-peer-scorer")
if participant["cl_client_type"] == "teku":
participant["beacon_extra_params"].append("--Xp2p-gossip-scoring-enabled")
if participant["cl_client_type"] == "lodestar":
participant["beacon_extra_params"].append("--disablePeerScoring")
return parsed_arguments_dict


# TODO perhaps clean this up into a map
def enrich_mev_extra_params(parsed_arguments_dict, mev_prefix, mev_port, mev_type):
for index, participant in enumerate(parsed_arguments_dict["participants"]):
Expand Down

0 comments on commit 63f7ff3

Please sign in to comment.