Skip to content

Conversation

ojuschugh1
Copy link

Suggested Commit Message

fix(prefunded-accounts): use pop() on PRE_FUNDED_ACCOUNTS to avoid key reuse

Replaces all fixed-index accesses of PRE_FUNDED_ACCOUNTS with a LIFO stack
via `.pop()`, ensuring each service receives a unique key and eliminating
collisions across services. Closes #360.

Pull Request Description

Goal

Ensure that no two services ever share the same prefunded account by switching from static-index lookups to a .pop()-based allocation from a mutable stack.

What Changed

  • Copied the original prefunded_accounts list into a local accounts_stack = prefunded_accounts[:].
  • Replaced every prefunded_accounts[<n>] or slice (e.g. [6:8]) with accounts_stack.pop() calls.
  • Updated MEV flood, custom-flood, and spamoor launcher invocations to pull keys/addresses from the stack.

How to Test

  1. Dry-run your changes to validate Starlark syntax:
    kurtosis run --dry-run . "{}"
  2. Launch the enclave for real:
    kurtosis run . "{}"
  3. Inspect the enclave to list service IDs:
    kurtosis enclave inspect <enclave-name>
  4. Stream logs for all services and grep for the key/address printouts:
    kurtosis service logs -f -x <enclave-name> | grep PRIVATE_KEY
    Confirm each service logs a different key.
  5. Verify on-chain balances for each popped address using your Hardhat balance task or an ethers.js script. All addresses should show the genesis allocation (e.g. 10 ETH) with no duplicates.
  6. Clean up once done:
    kurtosis enclave rm <enclave-name>
    kurtosis clean --all

Related Issue

Closes [#360](#360)

…y reuse

Replaces all fixed-index accesses of PRE_FUNDED_ACCOUNTS with a LIFO stack
via `.pop()`, ensuring each service receives a unique key and eliminating
collisions across services. Closes ethpandaops#360.
@ojuschugh1
Copy link
Author

Tagging @pk910 for the review. Thanks and regards

@barnabasbusa
Copy link
Collaborator

There are a bunch of other services that are also using different private keys. Would you be up to updating this everywhere? Otherwise its a half baked PR only.

@ojuschugh1
Copy link
Author

Hi @barnabasbusa , Thanks for the reply, Sure, I will be glad to do that. Thanks for letting me know about this :)

@barnabasbusa barnabasbusa marked this pull request as draft May 8, 2025 13:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants