Skip to content

Commit

Permalink
Merge pull request #891 from celo-org/dhutch/upstream_merge
Browse files Browse the repository at this point in the history
Upstream merge to Dec 2022
  • Loading branch information
rkachowski authored Jun 1, 2023
2 parents 714f420 + e92dc12 commit 38979d3
Show file tree
Hide file tree
Showing 245 changed files with 13,573 additions and 3,997 deletions.
5 changes: 5 additions & 0 deletions .dialyzer-ignore
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,11 @@ lib/block_scout_web/templates/address_contract/index.html.eex:170
lib/block_scout_web/templates/address_contract/index.html.eex:207
lib/explorer/third_party_integrations/sourcify.ex:159
lib/explorer/third_party_integrations/sourcify.ex:162
lib/explorer/smart_contract/solidity/verifier.ex:317
lib/block_scout_web/templates/address_contract/index.html.eex:158
lib/block_scout_web/templates/address_contract/index.html.eex:195
lib/explorer/third_party_integrations/sourcify.ex:120
lib/explorer/third_party_integrations/sourcify.ex:123
lib/block_scout_web/views/transaction_view.ex:137
lib/block_scout_web/views/transaction_view.ex:152
lib/block_scout_web/views/transaction_view.ex:197
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,7 @@ jobs:
ADMIN_PANEL_ENABLED: "true"
ACCOUNT_ENABLED: "true"
ACCOUNT_REDIS_URL: "redis://localhost:6379"
API_V2_ENABLED: "true"
- name: Upload Unit Test Results
if: always()
uses: actions/upload-artifact@v2
Expand Down
86 changes: 86 additions & 0 deletions .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
name: Run E2E tests k8s

on:
# push:
pull_request:
workflow_dispatch:

env:
K8S_LOCAL_PORT: ${{ secrets.K8S_LOCAL_PORT }}
K8S_HOST: ${{ secrets.K8S_HOST }}
BASTION_HOST: ${{ secrets.BASTION_HOST }}
K8S_PORT: ${{ secrets.K8S_PORT }}
USERNAME: ${{ secrets.USERNAME }}
BASTION_SSH_KEY: ${{secrets.BASTION_SSH_KEY}}

jobs:
push_to_registry:
name: Push Docker image to Docker Hub
runs-on: ubuntu-latest
outputs:
release-version: ${{ steps.output-step.outputs.release-version }}
short-sha: ${{ steps.output-step.outputs.short-sha }}
steps:
- name: Check out the repo
uses: actions/checkout@v3

- name: Set up QEMU
uses: docker/setup-qemu-action@v2

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v2

- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v4
with:
images: blockscout/blockscout

- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV

- name: Add outputs
run: |
echo "::set-output name=short-sha::${{ env.SHORT_SHA }}"
id: output-step

- name: Build and push Docker image
uses: docker/build-push-action@v3
with:
context: .
file: ./docker/Dockerfile
push: true
cache-from: type=registry,ref=blockscout/blockscout:pr-buildcache
cache-to: type=registry,ref=blockscout/blockscout:pr-buildcache,mode=max
tags: blockscout/blockscout:pr-${{ env.SHORT_SHA }}
build-args: |
CACHE_EXCHANGE_RATES_PERIOD=
DISABLE_READ_API=false
API_PATH=
NETWORK_PATH=
DISABLE_WEBAPP=false
DISABLE_WRITE_API=false
CACHE_ENABLE_TOTAL_GAS_USAGE_COUNTER=
WOBSERVER_ENABLED=false
ADMIN_PANEL_ENABLED=false
CACHE_ADDRESS_WITH_BALANCES_UPDATE_INTERVAL=
DISABLE_BRIDGE_MARKET_CAP_UPDATER=false
CACHE_BRIDGE_MARKET_CAP_UPDATE_INTERVAL=
SOCKET_ROOT=
deploy_and_tests:
needs: push_to_registry
uses: blockscout/blockscout-ci-cd/.github/workflows/e2e_new.yaml@master
with:
blockscoutImage: blockscout/blockscout:pr-${{ needs.push_to_registry.outputs.short-sha }}
blockscoutIngressHost: e2e-blockscout-$GITHUB_SHA_SHORT
frontendIngressHost: e2e-blockscout-$GITHUB_SHA_SHORT
gethIngressHost: e2e-geth-$GITHUB_SHA_SHORT
scVerifierIngressHost: e2e-sc-verifier-$GITHUB_SHA_SHORT
secrets: inherit
2 changes: 1 addition & 1 deletion .tool-versions
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
elixir 1.14.1
elixir 1.14.2-otp-25
erlang 25.1.1
nodejs 16.16.0
24 changes: 22 additions & 2 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

