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

Don't run check-token-list unless the token JSON files changed #3304

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
32 changes: 21 additions & 11 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
Expand All @@ -30,8 +30,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
Expand All @@ -55,24 +55,34 @@ jobs:

check-token-list:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: dorny/paths-filter@v3
id: filter
with:
filters: |
tokens:
- 'wormhole-connect/src/config/mainnet/wrappedTokens.ts'
- 'wormhole-connect/src/config/testnet/wrappedTokens.ts'
- uses: actions/setup-node@v4
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
with:
node-version: 20
cache: "npm"
cache-dependency-path: "wormhole-connect/package-lock.json"
- run: npm ci
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
working-directory: wormhole-connect
- run: npm run checkForeignAssets
if: steps.filter.outputs.tokens == 'true' || github.ref == 'refs/heads/development'
working-directory: wormhole-connect

build-hosted:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
Expand All @@ -85,8 +95,8 @@ jobs:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: "npm"
Expand Down
1 change: 0 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -253,4 +253,3 @@ This SDK is an open source software SDK that leverages the Wormhole protocol, a

Wormhole Connect is an NPM package that interacts with the Wormhole protocol. You assume all risks associated with using the SDK, the Wormhole Connect NPM package, the Wormhole protocol, and digital assets and decentralized systems generally, including but not limited to, that: (a) digital assets are highly volatile; (b) using digital assets is inherently risky due to both features of such assets and the potential unauthorized acts of third parties; (c) you may not have ready access to assets; and (d) you may lose some or all of your tokens or other assets. You agree that you will have no recourse against anyone else for any losses due to the use of the SDK or Wormhole. For example, these losses may arise from or relate to: (i) incorrect information; (ii) software or network failures; (iii) corrupted cryptocurrency wallet files; (iv) unauthorized access; (v) errors, mistakes, or inaccuracies; or (vi) third-party activities.


11 changes: 10 additions & 1 deletion wormhole-connect/scripts/checkForeignAssetsConfig.ts
Original file line number Diff line number Diff line change
Expand Up @@ -86,6 +86,13 @@ const checkEnvConfig = async (

const configForeignAddress =
wrappedTokens[tokenId.chain]?.[tokenId.address]?.[chain];

if (!configForeignAddress) {
// Skip chain for which there is no foreign asset configured
// Connect can fetch them dynamically at runtime anyway
return;
}

if (chain === tokenId.chain) {
if (configForeignAddress) {
throw new Error(
Expand Down Expand Up @@ -120,7 +127,9 @@ const checkEnvConfig = async (
`❌ Invalid foreign address detected! Env: ${env}, Token ${tokenId.chain} ${tokenId.address}, Chain: ${chain}, Expected: ${foreignAddress}, Received: ${configForeignAddress}`,
);
} else {
console.log('✅ Config matches');
console.log(
`✅ ${tokenId.chain} ${tokenId.address} on ${chain} is correctly set to ${foreignAddress}`,
);
}
} else {
if (!recommendedUpdates[tokenId.chain]) {
Expand Down
Loading