Skip to content

Commit

Permalink
feat: add blobspammer (#165)
Browse files Browse the repository at this point in the history
Changelog picked up from commits here:

feat: add blobspammer
  • Loading branch information
barnabasbusa authored Sep 6, 2023
1 parent 21b0975 commit f166d71
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 4 deletions.
16 changes: 15 additions & 1 deletion main.star
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ genesis_constants = import_module("github.com/kurtosis-tech/eth-network-package/

eth_network_module = import_module("github.com/kurtosis-tech/eth-network-package/main.star")
transaction_spammer = import_module("github.com/kurtosis-tech/eth2-package/src/transaction_spammer/transaction_spammer.star")
blob_spammer = import_module("github.com/kurtosis-tech/eth2-package/src/blob_spammer/blob_spammer.star")
cl_forkmon = import_module("github.com/kurtosis-tech/eth2-package/src/cl_forkmon/cl_forkmon_launcher.star")
el_forkmon = import_module("github.com/kurtosis-tech/eth2-package/src/el_forkmon/el_forkmon_launcher.star")
beacon_metrics_gazer = import_module("github.com/kurtosis-tech/eth2-package/src/beacon_metrics_gazer/beacon_metrics_gazer_launcher.star")
Expand Down Expand Up @@ -63,7 +64,7 @@ def run(plan, args):
beacon_uri = "{0}:{1}".format(all_cl_client_contexts[0].ip_addr, all_cl_client_contexts[0].http_port_num)
jwt_secret = all_el_client_contexts[0].jwt_secret
endpoint = mock_mev_launcher_module.launch_mock_mev(plan, el_uri, beacon_uri, jwt_secret)
mev_endpoints.append(endpoint)
mev_endpoints.append(endpoint)
elif args_with_right_defaults.mev_type and args_with_right_defaults.mev_type == FULL_MEV_TYPE:
el_uri = "http://{0}:{1}".format(all_el_client_contexts[0].ip_addr, all_el_client_contexts[0].rpc_port_num)
builder_uri = "http://{0}:{1}".format(all_el_client_contexts[-1].ip_addr, all_el_client_contexts[-1].rpc_port_num)
Expand Down Expand Up @@ -102,6 +103,19 @@ def run(plan, args):
transaction_spammer.launch_transaction_spammer(plan, genesis_constants.PRE_FUNDED_ACCOUNTS, all_el_client_contexts[0])
plan.print("Succesfully launched transaction spammer")

plan.print("Launching Blob spammer")
blob_spammer.launch_blob_spammer(
plan,
genesis_constants.PRE_FUNDED_ACCOUNTS,
all_el_client_contexts[0],
all_cl_client_contexts[0],
network_params.deneb_fork_epoch,
network_params.seconds_per_slot,
network_params.slots_per_epoch,
network_params.genesis_delay
)
plan.print("Succesfully launched blob spammer")

# We need a way to do time.sleep
# TODO add code that waits for CL genesis

Expand Down
46 changes: 46 additions & 0 deletions src/blob_spammer/blob_spammer.star
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
IMAGE_NAME = "ethpandaops/tx-fuzz:latest"
SERVICE_NAME = "blob-spammer"

ENTRYPOINT_ARGS = ["/bin/sh", "-c"]

def launch_blob_spammer(
plan,
prefunded_addresses,
el_client_context,
cl_client_context,
deneb_fork_epoch,
seconds_per_slot,
slots_per_epoch,
genesis_delay):
config = get_config(
prefunded_addresses,
el_client_context,
cl_client_context,
deneb_fork_epoch,
seconds_per_slot,
slots_per_epoch,
genesis_delay)
plan.add_service(SERVICE_NAME, config)

def get_config(
prefunded_addresses,
el_client_context,
cl_client_context,
deneb_fork_epoch,
seconds_per_slot,
slots_per_epoch,
genesis_delay):
dencunTime = (deneb_fork_epoch * slots_per_epoch * seconds_per_slot) + genesis_delay
return ServiceConfig(
image = IMAGE_NAME,
entrypoint = ENTRYPOINT_ARGS,
cmd = [" && ".join([
'apk update',
'apk add curl jq',
'current_epoch=$(curl -s http://{0}:{1}/eth/v2/beacon/blocks/head | jq -r ".version")'.format(cl_client_context.ip_addr, cl_client_context.http_port_num),
'echo $current_epoch',
'while [ $current_epoch != "deneb" ]; do echo "waiting for deneb, current epoch is $current_epoch"; current_epoch=$(curl -s http://{0}:{1}/eth/v2/beacon/blocks/head | jq -r ".version"); sleep {2}; done'.format(cl_client_context.ip_addr, cl_client_context.http_port_num, seconds_per_slot),
'echo "sleep is over, starting to send blob transactions"',
'/tx-fuzz.bin blobs --rpc=http://{0}:{1} --sk={2}'.format(el_client_context.ip_addr, el_client_context.rpc_port_num, prefunded_addresses[1].private_key),
])]
)
3 changes: 0 additions & 3 deletions src/transaction_spammer/transaction_spammer.star
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,6 @@ def launch_transaction_spammer(plan, prefunded_addresses, el_client_context):


def get_config(prefunded_addresses, el_client_context):
private_keys_strs = []
address_strs = []

return ServiceConfig(
image = IMAGE_NAME,
cmd = [
Expand Down

0 comments on commit f166d71

Please sign in to comment.