Skip to content

Commit 0deb760

Browse files
authored
Merge pull request #4 from poanetwork/master
Updating Springrole blockscout with latest release
2 parents 4d304dc + 48fe3a4 commit 0deb760

File tree

222 files changed

+8825
-3025
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

222 files changed

+8825
-3025
lines changed

.circleci/config.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -122,6 +122,7 @@ jobs:
122122
- mix.exs
123123
- mix.lock
124124
- appspec.yml
125+
- rel
125126
check_formatted:
126127
docker:
127128
# Ensure .tool-versions matches
@@ -279,6 +280,32 @@ jobs:
279280
name: Jest
280281
command: ./node_modules/.bin/jest
281282
working_directory: apps/block_scout_web/assets
283+
release:
284+
docker:
285+
# Ensure .tool-versions matches
286+
- image: circleci/elixir:1.7.2
287+
environment:
288+
MIX_ENV: prod
289+
290+
working_directory: ~/app
291+
292+
steps:
293+
- attach_workspace:
294+
at: .
295+
296+
- run: mix local.hex --force
297+
- run: mix local.rebar --force
298+
- run: mix release --verbose --env prod
299+
- run:
300+
name: Collecting artifacts
301+
command: |
302+
find -name 'blockscout.tar.gz' -exec sh -c 'mkdir -p ci_artifact && cp "$@" ci_artifact/ci_artifact_blockscout.tar.gz' _ {} +
303+
when: always
304+
305+
- store_artifacts:
306+
name: Uploading CI artifacts
307+
path: ci_artifact/ci_artifact_blockscout.tar.gz
308+
destination: ci_artifact_blockscout.tar.gz
282309
sobelow:
283310
docker:
284311
# Ensure .tool-versions matches
@@ -561,6 +588,9 @@ workflows:
561588
- jest:
562589
requires:
563590
- build
591+
- release:
592+
requires:
593+
- build
564594
- sobelow:
565595
requires:
566596
- build

.credo.exs

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,9 @@
7575
# Priority values are: `low, normal, high, higher`
7676
#
7777
{Credo.Check.Design.AliasUsage,
78-
excluded_namespaces: ~w(Block Blocks Import Socket Task),
79-
excluded_lastnames: ~w(Address DateTime Exporter Fetcher Full Instrumenter Monitor Name Number Repo Time Unit),
78+
excluded_namespaces: ~w(Block Blocks Import Socket SpandexDatadog Task),
79+
excluded_lastnames:
80+
~w(Address DateTime Exporter Fetcher Full Instrumenter Logger Monitor Name Number Repo Spec Time Unit),
8081
priority: :low},
8182

8283
# For some checks, you can also set other parameters

README.md

