diff --git a/.circleci/config.yml b/.circleci/config.yml index 1eec164659..53e5680e78 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -480,7 +480,7 @@ jobs: command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: - name: mix test --exclude no_geth + name: mix test --exclude no_parity command: | # Don't submit coverage report for forks, but let the build succeed if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then @@ -534,7 +534,7 @@ jobs: command: dockerize -wait tcp://localhost:5432 -timeout 1m - run: - name: mix test --exclude no_geth + name: mix test --exclude no_parity command: | # Don't submit coverage report for forks, but let the build succeed if [[ -z "$COVERALLS_REPO_TOKEN" ]]; then diff --git a/CHANGELOG.md b/CHANGELOG.md index 6ae0caeb85..14cae576cc 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,72 +1,111 @@ ## Current ### Features -- [#1963](https://github.com/poanetwork/blockscout/pull/1963) - added rinkeby theme and rinkeby logo -- [#1959](https://github.com/poanetwork/blockscout/pull/1959) - added goerli theme and goerli logo +- [#1963](https://github.com/poanetwork/blockscout/pull/1963), [#1959](https://github.com/poanetwork/blockscout/pull/1959), [#1948](https://github.com/poanetwork/blockscout/pull/1948), [#1936](https://github.com/poanetwork/blockscout/pull/1936), [#1925](https://github.com/poanetwork/blockscout/pull/1925), [#1922](https://github.com/poanetwork/blockscout/pull/1922), [#1903](https://github.com/poanetwork/blockscout/pull/1903), [#1874](https://github.com/poanetwork/blockscout/pull/1874), [#1895](https://github.com/poanetwork/blockscout/pull/1895) - added new themes and logos for poa, eth, rinkeby, goerli, ropsten, kovan, sokol, xdai, etc, rsk +- [#2010](https://github.com/poanetwork/blockscout/pull/2010) - added "block not found" and "tx not found pages" - [#1928](https://github.com/poanetwork/blockscout/pull/1928) - pagination styles were updated -- [#1948](https://github.com/poanetwork/blockscout/pull/1948) - added ropsten theme and ropsten logo - [#1940](https://github.com/poanetwork/blockscout/pull/1940) - qr modal button and background issue -- [#1936](https://github.com/poanetwork/blockscout/pull/1936) - added kovan, sokol themes and logos -- [#1925](https://github.com/poanetwork/blockscout/pull/1925) - added dai theme and logo -- [#1922](https://github.com/poanetwork/blockscout/pull/1922) - added ethereum classic theme and logo - [#1907](https://github.com/poanetwork/blockscout/pull/1907) - dropdown color bug fix (lukso theme) and tooltip color bug fix -- [#1903](https://github.com/poanetwork/blockscout/pull/1903) - added rsk theme and rsk logo -- [#1895](https://github.com/poanetwork/blockscout/pull/1895) - add changes to poa theme and poa logo -- [#1812](https://github.com/poanetwork/blockscout/pull/1812) - add pagination to addresses page -- [#1874](https://github.com/poanetwork/blockscout/pull/1874) - add changes to ethereum theme and ethereum logo -- [#1815](https://github.com/poanetwork/blockscout/pull/1815) - able to search without prefix "0x" -- [#1813](https://github.com/poanetwork/blockscout/pull/1813) - add total blocks counter to the main page -- [#1806](https://github.com/poanetwork/blockscout/pull/1806) - verify contracts with a post request - [#1857](https://github.com/poanetwork/blockscout/pull/1857) - Re-implement Geth JS internal transaction tracer in Elixir - [#1859](https://github.com/poanetwork/blockscout/pull/1859) - feat: show raw transaction traces -- [#1890](https://github.com/poanetwork/blockscout/pull/1890) - Verification links to other explorers for ETH Mainnet -- [#1920](https://github.com/poanetwork/blockscout/pull/1920) - fix: remove source code fields from list endpoint -- [#1876](https://github.com/poanetwork/blockscout/pull/1876) - async calculate a count of blocks - [#1941](https://github.com/poanetwork/blockscout/pull/1941) - feat: add on demand fetching and stale attr to rpc - [#1957](https://github.com/poanetwork/blockscout/pull/1957) - Calculate stakes ratio before insert pools - [#1956](https://github.com/poanetwork/blockscout/pull/1956) - add logs tab to address -- [#1933](https://github.com/poanetwork/blockscout/pull/1933) - add eth_BlockNumber json rpc method - [#1952](https://github.com/poanetwork/blockscout/pull/1952) - feat: exclude empty contracts by default +- [#1989](https://github.com/poanetwork/blockscout/pull/1989) - fix: consolidate address w/ balance one at a time - [#1954](https://github.com/poanetwork/blockscout/pull/1954) - feat: use creation init on self destruct +- [#1974](https://github.com/poanetwork/blockscout/pull/1974) - feat: previous page button logic +- [#1999](https://github.com/poanetwork/blockscout/pull/1999) - load data async on addresses page +- [#2002](https://github.com/poanetwork/blockscout/pull/2002) - Get estimated count of blocks when cache is empty +- [#1807](https://github.com/poanetwork/blockscout/pull/1807) - New theming capabilites. +- [#1890](https://github.com/poanetwork/blockscout/pull/1890) - Verification links to other explorers for ETH ### Fixes - [#1944](https://github.com/poanetwork/blockscout/pull/1944) - fixed styles for token's dropdown. - [#1926](https://github.com/poanetwork/blockscout/pull/1926) - status label alignment -- [#1829](https://github.com/poanetwork/blockscout/pull/1829) - Handle nil quantities in block decoding routine -- [#1830](https://github.com/poanetwork/blockscout/pull/1830) - Make block size field nullable -- [#1840](https://github.com/poanetwork/blockscout/pull/1840) - Handle case when total supply is nil -- [#1838](https://github.com/poanetwork/blockscout/pull/1838) - Block counter calculates only consensus blocks - [#1849](https://github.com/poanetwork/blockscout/pull/1849) - Improve chains menu - [#1869](https://github.com/poanetwork/blockscout/pull/1869) - Fix output and gas extraction in JS tracer for Geth - [#1868](https://github.com/poanetwork/blockscout/pull/1868) - fix: logs list endpoint performance - [#1822](https://github.com/poanetwork/blockscout/pull/1822) - Fix style breaks in decompiled contract code view - [#1885](https://github.com/poanetwork/blockscout/pull/1885) - highlight reserved words in decompiled code - [#1896](https://github.com/poanetwork/blockscout/pull/1896) - re-query tokens in top nav automplete -- [#1881](https://github.com/poanetwork/blockscout/pull/1881) - fix: store solc versions locally for performance - [#1905](https://github.com/poanetwork/blockscout/pull/1905) - fix reorgs, uncles pagination -- [#1875](https://github.com/poanetwork/blockscout/pull/1875) - fix: resolve false positive constructor arguments - [#1904](https://github.com/poanetwork/blockscout/pull/1904) - fix `BLOCK_COUNT_CACHE_TTL` env var type -- [#1898](https://github.com/poanetwork/blockscout/pull/1898) - check if the constructor has arguments before verifying constructor arguments - [#1915](https://github.com/poanetwork/blockscout/pull/1915) - fallback to 2 latest evm versions - [#1937](https://github.com/poanetwork/blockscout/pull/1937) - Check the presence of overlap[i] object before retrieving properties from it - [#1960](https://github.com/poanetwork/blockscout/pull/1960) - do not remove bold text in decompiled contacts -- [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block +- [#1992](https://github.com/poanetwork/blockscout/pull/1992) - fix: support https for wobserver polling +- [#1966](https://github.com/poanetwork/blockscout/pull/1966) - fix: add fields for contract filter performance +- [#2008](https://github.com/poanetwork/blockscout/pull/2008) - add new function clause for xDai network beneficiaries +- [#2009](https://github.com/poanetwork/blockscout/pull/2009) - addresses page improvements ### Chore -- [#1814](https://github.com/poanetwork/blockscout/pull/1814) - Clear build artefacts script -- [#1837](https://github.com/poanetwork/blockscout/pull/1837) - Add -f flag to clear_build.sh script delete static folder - [#1900](https://github.com/poanetwork/blockscout/pull/1900) - SUPPORTED_CHAINS ENV var -- [#1892](https://github.com/poanetwork/blockscout/pull/1892) - Remove temporary worker modules - [#1958](https://github.com/poanetwork/blockscout/pull/1958) - Default value for release link env var +- [#1964](https://github.com/poanetwork/blockscout/pull/1964) - ALLOWED_EVM_VERSIONS env var - [#1975](https://github.com/poanetwork/blockscout/pull/1975) - add log index to transaction view +- [#1988](https://github.com/poanetwork/blockscout/pull/1988) - Fix wrong parity tasks names in Circle CI +- [#2000](https://github.com/poanetwork/blockscout/pull/2000) - docker/Makefile: always set a container name + +## 1.3.14-beta + +### Features + +- [#1812](https://github.com/poanetwork/blockscout/pull/1812) - add pagination to addresses page +- [#1920](https://github.com/poanetwork/blockscout/pull/1920) - fix: remove source code fields from list endpoint +- [#1876](https://github.com/poanetwork/blockscout/pull/1876) - async calculate a count of blocks + +### Fixes + +- [#1917](https://github.com/poanetwork/blockscout/pull/1917) - Force block refetch if transaction is re-collated in a different block + +### Chore + +- [#1892](https://github.com/poanetwork/blockscout/pull/1892) - Remove temporary worker modules + +## 1.3.13-beta + +### Features + +- [#1933](https://github.com/poanetwork/blockscout/pull/1933) - add eth_BlockNumber json rpc method + +### Fixes + +- [#1875](https://github.com/poanetwork/blockscout/pull/1875) - fix: resolve false positive constructor arguments +- [#1881](https://github.com/poanetwork/blockscout/pull/1881) - fix: store solc versions locally for performance +- [#1898](https://github.com/poanetwork/blockscout/pull/1898) - check if the constructor has arguments before verifying constructor arguments + +## 1.3.12-beta + +Reverting of synchronous block counter, implemented in #1848 + +## 1.3.11-beta + +### Features + +- [#1815](https://github.com/poanetwork/blockscout/pull/1815) - Be able to search without prefix "0x" +- [#1813](https://github.com/poanetwork/blockscout/pull/1813) - Add total blocks counter to the main page +- [#1806](https://github.com/poanetwork/blockscout/pull/1806) - Verify contracts with a post request +- [#1848](https://github.com/poanetwork/blockscout/pull/1848) - Add cache for block counter + +### Fixes + +- [#1829](https://github.com/poanetwork/blockscout/pull/1829) - Handle nil quantities in block decoding routine +- [#1830](https://github.com/poanetwork/blockscout/pull/1830) - Make block size field nullable +- [#1840](https://github.com/poanetwork/blockscout/pull/1840) - Handle case when total supply is nil +- [#1838](https://github.com/poanetwork/blockscout/pull/1838) - Block counter calculates only consensus blocks + +### Chore + +- [#1814](https://github.com/poanetwork/blockscout/pull/1814) - Clear build artefacts script +- [#1837](https://github.com/poanetwork/blockscout/pull/1837) - Add -f flag to clear_build.sh script delete static folder ## 1.3.10-beta ### Features -- [#1807](https://github.com/poanetwork/blockscout/pull/1807) - New theming capabilites. - [#1739](https://github.com/poanetwork/blockscout/pull/1739) - highlight decompiled source code - [#1696](https://github.com/poanetwork/blockscout/pull/1696) - full-text search by tokens - [#1742](https://github.com/poanetwork/blockscout/pull/1742) - Support RSK diff --git a/apps/block_scout_web/assets/css/app.scss b/apps/block_scout_web/assets/css/app.scss index cbc6c64d38..7aab7728a4 100644 --- a/apps/block_scout_web/assets/css/app.scss +++ b/apps/block_scout_web/assets/css/app.scss @@ -121,6 +121,7 @@ $fa-font-path: "~@fortawesome/fontawesome-free/webfonts"; @import "components/api"; @import "components/alerts"; @import "components/verify_other_explorers"; +@import "components/errors"; :export { primary: $primary; diff --git a/apps/block_scout_web/assets/css/components/_errors.scss b/apps/block_scout_web/assets/css/components/_errors.scss new file mode 100644 index 0000000000..05a850bc03 --- /dev/null +++ b/apps/block_scout_web/assets/css/components/_errors.scss @@ -0,0 +1,137 @@ +$error-tablet-breakpoint: 768px; + +// Block Not Found + +.block-not-found { + display: flex; + flex-direction: column; + padding-bottom: 50px; + @media (min-width: $error-tablet-breakpoint) { + flex-direction: row; + align-items: center; + justify-content: center; + padding-top: 52px; + } +} + +.block-not-found-img { + margin-bottom: 40px; + text-align: center; + @media (min-width: $error-tablet-breakpoint) { + margin-bottom: 0; + text-align: left; + } + img { + max-width: 100%; + height: auto; + } +} + +.block-not-found-content { + text-align: center; + @media (min-width: $error-tablet-breakpoint) { + text-align: left; + padding-left: 52px; + max-width: 396px; + } +} + +.error-title { + margin-bottom: 20px !important; +} + +.error-descr { + display: block; + font-size: 14px; + color: #a3a9b5; + line-height: 1.714; + margin-bottom: 22px; + word-wrap: break-word; +} + +.error-btn { + background: transparent; + display: inline-flex !important; +} + +// TX Not Found +.tx-nf { + display: flex; + align-items: center; + justify-content: center; + flex-direction: column; + padding-bottom: 50px; + @media (min-width: $error-tablet-breakpoint) { + flex-direction: row; + padding-top: 52px; + } +} + +.tx-nf-content { + margin-top: 52px; + max-width: 700px; + @media (min-width: $error-tablet-breakpoint) { + margin-left: 90px; + margin-top: 0; + } +} + +.tx-nf-blocks { + margin-bottom: 40px; + margin-top: 40px; +} + +.tx-nf-block { + background-color: #fff; + box-shadow: 0px 0px 30px 0px rgba(202, 199, 226, 0.5); + padding: 17px 40px 17px 20px; + position: relative; + border-radius: 6px; + @media (min-width: $error-tablet-breakpoint) { + width: calc(50% - 20px); + } +} + +.tx-nf-block { + .error-descr { + margin-bottom: 0; + } + & + .tx-nf-block { + margin-top: 30px; + @media (min-width: $error-tablet-breakpoint) { + margin-top: 0; + } + } +} + +.tx-nf-blocks-row { + display: flex; + justify-content: space-between; + flex-direction: column; + @media (min-width: $error-tablet-breakpoint) { + flex-direction: row; + } + & + .tx-nf-blocks-row { + margin-top: 30px; + @media (min-width: $error-tablet-breakpoint) { + margin-top: 40px; + } + } +} + +.tx-nf-number { + display: inline-block; + position: absolute; + top: -15px; + left: -15px; + width: 30px; + height: 30px; + border-radius: 15px; + background-color: $secondary; + box-shadow: 0px 3px 5px 0px rgba($secondary, 0.25); + color: #fff; + font-weight: 700; + font-size: 14px; + text-align: center; + line-height: 32px; +} \ No newline at end of file diff --git a/apps/block_scout_web/assets/css/theme/_ether1_variables.scss b/apps/block_scout_web/assets/css/theme/_ether1_variables.scss new file mode 100644 index 0000000000..323ceb22ac --- /dev/null +++ b/apps/block_scout_web/assets/css/theme/_ether1_variables.scss @@ -0,0 +1,49 @@ +// general +$primary: #840032; +$secondary: #343434; +$tertiary: #7f7f7f; +$additional-font: #ff95db; + +// footer +$footer-background-color: $primary; +$footer-title-color: #fff; +$footer-text-color: #fff; +$footer-item-disc-color: $secondary; + +// dashboard +$dashboard-line-color-price: $tertiary; // price left border + +$dashboard-banner-chart-legend-value-color: $additional-font; // chart labels + +$dashboard-stats-item-value-color: $additional-font; // stat values + +$dashboard-stats-item-border-color: $secondary; // stat border + +$dashboard-banner-gradient-start: $primary; // gradient begin + +$dashboard-banner-gradient-end: lighten($primary, 5); // gradient end + +$dashboard-banner-network-plain-container-background-color: #4b021e; // stats bg + + +// navigation +.navbar { box-shadow: 0px 0px 30px 0px rgba(75, 2, 30, 0.12); } // header shadow +$header-icon-border-color-hover: $tertiary; // top border on hover +$header-icon-color-hover: $tertiary; // nav icon on hover +.dropdown-item:hover, .dropdown-item:focus { background-color: $tertiary !important; } // dropdown item on hover + +// buttons +$btn-line-bg: #fff; // button bg +$btn-line-color: #4b021e; // button border and font color && hover bg color +$btn-copy-color: #4b021e; // btn copy +$btn-qr-color: #4b021e; // btn qr-code + +//links & tile +.tile a { color: $tertiary !important; } // links color for badges +.tile-type-block { + border-left: 4px solid #4b021e; +} // tab active bg + +// card +$card-background-1: $tertiary; +$card-tab-active: $tertiary; diff --git a/apps/block_scout_web/assets/css/theme/_variables.scss b/apps/block_scout_web/assets/css/theme/_variables.scss index 01bdc463d8..14517ac46f 100644 --- a/apps/block_scout_web/assets/css/theme/_variables.scss +++ b/apps/block_scout_web/assets/css/theme/_variables.scss @@ -3,6 +3,7 @@ // @import "dai_variables"; // @import "ethereum_classic_variables"; // @import "ethereum_variables"; +// @import "ether1_variables"; // @import "expanse_variables"; // @import "gochain_variables"; // @import "goerli_variables"; diff --git a/apps/block_scout_web/assets/js/lib/async_listing_load.js b/apps/block_scout_web/assets/js/lib/async_listing_load.js index 71be924c95..e22f6e399d 100644 --- a/apps/block_scout_web/assets/js/lib/async_listing_load.js +++ b/apps/block_scout_web/assets/js/lib/async_listing_load.js @@ -48,10 +48,16 @@ export const asyncInitialState = { loading: false, /* if there was an error fetching items */ requestError: false, + /* if response has no items */ + emptyResponse: false, /* if it is loading the first page */ loadingFirstPage: true, /* link to the next page */ - nextPagePath: null + nextPagePath: null, + /* link to the previous page */ + prevPagePath: null, + /* visited pages */ + pagesStack: [] } export function asyncReducer (state = asyncInitialState, action) { @@ -78,15 +84,36 @@ export function asyncReducer (state = asyncInitialState, action) { }) } case 'ITEMS_FETCHED': { + var prevPagePath = null + + if (state.pagesStack.length >= 2) { + prevPagePath = state.pagesStack[state.pagesStack.length - 2] + } + return Object.assign({}, state, { requestError: false, + emptyResponse: action.items.length === 0, items: action.items, - nextPagePath: action.nextPagePath + nextPagePath: action.nextPagePath, + prevPagePath: prevPagePath }) } case 'NAVIGATE_TO_OLDER': { history.replaceState({}, null, state.nextPagePath) + if (state.pagesStack.length === 0) { + state.pagesStack.push(window.location.href.split('?')[0]) + } + + state.pagesStack.push(state.nextPagePath) + + return Object.assign({}, state, { beyondPageOne: true }) + } + case 'NAVIGATE_TO_NEWER': { + history.replaceState({}, null, state.prevPagePath) + + state.pagesStack.pop() + return Object.assign({}, state, { beyondPageOne: true }) } default: @@ -145,6 +172,10 @@ export const elements = { }, '[data-async-listing] [data-next-page-button]': { render ($el, state) { + if (state.emptyResponse) { + return $el.hide() + } + if (state.requestError || !state.nextPagePath || state.loading) { return $el.attr('disabled', 'disabled') } @@ -153,6 +184,33 @@ export const elements = { $el.attr('href', state.nextPagePath) } }, + '[data-async-listing] [data-prev-page-button]': { + render ($el, state) { + if (state.emptyResponse) { + return $el.hide() + } + + if (state.requestError || !state.prevPagePath || state.loading) { + return $el.attr('disabled', 'disabled') + } + + $el.attr('disabled', false) + $el.attr('href', state.prevPagePath) + } + }, + '[data-async-listing] [data-page-number]': { + render ($el, state) { + if (state.emptyResponse) { + return $el.hide() + } + + if (state.pagesStack.length === 0) { + return $el.text('Page 1') + } + + $el.text('Page ' + state.pagesStack.length) + } + }, '[data-async-listing] [data-loading-button]': { render ($el, state) { if (!state.loadingFirstPage && state.loading) return $el.show() @@ -193,7 +251,7 @@ export function createAsyncLoadStore (reducer, initialState, itemKey) { function firstPageLoad (store) { const $element = $('[data-async-listing]') - function loadItems () { + function loadItemsNext () { const path = store.getState().nextPagePath store.dispatch({type: 'START_REQUEST'}) $.getJSON(path, {type: 'JSON'}) @@ -201,18 +259,33 @@ function firstPageLoad (store) { .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) .always(() => store.dispatch({type: 'FINISH_REQUEST'})) } - loadItems() + + function loadItemsPrev () { + const path = store.getState().prevPagePath + store.dispatch({type: 'START_REQUEST'}) + $.getJSON(path, {type: 'JSON'}) + .done(response => store.dispatch(Object.assign({type: 'ITEMS_FETCHED'}, humps.camelizeKeys(response)))) + .fail(() => store.dispatch({type: 'REQUEST_ERROR'})) + .always(() => store.dispatch({type: 'FINISH_REQUEST'})) + } + loadItemsNext() $element.on('click', '[data-error-message]', (event) => { event.preventDefault() - loadItems() + loadItemsNext() }) $element.on('click', '[data-next-page-button]', (event) => { event.preventDefault() - loadItems() + loadItemsNext() store.dispatch({type: 'NAVIGATE_TO_OLDER'}) }) + + $element.on('click', '[data-prev-page-button]', (event) => { + event.preventDefault() + loadItemsPrev() + store.dispatch({type: 'NAVIGATE_TO_NEWER'}) + }) } const $element = $('[data-async-load]') diff --git a/apps/block_scout_web/assets/static/images/errors-img/etc-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/etc-block-not-found.png new file mode 100644 index 0000000000..57d63cb148 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/etc-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/etc-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/etc-block-not-found@2x.png new file mode 100644 index 0000000000..e1f484b479 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/etc-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/etc-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/etc-tx-not-found.png new file mode 100644 index 0000000000..e049e2ba5a Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/etc-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/etc-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/etc-tx-not-found@2x.png new file mode 100644 index 0000000000..124b903ad7 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/etc-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/eth-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/eth-block-not-found.png new file mode 100644 index 0000000000..977e0dbd32 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/eth-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/eth-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/eth-block-not-found@2x.png new file mode 100644 index 0000000000..b1ce45428e Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/eth-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/eth-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/eth-tx-not-found.png new file mode 100644 index 0000000000..25a4fa7768 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/eth-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/eth-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/eth-tx-not-found@2x.png new file mode 100644 index 0000000000..f6cfa7e50c Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/eth-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/goerli-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/goerli-block-not-found.png new file mode 100644 index 0000000000..77656a34c1 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/goerli-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/goerli-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/goerli-block-not-found@2x.png new file mode 100644 index 0000000000..8bc8a52bb4 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/goerli-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/goerli-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/goerli-tx-not-found.png new file mode 100644 index 0000000000..666ecc0928 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/goerli-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/goerli-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/goerli-tx-not-found@2x.png new file mode 100644 index 0000000000..255a8786cc Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/goerli-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/koan-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/koan-block-not-found@2x.png new file mode 100644 index 0000000000..8c952bf4b5 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/koan-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/kovan-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/kovan-block-not-found.png new file mode 100644 index 0000000000..7f947386cd Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/kovan-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/kovan-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/kovan-block-not-found@2x.png new file mode 100644 index 0000000000..4c8632d5cc Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/kovan-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/kovan-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/kovan-tx-not-found.png new file mode 100644 index 0000000000..a8f663f7a9 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/kovan-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/kovan-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/kovan-tx-not-found@2x.png new file mode 100644 index 0000000000..43be02d226 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/kovan-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/poa-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/poa-block-not-found.png new file mode 100644 index 0000000000..05e2d0e8a9 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/poa-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/poa-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/poa-block-not-found@2x.png new file mode 100644 index 0000000000..a9827caceb Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/poa-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/poa-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/poa-tx-not-found.png new file mode 100644 index 0000000000..0c2974d94b Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/poa-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/poa-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/poa-tx-not-found@2x.png new file mode 100644 index 0000000000..23679da31e Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/poa-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rinkeby-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-block-not-found.png new file mode 100644 index 0000000000..5d9bc35f8b Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rinkeby-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-block-not-found@2x.png new file mode 100644 index 0000000000..8e60bbcc6c Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rinkeby-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-tx-not-found.png new file mode 100644 index 0000000000..98d2a3a605 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rinkeby-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-tx-not-found@2x.png new file mode 100644 index 0000000000..b4175f4024 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rinkeby-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rinnkeby-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/rinnkeby-block-not-found.png new file mode 100644 index 0000000000..534e827d1e Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rinnkeby-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rinnkeby-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/rinnkeby-block-not-found@2x.png new file mode 100644 index 0000000000..0c7f9f7359 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rinnkeby-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/ropsten-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/ropsten-block-not-found.png new file mode 100644 index 0000000000..3ce59a2d9d Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/ropsten-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/ropsten-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/ropsten-block-not-found@2x.png new file mode 100644 index 0000000000..cf7cce8197 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/ropsten-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/ropsten-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/ropsten-tx-not-found.png new file mode 100644 index 0000000000..13a4f91eb0 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/ropsten-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/ropsten-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/ropsten-tx-not-found@2x.png new file mode 100644 index 0000000000..e2e66973d7 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/ropsten-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rsk-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/rsk-block-not-found.png new file mode 100644 index 0000000000..fd10b54047 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rsk-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rsk-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/rsk-block-not-found@2x.png new file mode 100644 index 0000000000..eb6a98df25 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rsk-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rsk-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/rsk-tx-not-found.png new file mode 100644 index 0000000000..03c6f76be2 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rsk-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/rsk-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/rsk-tx-not-found@2x.png new file mode 100644 index 0000000000..5559c9c5d2 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/rsk-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/sokol-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/sokol-block-not-found.png new file mode 100644 index 0000000000..fd10b54047 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/sokol-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/sokol-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/sokol-block-not-found@2x.png new file mode 100644 index 0000000000..eb6a98df25 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/sokol-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/sokol-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/sokol-tx-not-found.png new file mode 100644 index 0000000000..03c6f76be2 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/sokol-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/sokol-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/sokol-tx-not-found@2x.png new file mode 100644 index 0000000000..5559c9c5d2 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/sokol-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/xdai-block-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/xdai-block-not-found.png new file mode 100644 index 0000000000..94339df5dc Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/xdai-block-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/xdai-block-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/xdai-block-not-found@2x.png new file mode 100644 index 0000000000..fd3c12bae2 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/xdai-block-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/xdai-tx-not-found.png b/apps/block_scout_web/assets/static/images/errors-img/xdai-tx-not-found.png new file mode 100644 index 0000000000..666ecc0928 Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/xdai-tx-not-found.png differ diff --git a/apps/block_scout_web/assets/static/images/errors-img/xdai-tx-not-found@2x.png b/apps/block_scout_web/assets/static/images/errors-img/xdai-tx-not-found@2x.png new file mode 100644 index 0000000000..255a8786cc Binary files /dev/null and b/apps/block_scout_web/assets/static/images/errors-img/xdai-tx-not-found@2x.png differ diff --git a/apps/block_scout_web/assets/static/images/ether1_logo.svg b/apps/block_scout_web/assets/static/images/ether1_logo.svg new file mode 100644 index 0000000000..1ebd89e7df --- /dev/null +++ b/apps/block_scout_web/assets/static/images/ether1_logo.svg @@ -0,0 +1,44 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex index 3d43ed7054..6ce33a2773 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/address_controller.ex @@ -3,11 +3,13 @@ defmodule BlockScoutWeb.AddressController do import BlockScoutWeb.Chain, only: [paging_options: 1, next_page_params: 3, split_list_by_page: 1] + alias BlockScoutWeb.AddressView alias Explorer.{Chain, Market} alias Explorer.Chain.Address alias Explorer.ExchangeRates.Token + alias Phoenix.View - def index(conn, params) do + def index(conn, %{"type" => "JSON"} = params) do addresses = params |> paging_options() @@ -15,41 +17,51 @@ defmodule BlockScoutWeb.AddressController do {addresses_page, next_page} = split_list_by_page(addresses) - cur_page_number = - cond do - !params["prev_page_number"] -> 1 - params["next_page"] -> String.to_integer(params["prev_page_number"]) + 1 - params["prev_page"] -> String.to_integer(params["prev_page_number"]) - 1 - end - next_page_path = case next_page_params(next_page, addresses_page, params) do nil -> nil next_page_params -> - next_params = - next_page_params - |> Map.put("prev_page_path", cur_page_path(conn, params)) - |> Map.put("next_page", true) - |> Map.put("prev_page_number", cur_page_number) - address_path( conn, :index, - next_params + Map.delete(next_page_params, "type") ) end + exchange_rate = Market.get_exchange_rate(Explorer.coin()) || Token.null() + total_supply = Chain.total_supply() + + items = + addresses_page + |> Enum.with_index(1) + |> Enum.map(fn {{address, tx_count}, index} -> + View.render_to_string( + AddressView, + "_tile.html", + address: address, + index: index, + exchange_rate: exchange_rate, + total_supply: total_supply, + tx_count: tx_count, + validation_count: validation_count(address) + ) + end) + + json( + conn, + %{ + items: items, + next_page_path: next_page_path + } + ) + end + + def index(conn, _params) do render(conn, "index.html", - address_tx_count_pairs: addresses_page, - page_address_count: Enum.count(addresses_page), - address_count: Chain.count_addresses_with_balance_from_cache(), - exchange_rate: Market.get_exchange_rate(Explorer.coin()) || Token.null(), - total_supply: Chain.total_supply(), - next_page_path: next_page_path, - prev_page_path: params["prev_page_path"], - cur_page_number: cur_page_number + current_path: current_path(conn), + address_count: Chain.count_addresses_with_balance_from_cache() ) end @@ -64,16 +76,4 @@ defmodule BlockScoutWeb.AddressController do def validation_count(%Address{} = address) do Chain.address_to_validation_count(address) end - - defp cur_page_path(conn, %{"hash" => _hash, "fetched_coin_balance" => _balance} = params) do - new_params = Map.put(params, "next_page", false) - - address_path( - conn, - :index, - new_params - ) - end - - defp cur_page_path(conn, _), do: address_path(conn, :index) end diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex index 23dacd45da..3b3c9af5ec 100644 --- a/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex +++ b/apps/block_scout_web/lib/block_scout_web/controllers/api/rpc/contract_controller.ex @@ -98,10 +98,10 @@ defmodule BlockScoutWeb.API.RPC.ContractController do Chain.list_decompiled_contracts(page_size, offset, not_decompiled_with_version) :unverified -> - Chain.list_unverified_contracts(page_size, offset) + Chain.list_unordered_unverified_contracts(page_size, offset) :not_decompiled -> - Chain.list_not_decompiled_contracts(page_size, offset) + Chain.list_unordered_not_decompiled_contracts(page_size, offset) :empty -> Chain.list_empty_contracts(page_size, offset) diff --git a/apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex b/apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex new file mode 100644 index 0000000000..e5ad7838bd --- /dev/null +++ b/apps/block_scout_web/lib/block_scout_web/controllers/pagination_helpers.ex @@ -0,0 +1,20 @@ +defmodule BlockScoutWeb.PaginationHelpers do + @moduledoc """ + Common pagination logic helpers. + """ + + def current_page_number(params) do + cond do + !params["prev_page_number"] -> 1 + params["next_page"] -> String.to_integer(params["prev_page_number"]) + 1 + params["prev_page"] -> String.to_integer(params["prev_page_number"]) - 1 + end + end + + def add_navigation_params(params, current_page_path, current_page_number) do + params + |> Map.put("prev_page_path", current_page_path) + |> Map.put("next_page", true) + |> Map.put("prev_page_number", current_page_number) + end +end diff --git a/apps/block_scout_web/lib/block_scout_web/etherscan.ex b/apps/block_scout_web/lib/block_scout_web/etherscan.ex index 3167689f3c..670d0787bf 100644 --- a/apps/block_scout_web/lib/block_scout_web/etherscan.ex +++ b/apps/block_scout_web/lib/block_scout_web/etherscan.ex @@ -862,11 +862,6 @@ defmodule BlockScoutWeb.Etherscan do name: "Contract", fields: %{ "Address" => @address_hash_type, - "DecompilerVersion" => %{ - type: "decompiler version", - definition: "When decompiled source code is present, the decompiler version with which it was generated.", - example: "decompiler.version" - }, "ABI" => %{ type: "ABI", definition: "JSON string for the contract's Application Binary Interface (ABI)", @@ -938,9 +933,16 @@ defmodule BlockScoutWeb.Etherscan do """ } + @contract_decompiler_version_type %{ + type: "decompiler version", + definition: "When decompiled source code is present, the decompiler version with which it was generated.", + example: "decompiler.version" + } + @contract_with_sourcecode_model @contract_model |> put_in([:fields, "SourceCode"], @contract_source_code_type) |> put_in([:fields, "DecompiledSourceCode"], @contract_decompiled_source_code_type) + |> put_in([:fields, "DecompilerVersion"], @contract_decompiler_version_type) @transaction_receipt_status_model %{ name: "TransactionReceiptStatus", @@ -1831,7 +1833,12 @@ defmodule BlockScoutWeb.Etherscan do @contract_listcontracts_action %{ name: "listcontracts", - description: "Get a list of contracts, sorted ascending by the time they were first seen by the explorer.", + description: """ + Get a list of contracts, sorted ascending by the time they were first seen by the explorer. + + If you provide the filters `not_decompiled`(`4`) or `not_verified(4)` the results will not + be sorted for performance reasons. + """, required_params: [], optional_params: [ %{ diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex index 91697de0c9..47d7f2457b 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address/index.html.eex @@ -1,20 +1,13 @@
-
+

