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

add blockscout contract validation #55

Closed
wants to merge 6 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .env
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# SEQUENCER
ROLLUP_SEQUENCER_MANGATA_NODE_URL=ws://node-alice:9944
ROLLUP_SEQUENCER_ETH_CHAIN_URL=ws://anvil:8545
ROLLUP_SEQUENCER_MNEMONIC="0x8075991ce870b93a8870eca0c0f91913d12f47948ca0fd25b49c6fa7cdbeee8b"
ROLLUP_SEQUENCER_MNEMONIC="//Bob"

# UPDATER
ROLLUP_UPDATER_MANGATA_NODE_URL=ws://node-alice:9944
Expand Down
12 changes: 0 additions & 12 deletions .github/workflows/pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -43,18 +43,6 @@ jobs:
with:
env: fungible
version: ${{ needs.init.outputs.GLOBAL_VERSION }}

run-e2e-test:
name: Run e2e tests
needs: [init, build-and-test]
uses: ./.github/workflows/reusable-e2e-tests.yml
secrets: inherit
permissions:
contents: read
actions: read
checks: write
with:
globalVersion: ${{ needs.init.outputs.GLOBAL_VERSION }}

clean-up-fungible:
name: Delete fungible environment
Expand Down
185 changes: 80 additions & 105 deletions .github/workflows/reusable-e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -1,147 +1,122 @@
name: Run e2e tests
name: Run e2e
on:
workflow_call:
inputs:
e2eBranch:
type: string
required: false
substrateNodeVersion:
type: string
required: false
default: 'eth-rollup-develop'
globalVersion:
type: string
required: false
default: '8dd0c81aa88b967334d001d8cae031f8799a189f'
pull_request:
types: [opened, synchronize, closed]

workflow_dispatch:
inputs:
e2eBranch:
type: string
required: false
substrateNodeVersion:
type: string
required: false
default: 'eth-rollup-develop'
globalVersion:
type: string
required: false
default: '8dd0c81aa88b967334d001d8cae031f8799a189f'
inputs:
e2eBranch:
description: ''
required: false
default: 'eth-rollup-develop'

permissions:
contents: read
actions: read
contents: write
id-token: write
deployments: write
checks: write

env:
CURRENT_BRANCH: ${{ github.head_ref || github.ref_name }}
DEFAULT_E2E_REPO_BRANCH: eth-rollup-develop
AVS_AGGREGATOR_VERSION: ${{ inputs.globalVersion }}
AVS_FINALIZER_VERSION: ${{ inputs.globalVersion }}
ROLLUP_SEQUENCER_VERSION: ${{ inputs.globalVersion }}
ROLLUP_UPDATER_VERSION: ${{ inputs.globalVersion }}
MANGATA_NODE_VERSION: ${{ inputs.substrateNodeVersion }}
concurrency:
group: ${{ github.workflow }}-${{ github.head_ref || github.run_id }}
cancel-in-progress: true

jobs:
run-e2e-tests:
init:
name: Set global version
if: github.event.action != 'closed'
runs-on: ubuntu-latest
outputs:
GLOBAL_VERSION: ${{ steps.set_vars.outputs.GLOBAL_VERSION }}
steps:
- name: Set global version
id: set_vars
run: echo "GLOBAL_VERSION=${{ github.sha }}" >> $GITHUB_OUTPUT

#build-and-test:
#needs: [init]
#name: Build
#uses: ./.github/workflows/reusable-build-and-test.yml
#secrets: inherit
#with:
#version: ${{ needs.init.outputs.GLOBAL_VERSION }}

start-env:
runs-on: [ubuntu-latest]
needs: [init]
steps:
- uses: actions/checkout@v4
with:
submodules: recursive
submodules: 'recursive'

#- name: build finalizer
# working-directory: avs-finalizer/
# run: cargo +stable build --release

- name: Start env
run: docker compose up -d --wait

- name: Use custom branch in e2e tests repository if it exists, otherwise use default branch
id: e2e
run: |
# Implementation of this conditional action was taken from here:
# https://github.com/actions/checkout/issues/512#issuecomment-1264735491

