Skip to content

Commit

Permalink
Merge pull request #605 from threshold-network/support-sepolia
Browse files Browse the repository at this point in the history
Support deployment on Sepolia
  • Loading branch information
lukasz-zimnoch authored Nov 23, 2023
2 parents 6d8b382 + eeed2b1 commit ae3a434
Show file tree
Hide file tree
Showing 27 changed files with 412 additions and 410 deletions.
41 changes: 22 additions & 19 deletions .github/workflows/dashboard-ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ on:
workflow_dispatch:
inputs:
environment:
description: "Environment (network) for workflow execution, e.g. `goerli`"
description: "Environment (network) for workflow execution, e.g. `sepolia`"
required: false
upstream_builds:
description: "Upstream builds"
Expand Down Expand Up @@ -42,7 +42,10 @@ jobs:
run: git config --global url."https://".insteadOf git://

- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --ignore-scripts --frozen-lockfile

- name: Run token-dashboard post-install script
run: yarn run postinstall

- name: Check formatting
run: yarn format
Expand Down Expand Up @@ -74,7 +77,7 @@ jobs:
@keep-network/keep-ecdsa \
@keep-network/tbtc \
@keep-network/coverage-pools \
@keep-network/random-beacon
@keep-network/random-beacon --ignore-scripts
- name: Run postinstall script
# `yarn upgrade` doesn't trigger the `postinstall` script.
Expand All @@ -84,9 +87,9 @@ jobs:
run: yarn build
env:
PUBLIC_URL: /${{ github.head_ref }}
CHAIN_ID: 5
ETH_HOSTNAME_HTTP: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
CHAIN_ID: 11155111
ETH_HOSTNAME_HTTP: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ETH_HOSTNAME_WS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
NODE_OPTIONS: --max_old_space_size=4096
ELECTRUM_PROTOCOL: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
ELECTRUM_HOST: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand All @@ -98,7 +101,7 @@ jobs:
# run: yarn test

# This job will be triggered for PR updates. It will build the dashboard
# using `dapp-development-goerli`-taggeed packages which contain contracts
# using `dapp-development-sepolia`-taggeed packages which contain contracts
# with values modified to help with the testing of dashboard. The code will be
# published to
# https://preview.dashboard.test.threshold.network/${{ github.head_ref }}/index.html
Expand All @@ -109,18 +112,18 @@ jobs:
if: github.event_name == 'pull_request'
uses: ./.github/workflows/reusable-build-and-publish.yml
with:
environment: goerli
environment: sepolia
useUpstreamBuilds: false
# We use `dapp-development-goerli`-taggeed packages with modified
# We use `dapp-development-sepolia`-taggeed packages with modified
# contracts. They contain modifications that help with the testing of
# dashboard features.
dependentPackagesTag: dapp-development-goerli
dependentPackagesTag: dapp-development-sepolia
gcpBucketName: preview.dashboard.test.threshold.network
gcpBucketPath: ${{ github.head_ref }}
preview: true
secrets:
ethUrlHttp: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand All @@ -144,14 +147,14 @@ jobs:
uses: ./.github/workflows/reusable-build-and-publish.yml
with:
requireApproval: true
environment: goerli
environment: sepolia
useUpstreamBuilds: true
upstreamBuilds: ${{ github.event.inputs.upstream_builds }}
gcpBucketName: dashboard.test.threshold.network
preview: false
secrets:
ethUrlHttp: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand All @@ -170,14 +173,14 @@ jobs:
if: github.event_name == 'push'
uses: ./.github/workflows/reusable-build-and-publish.yml
with:
environment: goerli
environment: sepolia
useUpstreamBuilds: false
dependentPackagesTag: goerli
dependentPackagesTag: sepolia
gcpBucketName: dashboard.test.threshold.network
preview: false
secrets:
ethUrlHttp: ${{ secrets.GOERLI_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.GOERLI_ETH_HOSTNAME_WS }}
ethUrlHttp: ${{ secrets.SEPOLIA_ETH_HOSTNAME_HTTP }}
ethUrlWS: ${{ secrets.SEPOLIA_ETH_HOSTNAME_WS }}
gcpServiceKey: ${{ secrets.KEEP_TEST_CI_UPLOAD_DAPP_JSON_KEY_BASE64 }}
electrumProtocol: ${{ secrets.TESTNET_ELECTRUMX_PROTOCOL }}
electrumHost: ${{ secrets.TESTNET_ELECTRUMX_HOST }}
Expand Down
5 changes: 4 additions & 1 deletion .github/workflows/dashboard-mainnet.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,10 @@ jobs:
run: git config --global url."https://".insteadOf git://

- name: Install dependencies
run: yarn install --frozen-lockfile
run: yarn install --ignore-scripts --frozen-lockfile

- name: Run token-dashboard post-install script
run: yarn run postinstall

