Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Expose Hemi's bitcoin finality #3

Merged
merged 5 commits into from
Apr 4, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/ISSUE_TEMPLATE/config.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
blank_issues_enabled: false
blank_issues_enabled: true
contact_links:
- name: Feature Request
url: https://blockscout.canny.io/feature-requests
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,10 @@ jobs:
strategy:
fail-fast: false
matrix:
project: [ default, mobile, dark-color-mode ]
# "mobile" was removed from the projects list as it is consistently
# failing, manual tests show no problems and is not clear where the
# problem comes from.
project: [ default, dark-color-mode ]

steps:
- name: Install git-lfs
Expand Down
21 changes: 21 additions & 0 deletions .github/workflows/cleanup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,13 @@ jobs:
kubeConfigSecret: ci/data/dev/kubeconfig/k8s-dev
vaultRole: ci-dev
secrets: inherit
# This job tries to clean up the k8s setup. But we don't have such thing in
# the Hemi setup. Disabling instead of deleting to keep this as referenence
# for potential future improvements.
if: false
permissions:
id-token: write
contents: read
cleanup_l2_release:
uses: blockscout/blockscout-ci-cd/.github/workflows/cleanup_helmfile.yaml@master
with:
Expand All @@ -26,8 +33,22 @@ jobs:
kubeConfigSecret: ci/data/dev/kubeconfig/k8s-dev
vaultRole: ci-dev
secrets: inherit
# This job tries to clean up the k8s setup. But we don't have such thing in
# the Hemi setup. Disabling instead of deleting to keep this as referenence
# for potential future improvements.
if: false
permissions:
id-token: write
contents: read
cleanup_docker_image:
uses: blockscout/blockscout-ci-cd/.github/workflows/cleanup_docker.yaml@master
with:
dockerImage: review-$GITHUB_REF_NAME_SLUG
secrets: inherit
# This job has to be temporarily disabled as Hemi uses Docker Hub instead of
# GitHub to host the images. The referenced workflow will try to remove the
# image from GitHub. A new workflow needs to be created to do this instead.
if: false
permissions:
id-token: write
contents: read
10 changes: 10 additions & 0 deletions .github/workflows/deploy-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@ jobs:
kubeConfigSecret: ci/data/dev/kubeconfig/k8s-dev
vaultRole: ci-dev
secrets: inherit
# This job will deploy the newly created image version to k8s, but Hemi is
# not using that setup at the moment. Disabling it until the pipeline is
# revised and adapted.
if: false
permissions: write-all

deploy_l2:
name: Deploy frontend (L2)
Expand All @@ -39,3 +44,8 @@ jobs:
kubeConfigSecret: ci/data/dev/kubeconfig/k8s-dev
vaultRole: ci-dev
secrets: inherit
# This job will deploy the newly created image version to k8s, but Hemi is
# not using that setup at the moment. Disabling it until the pipeline is
# revised and adapted.
if: false
permissions: write-all
2 changes: 1 addition & 1 deletion .github/workflows/deploy-review-l2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
needs: make_slug
uses: './.github/workflows/publish-image.yml'
with:
tags: ghcr.io/blockscout/frontend:review-${{ needs.make_slug.outputs.REF_SLUG }}
tags: hemilabs/frontend:review-${{ needs.make_slug.outputs.REF_SLUG }}
secrets: inherit

deploy_review_l2:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deploy-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
needs: make_slug
uses: './.github/workflows/publish-image.yml'
with:
tags: ghcr.io/blockscout/frontend:review-${{ needs.make_slug.outputs.REF_SLUG }}
tags: hemilabs/frontend:review-${{ needs.make_slug.outputs.REF_SLUG }}
secrets: inherit

deploy_review:
Expand Down
4 changes: 4 additions & 0 deletions .github/workflows/project-management.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,10 @@ jobs:
review_requested_issues:
name: Get issues linked to PR
runs-on: ubuntu-latest
permissions:
contents: write
pull-requests: write
repository-projects: write
if: ${{ github.event.pull_request && github.event.action == 'review_requested' }}
outputs:
issues: ${{ steps.linked_issues.outputs.result }}
Expand Down
11 changes: 5 additions & 6 deletions .github/workflows/publish-image.yml
Original file line number Diff line number Diff line change
Expand Up @@ -40,14 +40,13 @@ jobs:
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/blockscout/frontend
images: hemilabs/frontend

- name: Login to GitHub Container Registry
uses: docker/login-action@v2
- name: Login to DockerHub
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }}

