From b6b6bd790ca7c40d91d2cef6d67c42d3a21fe821 Mon Sep 17 00:00:00 2001 From: albert Date: Sat, 24 Feb 2024 07:52:02 +0100 Subject: [PATCH] chore: add spam before snapshot --- .github/workflows/create-geth-arb-network.yml | 39 +++++++++++++++---- scripts/spam_txs.py | 24 ++++++++++++ 2 files changed, 56 insertions(+), 7 deletions(-) create mode 100644 scripts/spam_txs.py diff --git a/.github/workflows/create-geth-arb-network.yml b/.github/workflows/create-geth-arb-network.yml index eb739169..404dd568 100644 --- a/.github/workflows/create-geth-arb-network.yml +++ b/.github/workflows/create-geth-arb-network.yml @@ -47,7 +47,7 @@ jobs: runs-on: [self-hosted, linux, x64, ephemeral] steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Set up QEMU uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 @@ -100,12 +100,12 @@ jobs: password: ${{ secrets.GITHUB_TOKEN }} steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: ref: ${{ inputs.tag }} - name: Checkout chainflip-backend @ ${{ inputs.chainflip_backend_ref }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: token: ${{ secrets.CF_GITHUB_BOT_READONLY_BACKEND_REPO }} repository: chainflip-io/chainflip-backend @@ -188,7 +188,7 @@ jobs: - build-geth-state steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Checkout chainflip-io/nitro-testnode @ ${{ inputs.nitro_testnodes_ref }} uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 @@ -200,7 +200,7 @@ jobs: submodules: true - name: Checkout chainflip-backend @ ${{ inputs.chainflip_backend_ref }} - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 with: token: ${{ secrets.CF_GITHUB_BOT_READONLY_BACKEND_REPO }} repository: chainflip-io/chainflip-backend @@ -244,6 +244,31 @@ jobs: ./test-node.bash script send-l2 --to address_0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266 --ethamount 10000 ./test-node.bash script send-l2 --to address_0x70997970C51812dc3A010C7d01b50e0d17dc79C8 --ethamount 10000 + ############### Add spamming of the network here ############### + - name: Install Python virtualenv + run: pip install virtualenv + + - name: Setup Node + uses: actions/setup-node@8f152de45cc393bb48ce5d89d36b731f54556e65 + with: + node-version: "16" + + - name: Install Poetry + uses: snok/install-poetry@93ada01c735cc8a383ce0ce2ae205a21c415379b + + - run: npm install --global ganache-cli + - run: npm install --global yarn + - run: yarn + - run: poetry install + + - name: Add the network + run: poetry run brownie networks add Ethereum arb-l2 host=http://localhost:8547 chainid=412346 + + - name: Spam txs + run: poetry run brownie run spam_txs --network arb-l2 + + ############################################################ + - name: Stop Containers run: | # Stop ARB containers in order to preserve a clean state @@ -284,7 +309,7 @@ jobs: runs-on: [self-hosted, linux, x64, ephemeral] steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Set up QEMU ⚙️ uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 @@ -346,7 +371,7 @@ jobs: runs-on: [self-hosted, linux, x64, ephemeral] steps: - name: Checkout - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 - name: Set up QEMU ⚙️ uses: docker/setup-qemu-action@68827325e0b33c7199eb31dd4e31fbe9023e06e3 diff --git a/scripts/spam_txs.py b/scripts/spam_txs.py new file mode 100644 index 00000000..681d0f83 --- /dev/null +++ b/scripts/spam_txs.py @@ -0,0 +1,24 @@ +import sys +import os + +sys.path.append(os.path.abspath("tests")) +from shared_tests import * +from utils import prompt_user_continue_or_break +from consts import * +from brownie import accounts, network + +AUTONOMY_SEED = os.environ["SEED"] +cf_accs = accounts.from_mnemonic(AUTONOMY_SEED, count=10) +DEPLOYER_ACCOUNT_INDEX = int(os.environ.get("DEPLOYER_ACCOUNT_INDEX") or 0) + +DEPLOYER = cf_accs[DEPLOYER_ACCOUNT_INDEX] +print(f"DEPLOYER = {DEPLOYER}") +network.priority_fee("1 gwei") + +# NUM_SPAM_TXS = int(os.environ["NUM_SPAM_TXS"]) +NUM_SPAM_TXS = 100 + + +def main(): + for i in range(NUM_SPAM_TXS): + DEPLOYER.transfer(DEPLOYER, "1 ether")