Skip to content

Commit

Permalink
fix: Use unused accounts for mev flood (#359)
Browse files Browse the repository at this point in the history
  • Loading branch information
piwonskp committed Nov 10, 2023
1 parent e273993 commit 286654c
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 15 deletions.
9 changes: 5 additions & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -535,14 +535,15 @@ Here's a table of where the keys are used
| Account Index | Component Used In | Private Key Used | Public Key Used | Comment |
|---------------|---------------------|------------------|-----------------|-----------------------------|
| 0 | mev_flood || | As the admin_key |
| 0 | mev_custom_flood | || As the receiver of balance |
| 0 | Builder || | As coinbase |
| 0 | mev_custom_flood | || As the receiver of balance |
| 1 | blob_spammer || | As the sender of blobs |
| 2 | mev_flood || | As the user_key |
| 3 | transaction_spammer || | To spam transactions with |
| 4 | goomy_blob || | As the sender of blobs |
| 5 | eip4788_deployment || | As contract deployer |
| 6 | mev_custom_flood || | As the sender of balance |
| 6 | mev_flood || | As the contract owner |
| 7 | mev_flood || | As the user_key |
| 11 | mev_custom_flood || | As the sender of balance |
## Developing On This Package
Expand Down
7 changes: 5 additions & 2 deletions main.star
Original file line number Diff line number Diff line change
Expand Up @@ -195,11 +195,13 @@ def run(plan, args={}):

first_cl_client = all_cl_client_contexts[0]
first_client_beacon_name = first_cl_client.beacon_service_name
contract_owner, normal_user = genesis_constants.PRE_FUNDED_ACCOUNTS[6:8]
mev_flood.launch_mev_flood(
plan,
mev_params.mev_flood_image,
fuzz_target,
genesis_constants.PRE_FUNDED_ACCOUNTS,
contract_owner.private_key,
normal_user.private_key,
)
epoch_recipe = GetHttpRequestRecipe(
endpoint="/eth/v2/beacon/blocks/head",
Expand Down Expand Up @@ -228,7 +230,8 @@ def run(plan, args={}):
fuzz_target,
mev_params.mev_flood_extra_args,
mev_params.mev_flood_seconds_per_bundle,
genesis_constants.PRE_FUNDED_ACCOUNTS,
contract_owner.private_key,
normal_user.private_key,
)
mev_endpoints.append(endpoint)

Expand Down
16 changes: 7 additions & 9 deletions src/mev_flood/mev_flood_launcher.star
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ def prefixed_address(address):
return "0x" + address


def launch_mev_flood(plan, image, el_uri, genesis_accounts):
def launch_mev_flood(plan, image, el_uri, contract_owner, normal_user):
plan.add_service(
name="mev-flood",
config=ServiceConfig(
Expand All @@ -23,25 +23,23 @@ def launch_mev_flood(plan, image, el_uri, genesis_accounts):
"-c",
"./run init -r {0} -k {1} -u {2} -s deployment.json".format(
el_uri,
prefixed_address(genesis_accounts[0].private_key),
prefixed_address(genesis_accounts[2].private_key),
prefixed_address(contract_owner),
prefixed_address(normal_user),
),
]
),
)


def spam_in_background(
plan, el_uri, mev_flood_extra_args, seconds_per_bundle, genesis_accounts
plan, el_uri, mev_flood_extra_args, seconds_per_bundle, contract_owner, normal_user
):
admin_key, user_key = prefixed_address(
genesis_accounts[0].private_key
), prefixed_address(genesis_accounts[2].private_key)
owner, user = prefixed_address(contract_owner), prefixed_address(normal_user)
command = [
"/bin/sh",
"-c",
"nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle {3} >main.log 2>&1 &".format(
el_uri, admin_key, user_key, seconds_per_bundle
el_uri, owner, user, seconds_per_bundle
),
]
if mev_flood_extra_args:
Expand All @@ -50,7 +48,7 @@ def spam_in_background(
"/bin/sh",
"-c",
"nohup ./run spam -r {0} -k {1} -u {2} -l deployment.json --secondsPerBundle {3} {4} >main.log 2>&1 &".format(
el_uri, admin_key, user_key, seconds_per_bundle, joined_extra_args
el_uri, owner, user, seconds_per_bundle, joined_extra_args
),
]
plan.exec(service_name="mev-flood", recipe=ExecRecipe(command=command))

0 comments on commit 286654c

Please sign in to comment.