Skip to content

Commit

Permalink
feat: add spamoor (#850)
Browse files Browse the repository at this point in the history
  • Loading branch information
barnabasbusa authored Dec 6, 2024
1 parent d7e31e0 commit a01d772
Show file tree
Hide file tree
Showing 8 changed files with 126 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools-mev.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ additional_services:
- blutgang
- apache
- tracoor
- spamoor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
mev_type: flashbots
Expand Down
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools-minimal.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ additional_services:
- blutgang
- apache
- tracoor
- spamoor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
Expand Down
1 change: 1 addition & 0 deletions .github/tests/mix-with-tools.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ additional_services:
- blutgang
- apache
- tracoor
- spamoor
ethereum_metrics_exporter_enabled: true
snooper_enabled: true
keymanager_enabled: true
22 changes: 22 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -927,6 +927,27 @@ checkpoint_sync_enabled: false
# Global flag to set checkpoint sync url
checkpoint_sync_url: ""

# Spamoor params
spamoor_params:
# The image to use for spamoor
image: ethpandaops/spamoor:latest
# The type of transactions to send
# Valid values are eoatx, erctx, deploytx, depoy-destruct, blobs, gasburnertx
# Defaults to eoatx
tx_type: eoatx
# Throughput of spamoor
# Defaults to 1000
throughput: 1000
# Max pending transactions for spamoor
# Defaults to 1000
max_pending: 1000
# Max wallets for spamoor
# Defaults to 500
max_wallets: 500
# Extra parameters to send to spamoor
# Defaults to empty
spamoor_extra_args: []

# Global paarameter to set the exit ip address of services and public ports
port_publisher:
# if you have a service that you want to expose on a specific interfact; set that IP here
Expand Down Expand Up @@ -1166,6 +1187,7 @@ Here's a table of where the keys are used
| 8 | assertoor | ✅ | ✅ | As the funding for tests |
| 11 | mev_custom_flood | ✅ | | As the sender of balance |
| 12 | l2_contracts | ✅ | | Contract deployer address |
| 13 | spamoor | ✅ | | Spams transactions |

## Developing On This Package

Expand Down
10 changes: 10 additions & 0 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -61,6 +61,7 @@ assertoor = import_module("./src/assertoor/assertoor_launcher.star")
get_prefunded_accounts = import_module(
"./src/prefunded_accounts/get_prefunded_accounts.star"
)
spamoor = import_module("./src/spamoor/spamoor.star")

GRAFANA_USER = "admin"
GRAFANA_PASSWORD = "admin"
Expand Down Expand Up @@ -686,6 +687,15 @@ def run(plan, args={}):
global_node_selectors,
args_with_right_defaults.docker_cache_params,
)
elif additional_service == "spamoor":
plan.print("Launching spamoor")
spamoor.launch_spamoor(
plan,
prefunded_accounts,
all_el_contexts,
args_with_right_defaults.spamoor_params,
global_node_selectors,
)
else:
fail("Invalid additional service %s" % (additional_service))
if launch_prometheus_grafana:
Expand Down
27 changes: 27 additions & 0 deletions src/package_io/input_parser.star
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
"custom_flood_params",
"xatu_sentry_params",
"port_publisher",
"spamoor_params",
)


Expand Down Expand Up @@ -119,6 +120,7 @@ def input_parser(plan, input_args):
result["global_tolerations"] = []
result["global_node_selectors"] = {}
result["port_publisher"] = get_port_publisher_params("default")
result["spamoor_params"] = get_default_spamoor_params()

if constants.NETWORK_NAME.shadowfork in result["network_params"]["network"]:
shadow_base = result["network_params"]["network"].split("-shadowfork")[0]
Expand Down Expand Up @@ -184,6 +186,10 @@ def input_parser(plan, input_args):
result["xatu_sentry_params"][sub_attr] = sub_value
elif attr == "port_publisher":
result["port_publisher"] = get_port_publisher_params("user", input_args)
elif attr == "spamoor_params":
for sub_attr in input_args["spamoor_params"]:
sub_value = input_args["spamoor_params"][sub_attr]
result["spamoor_params"][sub_attr] = sub_value