# FIXME: It's work in progress, the contracts are not yet published.
# - name: Resolve latest mainnet contracts
Expand Down
45 changes: 21 additions & 24 deletions .github/workflows/reusable-build-and-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@ on:
required: false
default: false
type: boolean
# Currently the action only supports `environment` = `goerli`.
environment:
description: >
The environment on which the action should be used. For example `goerli`.
Will be used to deterine environment variables and decide which legacy
The environment on which the action should be used. For example `sepolia`.
Will be used to determine environment variables and decide which legacy
packages should be used for building.
required: true
type: string
Expand All @@ -28,7 +27,7 @@ on:
description: >
Tag which should be used to pull latest non-legacy `threshold-network` and
`keep-network` packages with contracts (required if
`useUpstreamBuilds==false`). For example `dapp-dev-goerli`.
`useUpstreamBuilds==false`). For example `dapp-dev-sepolia`.
required: false
type: string
gcpBucketName:
Expand Down Expand Up @@ -102,7 +101,11 @@ jobs:

- name: Install dependencies
shell: bash
run: yarn install --frozen-lockfile
run: yarn install --ignore-scripts --frozen-lockfile

- name: Run token-dashboard post-install script
shell: bash
run: yarn run postinstall

- name: Get upstream packages versions
if: inputs.useUpstreamBuilds == true
Expand All @@ -114,48 +117,42 @@ jobs:
threshold-contracts-version = github.com/threshold-network/solidity-contracts#version
random-beacon-contracts-version = github.com/keep-network/keep-core/random-beacon#version
# Currently we only support `environment` = `sepolia`. We provide explicit
# version of the `solidity-contracts` package, because using `sepolia` tag
# results in `expected manifest` error - probably caused by bug in Yarn:
# https://github.com/yarnpkg/yarn/issues/4731.
- name: Set packages versions
shell: bash
id: set-packages-versions
env:
TC_VERSION_MAPPING: '{"sepolia": "1.3.0-sepolia.0", "dapp-development-sepolia": "1.3.0-dapp-dev-sepolia.0"}'
run: |
if [ ${{ inputs.useUpstreamBuilds }} = 'false' ]; then
echo "threshold-contracts-version=${{ inputs.dependentPackagesTag }}" >> $GITHUB_OUTPUT
echo "threshold-contracts-version=${{ fromJson(env.TC_VERSION_MAPPING)[inputs.dependentPackagesTag] || inputs.dependentPackagesTag }}" >> $GITHUB_OUTPUT
echo "random-beacon-contracts-version=${{ inputs.dependentPackagesTag }}" >> $GITHUB_OUTPUT
else
echo "threshold-contracts-version=${{ steps.upstream-builds-query.outputs.threshold-contracts-version }}" >> $GITHUB_OUTPUT
echo "random-beacon-contracts-version=${{ steps.upstream-builds-query.outputs.random-beacon-contracts-version }}" >> $GITHUB_OUTPUT
fi
# Currently we only support `environment` = `goerli`. We provide explicit
# version of the `keep-core` package, because using `goerli` tag results
# in `expected manifest` error - probably caused by bug in Yarn:
# https://github.com/yarnpkg/yarn/issues/4731.

# In the `package.json` there are two different versions of
# `coverage-pools` used. This is done to allow using contracts from two
# different cov pool versions on the mainnet (needed for computations of
# the TVL-related fields) - one relates to KEEP token cov pool (<2.0.0)
# and one to to T token one (>=2.0.0).
# On the testnet environmet we currently don't have the T token cov pool
# deployed. The latest `goerli`- tagged version of the cov-pools package
# (`1.1.0-goerli.0`) contains KEEP-token related contracts. We want to
# stick to this version (we'll need to update it once we switch to
# Sepolia). For the `@threshold-network/coverage-pools` ideally we'd want
# to use a T token related pool, which if deployed for given environment,
# should be present in the latest `goerli`/`sepolia` package. If the
# T-related pool is not yet deployed for given environment, KEEP-related
# cov-pool contracts will be used in all TVL computations (which differs
# from the mainnet behavior, but is acceptable on the test env).

# On the testnet environmet we currently don't have the KEEP token cov
# pool deployed. The T-related cov-pool contracts will be used in all TVL
# computations (which differs from the mainnet behavior, but is acceptable
# on the test env).
- name: Resolve contracts
shell: bash
run: |
yarn upgrade \
@threshold-network/solidity-contracts@${{ steps.set-packages-versions.outputs.threshold-contracts-version }} \
@keep-network/keep-core@1.8.1-goerli.0 \
@keep-network/keep-core@${{ inputs.environment }} \
@keep-network/keep-ecdsa@${{ inputs.environment }} \
@keep-network/tbtc@${{ inputs.environment }} \
@keep-network/coverage-pools@1.1.0-goerli.0 \
@keep-network/coverage-pools@${{ inputs.environment }} \
@threshold-network/coverage-pools@npm:@keep-network/coverage-pools@${{ inputs.environment }} \
@keep-network/random-beacon@${{ steps.set-packages-versions.outputs.random-beacon-contracts-version }}
Expand Down
35 changes: 17 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -41,46 +41,45 @@ To make sure the changes made in local depository of `components` lib are implem

