Skip to content

Commit

Permalink
Merge branch 'master' into carterqw2/block-tracing
Browse files Browse the repository at this point in the history
  • Loading branch information
rkachowski authored Feb 15, 2024
2 parents 8d1fcf1 + f0f9931 commit cad15d3
Show file tree
Hide file tree
Showing 20 changed files with 205 additions and 132 deletions.
5 changes: 4 additions & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,7 @@ logs
/.fetch
erl_crash.dump
*.ez
*.beam
*.beam

# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json
129 changes: 81 additions & 48 deletions .github/workflows/blockscout.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,12 @@ env:
ACCOUNT_AUTH0_DOMAIN: 'blockscoutcom.us.auth0.com'
ACCOUNT_AUTH0_LOGOUT_URL: 'https://blockscoutcom.us.auth0.com/v2/logout'
ACCOUNT_AUTH0_LOGOUT_RETURN_URL: 'https://blockscout.com/auth/logout'
CACHE_VERSION: 20
CACHE_VERSION: 22

jobs:
build-and-cache:
name: Build and Cache deps
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: [ '8-cpu', 'self-hosted', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -94,7 +94,7 @@ jobs:

credo:
name: Credo
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand All @@ -121,7 +121,7 @@ jobs:

check_formatted:
name: Code formatting checks
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand All @@ -147,7 +147,7 @@ jobs:
- run: mix format --check-formatted
dialyzer:
name: Dialyzer static analysis
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -190,7 +190,7 @@ jobs:

gettext:
name: Missing translation keys check
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -219,7 +219,7 @@ jobs:
working-directory: "apps/block_scout_web"
sobelow:
name: Sobelow security analysis
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -250,7 +250,7 @@ jobs:
working-directory: "apps/block_scout_web"
eslint:
name: ESLint
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -307,7 +307,7 @@ jobs:

jest:
name: JS Tests
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -355,7 +355,7 @@ jobs:

test_nethermind_mox_ethereum_jsonrpc:
name: EthereumJSONRPC Tests
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -423,7 +423,7 @@ jobs:
path: _build/test/junit/ethereum_jsonrpc/*.xml
test_nethermind_mox_explorer:
name: Explorer Tests
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -512,7 +512,7 @@ jobs:
path: _build/test/junit/explorer/*.xml
test_nethermind_mox_indexer:
name: Indexer Tests
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -585,7 +585,7 @@ jobs:

test_nethermind_mox_block_scout_web:
name: Blockscout Web Tests
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
Expand Down Expand Up @@ -699,10 +699,9 @@ jobs:
name: Wallaby screenshots
path: apps/block_scout_web/screenshots/*.png


publish-test-results:
name: "Publish Unit Tests Results"
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
needs:
Expand All @@ -724,7 +723,7 @@ jobs:
files: artifacts/**/*.xml

set-docker-vars:
runs-on: ['self-hosted', 'org', '8-cpu']
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
needs: [credo, check_formatted, dialyzer, gettext, sobelow, eslint, jest, test_nethermind_mox_ethereum_jsonrpc, test_nethermind_mox_explorer, test_nethermind_mox_indexer, test_nethermind_mox_block_scout_web]
Expand All @@ -745,37 +744,71 @@ jobs:
echo "tag=${{ github.ref != 'ref/heads/main' && 'testing' || 'latest' }}" >> $GITHUB_OUTPUT
echo "sha=${{ github.ref != 'ref/heads/main' && github.event.pull_request.head.sha || github.sha }}" >> $GITHUB_OUTPUT
Build-Blockscout:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
build-blockscout-container:
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
needs: [set-docker-vars]
with:
workload-id-provider: ${{ needs.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ needs.set-docker-vars.outputs.service-account }}
artifact-registry: "${{ needs.set-docker-vars.outputs.artifact-registry }}/blockscout"
tag: ${{ needs.set-docker-vars.outputs.tag }}
context: .
file: docker/Dockerfile
build-args: |
"FORCE_MIX_COMPILE_CACHE_MISS=${{ needs.set-docker-vars.outputs.sha }}"
trivy: true
trivy-timeout: 20m


Build-Blockscout-api:
uses: celo-org/reusable-workflows/.github/workflows/[email protected]
permissions:
contents: read
id-token: write
security-events: write
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: celo-org/reusable-workflows/.github/actions/[email protected]
with:
workload-id-provider: ${{ needs.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ needs.set-docker-vars.outputs.service-account }}
access-token-lifetime: "20m"
docker-gcp-registries: "us-west1-docker.pkg.dev"
- name: Build, push and scan the container
uses: celo-org/reusable-workflows/.github/actions/build-container@main
with:
platforms: linux/amd64
registry: "${{ needs.set-docker-vars.outputs.artifact-registry }}/blockscout"
tags: ${{ needs.set-docker-vars.outputs.tag }}
context: .
dockerfile: docker/Dockerfile
build-args: |
"FORCE_MIX_COMPILE_CACHE_MISS=${{ needs.set-docker-vars.outputs.sha }}"
push: true
trivy: true

build-blockscout-api-container:
runs-on: ['self-hosted', '8-cpu', 'blockscout']
container:
image: us-west1-docker.pkg.dev/devopsre/actions-runner-controller/blockscout:latest
options: --user root
needs: [set-docker-vars]
with:
workload-id-provider: ${{ needs.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ needs.set-docker-vars.outputs.service-account }}
artifact-registry: "${{ needs.set-docker-vars.outputs.artifact-registry }}/blockscout-api"
tag: ${{ needs.set-docker-vars.outputs.tag }}
context: .
file: docker/Dockerfile
build-args: |
"FORCE_MIX_COMPILE_CACHE_MISS=${{ needs.set-docker-vars.outputs.sha }}"
"DISABLE_WRITE_API=true",
"DISABLE_INDEXER=true",
"DISABLE_WEBAPP=true",
trivy: true
trivy-timeout: 20m
permissions:
contents: read
id-token: write
security-events: write
steps:
- name: 'Checkout'
uses: actions/checkout@v4
- name: Authenticate to Google Cloud
uses: celo-org/reusable-workflows/.github/actions/[email protected]
with:
workload-id-provider: ${{ needs.set-docker-vars.outputs.workload-id-provider }}
service-account: ${{ needs.set-docker-vars.outputs.service-account }}
access-token-lifetime: "20m"
docker-gcp-registries: "us-west1-docker.pkg.dev"
- name: Build, push and scan the container
uses: celo-org/reusable-workflows/.github/actions/build-container@main
with:
platforms: linux/amd64
registry: "${{ needs.set-docker-vars.outputs.artifact-registry }}/blockscout"
tags: ${{ needs.set-docker-vars.outputs.tag }}
context: .
dockerfile: docker/Dockerfile
build-args: |
"FORCE_MIX_COMPILE_CACHE_MISS=${{ needs.set-docker-vars.outputs.sha }}"
"DISABLE_WRITE_API=true",
"DISABLE_INDEXER=true",
"DISABLE_WEBAPP=true",
push: true
trivy: true
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -64,3 +64,6 @@ node_modules
*.iml

.vscode

# Ignore generated credentials from google-github-actions/auth
gha-creds-*.json
16 changes: 3 additions & 13 deletions apps/block_scout_web/config/navigation.exs
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,6 @@ import Config
config :block_scout_web,
defi: [
%{title: "Moola", url: "https://moola.market/"},
%{title: "Pinnata", url: "https://www.pinnata.xyz/farm#/"},
%{title: "GoodGhosting", url: "https://goodghosting.com/"},
%{title: "Revo", url: "https://revo.market/"},
%{title: "ImmortalDao Finance", url: "https://www.immortaldao.finance"}
],
Expand All @@ -18,15 +16,11 @@ config :block_scout_web,
wallet_list: [
%{title: "Valora", url: "https://valoraapp.com/"},
%{title: "Celo Terminal", url: "https://celoterminal.com/"},
%{title: "Celo Wallet", url: "https://celowallet.app/"},
%{title: "Node Wallet", url: "https://www.nodewallet.xyz/"}
%{title: "Celo Wallet", url: "https://celowallet.app/"}
],
nft_list: [
%{title: "Niftydrop", url: "https://niftydrop.net/"},
%{title: "NFT Viewer", url: "https://nfts.valoraapp.com/"},
%{title: "Cyberbox", url: "https://cyberbox.art/"},
%{title: "Nomspace", url: "https://nom.space/"},
%{title: "Alities", url: "https://alities.io/"}
%{title: "Nomspace", url: "https://nom.space/"}
],
connect_list: [
%{title: "impactMarket", url: "https://impactmarket.com/"},
Expand All @@ -39,21 +33,17 @@ config :block_scout_web,
%{title: "ChiSpend", url: "https://chispend.com/"}
],
finance_tools_list: [
%{title: "Celo Tracker", url: "https://celotracker.com/"},
%{title: "celo.tax", url: "https://celo.tax/"},
%{title: "Trelis", url: "https://trelis.com/"}
%{title: "Celo Tracker", url: "https://celotracker.com/"}
],
resources: [
%{title: "Celo Vote", url: "https://celovote.com/"},
%{title: "Celo Forum", url: "https://forum.celo.org/"},
%{title: "TheCelo", url: "https://thecelo.com/"},
%{title: "Validators", url: "https://celo.org/validators/explore"},
%{title: "Celo Reserve", url: "https://celoreserve.org/"},
%{title: "Celo Docs", url: "https://docs.celo.org/"}
],
learning: [
%{title: "Celo Whitepaper", url: "https://celo.org/papers/whitepaper"},
%{title: "Learn Celo", url: "https://learn.figment.io/protocols/celo"},
%{title: "Coinbase Earn", url: "https://www.coinbase.com/price/celo"}
],
other_networks: [
Expand Down
15 changes: 12 additions & 3 deletions apps/block_scout_web/lib/block_scout_web/views/transaction_view.ex
Original file line number Diff line number Diff line change
@@ -1,13 +1,16 @@
defmodule BlockScoutWeb.TransactionView do
use BlockScoutWeb, :view

require Logger

alias BlockScoutWeb.{AccessHelpers, AddressView, BlockView, TabHelpers}
alias BlockScoutWeb.Account.AuthController
alias BlockScoutWeb.Cldr.Number
alias Explorer.Celo.Util
alias Explorer.{Chain, CustomContractsHelpers, Repo}
alias Explorer.Chain.Block.Reward
alias Explorer.Chain.{Address, Block, InternalTransaction, Transaction, Wei}
alias Explorer.Chain.Token, as: ChainToken
alias Explorer.Counters.AverageBlockTime
alias Explorer.ExchangeRates.Token
alias Timex.Duration
Expand Down Expand Up @@ -498,12 +501,18 @@ defmodule BlockScoutWeb.TransactionView do
format_wei_value(Wei.from(fee, :wei), denomination, include_unit_label: include_label?, currency: currency)}
end

def get_fee_token_name(transaction) do
def get_fee_token_name(%{gas_currency_hash: gch} = transaction) do
token = Transaction.get_fee_token_name(transaction)

case token do
{:ok, address} -> address
{:error, :not_found} -> %{name: "", symbol: "#{gettext("CELO")}"}
{:ok, address} ->
address

{:error, :not_found} ->
Logger.info("Found unknown gas token at #{inspect(gch)}")
ChainToken.set_uncatalogued_token(transaction)

%{name: "", symbol: "#{gettext("CELO")}"}
end
end

Expand Down
Loading

0 comments on commit cad15d3

Please sign in to comment.