<%= gettext "Addresses" %>

- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", prev_page_path: @prev_page_path, next_page_path: @next_page_path, cur_page_number: @cur_page_number, show_pagination_limit: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> -
- <%= for {{address, tx_count}, index} <- Enum.with_index(@address_tx_count_pairs, 1) do %> - <%= render "_tile.html", - address: address, index: index, exchange_rate: @exchange_rate, - total_supply: @total_supply, tx_count: tx_count, - validation_count: validation_count(address) %> - <% end %> -
+
- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", prev_page_path: @prev_page_path, next_page_path: @next_page_path, cur_page_number: @cur_page_number, show_pagination_limit: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex index f8693b2692..6b9459f5b3 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/address_coin_balance/index.html.eex @@ -28,7 +28,7 @@ - <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> - - + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> -
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block/index.html.eex index 9a0b61a394..92b91ce287 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block/index.html.eex @@ -9,35 +9,14 @@

<%= gettext("%{block_type}s", block_type: @block_type) %>

- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> -
- - - - - <%= gettext("Loading") %>... -
<%= gettext "There are no blocks." %>
- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> - - - - + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex index 68faa6fb73..ce9f49ad7a 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/404.html.eex @@ -1,16 +1,12 @@
-
-
-
-
-

- <%= gettext("Block Details") %> -

