Skip to content

Commit

Permalink
feat: added integration test andd e2e tests for transaction exclusion…
Browse files Browse the repository at this point in the history
… api
  • Loading branch information
jonesho committed Oct 9, 2024
1 parent c6a9235 commit f1492c2
Show file tree
Hide file tree
Showing 27 changed files with 1,210 additions and 46 deletions.
36 changes: 33 additions & 3 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -202,9 +202,39 @@ jobs:
e2e-tests-logs-dump: true
secrets: inherit

run-e2e-tests-tx-exclusion-geth-tracing:
needs: [ store-image-name-and-tags, docker-build ]
if: ${{ always() && needs.docker-build.result == 'success' }}
concurrency:
group: run-e2e-tests-tx-exclusion-geth-tracing-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
uses: ./.github/workflows/reuse-run-e2e-tests.yml
with:
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
untested_tag_suffix: ${{ needs.store-image-name-and-tags.outputs.untested_tag_suffix }}
tracing-engine: 'geth'
e2e-tests-for-tx-exclusion: true
e2e-tests-logs-dump: true
secrets: inherit

run-e2e-tests-tx-exclusion:
needs: [ store-image-name-and-tags, docker-build ]
if: ${{ always() && needs.docker-build.result == 'success' }}
concurrency:
group: run-e2e-tests-tx-exclusion-${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: ${{ github.ref_name != 'main' }}
uses: ./.github/workflows/reuse-run-e2e-tests.yml
with:
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
untested_tag_suffix: ${{ needs.store-image-name-and-tags.outputs.untested_tag_suffix }}
tracing-engine: 'besu'
e2e-tests-for-tx-exclusion: true
e2e-tests-logs-dump: true
secrets: inherit

tag-after-run-tests-success:
needs: [ store-image-name-and-tags, testing, run-e2e-tests, run-e2e-tests-geth-tracing ]
if: ${{ always() && needs.testing.result == 'success' && needs.run-e2e-tests.outputs.tests_outcome == 'success' && needs.run-e2e-tests-geth-tracing.outputs.tests_outcome == 'success' }}
needs: [ store-image-name-and-tags, testing, run-e2e-tests, run-e2e-tests-geth-tracing, run-e2e-tests-tx-exclusion, run-e2e-tests-tx-exclusion-geth-tracing ]
if: ${{ always() && needs.testing.result == 'success' && needs.run-e2e-tests.outputs.tests_outcome == 'success' && needs.run-e2e-tests-geth-tracing.outputs.tests_outcome == 'success' && needs.run-e2e-tests-tx-exclusion.outputs.tests_outcome == 'success' && needs.run-e2e-tests-tx-exclusion-geth-tracing.outputs.tests_outcome == 'success' }}
uses: ./.github/workflows/reuse-tag-without-untested-suffix.yml
with:
commit_tag: ${{ needs.store-image-name-and-tags.outputs.commit_tag }}
Expand All @@ -214,7 +244,7 @@ jobs:
secrets: inherit

cleanup-deployments:
needs: [ run-e2e-tests, run-e2e-tests-geth-tracing ]
needs: [ run-e2e-tests, run-e2e-tests-geth-tracing, run-e2e-tests-tx-exclusion, run-e2e-tests-tx-exclusion-geth-tracing ]
if: ${{ always() }}
runs-on: [self-hosted, ubuntu-22.04, X64, small]
steps:
Expand Down
50 changes: 46 additions & 4 deletions .github/workflows/reuse-run-e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,11 @@ on:
required: false
type: boolean
default: true
e2e-tests-for-tx-exclusion:
description: Run end to end tests for transaction exclusion
required: false
type: boolean
default: false
workflow_call:
inputs:
commit_tag:
Expand Down Expand Up @@ -56,6 +61,11 @@ on:
required: false
type: boolean
default: true
e2e-tests-for-tx-exclusion:
description: Run end to end tests for transaction exclusion
required: false
type: boolean
default: false
outputs:
tests_outcome:
value: ${{ jobs.run-e2e-tests.outputs.tests_outcome }}
Expand All @@ -75,7 +85,7 @@ jobs:
TRANSACTION_EXCLUSION_API_TAG: ${{ inputs.commit_tag }}-${{ inputs.untested_tag_suffix }}
GITHUB_TOKEN: ${{ secrets._GITHUB_TOKEN_RELEASE_ACCESS }}
outputs:
tests_outcome: ${{ steps.run_e2e_tests.outcome }}
tests_outcome: ${{ (inputs.e2e-tests-for-tx-exclusion && steps.run_e2e_tests_tx_exclusion.outcome) || (!inputs.e2e-tests-for-tx-exclusion && steps.run_e2e_tests.outcome) }}
runs-on: [self-hosted, Linux, X64, large]
environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }}
steps:
Expand Down Expand Up @@ -116,7 +126,7 @@ jobs:
command: |
make pull-all-images
- name: Spin up fresh environment with geth tracing with retry
if: ${{ inputs.tracing-engine == 'geth' }}
if: ${{ inputs.tracing-engine == 'geth' && !inputs.e2e-tests-for-tx-exclusion }}
uses: nick-fields/retry@v2
with:
max_attempts: 10
Expand All @@ -128,7 +138,7 @@ jobs:
on_retry_command: |
make clean-environment
- name: Spin up fresh environment with besu tracing with retry
if: ${{ inputs.tracing-engine == 'besu' }}
if: ${{ inputs.tracing-engine == 'besu' && !inputs.e2e-tests-for-tx-exclusion }}
uses: nick-fields/retry@v2
with:
max_attempts: 10
Expand All @@ -139,6 +149,30 @@ jobs:
make start-all-traces-v2
on_retry_command: |
make clean-environment
- name: Spin up fresh environment for tx-exclusion e2e tests with geth tracing with retry
if: ${{ inputs.tracing-engine == 'geth' && inputs.e2e-tests-for-tx-exclusion }}
uses: nick-fields/retry@v2
with:
max_attempts: 10
retry_on: error
retry_wait_seconds: 30
timeout_minutes: 10
command: |
make start-all-tx-exclusion
on_retry_command: |
make clean-environment
- name: Spin up fresh environment for tx-exclusion e2e tests with besu tracing with retry
if: ${{ inputs.tracing-engine == 'besu' && inputs.e2e-tests-for-tx-exclusion }}
uses: nick-fields/retry@v2
with:
max_attempts: 10
retry_on: error
retry_wait_seconds: 30
timeout_minutes: 10
command: |
make start-all-tx-exclusion-traces-v2
on_retry_command: |
make clean-environment
- name: List docker containers/images
if: ${{ always() && inputs.e2e-tests-containers-list }}
continue-on-error: true
Expand All @@ -148,12 +182,19 @@ jobs:
- name: Run e2e tests
id: run_e2e_tests
timeout-minutes: 25
if: ${{ !inputs.e2e-tests-for-tx-exclusion }}
run: |
pnpm run -F e2e test:e2e:local
- name: Run e2e tests for tx exclusion
id: run_e2e_tests_tx_exclusion
timeout-minutes: 25
if: ${{ inputs.e2e-tests-for-tx-exclusion }}
run: |
pnpm run -F e2e test:e2e:tx-exclusion:local
- name: Show e2e tests result
if: always()
run: |
echo "E2E_TESTS_RESULT: ${{ steps.run_e2e_tests.outcome }}"
echo "E2E_TESTS_RESULT: ${{ (inputs.e2e-tests-for-tx-exclusion && steps.run_e2e_tests_tx_exclusion.outcome) || (!inputs.e2e-tests-for-tx-exclusion && steps.run_e2e_tests.outcome) }}"
- name: Dump logs
if: ${{ failure() && inputs.e2e-tests-logs-dump }}
run: |
Expand All @@ -168,6 +209,7 @@ jobs:
docker logs postman --since 1h &>> docker_logs/postman.txt
docker logs traces-node --since 1h &>> docker_logs/traces-node.txt
docker logs traces-node-v2 --since 1h &>> docker_logs/traces-node-v2.txt;
docker logs transaction-exclusion-api --since 1h &>> docker_logs/transaction-exclusion-api.txt
docker logs sequencer --since 1h &>> docker_logs/sequencer.txt
- name: Archive debug logs
uses: actions/upload-artifact@v4
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,9 @@ on:

jobs:
build-and-publish:
runs-on: ubuntu-24.04
runs-on: [self-hosted, ubuntu-22.04, X64, small]
name: Transaction exclusion api build
environment: ${{ github.ref != 'refs/heads/main' && 'docker-build-and-e2e' || '' }}
env:
COMMIT_TAG: ${{ inputs.commit_tag }}
DEVELOP_TAG: ${{ inputs.develop_tag }}
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/transaction-exclusion-api-testing.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ on:

jobs:
run-tests:
runs-on: ubuntu-24.04
runs-on: [self-hosted, ubuntu-22.04, X64, small]
name: Transaction exclusion api tests
steps:
- name: Checkout
Expand Down
12 changes: 12 additions & 0 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,12 @@ start-whole-environment:
start-whole-environment-traces-v2:
docker compose -f docker/compose.yml -f docker/compose-local-dev-traces-v2.overrides.yml --profile l1 --profile l2 up -d

start-environment-tx-exclusion:
docker compose -f docker/compose.yml -f docker/compose-local-dev.overrides.yml -f docker/compose-besu-traces-limits-reduced.overrides.yml --profile l1 --profile l2 up -d

start-environment-tx-exclusion-traces-v2:
docker compose -f docker/compose.yml -f docker/compose-local-dev-traces-v2.overrides.yml -f docker/compose-besu-traces-limits-reduced.overrides.yml --profile l1 --profile l2 up -d