Lines changed: 44 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
<h1 align="center">BlockScout</h1>
88
<p align="center">Blockchain Explorer for inspecting and analyzing EVM Chains.</p>
99
<div align="center">
10-
10+
1111
[![CircleCI](https://circleci.com/gh/poanetwork/blockscout.svg?style=svg&circle-token=f8823a3d0090407c11f87028c73015a331dbf604)](https://circleci.com/gh/poanetwork/blockscout) [![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)
1212

1313
</div>
@@ -245,6 +245,22 @@ To view Modules and API Reference documentation:
245245
2. View the generated docs.
246246
`open doc/index.html`
247247

248+
## Front-end
249+
250+
### Javascript
251+
252+
All Javascript files are under [apps/block_scout_web/assets/js](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/js) and the main file is [app.js](https://github.com/poanetwork/blockscout/blob/master/apps/block_scout_web/assets/js/app.js). This file imports all javascript used in the application. If you want to create a new JS file consider creating into [/js/pages](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/js/pages) or [/js/lib](https://github.com/poanetwork/blockscout/tree/master/apps/block_scout_web/assets/js/lib), as follows:
253+
254+
#### js/lib
255+
This folder contains all scripts that can be reused in any page or can be used as a helper to some component.
256+
257+
#### js/pages
258+
This folder contains the scripts that are specific for some page.
259+
260+
#### Redux
261+
This project uses Redux to control the state in some pages. There are pages that have things happening in real-time thanks to the Phoenix channels, e.g. Address page, so the page state changes a lot depending on which events it is listening. The redux is also used to load some contents asynchronous, see [async_listing_load.js](https://github.com/poanetwork/blockscout/blob/master/apps/block_scout_web/assets/js/lib/async_listing_load.js).
262+
263+
To understand how to build new pages that need redux in this project, see the [redux_helpers.js](https://github.com/poanetwork/blockscout/blob/master/apps/block_scout_web/assets/js/lib/redux_helpers.js)
248264

249265
## Internationalization
250266

@@ -283,6 +299,33 @@ BlockScout is setup to export [Prometheus](https://prometheus.io/) metrics at `/
283299
3. Click "Load"
284300
6. View the dashboards. (You will need to click-around and use BlockScout for the web-related metrics to show up.)
285301

302+
## Tracing
303+
304+
Blockscout supports tracing via
305+
[Spandex](http://[email protected]:spandex-project/spandex.git). Each application
306+
has its own tracer, that is configured internally to that application. In order
307+
to enable it, visit each application's `config/<env>.ex` and update its tracer
308+
configuration to change `disabled?: true` to `disabled?: false`. Do this for
309+
each application you'd like included in your trace data.
310+
311+
Currently, only [Datadog](https://www.datadoghq.com/) is supported as a
312+
tracing backend, but more will be added soon.
313+
314+
### DataDog
315+
316+
If you would like to use DataDog, after enabling `Spandex`, set
317+
`"DATADOG_HOST"` and `"DATADOG_PORT"` environment variables to the
318+
host/port that your Datadog agent is running on. For more information on
319+
Datadog and the Datadog agent, see their
320+
[documentation](https://docs.datadoghq.com/).
321+
322+
### Other
323+
324+
If you want to use a different backend, remove the
325+
`SpandexDatadog.ApiServer` `Supervisor.child_spec` from
326+
`Explorer.Application` and follow any instructions provided in `Spandex`
327+
for setting up that backend.
328+
286329
## Memory Usage
287330

288331
The work queues for building the index of all blocks, balances (coin and token), and internal transactions can grow quite large. By default, the soft-limit is 1 GiB, which can be changed in `apps/indexer/config/config.exs`:
Lines changed: 80 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
import { asyncReducer, asyncInitialState } from '../../js/lib/async_listing_load'
2+
3+
describe('ELEMENTS_LOAD', () => {
4+
test('sets only nextPagePath and ignores other keys', () => {
5+
const state = Object.assign({}, asyncInitialState)
6+
const action = { type: 'ELEMENTS_LOAD', nextPagePath: 'set', foo: 1 }
7+
const output = asyncReducer(state, action)
8+
9+
expect(output.foo).not.toEqual(1)
10+
expect(output.nextPagePath).toEqual('set')
11+
})
12+
})
13+
14+
describe('ADD_ITEM_KEY', () => {
15+
test('sets itemKey to what was passed in the action', () => {
16+
const expectedItemKey = 'expected.Key'
17+
18+
const state = Object.assign({}, asyncInitialState)
19+
const action = { type: 'ADD_ITEM_KEY', itemKey: expectedItemKey }
20+
const output = asyncReducer(state, action)
21+
22+
expect(output.itemKey).toEqual(expectedItemKey)
23+
})
24+
})
25+
26+
describe('START_REQUEST', () => {
27+
test('sets loading status to true', () => {
28+
const state = Object.assign({}, asyncInitialState, { loading: false })
29+
const action = { type: 'START_REQUEST' }
30+
const output = asyncReducer(state, action)
31+
32+
expect(output.loading).toEqual(true)
33+
})
34+
})
35+
36+
describe('REQUEST_ERROR', () => {
37+
test('sets requestError to true', () => {
38+
const state = Object.assign({}, asyncInitialState, { requestError: false })
39+
const action = { type: 'REQUEST_ERROR' }
40+
const output = asyncReducer(state, action)
41+
42+
expect(output.requestError).toEqual(true)
43+
})
44+
})
45+
46+
describe('FINISH_REQUEST', () => {
47+
test('sets loading status to false', () => {
48+
const state = Object.assign({}, asyncInitialState, {
49+
loading: true,
50+
loadingFirstPage: true
51+
})
52+
const action = { type: 'FINISH_REQUEST' }
53+
const output = asyncReducer(state, action)
54+
55+
expect(output.loading).toEqual(false)
56+
expect(output.loadingFirstPage).toEqual(false)
57+
})
58+
})
59+
60+
describe('ITEMS_FETCHED', () => {
61+
test('sets the items to what was passed in the action', () => {
62+
const expectedItems = [1, 2, 3]
63+
64+
const state = Object.assign({}, asyncInitialState)
65+
const action = { type: 'ITEMS_FETCHED', items: expectedItems }
66+
const output = asyncReducer(state, action)
67+
68+
expect(output.items).toEqual(expectedItems)
69+
})
70+
})
71+
72+
describe('NAVIGATE_TO_OLDER', () => {
73+
test('sets beyondPageOne to true', () => {
74+
const state = Object.assign({}, asyncInitialState, { beyondPageOne: false })
75+
const action = { type: 'NAVIGATE_TO_OLDER' }
76+
const output = asyncReducer(state, action)
77+
78+
expect(output.beyondPageOne).toEqual(true)
79+
})
80+
})

0 commit comments

Comments
 (0)