-
- <%= block_not_found_message(@block_above_tip) %> -
-
-
+
+
+ Block Not Found +
+
+

<%= gettext("Block Details") %>

+

<%= block_not_found_message(@block_above_tip) %>

+ Back Home
-
+
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex index 79574e8fee..add34c7b4d 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/block_transaction/index.html.eex @@ -44,19 +44,6 @@ <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true %> <% end %> - diff --git a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_pagination_container.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_pagination_container.html.eex index 6f33bcf854..f9992c6d86 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/common_components/_pagination_container.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/common_components/_pagination_container.html.eex @@ -1,5 +1,5 @@
- <%= if assigns[:show_pagination_limit] do %> + <%= if false do %>
<%= gettext "Show" %> @@ -14,19 +14,22 @@ -
\ No newline at end of file +
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/pending_transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/pending_transaction/index.html.eex index 8c57144734..4c97be61e1 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/pending_transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/pending_transaction/index.html.eex @@ -3,7 +3,7 @@

<%= gettext "Pending Transactions" %>

- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
@@ -32,22 +32,8 @@ <%= gettext("Loading") %>...
- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> - - -
-
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex index de2bb9707a..3b24912dd5 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/holder/index.html.eex @@ -15,6 +15,8 @@

<%= gettext "Token Holders" %>