if result.get("disable_peer_scoring"):
result = enrich_disable_peer_scoring(result)
Expand Down Expand Up @@ -430,6 +436,14 @@ def input_parser(plan, input_args):
"interval_between_transactions"
],
),
spamoor_params=struct(
image=result["spamoor_params"]["image"],
tx_type=result["spamoor_params"]["tx_type"],
throughput=result["spamoor_params"]["throughput"],
max_pending=result["spamoor_params"]["max_pending"],
max_wallets=result["spamoor_params"]["max_wallets"],
spamoor_extra_args=result["spamoor_params"]["spamoor_extra_args"],
),
additional_services=result["additional_services"],
wait_for_finalization=result["wait_for_finalization"],
global_log_level=result["global_log_level"],
Expand Down Expand Up @@ -844,6 +858,7 @@ def default_input_args(input_args):
"nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
"public_port_start": None,
},
"spamoor_params": get_default_spamoor_params(),
}


Expand Down Expand Up @@ -1151,6 +1166,17 @@ def get_default_xatu_sentry_params():
}


def get_default_spamoor_params():
return {
"image": "ethpandaops/spamoor:latest",
"tx_type": "eoatx",
"throughput": 1000,
"max_pending": 1000,
"max_wallets": 500,
"spamoor_extra_args": [],
}


def get_default_custom_flood_params():
# this is a simple script that increases the balance of the coinbase address at a cadence
return {"interval_between_transactions": 1}
Expand Down Expand Up @@ -1346,6 +1372,7 @@ def docker_cache_image_override(plan, result):
"goomy_blob_params.image",
"prometheus_params.image",
"grafana_params.image",
"spamoor_params.image",
]

if result["docker_cache_params"]["url"] == "":
Expand Down
9 changes: 9 additions & 0 deletions src/package_io/sanity_check.star
Original file line number Diff line number Diff line change
Expand Up @@ -244,6 +244,14 @@ SUBCATEGORY_PARAMS = {
"xatu_server_headers",
"beacon_subscriptions",
],
"spamoor_params": [
"image",
"tx_type",
"throughput",
"max_pending",
"max_wallets",
"spamoor_extra_args",
],
"port_publisher": [
"nat_exit_ip",
"el",
Expand Down Expand Up @@ -273,6 +281,7 @@ ADDITIONAL_SERVICES_PARAMS = [
"forky",
"apache",
"tracoor",
"spamoor",
]

ADDITIONAL_CATEGORY_PARAMS = {
Expand Down
55 changes: 55 additions & 0 deletions src/spamoor/spamoor.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
shared_utils = import_module("../shared_utils/shared_utils.star")
SERVICE_NAME = "spamoor"

# The min/max CPU/memory that spamoor can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 300


def launch_spamoor(
plan,
prefunded_addresses,
all_el_contexts,
spamoor_params,
global_node_selectors,
):
config = get_config(
prefunded_addresses,
all_el_contexts,
spamoor_params,
global_node_selectors,
)
plan.add_service(SERVICE_NAME, config)


def get_config(
prefunded_addresses,
all_el_contexts,
spamoor_params,
node_selectors,
):
cmd = [
"{}".format(spamoor_params.tx_type),
"--privkey={}".format(prefunded_addresses[13].private_key),
"--rpchost={}".format(
",".join([el_context.rpc_http_url for el_context in all_el_contexts])
),
"--throughput={}".format(spamoor_params.throughput),
"--max-pending={}".format(spamoor_params.max_pending),
"--max-wallets={}".format(spamoor_params.max_wallets),
]

if len(spamoor_params.spamoor_extra_args) > 0:
cmd.extend([param for param in spamoor_params.spamoor_extra_args])

return ServiceConfig(
image=spamoor_params.image,
cmd=cmd,
min_cpu=MIN_CPU,
max_cpu=MAX_CPU,
min_memory=MIN_MEMORY,
max_memory=MAX_MEMORY,
node_selectors=node_selectors,
)

0 comments on commit a01d772

Please sign in to comment.