Merge pull request #3214 from poanetwork/vb-current-token-balances-fetcher

Fix current token balances fetcher
pull/3215/head
Victor Baranov 4 years ago committed by GitHub
commit e4ab89bd4b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
  1. 284
      .github/workflows/config.yml
  2. 1
      CHANGELOG.md
  3. 8
      README.md
  4. 6
      apps/explorer/lib/explorer/chain/import/runner/address/current_token_balances.ex

@ -1145,145 +1145,145 @@ jobs:
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
coveralls:
runs-on: ubuntu-latest
services:
postgres:
image: postgres
env:
# Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
POSTGRES_DB: explorer_test
# match PGPASSWORD for elixir image above
POSTGRES_PASSWORD: postgres
# match PGUSER for elixir image above
POSTGRES_USER: postgres
# Set health checks to wait until postgres has started
options: >-
--health-cmd pg_isready
--health-interval 10s
--health-timeout 5s
--health-retries 5
ports:
# Maps tcp port 5432 on service container to the host
- 5432:5432
steps:
- uses: actions/checkout@v2
- uses: actions/setup-elixir@v1
with:
otp-version: '22.2'
elixir-version: '1.10.3'
- run: mix local.hex --force
- run: mix local.rebar --force
- name: Cache mix.exs
uses: actions/cache@v2
with:
path: ~/
key: |
v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
restore-keys: v8-mix-compile-
- run: mix deps.get
- name: Cache node modules
uses: actions/cache@v2
with:
path: ~/.npm
key: |
v7-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }}
'v7-npm-install-{{ .Branch }}'
v7-npm-install
restore-keys: v7-npm-install-
- run: npm install
working-directory: apps/explorer
- name: Cache dependencies
uses: actions/cache@v2
with:
path: apps/explorer/node_modules
key: >-
v3-npm-install-{{ .Branch }}-{{ checksum
"apps/explorer/package-lock.json" }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: apps/explorer/node_modules
key: 'v3-npm-install-{{ .Branch }}'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: apps/explorer/node_modules
key: v3-npm-install
- run: npm install
working-directory: apps/block_scout_web/assets
- run: npm rebuild node-sass
working-directory: apps/block_scout_web/assets
- name: Cache dependencies
uses: actions/cache@v2
with:
path: apps/block_scout_web/assets/node_modules
key: >-
v7-npm-install-{{ .Branch }}-{{ checksum
"apps/block_scout_web/assets/package-lock.json" }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: apps/block_scout_web/assets/node_modules
key: 'v7-npm-install-{{ .Branch }}'
- name: Cache dependencies
uses: actions/cache@v2
with:
path: apps/block_scout_web/assets/node_modules
key: v7-npm-install
- run: mix compile
- run: make
working-directory: "deps/libsecp256k1"
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
deps
_build
key: >-
v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum
"ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
deps
_build
key: >-
v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum
"ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
- name: Cache dependencies
uses: actions/cache@v2
with:
path: |
deps
_build
key: >-
v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum
"ELIXIR_VERSION.lock" }}
- name: Build assets
run: node node_modules/webpack/bin/webpack.js --mode development
working-directory: "apps/block_scout_web/assets"
- run: ./bin/install_chrome_headless.sh
- name: prepare DB
run: |
mix ecto.create --quiet
mix ecto.migrate
env:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
- name: coveralls
run: mix coveralls.html --exclude no_parity --parallel --umbrella
env:
MIX_ENV: test
# match POSTGRES_PASSWORD for postgres image below
PGPASSWORD: postgres
# match POSTGRES_USER for postgres image below
PGUSER: postgres
ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"
# coveralls:
# runs-on: ubuntu-latest
# services:
# postgres:
# image: postgres
# env:
# # Match apps/explorer/config/test.exs config :explorer, Explorer.Repo, database
# POSTGRES_DB: explorer_test
# # match PGPASSWORD for elixir image above
# POSTGRES_PASSWORD: postgres
# # match PGUSER for elixir image above
# POSTGRES_USER: postgres
# # Set health checks to wait until postgres has started
# options: >-
# --health-cmd pg_isready
# --health-interval 10s
# --health-timeout 5s
# --health-retries 5
# ports:
# # Maps tcp port 5432 on service container to the host
# - 5432:5432
# steps:
# - uses: actions/checkout@v2
# - uses: actions/setup-elixir@v1
# with:
# otp-version: '22.2'
# elixir-version: '1.10.3'
# - run: mix local.hex --force
# - run: mix local.rebar --force
# - name: Cache mix.exs
# uses: actions/cache@v2
# with:
# path: ~/
# key: |
# v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
# v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
# v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum "ELIXIR_VERSION.lock" }}
# restore-keys: v8-mix-compile-
# - run: mix deps.get
# - name: Cache node modules
# uses: actions/cache@v2
# with:
# path: ~/.npm
# key: |
# v7-npm-install-{{ .Branch }}-{{ checksum "apps/block_scout_web/assets/package-lock.json" }}
# 'v7-npm-install-{{ .Branch }}'
# v7-npm-install
# restore-keys: v7-npm-install-
# - run: npm install
# working-directory: apps/explorer
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: apps/explorer/node_modules
# key: >-
# v3-npm-install-{{ .Branch }}-{{ checksum
# "apps/explorer/package-lock.json" }}
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: apps/explorer/node_modules
# key: 'v3-npm-install-{{ .Branch }}'
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: apps/explorer/node_modules
# key: v3-npm-install
# - run: npm install
# working-directory: apps/block_scout_web/assets
# - run: npm rebuild node-sass
# working-directory: apps/block_scout_web/assets
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: apps/block_scout_web/assets/node_modules
# key: >-
# v7-npm-install-{{ .Branch }}-{{ checksum
# "apps/block_scout_web/assets/package-lock.json" }}
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: apps/block_scout_web/assets/node_modules
# key: 'v7-npm-install-{{ .Branch }}'
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: apps/block_scout_web/assets/node_modules
# key: v7-npm-install
# - run: mix compile
# - run: make
# working-directory: "deps/libsecp256k1"
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: |
# deps
# _build
# key: >-
# v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum
# "ELIXIR_VERSION.lock" }}-{{ checksum "mix.lock" }}
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: |
# deps
# _build
# key: >-
# v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum
# "ELIXIR_VERSION.lock" }}-{{ checksum "mix.exs" }}
# - name: Cache dependencies
# uses: actions/cache@v2
# with:
# path: |
# deps
# _build
# key: >-
# v8-mix-compile-{{ checksum "OTP_VERSION.lock" }}-{{ checksum
# "ELIXIR_VERSION.lock" }}
# - name: Build assets
# run: node node_modules/webpack/bin/webpack.js --mode development
# working-directory: "apps/block_scout_web/assets"
# - run: ./bin/install_chrome_headless.sh
# - name: prepare DB
# run: |
# mix ecto.create --quiet
# mix ecto.migrate
# env:
# MIX_ENV: test
# # match POSTGRES_PASSWORD for postgres image below
# PGPASSWORD: postgres
# # match POSTGRES_USER for postgres image below
# PGUSER: postgres
# - name: coveralls
# run: mix coveralls.html --exclude no_parity --parallel --umbrella
# env:
# MIX_ENV: test
# # match POSTGRES_PASSWORD for postgres image below
# PGPASSWORD: postgres
# # match POSTGRES_USER for postgres image below
# PGUSER: postgres
# ETHEREUM_JSONRPC_CASE: "EthereumJSONRPC.Case.Parity.Mox"
# ETHEREUM_JSONRPC_WEB_SOCKET_CASE: "EthereumJSONRPC.WebSocket.Case.Mox"