+ <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + @@ -25,24 +27,11 @@
-
- - - - - <%= gettext("Loading") %>... -
+
- - + + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> + diff --git a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex index fc1d6e9291..980cc4b05a 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/tokens/transfer/index.html.eex @@ -14,7 +14,7 @@

<%= gettext "Token Transfers" %>

- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
-
- - - - - <%= gettext("Loading") %>... -
-
- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> - - - diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex index dd64899485..18928915f2 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/index.html.eex @@ -3,7 +3,7 @@

<%= gettext "Validated Transactions" %>

- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "top", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %>
@@ -28,30 +28,9 @@
-
- - - - - <%= gettext("Loading") %>... -
-
- <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true %> + <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true, data_next_page_button: true, data_prev_page_button: true %> - - -
diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex index 97df28640a..c34d84824a 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction/not_found.html.eex @@ -1,47 +1,33 @@
-
-
-
-
-
- -

<%= gettext "Transaction Details" %>

-
-
- - -
-
- <%= gettext("The transaction %{bold_hash} was not processed yet", bold_hash: "#{@transaction_hash}") |> raw() %> -
-
-
-

<%= gettext "Once we have the transaction's data this page will refresh automatically" %>

-

<%= gettext "The possible reasons for this transaction not being processed include the following:" %>

-
    -
  • <%= gettext "The transaction was made a few seconds ago" %>
  • -
  • <%= gettext "The transaction may be in the pool of a node that didn't broadcast it yet" %>
  • -
  • <%= gettext "Some transactions may take a while longer to be indexed depending on the load on the network" %>
  • -
  • <%= gettext "The transaction still does not exist" %>
  • -
-
+
+
+ Block Not Found +
+
+

<%= gettext("Sorry, We are unable to locate this transaction Hash") %>

+
+
+
+ 1 +

<%= gettext("If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page.") %>

+
+
+ 2 +

<%= gettext("It could still be in the TX Pool of a different node, waiting to be broadcasted.") %>

+
+
+
+
+ 3 +

<%= gettext("During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it.") %>

+
+
+ 4 +

<%= gettext("If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information.") %>

