goomy_blob.star 2.34 KB
Newer Older
1 2 3 4 5
SERVICE_NAME = "goomy-blob-spammer"
IMAGE_NAME = "ethpandaops/goomy-blob:master"

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

6 7 8 9 10 11
# The min/max CPU/memory that goomy can use
MIN_CPU = 100
MAX_CPU = 1000
MIN_MEMORY = 20
MAX_MEMORY = 300

12 13 14 15

def launch_goomy_blob(
    plan,
    prefunded_addresses,
16 17
    el_contexts,
    cl_context,
18 19
    seconds_per_slot,
    goomy_blob_params,
20
    global_node_selectors,
21 22 23
):
    config = get_config(
        prefunded_addresses,
24 25
        el_contexts,
        cl_context,
26 27
        seconds_per_slot,
        goomy_blob_params.goomy_blob_args,
28
        global_node_selectors,
29 30 31 32 33 34
    )
    plan.add_service(SERVICE_NAME, config)


def get_config(
    prefunded_addresses,
35 36
    el_contexts,
    cl_context,
37 38
    seconds_per_slot,
    goomy_blob_args,
39
    node_selectors,
40 41
):
    goomy_cli_args = []
42
    for index, client in enumerate(el_contexts):
43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62
        goomy_cli_args.append(
            "-h http://{0}:{1}".format(
                client.ip_addr,
                client.rpc_port_num,
            )
        )

    goomy_args = " ".join(goomy_blob_args)
    if goomy_args == "":
        goomy_args = "combined -b 2 -t 2 --max-pending 3"
    goomy_cli_args.append(goomy_args)

    return ServiceConfig(
        image=IMAGE_NAME,
        entrypoint=ENTRYPOINT_ARGS,
        cmd=[
            " && ".join(
                [
                    "apt-get update",
                    "apt-get install -y curl jq",
63 64
                    'current_epoch=$(curl -s {0}/eth/v2/beacon/blocks/head | jq -r ".version")'.format(
                        cl_context.beacon_http_url,
65
                    ),
66 67
                    'while [ $current_epoch != "deneb" ]; do echo "waiting for deneb, current epoch is $current_epoch"; current_epoch=$(curl -s {0}/eth/v2/beacon/blocks/head | jq -r ".version"); sleep {1}; done'.format(
                        cl_context.beacon_http_url,
68 69 70 71 72 73 74 75 76 77
                        seconds_per_slot,
                    ),
                    'echo "sleep is over, starting to send blob transactions"',
                    "./blob-spammer -p {0} {1}".format(
                        prefunded_addresses[4].private_key,
                        " ".join(goomy_cli_args),
                    ),
                ]
            )
        ],
78 79 80 81
        min_cpu=MIN_CPU,
        max_cpu=MAX_CPU,
        min_memory=MIN_MEMORY,
        max_memory=MAX_MEMORY,
82
        node_selectors=node_selectors,
83
    )