### Features

- [#5561](https://github.com/blockscout/blockscout/pull/5561), [#6523](https://github.com/blockscout/blockscout/pull/6523) - Improve working with contracts implementations
- [#6401](https://github.com/blockscout/blockscout/pull/6401) - Add Sol2Uml contract visualization
- [#6481](https://github.com/blockscout/blockscout/pull/6481) - Smart contract verification improvements
- [#6444](https://github.com/blockscout/blockscout/pull/6444) - Add support for yul verification via rust microservice
- [#6440](https://github.com/blockscout/blockscout/pull/6440) - Add support for base64 encoded NFT metadata
- [#6407](https://github.com/blockscout/blockscout/pull/6407) - Indexed ratio for int txs fetching stage
- [#6324](https://github.com/blockscout/blockscout/pull/6324) - Add verified contracts list page
- [#6379](https://github.com/blockscout/blockscout/pull/6379), [#6429](https://github.com/blockscout/blockscout/pull/6429) - API v2 for frontend
- [#6351](https://github.com/blockscout/blockscout/pull/6351) - Enable forum link env var
- [#6316](https://github.com/blockscout/blockscout/pull/6316) - Copy public tags functionality to master
- [#6196](https://github.com/blockscout/blockscout/pull/6196) - INDEXER_CATCHUP_BLOCKS_BATCH_SIZE and INDEXER_CATCHUP_BLOCKS_CONCURRENCY env varaibles
Expand All @@ -12,9 +20,19 @@
- [#6168](https://github.com/blockscout/blockscout/pull/6168) - Token instance fetcher checks instance owner and updates current token balance
- [#6209](https://github.com/blockscout/blockscout/pull/6209) - Add metrics for block import stages, runners, steps
- [#6257](https://github.com/blockscout/blockscout/pull/6257), [#6276](https://github.com/blockscout/blockscout/pull/6276) - DISABLE_TOKEN_INSTANCE_FETCHER env variable
- [#6391](https://github.com/blockscout/blockscout/pull/6391), [#6427](https://github.com/blockscout/blockscout/pull/6427) - TokenTransfer token_id -> token_ids migration
- [#6443](https://github.com/blockscout/blockscout/pull/6443) - Drop internal transactions order index
- [#6450](https://github.com/blockscout/blockscout/pull/6450) - INDEXER_INTERNAL_TRANSACTIONS_BATCH_SIZE and INDEXER_INTERNAL_TRANSACTIONS_CONCURRENCY env variables
- [#6454](https://github.com/blockscout/blockscout/pull/6454) - INDEXER_RECEIPTS_BATCH_SIZE, INDEXER_RECEIPTS_CONCURRENCY, INDEXER_COIN_BALANCES_BATCH_SIZE, INDEXER_COIN_BALANCES_CONCURRENCY env variables
- [#6476](https://github.com/blockscout/blockscout/pull/6476), [#6484](https://github.com/blockscout/blockscout/pull/6484) - Update token balances indexes

### Fixes

- [#6532](https://github.com/blockscout/blockscout/pull/6532) - Fix index creation migration
- [#6473](https://github.com/blockscout/blockscout/pull/6473) - Fix state changes for contract creation transactions
- [#6475](https://github.com/blockscout/blockscout/pull/6475) - Fix token name with unicode graphemes shortening
- [#6420](https://github.com/blockscout/blockscout/pull/6420) - Fix address logs search
- [#6390](https://github.com/blockscout/blockscout/pull/6390), [#6502](https://github.com/blockscout/blockscout/pull/6502), [#6511](https://github.com/blockscout/blockscout/pull/6511) - Fix transactions responses in API v2
- [#6357](https://github.com/blockscout/blockscout/pull/6357), [#6409](https://github.com/blockscout/blockscout/pull/6409), [#6428](https://github.com/blockscout/blockscout/pull/6428) - Fix definitions of NETWORK_PATH, API_PATH, SOCKET_ROOT: process trailing slash
- [#6338](https://github.com/blockscout/blockscout/pull/6338) - Fix token search with space
- [#6329](https://github.com/blockscout/blockscout/pull/6329) - Prevent logger from truncating response from rust verifier service in case of an error
Expand All @@ -33,9 +51,12 @@
- [#6223](https://github.com/blockscout/blockscout/pull/6223) - Fix coin_id test
- [#6336](https://github.com/blockscout/blockscout/pull/6336) - Fix sending request on each key in token search
- [#6327](https://github.com/blockscout/blockscout/pull/6327) - Fix and refactor address logs page and search
- [#6449](https://github.com/blockscout/blockscout/pull/6449) - Search min_missing_block_number from zero
- [#6492](https://github.com/blockscout/blockscout/pull/6492) - Remove token instance owner fetching

### Chore

- [#6387](https://github.com/blockscout/blockscout/pull/6387) - Fix errors in docker-build and e2e-tests workflows
- [#6325](https://github.com/blockscout/blockscout/pull/6325) - Set http_only attribute of account authorization cookie to false
- [#6343](https://github.com/blockscout/blockscout/pull/6343) - Docker-compose persistent logs
- [#6240](https://github.com/blockscout/blockscout/pull/6240) - Elixir 1.14 support
Expand Down Expand Up @@ -129,6 +150,7 @@
- [#5968](https://github.com/blockscout/blockscout/pull/5968) - Add call type in the response of txlistinternal API method
- [#5860](https://github.com/blockscout/blockscout/pull/5860) - Integrate rust verifier micro-service ([blockscout-rs/verifier](https://github.com/blockscout/blockscout-rs/tree/main/verification))
- [#6001](https://github.com/blockscout/blockscout/pull/6001) - Add ETHEREUM_JSONRPC_DISABLE_ARCHIVE_BALANCES env var that filters requests and query node only if the block quantity is "latest"
- [#5944](https://github.com/blockscout/blockscout/pull/5944) - Add tab with state changes to transaction page

### Fixes

Expand Down Expand Up @@ -447,7 +469,6 @@
- [#5105](https://github.com/blockscout/blockscout/pull/5105) - Redesign token page
- [#5016](https://github.com/blockscout/blockscout/pull/5016) - Add view for internal transactions error
- [#4690](https://github.com/blockscout/blockscout/pull/4690) - Improve pagination: introduce pagination with random access to pages; Integrate it to the Transactions List page
- [#6168](https://github.com/blockscout/blockscout/pull/6168) - Token instance fetcher checks instance owner and updates current token balance

### Fixes

Expand All @@ -467,7 +488,6 @@
- [#5155](https://github.com/blockscout/blockscout/pull/5155) - Fix get_implementation_abi_from_proxy/2 implementation
- [#5154](https://github.com/blockscout/blockscout/pull/5154) - Fix token counters bug
- [#4862](https://github.com/blockscout/blockscout/pull/4862) - Fix internal transactions pagination
- [#6090](https://github.com/blockscout/blockscout/pull/6090) - Fix metadata fetching for ERC-1155 tokens instances

### Chore

Expand Down
6 changes: 6 additions & 0 deletions apps/block_scout_web/assets/css/components/_navbar.scss
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ $header-textfield-magnifier-color: $header-links-color !default;
$header-link-horizontal-padding: 0.71rem;
$navbar-logo-height: auto !default;
$navbar-logo-width: 100% !default;
$dropdown-menu-item-color: #000 !default;

.navbar.navbar-primary {
background-color: $header-background-color;
Expand All @@ -23,6 +24,11 @@ $navbar-logo-width: 100% !default;
}

.navbar-nav {

.nav-submenu {
padding: 10px 20px;
color: $dropdown-menu-item-color;
}

.nav-link {
outline: none;
Expand Down
3 changes: 3 additions & 0 deletions apps/block_scout_web/assets/css/theme/_dark-theme.scss
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,9 @@ $dark-stakes-banned-background: #3e314c;
background-color: $dark-light-bg;
}
}
.nav-submenu {
color: $labels-dark;
}
}
.navbar-brand .navbar-logo {
filter: brightness(0) invert(1);
Expand Down
43 changes: 34 additions & 9 deletions apps/block_scout_web/assets/js/lib/indexing.js
Original file line number Diff line number Diff line change
Expand Up @@ -3,23 +3,48 @@ import humps from 'humps'
import numeral from 'numeral'
import socket from '../socket'

function tryUpdateIndexedStatus (el, indexedRatio = el.dataset.indexedRatio, indexingFinished = false) {
function tryUpdateIndexedStatus (el, indexedRatioBlocks = el.dataset.indexedRatioBlocks, indexedRatio = el.dataset.indexedRatio, indexingFinished = false) {
if (indexingFinished) return $("[data-selector='indexed-status']").remove()
const blocksPercentComplete = numeral(indexedRatio).format('0%')
const indexedRatioFloat = parseFloat(indexedRatio)
const indexedRatioBlocksFloat = parseFloat(indexedRatioBlocks)

if (!isNaN(indexedRatioBlocksFloat)) {
el.dataset.indexedRatioBlocks = indexedRatioBlocks
} else if (!isNaN(indexedRatioFloat)) {
el.dataset.indexedRatio = indexedRatio
}

const blocksPercentComplete = numeral(el.dataset.indexedRatioBlocks).format('0%')
let indexedText
if (blocksPercentComplete === '100%') {
indexedText = window.localized['Indexing Internal Transactions']
const intTxsPercentComplete = numeral(el.dataset.indexedRatio).format('0%')
indexedText = `${intTxsPercentComplete} ${window.localized['Blocks With Internal Transactions Indexed']}`
} else {
indexedText = `${blocksPercentComplete} ${window.localized['Blocks Indexed']}`
}
if (indexedText !== el.innerHTML) el.innerHTML = indexedText

if (indexedText !== el.innerHTML) {
el.innerHTML = indexedText
}
}

export function updateIndexStatus (msg = {}) {
$('[data-indexed-ratio]').each((i, el) => tryUpdateIndexedStatus(el, msg.ratio, msg.finished))
export function updateIndexStatus (msg = {}, type) {
$('[data-indexed-ratio]').each((i, el) => {
if (type === 'blocks') {
tryUpdateIndexedStatus(el, msg.ratio, null, msg.finished)
} else if (type === 'internal_transactions') {
tryUpdateIndexedStatus(el, null, msg.ratio, msg.finished)
} else {
tryUpdateIndexedStatus(el, null, null, msg.finished)
}
})
}
updateIndexStatus()

const indexingChannel = socket.channel('blocks:indexing')
indexingChannel.join()
indexingChannel.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg)))
const IndexingChannelBlocks = socket.channel('blocks:indexing')
IndexingChannelBlocks.join()
IndexingChannelBlocks.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg), 'blocks'))

const indexingChannelInternalTransactions = socket.channel('blocks:indexing_internal_transactions')
indexingChannelInternalTransactions.join()
indexingChannelInternalTransactions.on('index_status', (msg) => updateIndexStatus(humps.camelizeKeys(msg), 'internal_transactions'))
82 changes: 82 additions & 0 deletions apps/block_scout_web/assets/js/pages/sol2uml.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
import 'viewerjs/dist/viewer.min.css'
import Viewer from 'viewerjs'
import $ from 'jquery'
import { createStore, connectElements } from '../lib/redux_helpers.js'

export const initialState = {
contract_svg: null,
visualize_error: null
}

export function reducer (state = initialState, action) {
switch (action.type) {
case 'SVG_FETCHED': {
return Object.assign({}, state, {
contract_svg: action.contract_svg,
visualize_error: action.error
})
}
default:
return state
}
}

const elements = {
'[data-selector="contract-image"]': {
render ($el, state, oldState) {
if (state.contract_svg) {
$('#spinner').hide()
$('#gallery img').attr('src', 'data:image/svg+xml;base64,' + state.contract_svg)
const gallery = document.getElementById('gallery')
const viewer = new Viewer(gallery, {
inline: false,
toolbar: {
zoomIn: 2,
zoomOut: 4,
oneToOne: 4,
reset: 4,
play: {
show: 4,
size: 'large'
},
rotateLeft: 4,
rotateRight: 4,
flipHorizontal: 4,
flipVertical: 4
}
})
viewer.update()
$el.show()
} else if (state.visualize_error) {
$('#spinner').hide()
$el.empty().text('Cannot visualize contract: ' + state.visualize_error)
$el.show()
} else {
$('#spinner').show()
$el.hide()
}
}
}
}

function loadSvg (store) {
const $element = $('[data-async-contract-svg]')
const path = $element.data().asyncContractSvg

function fetchSvg () {
$.getJSON(path)
.done((response) => {
store.dispatch(Object.assign({ type: 'SVG_FETCHED' }, response))
})
}

fetchSvg()
}

function main () {
const store = createStore(reducer)
connectElements({ store, elements })
loadSvg(store)
}

main()
3 changes: 2 additions & 1 deletion apps/block_scout_web/assets/js/pages/transaction.js
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,8 @@ if ($transactionDetailsPage.length) {
pathParts.includes('token-transfers') ||
pathParts.includes('logs') ||
pathParts.includes('token-transfers') ||
pathParts.includes('raw-trace')
pathParts.includes('raw-trace') ||
pathParts.includes('state')
if (shouldScroll) {
document.getElementById('transaction-tabs').scrollIntoView()
}
Expand Down
Loading

0 comments on commit 38979d3

Please sign in to comment.