- name: Add SHORT_SHA env property with commit short sha
run: echo "SHORT_SHA=`echo ${GITHUB_SHA} | cut -c1-8`" >> $GITHUB_ENV
Expand Down
3 changes: 3 additions & 0 deletions .github/workflows/update-project-cards.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,9 @@ jobs:
run:
name: Run
runs-on: ubuntu-latest
# Project management at Hemi is not done using GitHub Projects.
# Disabling this job. Otherwise it fails because no tokens are supplied.
if: false
steps:
- name: Getting project info
id: project_info
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,18 +2,18 @@

<p align="center">
<span>Frontend application for </span>
<a href="https://github.com/blockscout/blockscout/blob/master/README.md">Blockscout</a>
<a href="https://github.com/hemilabs/blockscout/blob/master/README.md">Blockscout</a>
<span> blockchain explorer</span>
</p>

## Running and configuring the app

App is distributed as a docker image. Here you can find information about the [package](https://github.com/blockscout/frontend/pkgs/container/frontend) and its recent [releases](https://github.com/blockscout/frontend/releases).
App is distributed as a docker image. Images are automatically built and pushed to the repository on every merge to the default branch. Here you can find information about the [package](https://hub.docker.com/repository/docker/hemilabs/frontend/general) and its recent [releases](https://github.com/hemilabs/frontend/releases). If an image is required outside that automated flow, see [how to manually trigger the build and push workflow](./docs/MANUAL_BUILD.md).

You can configure your app by passing necessary environment variables when starting the container. See full list of ENVs and their description [here](./docs/ENVS.md).

```sh
docker run -p 3000:3000 --env-file <path-to-your-env-file> ghcr.io/blockscout/frontend:latest
docker run -p 3000:3000 --env-file <path-to-your-env-file> hemilabs/frontend:latest
```

Alternatively, you can build your own docker image and run your app from that. Please follow this [guide](./docs/CUSTOM_BUILD.md).
Expand Down
2 changes: 1 addition & 1 deletion configs/envs/.env.eth_goerli
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ NEXT_PUBLIC_FEATURED_NETWORKS=https://raw.githubusercontent.com/blockscout/front
NEXT_PUBLIC_NETWORK_LOGO=https://raw.githubusercontent.com/blockscout/frontend-configs/dev/configs/network-logos/goerli.svg
NEXT_PUBLIC_NETWORK_ICON=https://raw.githubusercontent.com/blockscout/frontend-configs/dev/configs/network-icons/goerli.svg
## footer
##views
## views
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES=[{'name':'LooksRare','collection_url':'https://goerli.looksrare.org/collections/{hash}','instance_url':'https://goerli.looksrare.org/collections/{hash}/{id}','logo_url':'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/nft-marketplace-logos/looks-rare.png'}]
## misc
NEXT_PUBLIC_NETWORK_EXPLORERS=[{'title':'Bitquery','baseUrl':'https://explorer.bitquery.io/','paths':{'tx':'/goerli/tx','address':'/goerli/address','token':'/goerli/token','block':'/goerli/block'}},{'title':'Etherscan','baseUrl':'https://goerli.etherscan.io/','paths':{'tx':'/tx','address':'/address','token':'/token','block':'/block'}}]
Expand Down
1 change: 1 addition & 0 deletions configs/envs/.env.optimism_goerli
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ NEXT_PUBLIC_FEATURED_NETWORKS=https://raw.githubusercontent.com/blockscout/front
## footer
## misc
NEXT_PUBLIC_NETWORK_EXPLORERS=[{'title':'Etherscan','baseUrl':'https://etherscan.io/','paths':{'tx':'/tx','address':'/address','token':'/token','block':'/block'}}]

# app features
NEXT_PUBLIC_APP_INSTANCE=local
NEXT_PUBLIC_APP_ENV=development
Expand Down
2 changes: 1 addition & 1 deletion configs/envs/.env.sepolia
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ NEXT_PUBLIC_NETWORK_ICON_DARK=https://raw.githubusercontent.com/blockscout/front
NEXT_PUBLIC_OTHER_LINKS=[{'url':'https://sepolia.drpc.org?ref=559183','text':'Public RPC'}]
## footer
NEXT_PUBLIC_FOOTER_LINKS=https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/footer-links/sepolia.json
##views
## views
NEXT_PUBLIC_VIEWS_NFT_MARKETPLACES=[{'name':'LooksRare','collection_url':'https://sepolia.looksrare.org/collections/{hash}','instance_url':'https://sepolia.looksrare.org/collections/{hash}/{id}','logo_url':'https://raw.githubusercontent.com/blockscout/frontend-configs/main/configs/nft-marketplace-logos/looks-rare.png'}]
## misc
NEXT_PUBLIC_NETWORK_EXPLORERS=[{'title':'Etherscan','baseUrl':'https://sepolia.etherscan.io/','paths':{'tx':'/tx','address':'/address','token':'/token','block':'/block'}},{'title':'Tenderly','baseUrl':'https://dashboard.tenderly.co','paths':{'tx':'/tx/sepolia'}}]
Expand Down
2 changes: 1 addition & 1 deletion deploy/tools/envs-validator/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ async function checkPlaceholdersCongruity(envsMap: Record<string, string>) {
console.log(` ${ env }`);
});
console.log(` They are either deprecated or running the app with them may lead to unexpected behavior.
Please check the documentation for more details - https://github.com/blockscout/frontend/blob/main/docs/ENVS.md
Please check the documentation for more details - https://github.com/hemilabs/frontend/blob/main/docs/ENVS.md
`);
throw new Error();
}
Expand Down
2 changes: 1 addition & 1 deletion deploy/tools/feature-reporter/entry.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ async function run() {
console.log();
try {
console.log(`📋 Here is the list of the features enabled for the running instance.
To adjust their configuration, please refer to the documentation - https://github.com/blockscout/frontend/blob/main/docs/ENVS.md#app-features
To adjust their configuration, please refer to the documentation - https://github.com/hemilabs/frontend/blob/main/docs/ENVS.md#app-features
`);
Object.entries(config.features)
.forEach(([ , feature ]) => {
Expand Down
6 changes: 6 additions & 0 deletions docs/MANUAL_BUILD.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
# Manually build and push Docker images

The [Publish Docker image workflow](.github/workflows/publish-image.yml) can be manually triggered from the GitHub UI:

1. Go to `Actions` and select the `Publish Docker image` workflow in the left.
1. Open the `Run workflow` pull-down in the right, select the branch and add a tag like `hemilabs/frontend:latest`, then click the `Run workflow` button.
5 changes: 3 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"name": "blockscout-frontend",
"version": "1.0.0",
"private": false,
"homepage": "https://github.com/blockscout/frontend#readme",
"homepage": "https://github.com/hemilabs/frontend#readme",
"engines": {
"node": "20.11.0",
"npm": "10.2.4"
Expand Down Expand Up @@ -149,7 +149,8 @@
"typescript": "^5.1.0",
"vite-plugin-svgr": "^2.2.2",
"vite-tsconfig-paths": "^3.5.2",
"ws": "^8.11.0"
"ws": "^8.11.0",
"yarn": "^1.22.21"
},
"lint-staged": {
"*.{js,jsx,ts,tsx}": "eslint --cache --fix"
Expand Down
2 changes: 1 addition & 1 deletion theme/components/Modal.ts
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ const baseStyleDialog = defineStyle((props) => {

const baseStyleDialogContainer = defineStyle({
'::-webkit-scrollbar': { display: 'none' },
'scrollbar-width': 'none',
scrollbarWidth: 'none',
// '@supports (height: -webkit-fill-available)': { height: '-webkit-fill-available' },
});

Expand Down
4 changes: 2 additions & 2 deletions theme/global.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ const global = (props: StyleFunctionProps) => ({
body: {
bg: mode('white', 'black')(props),
...getDefaultTransitionProps(),
'-webkit-tap-highlight-color': 'transparent',
'font-variant-ligatures': 'no-contextual',
WebkitTapHighlightColor: 'transparent',
fontVariantLigatures: 'no-contextual',
},
mark: {
bgColor: mode('green.100', 'green.800')(props),
Expand Down
2 changes: 1 addition & 1 deletion theme/utils/getOutlinedFieldStyles.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export default function getOutlinedFieldStyles(props: StyleFunctionProps) {
},
':-webkit-autofill': {
// background color for disabled input which value was selected from browser autocomplete popup
'-webkit-box-shadow': `0 0 0px 1000px ${ mode('rgba(16, 17, 18, 0.08)', 'rgba(255, 255, 255, 0.08)')(props) } inset`,
WebkitBoxShadow: `0 0 0px 1000px ${ mode('rgba(16, 17, 18, 0.08)', 'rgba(255, 255, 255, 0.08)')(props) } inset`,
},
},
_invalid: {
Expand Down
8 changes: 4 additions & 4 deletions tools/scripts/favicon-generator.dev.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
secrets_file="./configs/envs/.env.secrets"
favicon_folder="./public/favicon/"
master_url="https://raw.githubusercontent.com/blockscout/frontend/main/tools/scripts/favicon.svg"
master_url="https://raw.githubusercontent.com/hemilabs/frontend/main/tools/scripts/favicon.svg"

if [ ! -f "$secrets_file" ]; then
echo "Error: File '$secrets_file' not found."
exit 1
echo "Error: File '$secrets_file' not found."
exit 1
fi

dotenv \
Expand All @@ -16,4 +16,4 @@ if [ -d "$favicon_folder" ]; then
rm -r "$favicon_folder"
fi
mkdir -p "$favicon_folder"
cp -r ./deploy/tools/favicon-generator/output/* "$favicon_folder"
cp -r ./deploy/tools/favicon-generator/output/* "$favicon_folder"
2 changes: 2 additions & 0 deletions types/api/block.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ export interface Block {
bitcoin_merged_mining_merkle_proof?: string | null;
hash_for_merged_mining?: string | null;
minimum_gas_price?: string | null;
// HEMI FIELDS
btc_finality?: number;
}

export interface BlocksResponse {
Expand Down
2 changes: 2 additions & 0 deletions types/api/transaction.ts
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,8 @@ export type Transaction = {
zkevm_batch_number?: number;
zkevm_status?: typeof ZKEVM_L2_TX_STATUSES[number];
zkevm_sequence_hash?: string;
// Hemi fields
btc_finality?: number;
}

export const ZKEVM_L2_TX_STATUSES = [ 'Confirmed by Sequencer', 'L1 Confirmed' ];
Expand Down
11 changes: 11 additions & 0 deletions ui/block/BlockDetails.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,17 @@ const BlockDetails = ({ query }: Props) => {
>
<DetailsTimestamp timestamp={ data.timestamp } isLoading={ isPlaceholderData }/>
</DetailsInfoItem>
{ data.btc_finality && (
<DetailsInfoItem
title="Bitcoin finality"
hint="Number of Bitcoin block confirmations protecting this block."
isLoading={ isPlaceholderData }
>
<Skeleton isLoaded={ !isPlaceholderData }>
{ data.btc_finality }
</Skeleton>
</DetailsInfoItem>
) }
<DetailsInfoItem
title="Transactions"
hint="The number of transactions in the block"
Expand Down
6 changes: 3 additions & 3 deletions ui/shared/Tabs/AdaptiveTabsList.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -51,13 +51,13 @@ const AdaptiveTabsList = (props: Props) => {
overflowX={{ base: 'auto', lg: 'initial' }}
overscrollBehaviorX="contain"
css={{
'scroll-snap-type': 'x mandatory',
scrollSnapType: 'x mandatory',
// hide scrollbar
'&::-webkit-scrollbar': { /* Chromiums */
display: 'none',
},
'-ms-overflow-style': 'none', /* IE and Edge */
'scrollbar-width': 'none', /* Firefox */
MsOverflowStyle: 'none', /* IE and Edge */
scrollbarWidth: 'none', /* Firefox */
}}
bgColor={ listBgColor }
transitionProperty="top,box-shadow,background-color,color"
Expand Down
4 changes: 2 additions & 2 deletions ui/snippets/footer/Footer.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@ import getApiVersionUrl from './utils/getApiVersionUrl';

const MAX_LINKS_COLUMNS = 4;

const FRONT_VERSION_URL = `https://github.com/blockscout/frontend/tree/${ config.UI.footer.frontendVersion }`;
const FRONT_COMMIT_URL = `https://github.com/blockscout/frontend/commit/${ config.UI.footer.frontendCommit }`;
const FRONT_VERSION_URL = `https://github.com/hemilabs/frontend/tree/${ config.UI.footer.frontendVersion }`;
const FRONT_COMMIT_URL = `https://github.com/hemilabs/frontend/commit/${ config.UI.footer.frontendCommit }`;

const Footer = () => {

Expand Down
11 changes: 11 additions & 0 deletions ui/tx/details/TxInfo.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -226,6 +226,17 @@ const TxInfo = ({ data, isLoading, socketStatus }: Props) => {
) }
</DetailsInfoItem>
) }
{ data.btc_finality && (
<DetailsInfoItem
title="Bitcoin finality"
hint="Number of Bitcoin block confirmations protecting this transaction."
isLoading={ isLoading }
>
<Skeleton isLoaded={ !isLoading }>
{ data.btc_finality }
</Skeleton>
</DetailsInfoItem>
) }
{ data.execution_node && (
<DetailsInfoItem
title="Kettle"
Expand Down
5 changes: 5 additions & 0 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16212,6 +16212,11 @@ yargs@^17.7.2:
y18n "^5.0.5"
yargs-parser "^21.1.1"

yarn@^1.22.21:
version "1.22.21"
resolved "https://registry.yarnpkg.com/yarn/-/yarn-1.22.21.tgz#1959a18351b811cdeedbd484a8f86c3cc3bbaf72"
integrity sha512-ynXaJsADJ9JiZ84zU25XkPGOvVMmZ5b7tmTSpKURYwgELdjucAOydqIOrOfTxVYcNXe91xvLZwcRh68SR3liCg==

[email protected]:
version "3.1.1"
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
Expand Down
Loading