# This condition check if the input 'e2eBranch' is empty, and if it is, it checks if the current branch name exists in 'mangata-e2e' repository
if [[ -z "${{ inputs.e2eBranch }}" ]]; then
# Checking if current branch name exists in 'mangata-e2e' repository
if git ls-remote --heads --quiet --exit-code https://github.com/mangata-finance/mangata-e2e.git ${{ env.CURRENT_BRANCH }}; then
echo "Using custom '${{ env.CURRENT_BRANCH }}' branch as it exists in 'mangata-e2e' repository"
echo "BRANCH=${{ env.CURRENT_BRANCH }}" >> $GITHUB_OUTPUT
else
echo "Custom branch '${{ env.CURRENT_BRANCH }}' does not exist in 'mangata-e2e' repository, using default '${{ env.DEFAULT_E2E_REPO_BRANCH }}' branch"
echo "BRANCH=${{ env.DEFAULT_E2E_REPO_BRANCH }}" >> $GITHUB_OUTPUT
fi
else
echo "Using '${{ inputs.e2eBranch }}' branch fo 'mangata-e2e' repository as it was provided in the input"
echo "BRANCH=${{ inputs.e2eBranch }}" >> $GITHUB_OUTPUT
fi

export AVS_AGGREGATOR_VERSION=8dd0c81aa88b967334d001d8cae031f8799a189f
export AVS_FINALIZER_VERSION=8dd0c81aa88b967334d001d8cae031f8799a189f
docker compose build sequencer updater
docker compose up --wait

# - name: Sleep for 2 minutes
# run: sleep 120s

- name: docker ps
run: docker ps

- name: Decide if main - branch or parameter
# if we have something in e2eBranch - override E2EBranchName, else -> E2EBRANCHNAME , that
# by default will be main.
run: echo "E2EBRANCHNAME=${{ inputs.e2eBranch || 'eth-rollup-develop' }}" >> $GITHUB_ENV

- name: Checkout tests
uses: actions/checkout@v4
with:
repository: mangata-finance/mangata-e2e
ref: ${{ steps.e2e.outputs.BRANCH }}
ref: "eth-rollup-develop"
path: e2eTests

- name: Install e2e tests dependencies
working-directory: e2eTests
run: yarn install

- name: restart sequencer
run: docker restart rollup-sequencer-1

- name: Run tests
working-directory: e2eTests
run: yarn test-rollup
run: "yarn test-rollup"
env:
NODE_OPTIONS: --max_old_space_size=12288

- name: Get sequencer logs
- name: Get Seq logs
if: success() || failure()
run: docker logs rollup-sequencer-1


- name: Get updater logs
if: success() || failure()
run: docker logs rollup-updater-1

