Skip to content

Commit a01d772

Browse files
authored
feat: add spamoor (ethereum#850)
1 parent d7e31e0 commit a01d772

File tree

8 files changed

+126
-0
lines changed

8 files changed

+126
-0
lines changed

.github/tests/mix-with-tools-mev.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ additional_services:
2626
- blutgang
2727
- apache
2828
- tracoor
29+
- spamoor
2930
ethereum_metrics_exporter_enabled: true
3031
snooper_enabled: true
3132
mev_type: flashbots

.github/tests/mix-with-tools-minimal.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ additional_services:
2828
- blutgang
2929
- apache
3030
- tracoor
31+
- spamoor
3132
ethereum_metrics_exporter_enabled: true
3233
snooper_enabled: true
3334
keymanager_enabled: true

.github/tests/mix-with-tools.yaml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@ additional_services:
2828
- blutgang
2929
- apache
3030
- tracoor
31+
- spamoor
3132
ethereum_metrics_exporter_enabled: true
3233
snooper_enabled: true
3334
keymanager_enabled: true

README.md

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -927,6 +927,27 @@ checkpoint_sync_enabled: false
927927
# Global flag to set checkpoint sync url
928928
checkpoint_sync_url: ""
929929

930+
# Spamoor params
931+
spamoor_params:
932+
# The image to use for spamoor
933+
image: ethpandaops/spamoor:latest
934+
# The type of transactions to send
935+
# Valid values are eoatx, erctx, deploytx, depoy-destruct, blobs, gasburnertx
936+
# Defaults to eoatx
937+
tx_type: eoatx
938+
# Throughput of spamoor
939+
# Defaults to 1000
940+
throughput: 1000
941+
# Max pending transactions for spamoor
942+
# Defaults to 1000
943+
max_pending: 1000
944+
# Max wallets for spamoor
945+
# Defaults to 500
946+
max_wallets: 500
947+
# Extra parameters to send to spamoor
948+
# Defaults to empty
949+
spamoor_extra_args: []
950+
930951
# Global paarameter to set the exit ip address of services and public ports
931952
port_publisher:
932953
# if you have a service that you want to expose on a specific interfact; set that IP here
@@ -1166,6 +1187,7 @@ Here's a table of where the keys are used
11661187
| 8 | assertoor | ✅ | ✅ | As the funding for tests |
11671188
| 11 | mev_custom_flood | ✅ | | As the sender of balance |
11681189
| 12 | l2_contracts | ✅ | | Contract deployer address |
1190+
| 13 | spamoor | ✅ | | Spams transactions |
11691191

11701192
## Developing On This Package
11711193

main.star

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -61,6 +61,7 @@ assertoor = import_module("./src/assertoor/assertoor_launcher.star")
6161
get_prefunded_accounts = import_module(
6262
"./src/prefunded_accounts/get_prefunded_accounts.star"
6363
)
64+
spamoor = import_module("./src/spamoor/spamoor.star")
6465

6566
GRAFANA_USER = "admin"
6667
GRAFANA_PASSWORD = "admin"
@@ -686,6 +687,15 @@ def run(plan, args={}):
686687
global_node_selectors,
687688
args_with_right_defaults.docker_cache_params,
688689
)
690+
elif additional_service == "spamoor":
691+
plan.print("Launching spamoor")
692+
spamoor.launch_spamoor(
693+
plan,
694+
prefunded_accounts,
695+
all_el_contexts,
696+
args_with_right_defaults.spamoor_params,
697+
global_node_selectors,
698+
)
689699
else:
690700
fail("Invalid additional service %s" % (additional_service))
691701
if launch_prometheus_grafana:

src/package_io/input_parser.star

Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ ATTR_TO_BE_SKIPPED_AT_ROOT = (
8686
"custom_flood_params",
8787
"xatu_sentry_params",
8888
"port_publisher",
89+
"spamoor_params",
8990
)
9091

9192

@@ -119,6 +120,7 @@ def input_parser(plan, input_args):
119120
result["global_tolerations"] = []
120121
result["global_node_selectors"] = {}
121122
result["port_publisher"] = get_port_publisher_params("default")
123+
result["spamoor_params"] = get_default_spamoor_params()
122124

123125
if constants.NETWORK_NAME.shadowfork in result["network_params"]["network"]:
124126
shadow_base = result["network_params"]["network"].split("-shadowfork")[0]
@@ -184,6 +186,10 @@ def input_parser(plan, input_args):
184186
result["xatu_sentry_params"][sub_attr] = sub_value
185187
elif attr == "port_publisher":
186188
result["port_publisher"] = get_port_publisher_params("user", input_args)
189+
elif attr == "spamoor_params":
190+
for sub_attr in input_args["spamoor_params"]:
191+
sub_value = input_args["spamoor_params"][sub_attr]
192+
result["spamoor_params"][sub_attr] = sub_value
187193