`yarn add-components-lib`

# Run T dapp against the Görli network
# Run T dapp against the Sepolia network

## Update the `.env` file:

```
REACT_APP_SUPPORTED_CHAIN_ID=5
REACT_APP_SUPPORTED_CHAIN_ID=11155111
REACT_APP_ETH_HOSTNAME_HTTP=<your http ETH hostname- eg. Infura>
REACT_APP_ETH_HOSTNAME_WS=<your ws ETH hostname- eg. Infura>
// We can skip this env variable- the dapp uses the correct address
// of Multicall contract for Görli under the hood.
// of Multicall contract for Sepolia under the hood.
REACT_APP_MULTICALL_ADDRESS=$MULTICALL_ADDRESS
```

## Setup

`yarn`

## Install Görli contracts
## Install Sepolia contracts

```
yarn upgrade @keep-network/coverage-pools@goerli \
@keep-network/ecdsa@goerli \
@keep-network/keep-core@goerli \
@keep-network/keep-ecdsa@goerli \
@keep-network/random-beacon@goerli \
@keep-network/tbtc@goerli \
@keep-network/tbtc-v2@goerli \
@keep-network/tbtc-v2.ts@goerli \
@threshold-network/coverage-pools@npm:@keep-network/coverage-pools@goerli \
@threshold-network/solidity-contracts@goerli
yarn upgrade @keep-network/coverage-pools@sepolia \
@keep-network/ecdsa@sepolia \
@keep-network/keep-core@sepolia \
@keep-network/keep-ecdsa@sepolia \
@keep-network/random-beacon@sepolia \
@keep-network/tbtc@sepolia \
@keep-network/tbtc-v2@sepolia \
@threshold-network/coverage-pools@npm:@keep-network/coverage-pools@sepolia \
@threshold-network/solidity-contracts@sepolia
```

**NOTE 1:** We use the same Goerli versions for both
**NOTE 1:** We use the same Sepolia versions for both
`@keep-network/coverage-pools` and `@threshold-network/coverage-pools`, because
we don't have the newest version of the package on Goerli network, only on the
we don't have the v1 version of the package on Sepolia network, only on the
Mainnet.

**NOTE 2:** If you encounter an `expected manifest` error while executing this,
then try providing an explicit version of the `keep-core` package:
`@keep-network/[email protected]goerli.0`
`@keep-network/[email protected]sepolia.0`
The error is probably caused by a bug in Yarn:
https://github.com/yarnpkg/yarn/issues/4731.

Expand Down Expand Up @@ -111,7 +110,7 @@ The following procedure allows to deploy T token dashboard to production:
`releases/mainnet/<version>`. Release branch should never be merged to `main`
and creating a PR with a release branch is not required.
Dependencies and project version needs to be updated on the release branch.
All `-dev`, `-goerli` dependencies need to be updated to mainnet versions.
All `-dev`, `-sepolia` dependencies need to be updated to mainnet versions.
See [this commit](https://github.com/threshold-network/token-dashboard/commit/5452b68886ebc514d941a087973dfa9ac3802a7e)
for `v1.0.0` release as a good example.
2. Preview of the release branch will be uploaded to `preview.dashboard.threshold.network`
Expand Down
2 changes: 1 addition & 1 deletion src/components/Navbar/NetworkButton.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ const NetworkButton: FC<{ chainId?: number }> = ({ chainId }) => {
icon: <Icon as={ethereumLogo} />,
bg: "gray.700",
},
[ChainID.Goerli]: {
[ChainID.Sepolia]: {
icon: (
<Icon
as={MdOutlineTrain}
Expand Down
2 changes: 1 addition & 1 deletion src/enums/web3.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
export enum ChainID {
Ethereum = 1,
Goerli = 5,
Sepolia = 11155111,
Localhost = 1337,
}

Expand Down
1 change: 1 addition & 0 deletions src/threshold-ts/multicall/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,7 @@ export const MULTICALL_ABI = [
export const MULTICALL_ADDRESSESS = {
1: "0xeefba1e63905ef1d7acba5a8513c70307c1ce441",
5: "0x77dca2c955b15e9de4dbbcf1246b4b85b651e50e",
11155111: "0xcA11bde05977b3631167028862bE2a173976CA11",
1337: process.env.REACT_APP_MULTICALL_ADDRESS || AddressZero,
} as Record<number | string, string>

Expand Down

Large diffs are not rendered by default.

Large diffs are not rendered by default.

Loading

0 comments on commit ae3a434

Please sign in to comment.