Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[stress test] inject erc-20 txs #13

Open
bitwiseguy opened this issue Oct 18, 2024 · 7 comments
Open

[stress test] inject erc-20 txs #13

bitwiseguy opened this issue Oct 18, 2024 · 7 comments

Comments

@bitwiseguy
Copy link
Collaborator

Currently the stress test just injects simple eth transfer txs. While the test is able to fill blocks up to the gas target with these txs, it does not provide the same processing strain on the node as other txs that contain different opcodes. As a next step, it would be nice to be able to also inject txs that contain SSTORE/SLOAD opcodes (e.g. ERC-20 token transfers) and compare the results.

Since writing to unique storage slots is suspected to be a driver of processing block time, the inject txs should aim to use many different storage slots instead of the same slots across many txs.

@GrapeBaBa
Copy link

Have some questions here.

  1. Is it essential to initially create and deploy contract transactions, and carry out initialization transactions such as depositing funds into multiple addresses?
  2. How can data and test transactions be structured to ensure that each execution of the test conducts with a specific degree of determinism, allowing observation of results across multiple tests?

@bitwiseguy
Copy link
Collaborator Author

  1. There is already some code as part of the stress test to deposit l2 funds into the test addresses here. You should be able to just use that. Probably will need to create at least one contract deployment tx unless there is already a known contract deployed on that network that you want to interact with. One idea from @danyalprout is to create a contract that has assembly and you can pass an arg that causes it to run certain opcodes that many times. Perhaps a more straightforward approach is to deploy an ERC-20 contract and transfer tokens. Those txs will use SSTORE opcodes, but will be less tightly controlled and not sure if they will achieve the test scenario of updating many "unique storage locations"

  2. I tried to achieve determinism by running the replay tests against the same range of blocks on the same node (made easier + more repeatable by op-wheel which helps rewind the safe/unsafe block head to a given point). So all the same txs were replayed each test. However, still saw some pretty big variance in block processing times. I suspect much of the variance is due to memory usage of the op-geth node (i.e. caching, etc) and periodic db compactions but I don't have any data to definitively support that theory

@GrapeBaBa
Copy link

@bitwiseguy Are you already working on this?

@bitwiseguy
Copy link
Collaborator Author

@GrapeBaBa - No I am not working on it. Please feel free to assign it to yourself and work on it if you have the time to do it. Would welcome the contribution

@GrapeBaBa
Copy link

@bitwiseguy Glad to contribute, however we need to decide which method to select for implementation first.

@bitwiseguy
Copy link
Collaborator Author

@GrapeBaBa - awesome! As a first step I would try deploying a simple ERC-20 contract during the stress test initialization and send token transfers through that as one version of the stress test. So we would have two options for stress testing, ideally configurable through the env vars file by expanding the number of valid options to this variable, or adding a supplementary env var that allows you to select the stress type (and default to the simple eth transfer version if not specified):

  1. replay (already done)
  2. stress, eth transfers (already done)
  3. stress, erc20 transfers (next step)
  4. stress, opcode selector (future improvement)

@GrapeBaBa
Copy link

@bitwiseguy If you are ok, we can help to draft a PR for ERC-20 testing. I have talked with @thinkAfCod yesterday, we could start it next week.

@bitwiseguy bitwiseguy changed the title stress test: inject txs with SSTORE/SLOAD opcodes stress test: inject erc-20 txs Oct 25, 2024
@bitwiseguy bitwiseguy changed the title stress test: inject erc-20 txs [stress test] inject erc-20 txs Oct 28, 2024
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

No branches or pull requests

2 participants