pull-all-images:
docker compose -f docker/compose.yml -f docker/compose-local-dev-traces-v2.overrides.yml --profile l1 --profile l2 pull

Expand Down Expand Up @@ -128,6 +134,12 @@ start-all-traces-v2:
L1_GENESIS_TIME=$(get_future_time) make start-whole-environment-traces-v2
make deploy-contracts

start-all-tx-exclusion:
L1_GENESIS_TIME=$(get_future_time) make start-environment-tx-exclusion

start-all-tx-exclusion-traces-v2:
L1_GENESIS_TIME=$(get_future_time) make start-environment-tx-exclusion-traces-v2

deploy-contracts-v4:
make compile-contracts
$(MAKE) -j2 deploy-linea-rollup-v4 deploy-l2messageservice
Expand Down
14 changes: 14 additions & 0 deletions build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -147,6 +147,20 @@ dockerCompose {
projectName = "docker"
environment.put("L1_GENESIS_TIME", "${Instant.now().plusSeconds(3).getEpochSecond()}")
}

localStackPostgresDbOnly {
startedServices = [
"postgres"
]
composeAdditionalArgs = ["--profile", "l2"]
useComposeFiles = ["${project.rootDir.path}/docker/compose.yml"]
waitForHealthyStateTimeout = Duration.ofMinutes(3)
waitForTcpPorts = false
removeOrphans = true
noRecreate = true
projectName = "docker"
environment.put("L1_GENESIS_TIME", "${Instant.now().plusSeconds(3).getEpochSecond()}")
}
}

