Skip to content

Commit

Permalink
Merge branch 'main' into a7_relayer_watchdog_updates
Browse files Browse the repository at this point in the history
  • Loading branch information
mask-pp authored Feb 17, 2024
2 parents 1ccf538 + 58ffe10 commit 610e31f
Show file tree
Hide file tree
Showing 360 changed files with 9,056 additions and 12,680 deletions.
9 changes: 0 additions & 9 deletions .github/dependabot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,12 +26,3 @@ updates:
time: "04:20"
timezone: "America/New_York"
open-pull-requests-limit: 10

- package-ecosystem: "pip"
directory: "/packages/protocol/simulation"
schedule:
interval: "monthly"
day: "saturday"
time: "04:20"
timezone: "America/New_York"
open-pull-requests-limit: 10
4 changes: 2 additions & 2 deletions .github/workflows/bridge-ui-v2.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install pnpm dependencies
uses: ./.github/actions/install-pnpm-dependencies
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/eventindexer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.21.0
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -33,11 +33,11 @@ jobs:
needs: lint
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: ">=1.21.0"
Expand All @@ -60,7 +60,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/guardianproverhealthcheck.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.21.0
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -33,11 +33,11 @@ jobs:
needs: lint
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: "1.21.0"
Expand All @@ -60,7 +60,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/protocol.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,12 @@ jobs:
runs-on: ubuntu-latest
steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- name: Checkout repository
uses: actions/checkout@v3
uses: actions/checkout@v4
with:
submodules: recursive

Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/relayer.yml
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ jobs:
- uses: actions/setup-go@v3
with:
go-version: 1.21.0
- uses: actions/checkout@v3
- uses: actions/checkout@v4
- name: golangci-lint
uses: golangci/golangci-lint-action@v3
with:
Expand All @@ -33,11 +33,11 @@ jobs:
needs: lint
steps:
- name: Cancel Previous Runs
uses: styfle/cancel-workflow-action@0.11.0
uses: styfle/cancel-workflow-action@0.12.1
with:
access_token: ${{ github.token }}

- uses: actions/checkout@v3
- uses: actions/checkout@v4
- uses: actions/setup-go@v3
with:
go-version: "1.21.0"
Expand All @@ -60,7 +60,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
with:
ref: ${{ github.ref }}

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/release-please.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,6 @@ jobs:
release-please:
runs-on: ubuntu-latest
steps:
- uses: google-github-actions/release-please-action@v3
- uses: google-github-actions/release-please-action@v4
with:
command: manifest
2 changes: 0 additions & 2 deletions .github/workflows/validate-pr-title.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,8 +35,6 @@ jobs:
guardian-prover-health-check-ui
protocol
relayer
starter-dapp
status-page
requireScope: true
subjectPattern: ^(?![A-Z]).+$ # Require lowercase PR title
subjectPatternError: |
Expand Down
3 changes: 1 addition & 2 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,5 @@
"packages/eventindexer": "0.13.0",
"packages/fork-diff": "0.4.0",
"packages/protocol": "0.15.2",
"packages/relayer": "0.12.0",
"packages/status-page": "0.12.0"
"packages/relayer": "0.12.0"
}
2 changes: 1 addition & 1 deletion CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ This section describes our coding standards at Taiko.

### Pull requests

