Add testing for all CHAIN_TYPEs

pull/8742/head
Maxim Filonov 12 months ago
parent 48bc9a16bd
commit f22c4b50d5
  1. 71
      .github/workflows/config.yml
  2. 2
      apps/explorer/lib/explorer/chain/block.ex
  3. 2
      apps/explorer/priv/rsk/migrations/20230724094744_add_rootstock_fields_to_blocks.exs
  4. 8
      apps/indexer/lib/indexer/fetcher/rootstock_data.ex

@ -27,11 +27,23 @@ on:
env:
MIX_ENV: test
OTP_VERSION: '25.2.1'
ELIXIR_VERSION: '1.14.5'
ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com'
OTP_VERSION: "25.2.1"
ELIXIR_VERSION: "1.14.5"
ACCOUNT_AUTH0_DOMAIN: "blockscoutcom.us.auth0.com"
jobs:
matrix-builder:
name: Build matrix
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
echo "matrix=$matrixStringifiedObject" >> $GITHUB_OUTPUT
env:
matrixStringifiedObject: '{"chain-type": ["ethereum", "polygon_edge", "polygon_zkevm", "rsk", "suave", "stability"]}'
build-and-cache:
name: Build and Cache deps
runs-on: ubuntu-latest
@ -142,10 +154,16 @@ jobs:
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: mix format --check-formatted
dialyzer:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
name: Dialyzer static analysis
runs-on: ubuntu-latest
needs: build-and-cache
needs:
- build-and-cache
- matrix-builder
steps:
- uses: actions/checkout@v4
- uses: erlef/setup-beam@v1
@ -169,18 +187,22 @@ jobs:
id: dialyzer-cache
with:
path: priv/plts
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-mixlockhash_25-${{ hashFiles('mix.lock') }}
key: ${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-${{ matrix.chain-type }}-dialyzer-mixlockhash_25-${{ hashFiles('mix.lock') }}
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-dialyzer-"
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-${{ matrix.chain-type }}-dialyzer-"
- name: Conditionally build Dialyzer Cache
if: steps.dialyzer-cache.output.cache-hit != 'true'
run: |
mkdir -p priv/plts
mix dialyzer --plt
env:
CHAIN_TYPE: ${{ matrix.chain-type }}
- name: Run Dialyzer
run: mix dialyzer --halt-exit-status
env:
CHAIN_TYPE: ${{ matrix.chain-type }}
gettext:
name: Missing translation keys check
@ -370,9 +392,14 @@ jobs:
working-directory: apps/block_scout_web/assets
test_nethermind_mox_ethereum_jsonrpc:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
name: EthereumJSONRPC Tests
runs-on: ubuntu-latest
needs: build-and-cache
needs:
- build-and-cache
- matrix-builder
services:
postgres:
image: postgres
@ -423,10 +450,16 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: "${{ matrix.chain-type }}"
test_nethermind_mox_explorer:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
name: Explorer Tests
runs-on: ubuntu-latest
needs: build-and-cache
needs:
- build-and-cache
- matrix-builder
services:
postgres:
image: postgres
@ -488,10 +521,16 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: "${{ matrix.chain-type }}"
test_nethermind_mox_indexer:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
name: Indexer Tests
runs-on: ubuntu-latest
needs: build-and-cache
needs:
- build-and-cache
- matrix-builder
services:
postgres:
image: postgres
@ -529,7 +568,6 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- run: ./bin/install_chrome_headless.sh
- name: mix test --exclude no_nethermind
@ -546,14 +584,19 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Nethermind.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
CHAIN_TYPE: "${{ matrix.chain-type }}"
test_nethermind_mox_block_scout_web:
strategy:
fail-fast: false
matrix: ${{ fromJson(needs.matrix-builder.outputs.matrix) }}
name: Blockscout Web Tests
runs-on: ubuntu-latest
needs: build-and-cache
needs:
- build-and-cache
- matrix-builder
services:
redis_db:
image: 'redis:alpine'
image: "redis:alpine"
ports:
- 6379:6379
@ -593,7 +636,6 @@ jobs:
restore-keys: |
${{ runner.os }}-${{ env.ELIXIR_VERSION }}-${{ env.OTP_VERSION }}-${{ env.MIX_ENV }}-deps-"
- name: Restore Explorer NPM Cache
uses: actions/cache@v2
id: explorer-npm-cache
@ -638,3 +680,4 @@ jobs:
ACCOUNT_ENABLED: "true"
ACCOUNT_REDIS_URL: "redis://localhost:6379"
SOURCIFY_INTEGRATION_ENABLED: "true"
CHAIN_TYPE: "${{ matrix.chain-type }}"

@ -11,7 +11,7 @@ defmodule Explorer.Chain.Block do
alias Explorer.Chain.Block.{Reward, SecondDegreeRelation}
@optional_attrs ~w(size refetch_needed total_difficulty difficulty base_fee_per_gas)a
|> (&(case Application.compile_env(:explorer, :chain_type) == "rsk" do
|> (&(case Application.compile_env(:explorer, :chain_type) do
"rsk" ->
&1 ++
~w(minimum_gas_price bitcoin_merged_mining_header bitcoin_merged_mining_coinbase_transaction bitcoin_merged_mining_merkle_proof hash_for_merged_mining)a

@ -1,4 +1,4 @@
defmodule Explorer.Repo.Migrations.AddRootstockFieldsToBlocks do
defmodule Explorer.Repo.RSK.Migrations.AddRootstockFieldsToBlocks do
use Ecto.Migration
def change do

@ -55,11 +55,11 @@ defmodule Indexer.Fetcher.RootstockData do
state = %__MODULE__{
blocks_to_fetch: nil,
interval: Application.get_env(:indexer, __MODULE__)[:interval] || @interval,
interval: opts[:interval] || Application.get_env(:indexer, __MODULE__)[:interval],
json_rpc_named_arguments: json_rpc_named_arguments,
batch_size: Application.get_env(:indexer, __MODULE__)[:batch_size] || @batch_size,
max_concurrency: Application.get_env(:indexer, __MODULE__)[:max_concurrency] || @concurrency,
db_batch_size: Application.get_env(:indexer, __MODULE__)[:db_batch_size] || @db_batch_size
batch_size: opts[:batch_size] || Application.get_env(:indexer, __MODULE__)[:batch_size],
max_concurrency: opts[:max_concurrency] || Application.get_env(:indexer, __MODULE__)[:max_concurrency],
db_batch_size: opts[:db_batch_size] || Application.get_env(:indexer, __MODULE__)[:db_batch_size]
}
Process.send_after(self(), :fetch_rootstock_data, state.interval)

Loading…
Cancel
Save