static Boolean hasKotlinPlugin(Project proj) {
Expand Down
77 changes: 77 additions & 0 deletions docker/compose-besu-traces-limits-reduced.overrides.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,77 @@
services:
sequencer:
environment:
JAVA_OPTS: -XX:+UnlockExperimentalVMOptions -XX:-UseG1GC -XX:+UseZGC
depends_on:
linea-besu-sequencer-plugin-downloader:
condition: service_completed_successfully
user: root
entrypoint:
- /bin/bash
- -c
- |
sed -e 's/ADD .*=.*/ADD = 4096 # reduced it for rejected tx testing/' /var/lib/besu/traces-limits.toml > /var/lib/besu/traces-limits-reduced.toml
/opt/besu/bin/besu \
--config-file=/var/lib/besu/sequencer.config.toml \
--node-private-key-file="/var/lib/besu/key" \
--plugin-linea-rejected-tx-endpoint="http://transaction-exclusion-api:8080" \
--plugin-linea-node-type="SEQUENCER" \
--plugin-linea-module-limit-file-path="/var/lib/besu/traces-limits-reduced.toml"
l2-node-besu:
hostname: l2-node-besu
container_name: l2-node-besu
image: consensys/linea-besu:24.10-delivery34
profiles: [ "l2", "l2-bc", "debug" ]
depends_on:
linea-besu-sequencer-plugin-downloader:
condition: service_completed_successfully
sequencer:
condition: service_healthy
user: root
ports:
- "9045:8545"
- "9046:8546"
- "9050:8550"
- "9051:8548"
- "30309:30303"
healthcheck:
test: [ "CMD-SHELL", "bash -c \"[ -f /tmp/pid ]\"" ]
interval: 1s
timeout: 1s
retries: 120
restart: "no"
environment:
LOG4J_CONFIGURATION_FILE: /var/lib/besu/log4j.xml
entrypoint:
- /bin/bash
- -c
- |
sed -e 's/ADD .*=.*/ADD = 4096 # reduced it for rejected tx testing/' /var/lib/besu/traces-limits.toml > /var/lib/besu/traces-limits-reduced.toml
/opt/besu/bin/besu \
--config-file=/var/lib/besu/l2-node-besu.config.toml \
--genesis-file=/var/lib/besu/genesis.json \
--plugin-linea-rejected-tx-endpoint="http://transaction-exclusion-api:8080" \
--plugin-linea-node-type="P2P" \
--plugin-linea-module-limit-file-path="/var/lib/besu/traces-limits-reduced.toml" \
--bootnodes=enode://14408801a444dafc44afbccce2eb755f902aed3b5743fed787b3c790e021fef28b8c827ed896aa4e8fb46e22bd67c39f994a73768b4b382f8597b0d44370e15d@11.11.11.101:30303
volumes:
- ./config/l2-node-besu/l2-node-besu-config.toml:/var/lib/besu/l2-node-besu.config.toml:ro
- ./config/linea-besu-sequencer/deny-list.txt:/var/lib/besu/deny-list.txt:ro
- ./config/l2-node-besu/log4j.xml:/var/lib/besu/log4j.xml:ro
- ./config/linea-local-dev-genesis-PoA-besu.json/:/var/lib/besu/genesis.json:ro
- ../config/common/traces-limits-besu-v2.toml:/var/lib/besu/traces-limits.toml:ro
- ../tmp/linea-besu-sequencer/plugins:/opt/besu/plugins/
- ../tmp/local/:/data/:rw
networks:
linea:
ipv4_address: 11.11.11.119

postman:
command: ["echo", "forced exit as not needed"]

coordinator:
command: ["echo", "forced exit as not needed"]

linea-besu-sequencer-finalized-tag-updater-plugin-downloader:
command: ["echo", "forced exit as not needed"]
3 changes: 1 addition & 2 deletions docker/compose-local-dev-traces-v2.overrides.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ services:
- ../config/common/traces-limits-besu-v2.toml:/var/lib/besu/traces-limits.toml:ro

linea-besu-sequencer-plugin-downloader:
command: [ "sh", "/file-downloader.sh", "https://github.com/Consensys/linea-sequencer/releases/download/v0.8.0-rc1.1/linea-sequencer-v0.8.0-rc1.1.jar", "/linea-besu-sequencer" ]
command: [ "sh", "/file-downloader.sh", "https://github.com/Consensys/linea-sequencer/releases/download/v0.8.0-rc4.1/linea-sequencer-v0.8.0-rc4.1.jar", "/linea-besu-sequencer" ]

traces-node:
command: ['echo', 'forced exit as replaced by traces-node-v2']
Expand Down Expand Up @@ -51,7 +51,6 @@ services:
--bootnodes=enode://14408801a444dafc44afbccce2eb755f902aed3b5743fed787b3c790e021fef28b8c827ed896aa4e8fb46e22bd67c39f994a73768b4b382f8597b0d44370e15d@11.11.11.101:30303
volumes:
- ./config/traces-node-v2/traces-node-v2-config.toml:/var/lib/besu/traces-node-v2.config.toml:ro
- ./config/traces-node-v2/key:/var/lib/besu/key:ro
- ./config/traces-node-v2/log4j.xml:/var/lib/besu/log4j.xml:ro
- ./config/linea-local-dev-genesis-PoA-besu.json/:/var/lib/besu/genesis.json:ro
- ../tmp/traces-node-v2/plugins:/opt/besu/plugins/
Expand Down
7 changes: 4 additions & 3 deletions docker/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,9 @@ services:
--node-private-key-file="/var/lib/besu/key" \
--plugin-linea-l1-polling-interval="PT12S" \
--plugin-linea-l1-smart-contract-address="0xCf7Ed3AccA5a467e9e704C703E8D87F634fB0Fc9" \
--plugin-linea-l1-rpc-endpoint="http://l1-el-node:8545"
--plugin-linea-l1-rpc-endpoint="http://l1-el-node:8545" \
--plugin-linea-rejected-tx-endpoint="http://transaction-exclusion-api:8080" \
--plugin-linea-node-type="SEQUENCER"
volumes:
- ./config/linea-besu-sequencer/sequencer.config.toml:/var/lib/besu/sequencer.config.toml:ro
- ./config/linea-besu-sequencer/deny-list.txt:/var/lib/besu/deny-list.txt:ro
Expand All @@ -71,7 +73,7 @@ services:
linea-besu-sequencer-plugin-downloader:
image: busybox:1.36.1
# profiles: ["l2", "l2-bc"] this works locally but breakes on CI, maybe Docker compose version issue
command: [ "sh", "/file-downloader.sh", "https://github.com/Consensys/linea-sequencer/releases/download/v0.1.4-test34/besu-sequencer-plugins-v0.1.4-test34.jar", "/linea-besu-sequencer" ]
command: [ "sh", "/file-downloader.sh", "https://github.com/Consensys/linea-sequencer/releases/download/v0.1.4-test35/besu-sequencer-plugins-v0.1.4-test35.jar", "/linea-besu-sequencer" ]
volumes:
- ./scripts/file-downloader.sh:/file-downloader.sh:ro
- ../tmp/linea-besu-sequencer/plugins:/linea-besu-sequencer/
Expand Down Expand Up @@ -518,7 +520,6 @@ services:
volumes:
- ./config/zkbesu-shomei/zkbesu-config.toml:/var/lib/besu/zkbesu-config.toml:ro
- ./config/zkbesu-shomei/key:/var/lib/besu/key:ro
- ./config/zkbesu-shomei/log4j.xml:/var/lib/besu/log4j.xml:ro
- ./config/linea-local-dev-genesis-PoA-besu.json/:/var/lib/besu/genesis.json:ro
- ../tmp/zkbesu-shomei/plugins:/opt/besu/plugins/
Expand Down
Loading

0 comments on commit f1492c2

Please sign in to comment.