- name: Test Report
uses: dorny/[email protected]
if: success() || failure()
uses: dorny/[email protected]
continue-on-error: true
if: success() || failure() # run this step even if previous step failed
with:
name: E2E report test-rollup
path: e2eTests/reports/*.xml
reporter: jest-junit
name: E2E report test-rollup # Name of the check run which will be created
path: e2eTests/reports/*.xml # Path to test results
reporter: jest-junit # Format of test results

run-avs-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
submodules: recursive

- name: Start env
run: docker compose up -d --wait

- name: Install Foundry
uses: foundry-rs/foundry-toolchain@v1
- name: build and copy contracts
working-directory: contracts
- name: Stop env
if: success() || failure() # run this step even if previous step failed
run: |
forge build
cp out/FinalizerTaskManager.sol/FinalizerTaskManager.json ../avs-finalizer/tests/abis/FinalizerTaskManager.json
cp out/IndexRegistryStorage.sol/IndexRegistryStorage.json ../avs-finalizer/tests/abis/IndexRegistryStorage.json
cp out/RegistryCoordinator.sol/RegistryCoordinator.json ../avs-finalizer/tests/abis/RegistryCoordinator.json
cp out/RegistryCoordinatorStorage.sol/RegistryCoordinatorStorage.json ../avs-finalizer/tests/abis/RegistryCoordinatorStorage.json

- name: FINALIZER tests - install deps
working-directory: avs-finalizer/tests/
run: yarn install

- name: FINALIZER tests - run tests
working-directory: avs-finalizer/tests/
run: yarn test
export AVS_AGGREGATOR_VERSION=8dd0c81aa88b967334d001d8cae031f8799a189f
export AVS_FINALIZER_VERSION=8dd0c81aa88b967334d001d8cae031f8799a189f
docker compose down -v

- name: Get avs-aggregator logs
if: success() || failure()
run: docker logs rollup-avs-aggregator-1

- name: Get avs-finalizer logs
if: success() || failure()
run: docker logs rollup-avs-finalizer-1

- name: Get anvil logs
if: success() || failure()
run: docker logs rollup-anvil-1

- run: docker ps


6 changes: 0 additions & 6 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,3 @@ out
!broadcast
**/broadcast/*
**/broadcast/*/31337/

/ops/blockscout-docker-compose/services/blockscout-db-data
/ops/blockscout-docker-compose/services/stats-db-data
/ops/blockscout-docker-compose/services/redis-data
/ops/blockscout-docker-compose/services/logs
/ops/blockscout-docker-compose/tmp
17 changes: 5 additions & 12 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,11 @@ CONTRACTS_REGEX="FinalizerServiceManager|FinalizerTaskManager|AVSDirectory|BLSAp

SKIP_WASM_BUILD=1

ETH_RPC_URL=http://localhost:8545
ETH_WS_URL=ws://localhost:8545
ETH_RPC_URL=http://0.0.0.0:8545
ETH_WS_URL=ws://0.0.0.0:8545
SUBSTRATE_RPC_URL=wss://kusama-archive.mangata.online:443
AVS_RPC_URL=http://localhost:8090
AVS_SERVER_IP_PORT_ADDRESS=localhost:8090
AVS_RPC_URL=http://0.0.0.0:8090
AVS_SERVER_IP_PORT_ADDRESS=0.0.0.0:8090

CHAIN_ID=31337
AVS_REGISTRY_COORDINATOR_ADDR=0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
Expand Down Expand Up @@ -77,14 +77,6 @@ start-avs-finalizer: ##
--bls-ephemeral-key \
--stake 100

start-blockscout: ## starts blockscout
cd ops/blockscout-docker-compose && docker-compose up -d

stop-blockscout: ## stops blockscout
cd ops/blockscout-docker-compose && docker-compose down -v

restart-blockscout: ## restarts blockscout (useful when you want to reset the database)
cd ops/blockscout-docker-compose && docker-compose down -v && docker-compose up -d
-----------------------------: ##
_____HELPER_____: ##
mocks: ## generates mocks for tests
Expand All @@ -97,3 +89,4 @@ tests-unit: ## runs all unit tests

tests-contract: ## runs all forge tests
cd contracts && forge test

16 changes: 16 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,12 @@ cd avs-finalizer
cargo +stable build --release
```

- setup mangata-node using `parachain-launch` (to be removed with solochain)
```
cd ./ops/parachain-launch-mangata-node/
npx @open-web3/parachain-launch generate config.yml
```

### Run
In the root folder run:

Expand All @@ -78,6 +84,16 @@ For every service other than:

just modify source code, tear down current docker-compose setup and run it again

#### Mangata Node
For using custom `mangata-node` :
- generate docker image either locally or pick one build by github
- modify `./ops/parachain-launch-mangata-node/config.yml` accordingly
- generate docker-compose config using `parachain-launch`
```
cd ./ops/parachain-launch-mangata-node/
npx @open-web3/parachain-launch generate config.yml
```

#### avs-finalizer
Steps:
- Modify `avs-finalizer` sources
Expand Down
6 changes: 2 additions & 4 deletions avs-aggregator/compose.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,11 @@ services:
- SUBSTRATE_RPC_URL=${SUBSTRATE_RPC_URL:-ws://collator-01:9944}
- CHAIN_ID=31337
- AVS_SERVER_IP_PORT_ADDRESS=0.0.0.0:8090
- AVS_BLOCK_VALIDATION_PERIOD=${AVS_BLOCK_VALIDATION_PERIOD:-5}
- AVS_BLOCK_VALIDATION_PERIOD=5
- AVS_REGISTRY_COORDINATOR_ADDR=0xa82fF9aFd8f496c3d6ac40E2a0F282E47488CFc9
- ECDSA_KEY_JSON={"address":"a0ee7a142d267c1f36714e4a8f75612f20a79720","crypto":{"cipher":"aes-128-ctr","ciphertext":"b0f6f8e3ba33f0b382b080de6661d827181de480f1a4f94bc20d66cb3d585907","cipherparams":{"iv":"4e3f9a8ca6ef8d1cd408e8aaae3c22d2"},"kdf":"scrypt","kdfparams":{"dklen":32,"n":262144,"p":1,"r":8,"salt":"c8f9f8cc03913e09cee7e1fd68732fac327576203ab277d740270f1dea82ee7e"},"mac":"353d65850b20d5fdb90ca2385c52e5b57662cb1d906fd58143f20a7720723cf6"},"id":"d3036cc7-d068-4f2f-9667-60aaca660e61","version":3}
- TESTNET=true
- ECDSA_EPHEMERAL_KEY=true
- BLS_EPHEMERAL_KEY=true
- AVS_KICK_PERIOD=5
ports:
- "8090:8090"

- "8090:8090"
Loading
Loading