188194
if result.get("disable_peer_scoring"):
189195
result = enrich_disable_peer_scoring(result)
@@ -430,6 +436,14 @@ def input_parser(plan, input_args):
430436
"interval_between_transactions"
431437
],
432438
),
439+
spamoor_params=struct(
440+
image=result["spamoor_params"]["image"],
441+
tx_type=result["spamoor_params"]["tx_type"],
442+
throughput=result["spamoor_params"]["throughput"],
443+
max_pending=result["spamoor_params"]["max_pending"],
444+
max_wallets=result["spamoor_params"]["max_wallets"],
445+
spamoor_extra_args=result["spamoor_params"]["spamoor_extra_args"],
446+
),
433447
additional_services=result["additional_services"],
434448
wait_for_finalization=result["wait_for_finalization"],
435449
global_log_level=result["global_log_level"],
@@ -844,6 +858,7 @@ def default_input_args(input_args):
844858
"nat_exit_ip": constants.PRIVATE_IP_ADDRESS_PLACEHOLDER,
845859
"public_port_start": None,
846860
},
861+
"spamoor_params": get_default_spamoor_params(),
847862
}
848863

849864

@@ -1151,6 +1166,17 @@ def get_default_xatu_sentry_params():
11511166
}
11521167

11531168

1169+
def get_default_spamoor_params():
1170+
return {
1171+
"image": "ethpandaops/spamoor:latest",
1172+
"tx_type": "eoatx",
1173+
"throughput": 1000,
1174+
"max_pending": 1000,
1175+
"max_wallets": 500,
1176+
"spamoor_extra_args": [],
1177+
}
1178+
1179+
11541180
def get_default_custom_flood_params():
11551181
# this is a simple script that increases the balance of the coinbase address at a cadence
11561182
return {"interval_between_transactions": 1}
@@ -1346,6 +1372,7 @@ def docker_cache_image_override(plan, result):
13461372
"goomy_blob_params.image",
13471373
"prometheus_params.image",
13481374
"grafana_params.image",
1375+
"spamoor_params.image",
13491376
]
13501377

13511378
if result["docker_cache_params"]["url"] == "":

src/package_io/sanity_check.star

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -244,6 +244,14 @@ SUBCATEGORY_PARAMS = {
244244
"xatu_server_headers",
245245
"beacon_subscriptions",
246246
],
247+
"spamoor_params": [
248+
"image",
249+
"tx_type",
250+
"throughput",
251+
"max_pending",
252+
"max_wallets",
253+
"spamoor_extra_args",
254+
],
247255
"port_publisher": [
248256
"nat_exit_ip",
249257
"el",
@@ -273,6 +281,7 @@ ADDITIONAL_SERVICES_PARAMS = [
273281
"forky",
274282
"apache",
275283
"tracoor",
284+
"spamoor",
276285
]
277286

278287
ADDITIONAL_CATEGORY_PARAMS = {

src/spamoor/spamoor.star

Lines changed: 55 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
shared_utils = import_module("../shared_utils/shared_utils.star")
2+
SERVICE_NAME = "spamoor"
3+
4+
# The min/max CPU/memory that spamoor can use
5+
MIN_CPU = 100
6+
MAX_CPU = 1000
7+
MIN_MEMORY = 20
8+
MAX_MEMORY = 300
9+
10+
11+
def launch_spamoor(
12+
plan,
13+
prefunded_addresses,
14+
all_el_contexts,
15+
spamoor_params,
16+
global_node_selectors,
17+
):
18+
config = get_config(
19+
prefunded_addresses,
20+
all_el_contexts,
21+
spamoor_params,
22+
global_node_selectors,
23+
)
24+
plan.add_service(SERVICE_NAME, config)
25+
26+
27+
def get_config(
28+
prefunded_addresses,
29+
all_el_contexts,
30+
spamoor_params,
31+
node_selectors,
32+
):
33+
cmd = [
34+
"{}".format(spamoor_params.tx_type),
35+
"--privkey={}".format(prefunded_addresses[13].private_key),
36+
"--rpchost={}".format(
37+
",".join([el_context.rpc_http_url for el_context in all_el_contexts])
38+
),
39+
"--throughput={}".format(spamoor_params.throughput),
40+
"--max-pending={}".format(spamoor_params.max_pending),
41+
"--max-wallets={}".format(spamoor_params.max_wallets),
42+
]
43+
44+
if len(spamoor_params.spamoor_extra_args) > 0:
45+
cmd.extend([param for param in spamoor_params.spamoor_extra_args])
46+
47+
return ServiceConfig(
48+
image=spamoor_params.image,
49+
cmd=cmd,
50+
min_cpu=MIN_CPU,
51+
max_cpu=MAX_CPU,
52+
min_memory=MIN_MEMORY,
53+
max_memory=MAX_MEMORY,
54+
node_selectors=node_selectors,
55+
)

0 commit comments

Comments
 (0)