Specify the scope of your change with a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) in the PR title (for example, `feat(scope): description of feature`). This will be squashed and merged into the `main` branch. You can find the full list of allowed scopes [here](https://github.com/taikoxyz/taiko-mono/blob/main/.github/workflows/lint-pr.yml#L19).
Specify the scope of your change with a [conventional commit](https://www.conventionalcommits.org/en/v1.0.0/) in the PR title (for example, `feat(scope): description of feature`). This will be squashed and merged into the `main` branch. You can find the full list of allowed scopes [here](https://github.com/taikoxyz/taiko-mono/blob/main/.github/workflows/validate-pr-title.yml).

Because we squash all of the changes into a single commit, please try to keep the PR limited to the scope specified in the commit message. This commit message will end up in the automated changelog by checking which packages are affected by the commit.

Expand Down
4 changes: 1 addition & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -38,9 +38,7 @@ taiko-mono/
│ ├── <a href="./packages/eventindexer">eventindexer</a>: Event indexer.
│ ├── <a href="./packages/fork-diff">fork-diff</a>: Fork <a href="https://geth.taiko.xyz">diff page</a> (currently, for Geth).
│ ├── <a href="./packages/protocol">protocol</a>: Taiko protocol and bridge smart contracts.
│ ├── <a href="./packages/relayer">relayer</a>: Bridge backend relayer in Go.
│ ├── <a href="./packages/starter-dapp">starter-dapp</a>: Template for Taiko dapps.
│ └── <a href="./packages/status-page">status-page</a>: Taiko protocol status page.
│ └── <a href="./packages/relayer">relayer</a>: Bridge backend relayer in Go.
...
</pre>

Expand Down
3 changes: 3 additions & 0 deletions packages/bridge-ui-v2/.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@ export PUBLIC_WALLETCONNECT_PROJECT_ID=""
export PUBLIC_NFT_BRIDGE_ENABLED=""
export PUBLIC_NFT_BATCH_TRANSFERS_ENABLED=""

# comma separated list of IPFS gateways, e.g. "https://ipfs.io,https://cloudflare-ipfs.com",...
export PUBLIC_IPFS_GATEWAYS=""

# Sentry
export PUBLIC_SENTRY_DSN=https://
export SENTRY_ORG=
Expand Down
34 changes: 32 additions & 2 deletions packages/bridge-ui-v2/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ This package contains the Bridge UI built with svelte and wagmi
- [Development setup](#development-setup)
- [Set up environment variables](#set-up-environment-variables)
- [Set up configurations](#set-up-configurations)
- [Optional flags](#optional-flags)
- [Start a development server:](#start-a-development-server)
- [Building](#building)

Expand Down Expand Up @@ -48,6 +49,7 @@ These are the additional configuration files that have to be filled in:
| **/config/configuredBridges.json** | Defines the chains that are connected via taiko bridges and lists the contract addresses |
| **/config/configuredChains.json** | Defines some metadata for the chains, such as name, icons, explorer URL, etc. |
| **/config/configuredRelayer.json** | If chains have a relayer, the URL and the chain IDs it covers are entered here |
| **/config/configuredEventIndexer.json** | NFT Indexer we can query to help with importing NFTs |
| **/config/configuredCustomTokens.json** | Defines a list of tokens that should be available in the token dropdowns |

---
Expand Down Expand Up @@ -81,23 +83,51 @@ To get started, open your terminal in `/packages/bridge-ui-v2/`
**Beware**, that if you make changes to the json files, you need to export them to the .env again via script.
<br>

#### Optional flags

```bash
pnpm export:config --<env> --<version>
```

You can store multiple configs in subfolders, currently the script accepts:
`--a5`, `--a6` for version and `--dev`, `--prod` for env

The folder structure should look like this then:

```
config/
|-- dev/
| |-- a5/
| |-- a6/
|-- prod/
| |-- a5/
| |-- a6/
```

More could be configured manually in `scripts/exportJsonToEnv.js`
<br>

### Start a development server:

```bash
pnpm dev

# or start the server and open the app in a new browser tab
pnpm dev -- --open

# if you want to expose the IP to your network you can use this flag
pnpm dev --host

```

## Building

To create a production version of your app:

```bash
npm run build
pnpm run build
```

You can preview the production build with `npm run preview`.
You can preview the production build with `pnpm run preview`.

To deploy your app, you may need to install an [adapter](https://kit.svelte.dev/docs/adapters) for your target environment.
14 changes: 12 additions & 2 deletions packages/bridge-ui-v2/__mocks__/@wagmi/core.ts
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ export const getPublicClient = vi.fn();

export const getContract = vi.fn();

export const fetchBalance = vi.fn();
export const getBalance = vi.fn();

export const fetchToken = vi.fn();
export const getToken = vi.fn();

export const readContract = vi.fn();

Expand Down Expand Up @@ -43,3 +43,13 @@ export const configureChains = vi.fn().mockReturnValue({
export const defaultWagmiConfig = vi.fn(() => {
return 'mockWagmiConfig';
});

export const http = vi.fn();

export const createConfig = vi.fn(() => {
return {
chains: mockChains,
};
});

export const reconnect = vi.fn();
3 changes: 3 additions & 0 deletions packages/bridge-ui-v2/__mocks__/viem.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
import { vi } from 'vitest';

export const getContract = vi.fn();
12 changes: 7 additions & 5 deletions packages/bridge-ui-v2/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"format": "prettier --write .",
"lint": "prettier --check . && eslint .",
"lint:fix": "pnpm format && eslint . --fix",
"generate:abi": "cd ../protocol && pnpm forge build && cd - && pnpm wagmi generate",
"generate:abi": "cd ../protocol && pnpm forge build --evm-version cancun && cd - && pnpm wagmi generate",
"export:config": "pnpm ./scripts/exportJsonToEnv.js"
},
"devDependencies": {
Expand All @@ -30,7 +30,7 @@
"@typescript-eslint/eslint-plugin": "^6.13.2",
"@typescript-eslint/parser": "^6.13.2",
"@vitest/coverage-v8": "^0.33.0",
"@wagmi/cli": "^1.5.2",
"@wagmi/cli": "^2.1.0",
"abitype": "^0.8.11",
"ajv": "^8.12.0",
"autoprefixer": "^10.4.16",
Expand Down Expand Up @@ -59,15 +59,17 @@
},
"type": "module",
"dependencies": {
"@wagmi/core": "^1.4.13",
"@web3modal/wagmi": "^3.5.3",
"@wagmi/connectors": "^4.1.13",
"@wagmi/core": "^2.6.4",
"@walletconnect/ethereum-provider": "^2.11.1",
"@web3modal/wagmi": "^4.0.1",
"@zerodevx/svelte-toast": "^0.9.5",
"axios": "^1.6.1",
"buffer": "^6.0.3",
"debug": "^4.3.4",
"events": "^3.3.0",
"object-hash": "^3.0.0",
"svelte-i18n": "^3.7.4",
"viem": "^1.18.9"
"viem": "^2.7.8"
}
}
53 changes: 46 additions & 7 deletions packages/bridge-ui-v2/scripts/exportJsonToEnv.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,18 +9,57 @@ const Logger = new LogUtil('exportJsonToEnv');

const envFile = './.env';

const bridgesPath = 'config/configuredBridges.json';
const chainsPath = 'config/configuredChains.json';
const tokensPath = 'config/configuredCustomTokens.json';
const relayerPath = 'config/configuredRelayer.json';
const eventIndexerPath = 'config/configuredEventIndexer.json';
const defaultPaths = {
bridges: 'configuredBridges.json',
chains: 'configuredChains.json',
tokens: 'configuredCustomTokens.json',
relayer: 'configuredRelayer.json',
eventIndexer: 'configuredEventIndexer.json',
};

// Parse command line arguments
const args = process.argv.slice(2);
const isLocal = args.includes('--local');
const isDev = args.includes('--dev');
const isProd = args.includes('--prod');
const isA6 = args.includes('--a6');
const isA5 = args.includes('--a5');

// Determine the environment
let environment = '';
if (isDev) {
environment = 'dev';
} else if (isProd) {
environment = 'prod';
} else if (isLocal) {
environment = 'local';
}

// Determine the version
let version = '';
if (isA6) {
version = 'a6';
} else if (isA5) {
version = 'a5';
}

Logger.info(`Detected ${environment} environment and ${version} version.`);

// Generate paths based on environment and version or create default paths
const paths = {};
Object.entries(defaultPaths).forEach(([key, value]) => {
const fileName = path.basename(value);
const filePath = path.dirname(value);
const updatedPath = path.join('config', environment, version, filePath, fileName);
paths[key] = updatedPath;
});

// Create a backup of the existing .env file
fs.copyFileSync(envFile, `${envFile}.bak`);

const jsonFiles = [bridgesPath, chainsPath, tokensPath, relayerPath, eventIndexerPath];
Object.entries(paths).forEach(([, value]) => {
const jsonFile = value;

jsonFiles.forEach((jsonFile) => {
if (fs.existsSync(jsonFile)) {
Logger.info(`Exporting ${jsonFile} to .env file...`);

Expand Down
Loading

0 comments on commit 610e31f

Please sign in to comment.