Skip to content

Commit

Permalink
Don't run check-token-list unless the token JSON files changed (#3304)
Browse files Browse the repository at this point in the history
* dont run check-token-list unless the file changed

* move token list into its own file

* testing condition

* test

* oops

* ok this should work

* omg

* d

* im straight up gonna cry

* bite me

* dorny?

* test

* update to v4 of checkout and setup-node

* :D

* test

* test

* fixy

* final test

* always run this job on development branch

* dont fetch foreign address for unconfigured chains
  • Loading branch information
artursapek authored Feb 28, 2025
1 parent a4a53b2 commit 9f908fc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 13 deletions.
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

0 comments on commit 9f908fc

Please sign in to comment.