@ -7,6 +7,7 @@
- [#3145](https://github.com/poanetwork/blockscout/pull/3145) - Pending txs per address API endpoint
### Fixes
- [#3214](https://github.com/poanetwork/blockscout/pull/3214) - Fix current token balances fetcher
- [#3143](https://github.com/poanetwork/blockscout/pull/3143) - Fix "Connection lost..." error at address page
- [#3209](https://github.com/poanetwork/blockscout/pull/3209) - GraphQL: fix internal server error at request of internal transactions at address
- [#3207](https://github.com/poanetwork/blockscout/pull/3207) - Fix read contract bytes array type output

@ -1,14 +1,8 @@
<p align="center">
<a href="https://blockscout.com">
<img width="200" src="https://blockscout.com/poa/core/android-chrome-192x192.png" \>
</a>
</p>
<h1 align="center">BlockScout</h1>
<p align="center">Blockchain Explorer for inspecting and analyzing EVM Chains.</p>
<div align="center">
![Blockscout](https://github.com/poanetwork/blockscout/workflows/Blockscout/badge.svg?branch=master) [![Coverage Status](https://coveralls.io/repos/github/poanetwork/blockscout/badge.svg?branch=master)](https://coveralls.io/github/poanetwork/blockscout?branch=master) [![Join the chat at https://gitter.im/poanetwork/blockscout](https://badges.gitter.im/poanetwork/blockscout.svg)](https://gitter.im/poanetwork/blockscout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
[![Blockscout](https://github.com/poanetwork/blockscout/workflows/Blockscout/badge.svg?branch=master)](https://github.com/poanetwork/blockscout/actions) [![Coverage Status](https://coveralls.io/repos/github/poanetwork/blockscout/badge.svg?branch=master)](https://coveralls.io/github/poanetwork/blockscout?branch=master) [![Join the chat at https://gitter.im/poanetwork/blockscout](https://badges.gitter.im/poanetwork/blockscout.svg)](https://gitter.im/poanetwork/blockscout?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
</div>

@ -228,7 +228,11 @@ defmodule Explorer.Chain.Import.Runner.Address.CurrentTokenBalances do
updated_at: fragment("GREATEST(EXCLUDED.updated_at, ?)", current_token_balance.updated_at)
]
],
where: fragment("? < EXCLUDED.block_number", current_token_balance.block_number)
where:
fragment("? < EXCLUDED.block_number", current_token_balance.block_number) or
(fragment("EXCLUDED.value IS NOT NULL") and
is_nil(current_token_balance.value_fetched_at) and
fragment("? = EXCLUDED.block_number", current_token_balance.block_number))
)
end

Loading…
Cancel
Save