+ <%= gettext("Back Home") %>
-
+
\ No newline at end of file diff --git a/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/index.html.eex b/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/index.html.eex index 45da95e2b5..53ef700b14 100644 --- a/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/index.html.eex +++ b/apps/block_scout_web/lib/block_scout_web/templates/transaction_token_transfer/index.html.eex @@ -32,20 +32,6 @@ <%= render BlockScoutWeb.CommonComponentsView, "_pagination_container.html", position: "bottom", cur_page_number: "1", show_pagination_limit: true %> <% end %> - diff --git a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex index 97d13335f2..37073f0509 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/address_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/address_view.ex @@ -3,8 +3,6 @@ defmodule BlockScoutWeb.AddressView do require Logger - import BlockScoutWeb.AddressController, only: [validation_count: 1] - alias BlockScoutWeb.LayoutView alias Explorer.Chain alias Explorer.Chain.{Address, Hash, InternalTransaction, SmartContract, Token, TokenTransfer, Transaction, Wei} diff --git a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex index 86bac53410..8f996a2bcc 100644 --- a/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex +++ b/apps/block_scout_web/lib/block_scout_web/views/api/rpc/contract_view.ex @@ -76,16 +76,12 @@ defmodule BlockScoutWeb.API.RPC.ContractView do defp prepare_contract(%Address{ hash: hash, - smart_contract: nil, - decompiled_smart_contracts: decompiled_smart_contracts + smart_contract: nil }) do - decompiled_smart_contract = latest_decompiled_smart_contract(decompiled_smart_contracts) - %{ "Address" => to_string(hash), "ABI" => "Contract source code not verified", "ContractName" => "", - "DecompilerVersion" => decompiler_version(decompiled_smart_contract), "CompilerVersion" => "", "OptimizationUsed" => "" } @@ -93,16 +89,12 @@ defmodule BlockScoutWeb.API.RPC.ContractView do defp prepare_contract(%Address{ hash: hash, - smart_contract: %SmartContract{} = contract, - decompiled_smart_contracts: decompiled_smart_contracts + smart_contract: %SmartContract{} = contract }) do - decompiled_smart_contract = latest_decompiled_smart_contract(decompiled_smart_contracts) - %{ "Address" => to_string(hash), "ABI" => Jason.encode!(contract.abi), "ContractName" => contract.name, - "DecompilerVersion" => decompiler_version(decompiled_smart_contract), "CompilerVersion" => contract.compiler_version, "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") } diff --git a/apps/block_scout_web/lib/block_scout_web/views/common_components_view..ex b/apps/block_scout_web/lib/block_scout_web/views/common_components_view.ex similarity index 100% rename from apps/block_scout_web/lib/block_scout_web/views/common_components_view..ex rename to apps/block_scout_web/lib/block_scout_web/views/common_components_view.ex diff --git a/apps/block_scout_web/mix.exs b/apps/block_scout_web/mix.exs index 34289ec672..02e9d203fb 100644 --- a/apps/block_scout_web/mix.exs +++ b/apps/block_scout_web/mix.exs @@ -128,7 +128,7 @@ defmodule BlockScoutWeb.Mixfile do {:timex, "~> 3.4"}, {:wallaby, "~> 0.22", only: [:test], runtime: false}, # `:cowboy` `~> 2.0` and Phoenix 1.4 compatibility - {:wobserver, "~> 0.2.0", github: "KronicDeth/wobserver", ref: "99683a936c75c0a94ebb884cef019f7ed0b97112"}, + {:wobserver, "~> 0.2.0", github: "poanetwork/wobserver", branch: "support-https"}, {:phoenix_form_awesomplete, "~> 0.1.4"} ] end diff --git a/apps/block_scout_web/priv/gettext/default.pot b/apps/block_scout_web/priv/gettext/default.pot index afab9ebdec..dab33f910b 100644 --- a/apps/block_scout_web/priv/gettext/default.pot +++ b/apps/block_scout_web/priv/gettext/default.pot @@ -99,7 +99,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 #: lib/block_scout_web/templates/transaction_log/index.html.eex:22 -#: lib/block_scout_web/views/address_view.ex:101 +#: lib/block_scout_web/views/address_view.ex:99 msgid "Address" msgstr "" @@ -190,7 +190,7 @@ msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/overview.html.eex:95 #: lib/block_scout_web/templates/address_validation/index.html.eex:13 -#: lib/block_scout_web/views/address_view.ex:310 +#: lib/block_scout_web/views/address_view.ex:308 msgid "Blocks Validated" msgstr "" @@ -218,7 +218,7 @@ msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:42 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 -#: lib/block_scout_web/views/address_view.ex:306 +#: lib/block_scout_web/views/address_view.ex:304 msgid "Code" msgstr "" @@ -262,14 +262,14 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:13 -#: lib/block_scout_web/views/address_view.ex:99 +#: lib/block_scout_web/views/address_view.ex:97 msgid "Contract Address" msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 -#: lib/block_scout_web/views/address_view.ex:39 -#: lib/block_scout_web/views/address_view.ex:73 +#: lib/block_scout_web/views/address_view.ex:37 +#: lib/block_scout_web/views/address_view.ex:71 msgid "Contract Address Pending" msgstr "" @@ -307,13 +307,11 @@ msgid "Copy Address" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:10 #: lib/block_scout_web/templates/transaction/overview.html.eex:16 msgid "Copy Transaction Hash" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:14 #: lib/block_scout_web/templates/transaction/overview.html.eex:20 msgid "Copy Txn Hash" msgstr "" @@ -478,7 +476,7 @@ msgstr "" #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 -#: lib/block_scout_web/views/address_view.ex:305 +#: lib/block_scout_web/views/address_view.ex:303 #: lib/block_scout_web/views/transaction_view.ex:339 msgid "Internal Transactions" msgstr "" @@ -505,7 +503,7 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/index.html.eex:8 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 -#: lib/block_scout_web/views/address_view.ex:311 +#: lib/block_scout_web/views/address_view.ex:309 #: lib/block_scout_web/views/transaction_view.ex:340 msgid "Logs" msgstr "" @@ -513,7 +511,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/layout/app.html.eex:53 -#: lib/block_scout_web/views/address_view.ex:123 +#: lib/block_scout_web/views/address_view.ex:121 msgid "Market Cap" msgstr "" @@ -582,7 +580,6 @@ msgid "Next" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:37 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:32 msgid "Next Page" msgstr "" @@ -604,21 +601,6 @@ msgstr "" msgid "OUT" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:57 -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:81 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:38 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:80 -#: lib/block_scout_web/templates/address_validation/index.html.eex:38 -#: lib/block_scout_web/templates/block/index.html.eex:30 -#: lib/block_scout_web/templates/block_transaction/index.html.eex:50 -#: lib/block_scout_web/templates/pending_transaction/index.html.eex:39 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:43 -#: lib/block_scout_web/templates/transaction/index.html.eex:45 -#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:38 -msgid "Older" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:34 msgid "Optimization enabled" @@ -683,7 +665,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:58 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25 -#: lib/block_scout_web/views/address_view.ex:308 +#: lib/block_scout_web/views/address_view.ex:306 #: lib/block_scout_web/views/tokens/overview_view.ex:37 msgid "Read Contract" msgstr "" @@ -750,7 +732,7 @@ msgid "Telegram" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:26 msgid "There are no holders for this Token." msgstr "" @@ -771,7 +753,7 @@ msgid "There are no logs for this transaction." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:23 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:15 msgid "There are no token transfers for this address." msgstr "" @@ -863,7 +845,7 @@ msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:8 #: lib/block_scout_web/templates/address_token/index.html.eex:8 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 -#: lib/block_scout_web/views/address_view.ex:303 +#: lib/block_scout_web/views/address_view.ex:301 msgid "Tokens" msgstr "" @@ -910,7 +892,6 @@ msgid "Transaction %{transaction}, %{subnetwork} %{transaction}" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:22 #: lib/block_scout_web/templates/transaction/overview.html.eex:11 msgid "Transaction Details" msgstr "" @@ -922,7 +903,7 @@ msgstr "" #: lib/block_scout_web/templates/block_transaction/index.html.eex:17 #: lib/block_scout_web/templates/chain/show.html.eex:108 #: lib/block_scout_web/templates/layout/_topnav.html.eex:35 -#: lib/block_scout_web/views/address_view.ex:304 +#: lib/block_scout_web/views/address_view.ex:302 msgid "Transactions" msgstr "" @@ -1105,9 +1086,6 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_read_contract/index.html.eex:14 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 -#: lib/block_scout_web/templates/address_validation/index.html.eex:22 -#: lib/block_scout_web/templates/address_validation/index.html.eex:47 #: lib/block_scout_web/templates/chain/show.html.eex:99 #: lib/block_scout_web/templates/chain/show.html.eex:125 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:21 @@ -1130,22 +1108,7 @@ msgid "GraphQL" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:66 -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:90 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:47 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:71 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:89 -#: lib/block_scout_web/templates/block/index.html.eex:19 -#: lib/block_scout_web/templates/block/index.html.eex:39 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:32 -#: lib/block_scout_web/templates/pending_transaction/index.html.eex:48 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:33 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:44 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:52 -#: lib/block_scout_web/templates/transaction/index.html.eex:36 -#: lib/block_scout_web/templates/transaction/index.html.eex:54 msgid "Loading" msgstr "" @@ -1164,11 +1127,6 @@ msgstr "" msgid "Raw Input" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/block_transaction/404.html.eex:7 -msgid "Block Details" -msgstr "" - #, elixir-format #: lib/block_scout_web/views/block_transaction_view.ex:15 msgid "Block not found, please try again later." @@ -1189,41 +1147,6 @@ msgstr "" msgid "Invalid Transaction Hash" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:33 -msgid "Once we have the transaction's data this page will refresh automatically" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:38 -msgid "Some transactions may take a while longer to be indexed depending on the load on the network" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:34 -msgid "The possible reasons for this transaction not being processed include the following:" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:29 -msgid "The transaction %{bold_hash} was not processed yet" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:37 -msgid "The transaction may be in the pool of a node that didn't broadcast it yet" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:39 -msgid "The transaction still does not exist" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:36 -msgid "The transaction was made a few seconds ago" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/transaction/invalid.html.eex:8 msgid "is not a valid transaction hash" @@ -1316,19 +1239,19 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57 -#: lib/block_scout_web/templates/address_validation/index.html.eex:29 +#: lib/block_scout_web/templates/address_validation/index.html.eex:22 #: lib/block_scout_web/templates/chain/show.html.eex:91 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:19 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:19 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:21 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20 #: lib/block_scout_web/templates/transaction/index.html.eex:20 msgid "Something went wrong, click to reload." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_validation/index.html.eex:25 +#: lib/block_scout_web/templates/address_validation/index.html.eex:18 msgid "There are no blocks validated by this address." msgstr "" @@ -1349,15 +1272,10 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:20 -#: lib/block_scout_web/views/address_view.ex:309 +#: lib/block_scout_web/views/address_view.ex:307 msgid "Coin Balance History" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:48 -msgid "Loading balances" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:22 #: lib/block_scout_web/templates/chain/show.html.eex:13 @@ -1381,7 +1299,7 @@ msgid "There are no pending transactions." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/block/index.html.eex:23 +#: lib/block_scout_web/templates/block/index.html.eex:16 msgid "There are no blocks." msgstr "" @@ -1658,7 +1576,7 @@ msgid "Copy Decompiled Contract Code" msgstr "" #, elixir-format -#: lib/block_scout_web/views/address_view.ex:307 +#: lib/block_scout_web/views/address_view.ex:305 msgid "Decompiled Code" msgstr "" @@ -1726,7 +1644,7 @@ msgstr "" #, elixir-format #: -#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40 msgid "Page" msgstr "" @@ -1744,10 +1662,15 @@ msgstr "" #, elixir-format #: -#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40 msgid "of" msgstr "" +#, elixir-format +#: lib/block_scout_web/templates/block_transaction/404.html.eex:7 +msgid "Block Details" +msgstr "" + #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:83 msgid "Contract Byte Code" @@ -1777,3 +1700,33 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/index.html.eex:77 msgid "There are no logs for this address." msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:7 +msgid "Sorry, We are unable to locate this transaction Hash" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:12 +msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:30 +msgid "Back Home" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:22 +msgid "During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:26 +msgid "If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:16 +msgid "It could still be in the TX Pool of a different node, waiting to be broadcasted." +msgstr "" diff --git a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po index ba97f8ef18..9802f885ab 100644 --- a/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po +++ b/apps/block_scout_web/priv/gettext/en/LC_MESSAGES/default.po @@ -99,7 +99,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_validator_metadata_modal.html.eex:16 #: lib/block_scout_web/templates/transaction_log/index.html.eex:22 -#: lib/block_scout_web/views/address_view.ex:101 +#: lib/block_scout_web/views/address_view.ex:99 msgid "Address" msgstr "" @@ -190,7 +190,7 @@ msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:32 #: lib/block_scout_web/templates/address/overview.html.eex:95 #: lib/block_scout_web/templates/address_validation/index.html.eex:13 -#: lib/block_scout_web/views/address_view.ex:310 +#: lib/block_scout_web/views/address_view.ex:308 msgid "Blocks Validated" msgstr "" @@ -218,7 +218,7 @@ msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:42 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:165 #: lib/block_scout_web/templates/api_docs/_action_tile.html.eex:187 -#: lib/block_scout_web/views/address_view.ex:306 +#: lib/block_scout_web/views/address_view.ex:304 msgid "Code" msgstr "" @@ -262,14 +262,14 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_contract_verification/new.html.eex:13 -#: lib/block_scout_web/views/address_view.ex:99 +#: lib/block_scout_web/views/address_view.ex:97 msgid "Contract Address" msgstr "" #, elixir-format #: lib/block_scout_web/templates/transaction/_pending_tile.html.eex:16 -#: lib/block_scout_web/views/address_view.ex:39 -#: lib/block_scout_web/views/address_view.ex:73 +#: lib/block_scout_web/views/address_view.ex:37 +#: lib/block_scout_web/views/address_view.ex:71 msgid "Contract Address Pending" msgstr "" @@ -307,13 +307,11 @@ msgid "Copy Address" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:10 #: lib/block_scout_web/templates/transaction/overview.html.eex:16 msgid "Copy Transaction Hash" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:14 #: lib/block_scout_web/templates/transaction/overview.html.eex:20 msgid "Copy Txn Hash" msgstr "" @@ -478,7 +476,7 @@ msgstr "" #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:19 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:11 #: lib/block_scout_web/templates/transaction_internal_transaction/index.html.eex:6 -#: lib/block_scout_web/views/address_view.ex:305 +#: lib/block_scout_web/views/address_view.ex:303 #: lib/block_scout_web/views/transaction_view.ex:339 msgid "Internal Transactions" msgstr "" @@ -505,7 +503,7 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/index.html.eex:8 #: lib/block_scout_web/templates/transaction/_tabs.html.eex:17 #: lib/block_scout_web/templates/transaction_log/index.html.eex:8 -#: lib/block_scout_web/views/address_view.ex:311 +#: lib/block_scout_web/views/address_view.ex:309 #: lib/block_scout_web/views/transaction_view.ex:340 msgid "Logs" msgstr "" @@ -513,7 +511,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/chain/show.html.eex:31 #: lib/block_scout_web/templates/layout/app.html.eex:53 -#: lib/block_scout_web/views/address_view.ex:123 +#: lib/block_scout_web/views/address_view.ex:121 msgid "Market Cap" msgstr "" @@ -582,7 +580,6 @@ msgid "Next" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:37 #: lib/block_scout_web/templates/tokens/inventory/index.html.eex:32 msgid "Next Page" msgstr "" @@ -604,21 +601,6 @@ msgstr "" msgid "OUT" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:57 -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:81 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:38 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:80 -#: lib/block_scout_web/templates/address_validation/index.html.eex:38 -#: lib/block_scout_web/templates/block/index.html.eex:30 -#: lib/block_scout_web/templates/block_transaction/index.html.eex:50 -#: lib/block_scout_web/templates/pending_transaction/index.html.eex:39 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:43 -#: lib/block_scout_web/templates/transaction/index.html.eex:45 -#: lib/block_scout_web/templates/transaction_token_transfer/index.html.eex:38 -msgid "Older" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:34 msgid "Optimization enabled" @@ -683,7 +665,7 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:58 #: lib/block_scout_web/templates/tokens/overview/_tabs.html.eex:25 -#: lib/block_scout_web/views/address_view.ex:308 +#: lib/block_scout_web/views/address_view.ex:306 #: lib/block_scout_web/views/tokens/overview_view.ex:37 msgid "Read Contract" msgstr "" @@ -750,7 +732,7 @@ msgid "Telegram" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:24 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:26 msgid "There are no holders for this Token." msgstr "" @@ -771,7 +753,7 @@ msgid "There are no logs for this transaction." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:23 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:15 msgid "There are no token transfers for this address." msgstr "" @@ -863,7 +845,7 @@ msgstr "" #: lib/block_scout_web/templates/address/_tabs.html.eex:8 #: lib/block_scout_web/templates/address_token/index.html.eex:8 #: lib/block_scout_web/templates/address_token_transfer/index.html.eex:9 -#: lib/block_scout_web/views/address_view.ex:303 +#: lib/block_scout_web/views/address_view.ex:301 msgid "Tokens" msgstr "" @@ -910,7 +892,6 @@ msgid "Transaction %{transaction}, %{subnetwork} %{transaction}" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:22 #: lib/block_scout_web/templates/transaction/overview.html.eex:11 msgid "Transaction Details" msgstr "" @@ -922,7 +903,7 @@ msgstr "" #: lib/block_scout_web/templates/block_transaction/index.html.eex:17 #: lib/block_scout_web/templates/chain/show.html.eex:108 #: lib/block_scout_web/templates/layout/_topnav.html.eex:35 -#: lib/block_scout_web/views/address_view.ex:304 +#: lib/block_scout_web/views/address_view.ex:302 msgid "Transactions" msgstr "" @@ -1105,9 +1086,6 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_read_contract/index.html.eex:14 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:19 -#: lib/block_scout_web/templates/address_validation/index.html.eex:22 -#: lib/block_scout_web/templates/address_validation/index.html.eex:47 #: lib/block_scout_web/templates/chain/show.html.eex:99 #: lib/block_scout_web/templates/chain/show.html.eex:125 #: lib/block_scout_web/templates/tokens/read_contract/index.html.eex:21 @@ -1130,22 +1108,7 @@ msgid "GraphQL" msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:66 -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:73 -#: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:90 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:47 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:71 -#: lib/block_scout_web/templates/address_transaction/index.html.eex:89 -#: lib/block_scout_web/templates/block/index.html.eex:19 -#: lib/block_scout_web/templates/block/index.html.eex:39 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:32 -#: lib/block_scout_web/templates/pending_transaction/index.html.eex:48 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:33 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:44 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:34 -#: lib/block_scout_web/templates/tokens/transfer/index.html.eex:52 -#: lib/block_scout_web/templates/transaction/index.html.eex:36 -#: lib/block_scout_web/templates/transaction/index.html.eex:54 msgid "Loading" msgstr "" @@ -1164,11 +1127,6 @@ msgstr "" msgid "Raw Input" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/block_transaction/404.html.eex:7 -msgid "Block Details" -msgstr "" - #, elixir-format #: lib/block_scout_web/views/block_transaction_view.ex:15 msgid "Block not found, please try again later." @@ -1189,41 +1147,6 @@ msgstr "" msgid "Invalid Transaction Hash" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:33 -msgid "Once we have the transaction's data this page will refresh automatically" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:38 -msgid "Some transactions may take a while longer to be indexed depending on the load on the network" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:34 -msgid "The possible reasons for this transaction not being processed include the following:" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:29 -msgid "The transaction %{bold_hash} was not processed yet" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:37 -msgid "The transaction may be in the pool of a node that didn't broadcast it yet" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:39 -msgid "The transaction still does not exist" -msgstr "" - -#, elixir-format -#: lib/block_scout_web/templates/transaction/not_found.html.eex:36 -msgid "The transaction was made a few seconds ago" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/transaction/invalid.html.eex:8 msgid "is not a valid transaction hash" @@ -1316,19 +1239,19 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:34 #: lib/block_scout_web/templates/address_internal_transaction/index.html.eex:61 -#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:28 +#: lib/block_scout_web/templates/address_token_transfer/index.html.eex:20 #: lib/block_scout_web/templates/address_transaction/index.html.eex:57 -#: lib/block_scout_web/templates/address_validation/index.html.eex:29 +#: lib/block_scout_web/templates/address_validation/index.html.eex:22 #: lib/block_scout_web/templates/chain/show.html.eex:91 #: lib/block_scout_web/templates/pending_transaction/index.html.eex:19 -#: lib/block_scout_web/templates/tokens/holder/index.html.eex:19 +#: lib/block_scout_web/templates/tokens/holder/index.html.eex:21 #: lib/block_scout_web/templates/tokens/transfer/index.html.eex:20 #: lib/block_scout_web/templates/transaction/index.html.eex:20 msgid "Something went wrong, click to reload." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/address_validation/index.html.eex:25 +#: lib/block_scout_web/templates/address_validation/index.html.eex:18 msgid "There are no blocks validated by this address." msgstr "" @@ -1349,15 +1272,10 @@ msgstr "" #, elixir-format #: lib/block_scout_web/templates/address/_tabs.html.eex:20 -#: lib/block_scout_web/views/address_view.ex:309 +#: lib/block_scout_web/views/address_view.ex:307 msgid "Coin Balance History" msgstr "" -#, elixir-format -#: lib/block_scout_web/templates/address_coin_balance/index.html.eex:48 -msgid "Loading balances" -msgstr "" - #, elixir-format #: lib/block_scout_web/templates/address_coin_balance/index.html.eex:22 #: lib/block_scout_web/templates/chain/show.html.eex:13 @@ -1381,7 +1299,7 @@ msgid "There are no pending transactions." msgstr "" #, elixir-format -#: lib/block_scout_web/templates/block/index.html.eex:23 +#: lib/block_scout_web/templates/block/index.html.eex:16 msgid "There are no blocks." msgstr "" @@ -1658,7 +1576,7 @@ msgid "Copy Decompiled Contract Code" msgstr "" #, elixir-format -#: lib/block_scout_web/views/address_view.ex:307 +#: lib/block_scout_web/views/address_view.ex:305 msgid "Decompiled Code" msgstr "" @@ -1726,7 +1644,7 @@ msgstr "" #, elixir-format #: -#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40 msgid "Page" msgstr "" @@ -1744,10 +1662,15 @@ msgstr "" #, elixir-format #: -#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:37 +#: lib/block_scout_web/templates/common_components/_pagination_container.html.eex:40 msgid "of" msgstr "" +#, elixir-format +#: lib/block_scout_web/templates/block_transaction/404.html.eex:7 +msgid "Block Details" +msgstr "" + #, elixir-format #: lib/block_scout_web/templates/address_contract/index.html.eex:83 msgid "Contract Byte Code" @@ -1777,3 +1700,33 @@ msgstr "" #: lib/block_scout_web/templates/address_logs/index.html.eex:77 msgid "There are no logs for this address." msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:7 +msgid "Sorry, We are unable to locate this transaction Hash" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:12 +msgid "If you have just submitted this transaction please wait for at least 30 seconds before refreshing this page." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:30 +msgid "Back Home" +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:22 +msgid "During times when the network is busy (i.e during ICOs) it can take a while for your transaction to propagate through the network and for us to index it." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:26 +msgid "If it still does not show up after 1 hour, please check with your sender/exchange/wallet/transaction provider for additional information." +msgstr "" + +#, elixir-format +#: lib/block_scout_web/templates/transaction/not_found.html.eex:16 +msgid "It could still be in the TX Pool of a different node, waiting to be broadcasted." +msgstr "" diff --git a/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs index e4e25174b1..8f64abafa6 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/address_controller_test.exs @@ -15,11 +15,10 @@ defmodule BlockScoutWeb.AddressControllerTest do start_supervised!(AddressesWithBalanceCounter) AddressesWithBalanceCounter.consolidate() - conn = get(conn, address_path(conn, :index)) + conn = get(conn, address_path(conn, :index, %{type: "JSON"})) + {:ok, %{"items" => items}} = Poison.decode(conn.resp_body) - assert conn.assigns.address_tx_count_pairs - |> Enum.map(fn {address, _transaction_count} -> address end) - |> Enum.map(& &1.hash) == address_hashes + assert Enum.count(items) == Enum.count(address_hashes) end test "returns an address's primary name when present", %{conn: conn} do @@ -29,9 +28,11 @@ defmodule BlockScoutWeb.AddressControllerTest do start_supervised!(AddressesWithBalanceCounter) AddressesWithBalanceCounter.consolidate() - conn = get(conn, address_path(conn, :index)) + conn = get(conn, address_path(conn, :index, %{type: "JSON"})) - assert html_response(conn, 200) =~ address_name.name + {:ok, %{"items" => [item]}} = Poison.decode(conn.resp_body) + + assert String.contains?(item, "POA Wallet") end end diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs index 993b25fcec..e6a0e7e702 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/address_controller_test.exs @@ -5,7 +5,7 @@ defmodule BlockScoutWeb.API.RPC.AddressControllerTest do alias BlockScoutWeb.API.RPC.AddressController alias Explorer.Chain - alias Explorer.Chain.{BlockNumberCache, Events.Subscriber, Transaction, Wei} + alias Explorer.Chain.{Events.Subscriber, Transaction, Wei} alias Explorer.Counters.{AddressesWithBalanceCounter, AverageBlockTime} alias Indexer.Fetcher.CoinBalanceOnDemand alias Explorer.Repo diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs index 399e49bfff..e070cf8e57 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/rpc/contract_controller_test.exs @@ -47,7 +47,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(contract.address_hash), "CompilerVersion" => contract.compiler_version, "ContractName" => contract.name, - "DecompilerVersion" => "", "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") } ] @@ -70,7 +69,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(address.hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "", "OptimizationUsed" => "" } ] @@ -94,7 +92,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(address.hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "", "OptimizationUsed" => "" } ] @@ -122,7 +119,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(address.hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "", "OptimizationUsed" => "" } ] @@ -145,7 +141,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "ABI" => Jason.encode!(contract.abi), "Address" => to_string(contract.address_hash), "CompilerVersion" => contract.compiler_version, - "DecompilerVersion" => "", "ContractName" => contract.name, "OptimizationUsed" => if(contract.optimization, do: "1", else: "0") } @@ -170,7 +165,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(decompiled_smart_contract.address_hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "test_decompiler", "OptimizationUsed" => "" } ] @@ -194,7 +188,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(smart_contract.address_hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "bizbuz", "OptimizationUsed" => "" } ] @@ -214,16 +207,15 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do assert response["message"] == "OK" assert response["status"] == "1" - assert response["result"] == [ - %{ - "ABI" => "Contract source code not verified", - "Address" => to_string(smart_contract.address_hash), - "CompilerVersion" => "", - "ContractName" => "", - "DecompilerVersion" => "bizbuz", - "OptimizationUsed" => "" - } - ] + assert %{ + "ABI" => "Contract source code not verified", + "Address" => to_string(smart_contract.address_hash), + "CompilerVersion" => "", + "ContractName" => "", + "OptimizationUsed" => "" + } in response["result"] + + refute to_string(non_match.address_hash) in Enum.map(response["result"], &Map.get(&1, "Address")) end test "filtering for only not_decompiled (and by extension not verified contracts)", %{params: params, conn: conn} do @@ -245,7 +237,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(contract_address.hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "", "OptimizationUsed" => "" } ] @@ -274,7 +265,6 @@ defmodule BlockScoutWeb.API.RPC.ContractControllerTest do "Address" => to_string(contract_address.hash), "CompilerVersion" => "", "ContractName" => "", - "DecompilerVersion" => "", "OptimizationUsed" => "" } ] diff --git a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs index 3df8561d0a..d6b52c8490 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/api/v1/decompiled_smart_contract_controller_test.exs @@ -2,7 +2,7 @@ defmodule BlockScoutWeb.API.V1.DecompiledControllerTest do use BlockScoutWeb.ConnCase alias Explorer.Repo - alias Explorer.Chain.DecompiledSmartContract + alias Explorer.Chain.{Address, DecompiledSmartContract} import Ecto.Query, only: [from: 2] @@ -87,6 +87,24 @@ defmodule BlockScoutWeb.API.V1.DecompiledControllerTest do assert decompiled_smart_contract.decompiler_version == decompiler_version assert decompiled_smart_contract.decompiled_source_code == decompiled_source_code end + + test "updates the address to be decompiled", %{conn: conn} do + address_hash = to_string(insert(:address, hash: "0x0000000000000000000000000000000000000001").hash) + decompiler_version = "test_decompiler" + decompiled_source_code = "hello world" + + params = %{ + "address_hash" => address_hash, + "decompiler_version" => decompiler_version, + "decompiled_source_code" => decompiled_source_code + } + + request = post(conn, api_v1_decompiled_smart_contract_path(conn, :create), params) + + assert request.status == 201 + + assert Repo.get!(Address, address_hash).decompiled + end end describe "when user is not authorized" do diff --git a/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs b/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs index 6a4e2ebf32..b8f6233e49 100644 --- a/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs +++ b/apps/block_scout_web/test/block_scout_web/controllers/block_transaction_controller_test.exs @@ -165,7 +165,7 @@ defmodule BlockScoutWeb.BlockTransactionControllerTest do defp assert_block_above_tip(conn) do assert conn |> html_response(404) - |> Floki.find(~S|[data-selector="block-not-found-message"|) + |> Floki.find(~S|.error-descr|) |> Floki.text() |> String.trim() == "Easy Cowboy! This block does not exist yet!" end diff --git a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex index d56a85cd9f..98174be69a 100644 --- a/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex +++ b/apps/ethereum_jsonrpc/lib/ethereum_jsonrpc/parity/fetched_beneficiaries.ex @@ -173,6 +173,7 @@ defmodule EthereumJSONRPC.Parity.FetchedBeneficiaries do defp get_address_type(reward_type, index) when reward_type == "external" and index == 1, do: :emission_funds defp get_address_type(reward_type, index) when reward_type == "external" and index == 2, do: :validator defp get_address_type(reward_type, index) when reward_type == "external" and index == 3, do: :validator + defp get_address_type(reward_type, index) when reward_type == "external" and index == 4, do: :validator defp get_address_type(reward_type, _index) when reward_type == "block", do: :validator defp get_address_type(reward_type, _index) when reward_type == "uncle", do: :uncle end diff --git a/apps/explorer/config/config.exs b/apps/explorer/config/config.exs index 0ba1a960c7..94a1d79c6d 100644 --- a/apps/explorer/config/config.exs +++ b/apps/explorer/config/config.exs @@ -9,7 +9,10 @@ use Mix.Config config :explorer, ecto_repos: [Explorer.Repo], coin: System.get_env("COIN") || "POA", - token_functions_reader_max_retries: 3 + token_functions_reader_max_retries: 3, + allowed_evm_versions: + System.get_env("ALLOWED_EVM_VERSIONS") || + "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg" config :explorer, Explorer.Counters.AverageBlockTime, enabled: true diff --git a/apps/explorer/lib/explorer/chain.ex b/apps/explorer/lib/explorer/chain.ex index 0977df1dd2..9446388531 100644 --- a/apps/explorer/lib/explorer/chain.ex +++ b/apps/explorer/lib/explorer/chain.ex @@ -363,21 +363,6 @@ defmodule Explorer.Chain do Repo.aggregate(Block, :count, :hash) end - @doc """ - The number of consensus blocks. - - iex> insert(:block, consensus: true) - iex> insert(:block, consensus: false) - iex> Explorer.Chain.block_consensus_count() - 1 - - """ - def block_consensus_count do - Block - |> where(consensus: true) - |> Repo.aggregate(:count, :hash) - end - @doc """ Reward for mining a block. @@ -569,9 +554,19 @@ defmodule Explorer.Chain do @spec create_decompiled_smart_contract(map()) :: {:ok, Address.t()} | {:error, Ecto.Changeset.t()} def create_decompiled_smart_contract(attrs) do - %DecompiledSmartContract{} - |> DecompiledSmartContract.changeset(attrs) - |> Repo.insert(on_conflict: :replace_all, conflict_target: [:decompiler_version, :address_hash]) + changeset = DecompiledSmartContract.changeset(%DecompiledSmartContract{}, attrs) + + Multi.new() + |> Multi.insert(:decompiled_smart_contract, changeset, + on_conflict: :replace_all, + conflict_target: [:decompiler_version, :address_hash] + ) + |> Multi.run(:set_address_decompiled, &set_address_decompiled/2) + |> Repo.transaction() + |> case do + {:ok, %{decompiled_smart_contract: decompiled_smart_contract}} -> {:ok, decompiled_smart_contract} + {:error, _, error_value, _} -> {:error, error_value} + end end @doc """ @@ -1997,7 +1992,9 @@ defmodule Explorer.Chain do cached_value = BlockCountCache.count() if is_nil(cached_value) do - block_consensus_count() + %Postgrex.Result{rows: [[count]]} = Repo.query!("SELECT reltuples FROM pg_class WHERE relname = 'blocks';") + + trunc(count * 0.90) else cached_value end @@ -2248,6 +2245,7 @@ defmodule Explorer.Chain do |> Multi.insert(:smart_contract, smart_contract_changeset) |> Multi.run(:clear_primary_address_names, &clear_primary_address_names/2) |> Multi.run(:insert_address_name, &create_address_name/2) + |> Multi.run(:set_address_verified, &set_address_verified/2) |> Repo.transaction() with {:ok, %{smart_contract: smart_contract}} <- insert_result do @@ -2255,6 +2253,35 @@ defmodule Explorer.Chain do else {:error, :smart_contract, changeset, _} -> {:error, changeset} + + {:error, :set_address_verified, message, _} -> + {:error, message} + end + end + + defp set_address_verified(repo, %{smart_contract: %SmartContract{address_hash: address_hash}}) do + query = + from( + address in Address, + where: address.hash == ^address_hash + ) + + case repo.update_all(query, set: [verified: true]) do + {1, _} -> {:ok, []} + _ -> {:error, "There was an error annotating that the address has been verified."} + end + end + + defp set_address_decompiled(repo, %{decompiled_smart_contract: %DecompiledSmartContract{address_hash: address_hash}}) do + query = + from( + address in Address, + where: address.hash == ^address_hash + ) + + case repo.update_all(query, set: [decompiled: true]) do + {1, _} -> {:ok, []} + _ -> {:error, "There was an error annotating that the address has been verified."} end end @@ -2767,50 +2794,46 @@ defmodule Explorer.Chain do query = from( address in Address, - where: - fragment( - "EXISTS (SELECT 1 FROM decompiled_smart_contracts WHERE decompiled_smart_contracts.address_hash = ?)", - address.hash - ), - preload: [:decompiled_smart_contracts, :smart_contract], - order_by: [asc: address.inserted_at], + where: address.contract_code != <<>>, + where: not is_nil(address.contract_code), + where: address.decompiled == true, limit: ^limit, - offset: ^offset + offset: ^offset, + order_by: [asc: address.inserted_at], + preload: [:smart_contract] ) query - |> filter_decompiled_with_version(not_decompiled_with_version) + |> reject_decompiled_with_version(not_decompiled_with_version) |> Repo.all() end - defp filter_decompiled_with_version(query, nil) do - query - end + defp reject_decompiled_with_version(query, nil), do: query - defp filter_decompiled_with_version(query, not_decompiled_with_version) do - from(address in query, - left_join: decompiled_smart_contract in DecompiledSmartContract, - on: decompiled_smart_contract.decompiler_version == ^not_decompiled_with_version, - on: decompiled_smart_contract.address_hash == address.hash, - where: is_nil(decompiled_smart_contract.id), - distinct: [address.hash] + defp reject_decompiled_with_version(query, reject_version) do + from( + address in query, + left_join: decompiled_smart_contract in assoc(address, :decompiled_smart_contracts), + on: decompiled_smart_contract.decompiler_version == ^reject_version, + where: is_nil(decompiled_smart_contract.address_hash) ) end def list_verified_contracts(limit, offset) do query = from( - address in Address, - where: not is_nil(address.contract_code), - join: smart_contract in SmartContract, - on: smart_contract.address_hash == address.hash, - preload: [{:smart_contract, smart_contract}, :decompiled_smart_contracts], - order_by: [asc: address.inserted_at], + smart_contract in SmartContract, + order_by: [asc: smart_contract.inserted_at], limit: ^limit, - offset: ^offset + offset: ^offset, + preload: [:address] ) - Repo.all(query) + query + |> Repo.all() + |> Enum.map(fn smart_contract -> + Map.put(smart_contract.address, :smart_contract, smart_contract) + end) end def list_contracts(limit, offset) do @@ -2818,7 +2841,7 @@ defmodule Explorer.Chain do from( address in Address, where: not is_nil(address.contract_code), - preload: [:smart_contract, :decompiled_smart_contracts], + preload: [:smart_contract], order_by: [asc: address.inserted_at], limit: ^limit, offset: ^offset @@ -2827,22 +2850,22 @@ defmodule Explorer.Chain do Repo.all(query) end - def list_unverified_contracts(limit, offset) do + def list_unordered_unverified_contracts(limit, offset) do query = from( address in Address, - left_join: smart_contract in SmartContract, - on: smart_contract.address_hash == address.hash, - where: not is_nil(address.contract_code), - where: is_nil(smart_contract.address_hash), where: address.contract_code != <<>>, - preload: [{:smart_contract, smart_contract}, :decompiled_smart_contracts], - order_by: [asc: address.inserted_at], + where: not is_nil(address.contract_code), + where: fragment("? IS NOT TRUE", address.verified), limit: ^limit, offset: ^offset ) - Repo.all(query) + query + |> Repo.all() + |> Enum.map(fn address -> + %{address | smart_contract: nil} + end) end def list_empty_contracts(limit, offset) do @@ -2858,30 +2881,23 @@ defmodule Explorer.Chain do Repo.all(query) end - def list_not_decompiled_contracts(limit, offset) do + def list_unordered_not_decompiled_contracts(limit, offset) do query = from( address in Address, - where: - fragment( - "NOT EXISTS (SELECT 1 FROM decompiled_smart_contracts WHERE decompiled_smart_contracts.address_hash = ?)", - address.hash - ), + where: fragment("? IS NOT TRUE", address.verified), + where: fragment("? IS NOT TRUE", address.decompiled), where: address.contract_code != <<>>, - left_join: smart_contract in SmartContract, - on: smart_contract.address_hash == address.hash, - left_join: decompiled_smart_contract in DecompiledSmartContract, - on: decompiled_smart_contract.address_hash == address.hash, - preload: [:smart_contract, :decompiled_smart_contracts], where: not is_nil(address.contract_code), - where: is_nil(smart_contract.address_hash), - where: is_nil(decompiled_smart_contract.address_hash), - order_by: [asc: address.inserted_at], limit: ^limit, offset: ^offset ) - Repo.all(query) + query + |> Repo.all() + |> Enum.map(fn address -> + %{address | smart_contract: nil} + end) end @doc """ diff --git a/apps/explorer/lib/explorer/chain/address.ex b/apps/explorer/lib/explorer/chain/address.ex index a565306fd7..a619d70546 100644 --- a/apps/explorer/lib/explorer/chain/address.ex +++ b/apps/explorer/lib/explorer/chain/address.ex @@ -22,7 +22,7 @@ defmodule Explorer.Chain.Address do Wei } - @optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce)a + @optional_attrs ~w(contract_code fetched_coin_balance fetched_coin_balance_block_number nonce decompiled verified)a @required_attrs ~w(hash)a @allowed_attrs @optional_attrs ++ @required_attrs @@ -75,6 +75,8 @@ defmodule Explorer.Chain.Address do field(:fetched_coin_balance_block_number, :integer) field(:contract_code, Data) field(:nonce, :integer) + field(:decompiled, :boolean, default: false) + field(:verified, :boolean, default: false) field(:has_decompiled_code?, :boolean, virtual: true) field(:stale?, :boolean, virtual: true) diff --git a/apps/explorer/lib/explorer/chain/import/runner/addresses.ex b/apps/explorer/lib/explorer/chain/import/runner/addresses.ex index 8a3ab2eb02..564c36452b 100644 --- a/apps/explorer/lib/explorer/chain/import/runner/addresses.ex +++ b/apps/explorer/lib/explorer/chain/import/runner/addresses.ex @@ -13,6 +13,11 @@ defmodule Explorer.Chain.Import.Runner.Addresses do @behaviour Import.Runner + @row_defaults %{ + decompiled: false, + verified: false + } + # milliseconds @timeout 60_000 @@ -45,9 +50,16 @@ defmodule Explorer.Chain.Import.Runner.Addresses do update_transactions_options = %{timeout: transactions_timeout, timestamps: timestamps} + changes_list_with_defaults = + Enum.map(changes_list, fn change -> + Enum.reduce(@row_defaults, change, fn {default_key, default_value}, acc -> + Map.put_new(acc, default_key, default_value) + end) + end) + multi |> Multi.run(:addresses, fn repo, _ -> - insert(repo, changes_list, insert_options) + insert(repo, changes_list_with_defaults, insert_options) end) |> Multi.run(:created_address_code_indexed_at_transactions, fn repo, %{addresses: addresses} when is_list(addresses) -> diff --git a/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex b/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex index 3a03a7bcd5..cdc2530f93 100644 --- a/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex +++ b/apps/explorer/lib/explorer/counters/addresses_with_balance_counter.ex @@ -40,15 +40,10 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do end @impl true - def init(args) do + def init(_args) do create_table() - if enable_consolidation?() do - Task.start_link(&consolidate/0) - schedule_next_consolidation() - end - - {:ok, args} + {:ok, %{consolidate?: enable_consolidation?()}, {:continue, :ok}} end def create_table do @@ -63,9 +58,7 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do end defp schedule_next_consolidation do - if enable_consolidation?() do - Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds)) - end + Process.send_after(self(), :consolidate, :timer.seconds(@update_interval_in_seconds)) end @doc """ @@ -75,6 +68,19 @@ defmodule Explorer.Counters.AddressesWithBalanceCounter do :ets.insert(table_name(), {key, info}) end + @impl true + def handle_continue(:ok, %{consolidate?: true} = state) do + consolidate() + schedule_next_consolidation() + + {:noreply, state} + end + + @impl true + def handle_continue(:ok, state) do + {:noreply, state} + end + @impl true def handle_info(:consolidate, state) do consolidate() diff --git a/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex b/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex index 1aa81d2488..4c4fea4109 100644 --- a/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex +++ b/apps/explorer/lib/explorer/smart_contract/solc_downloader.ex @@ -86,7 +86,7 @@ defmodule Explorer.SmartContract.SolcDownloader do download_path = "https://ethereum.github.io/solc-bin/bin/soljson-#{version}.js" download_path - |> HTTPoison.get!([], timeout: 60_000) + |> HTTPoison.get!([], timeout: 60_000, recv_timeout: 60_000) |> Map.get(:body) end end diff --git a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex index 656f1b9734..3e41bb08fa 100644 --- a/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex +++ b/apps/explorer/lib/explorer/smart_contract/solidity/code_compiler.ex @@ -8,7 +8,6 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do require Logger @new_contract_name "New.sol" - @allowed_evm_versions ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] @doc """ Compiles a code in the solidity command line. @@ -72,13 +71,13 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do code = Keyword.fetch!(params, :code) optimize = Keyword.fetch!(params, :optimize) optimization_runs = params |> Keyword.get(:optimization_runs, 200) |> Integer.to_string() - evm_version = Keyword.get(params, :evm_version, List.last(@allowed_evm_versions)) + evm_version = Keyword.get(params, :evm_version, List.last(allowed_evm_versions())) external_libs = Keyword.get(params, :external_libs, %{}) external_libs_string = Jason.encode!(external_libs) checked_evm_version = - if evm_version in @allowed_evm_versions do + if evm_version in allowed_evm_versions() do evm_version else "byzantium" @@ -125,7 +124,12 @@ defmodule Explorer.SmartContract.Solidity.CodeCompiler do end end - def allowed_evm_versions, do: @allowed_evm_versions + def allowed_evm_versions do + :explorer + |> Application.get_env(:allowed_evm_versions) + |> String.split(",") + |> Enum.map(fn version -> String.trim(version) end) + end def get_contract_info(contracts, _) when contracts == %{}, do: {:error, :compilation} diff --git a/apps/explorer/priv/repo/migrations/20190516140202_add_address_hash_index_to_decompiled_smart_contracts.exs b/apps/explorer/priv/repo/migrations/20190516140202_add_address_hash_index_to_decompiled_smart_contracts.exs new file mode 100644 index 0000000000..689a3757d2 --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190516140202_add_address_hash_index_to_decompiled_smart_contracts.exs @@ -0,0 +1,14 @@ +defmodule Explorer.Repo.Migrations.AddAddressHashIndexToDecompiledSmartContracts do + use Ecto.Migration + + def change do + execute( + """ + CREATE INDEX IF NOT EXISTS decompiled_smart_contracts_address_hash_index ON decompiled_smart_contracts(address_hash); + """, + """ + DROP INDEX IF EXISTS decompiled_smart_contracts_address_hash_index + """ + ) + end +end diff --git a/apps/explorer/priv/repo/migrations/20190516160535_add_decompiled_and_verified_flag_to_addresses.exs b/apps/explorer/priv/repo/migrations/20190516160535_add_decompiled_and_verified_flag_to_addresses.exs new file mode 100644 index 0000000000..cfc45092fd --- /dev/null +++ b/apps/explorer/priv/repo/migrations/20190516160535_add_decompiled_and_verified_flag_to_addresses.exs @@ -0,0 +1,18 @@ +defmodule Explorer.Repo.Migrations.AddDecompiledAndVerifiedFlagToAddresses do + use Ecto.Migration + + def change do + execute( + """ + ALTER TABLE addresses + ADD COLUMN IF NOT EXISTS decompiled BOOLEAN, + ADD COLUMN IF NOT EXISTS verified BOOLEAN; + """, + """ + ALTER TABLE addresses + DROP COLUMN IF EXISTS decompiled, + DROP COLUMN IF EXISTS verified; + """ + ) + end +end diff --git a/apps/explorer/test/explorer/chain_test.exs b/apps/explorer/test/explorer/chain_test.exs index cafd742e2a..0234672183 100644 --- a/apps/explorer/test/explorer/chain_test.exs +++ b/apps/explorer/test/explorer/chain_test.exs @@ -2859,6 +2859,12 @@ defmodule Explorer.ChainTest do assert {:ok, _} = Chain.create_smart_contract(attrs) assert Repo.get_by(Address.Name, name: "SimpleStorage") end + + test "sets the address verified field to true", %{valid_attrs: valid_attrs} do + assert {:ok, %SmartContract{} = smart_contract} = Chain.create_smart_contract(valid_attrs) + + assert Repo.get_by(Address, hash: smart_contract.address_hash).verified == true + end end describe "stream_unfetched_balances/2" do diff --git a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs index 57f15577ac..be68a03a0e 100644 --- a/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs +++ b/apps/explorer/test/explorer/smart_contract/solidity/code_compiler_test.exs @@ -310,6 +310,34 @@ defmodule Explorer.SmartContract.Solidity.CodeCompilerTest do end end + # describe "allowed_evm_versions/0" do + # test "returns allowed evm versions defined by ALLOWED_EVM_VERSIONS env var" do + # Application.put_env(:explorer, :allowed_evm_versions, "CustomEVM1,CustomEVM2,CustomEVM3") + # response = CodeCompiler.allowed_evm_versions() + + # assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response + # end + + # test "returns allowed evm versions defined by not trimmed ALLOWED_EVM_VERSIONS env var" do + # Application.put_env(:explorer, :allowed_evm_versions, "CustomEVM1, CustomEVM2, CustomEVM3") + # response = CodeCompiler.allowed_evm_versions() + + # assert ["CustomEVM1", "CustomEVM2", "CustomEVM3"] = response + # end + + # test "returns default_allowed_evm_versions" do + # Application.put_env( + # :explorer, + # :allowed_evm_versions, + # "homestead,tangerineWhistle,spuriousDragon,byzantium,constantinople,petersburg" + # ) + + # response = CodeCompiler.allowed_evm_versions() + + # assert ["homestead", "tangerineWhistle", "spuriousDragon", "byzantium", "constantinople", "petersburg"] = response + # end + # end + defp remove_init_data_and_whisper_data(code) do {res, _} = code diff --git a/apps/explorer/test/support/factory.ex b/apps/explorer/test/support/factory.ex index 115b07e066..fcde1e13f2 100644 --- a/apps/explorer/test/support/factory.ex +++ b/apps/explorer/test/support/factory.ex @@ -482,6 +482,7 @@ defmodule Explorer.Factory do address = %Address{ hash: address_hash(), + verified: true, contract_code: contract_code_info().bytecode, smart_contract: smart_contract } @@ -519,7 +520,7 @@ defmodule Explorer.Factory do contract_code_info = contract_code_info() %SmartContract{ - address_hash: insert(:address, contract_code: contract_code_info.bytecode).hash, + address_hash: insert(:address, contract_code: contract_code_info.bytecode, verified: true).hash, compiler_version: contract_code_info.version, name: contract_code_info.name, contract_source_code: contract_code_info.source_code, @@ -532,7 +533,7 @@ defmodule Explorer.Factory do contract_code_info = contract_code_info() %DecompiledSmartContract{ - address_hash: insert(:address, contract_code: contract_code_info.bytecode).hash, + address_hash: insert(:address, contract_code: contract_code_info.bytecode, decompiled: true).hash, decompiler_version: "test_decompiler", decompiled_source_code: contract_code_info.source_code } diff --git a/docker/Makefile b/docker/Makefile index 1f49ff50b5..ac1c2677d6 100644 --- a/docker/Makefile +++ b/docker/Makefile @@ -1,6 +1,7 @@ SYSTEM = $(shell uname -s) HOST = host.docker.internal DOCKER_IMAGE = blockscout_prod +BS_CONTAINER_NAME = blockscout PG_CONTAINER_NAME = postgres PG_CONTAINER_IMAGE = postgres:10.4 THIS_FILE = $(lastword $(MAKEFILE_LIST)) @@ -87,7 +88,7 @@ endif start: build postgres @echo "==> Starting blockscout" - @docker run --rm \ + @docker run --rm --name $(BS_CONTAINER_NAME) \ $(BLOCKSCOUT_CONTAINNER_PARAMS) \ -p 4000:4000 \ $(DOCKER_IMAGE) /bin/sh -c "mix phx.server" diff --git a/mix.lock b/mix.lock index e9066554b1..df1be8c242 100644 --- a/mix.lock +++ b/mix.lock @@ -109,5 +109,5 @@ "unicode_util_compat": {:hex, :unicode_util_compat, "0.4.1", "d869e4c68901dd9531385bb0c8c40444ebf624e60b6962d95952775cac5e90cd", [:rebar3], [], "hexpm"}, "wallaby": {:hex, :wallaby, "0.22.0", "e5d16bfa7ab23562c8a6e3b0a31445a2fd470ca622082a910114807ba823780d", [:mix], [{:httpoison, "~> 0.12 or ~> 1.0", [hex: :httpoison, repo: "hexpm", optional: false]}, {:poison, ">= 1.4.0", [hex: :poison, repo: "hexpm", optional: false]}, {:poolboy, "~> 1.5", [hex: :poolboy, repo: "hexpm", optional: false]}], "hexpm"}, "websocket_client": {:hex, :websocket_client, "1.3.0", "2275d7daaa1cdacebf2068891c9844b15f4fdc3de3ec2602420c2fb486db59b6", [:rebar3], [], "hexpm"}, - "wobserver": {:git, "https://github.com/KronicDeth/wobserver.git", "99683a936c75c0a94ebb884cef019f7ed0b97112", [ref: "99683a936c75c0a94ebb884cef019f7ed0b97112"]}, + "wobserver": {:git, "https://github.com/poanetwork/wobserver.git", "13bcda30a87f4f0be1878920a79433ad831eefbe", [branch: "support-https"]}, }