Skip to content
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
14 changes: 8 additions & 6 deletions .github/workflows/update-known-good.yml
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,10 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: KNOWN_GOOD_BLOCK_NUMBERS.env
path: KNOWN_GOOD_BLOCK_NUMBERS.env
name: KNOWN_GOOD_BLOCK_NUMBERS
path: |
KNOWN_GOOD_BLOCK_NUMBERS_POLKADOT.env
KNOWN_GOOD_BLOCK_NUMBERS_KUSAMA.env
retention-days: 1
tests:
needs: define-matrix
Expand All @@ -73,7 +75,7 @@ jobs:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: KNOWN_GOOD_BLOCK_NUMBERS.env
name: KNOWN_GOOD_BLOCK_NUMBERS
- run: yarn test packages/${{ matrix.tests }}
save:
needs: tests
Expand All @@ -91,14 +93,14 @@ jobs:
- name: Download a single artifact
uses: actions/download-artifact@v4
with:
name: KNOWN_GOOD_BLOCK_NUMBERS.env
name: KNOWN_GOOD_BLOCK_NUMBERS
- name: Commit and push changes
run: |
git config --global user.name 'github-actions[bot]'
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
git add KNOWN_GOOD_BLOCK_NUMBERS.env
git add -A 'KNOWN_GOOD_BLOCK_NUMBERS_*.env'
if ! git diff --cached --quiet; then
git commit -m "[ci skip] Update KNOWN_GOOD_BLOCK_NUMBERS"
git commit -m "[ci skip] Update known good block numbers"
git push
else
echo "No changes to commit"
Expand Down
37 changes: 27 additions & 10 deletions .github/workflows/update-snapshot.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,10 @@ jobs:
update:
runs-on: ubuntu-latest
timeout-minutes: 180
strategy:
fail-fast: false
matrix:
network: [polkadot, kusama]
steps:
- uses: actions/checkout@v4
- name: setup node env
Expand All @@ -23,22 +27,35 @@ jobs:
cache: 'yarn'
- run: yarn --immutable
- run: yarn update-known-good
- run: yarn test -u
- run: yarn test:${{ matrix.network }} -u
- name: Commit and Create PR
uses: actions/github-script@v6
with:
script: |
const branchName = `update-snapshots-${context.sha.slice(0, 7)}`
await exec.exec(`git config --global user.name 'github-actions[bot]'`)
await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'"`)
await exec.exec(`git checkout -b ${branchName}`)
await exec.exec(`git`, ['commit', '-am', 'update snapshots'])
await exec.exec(`git push origin HEAD:${branchName}`)
const { network } = context.payload.inputs || { network: '${{ matrix.network }}' };
const branchName = `update-snapshots-${network}-${context.sha.slice(0, 7)}`;
const upperNetwork = network.toUpperCase();

await exec.exec(`git config --global user.name 'github-actions[bot]'`);
await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'`);

const { stdout: status } = await exec.getExecOutput('git', ['status', '--porcelain']);
if (!status) {
console.log('No changes to commit.');
return;
}

await exec.exec(`git checkout -b ${branchName}`);
await exec.exec('git', ['add', '-A', `packages/${network}`]);
await exec.exec('git', ['add', '-A', `KNOWN_GOOD_BLOCK_NUMBERS_${upperNetwork}.env`]);
await exec.exec('git', ['commit', '-m', `Update snapshots for ${network}`]);
await exec.exec(`git push origin HEAD:${branchName}`);

await github.rest.pulls.create({
owner: context.repo.owner,
repo: context.repo.repo,
title: 'Update Snapshots',
title: `Update Snapshots for ${network}`,
head: branchName,
base: 'master',
body: 'Update Snapshots\n\nClose and reopen this PR to trigger CI.',
})
body: `Update Snapshots for ${network}\n\nClose and reopen this PR to trigger CI.`,
});
11 changes: 11 additions & 0 deletions KNOWN_GOOD_BLOCK_NUMBERS_KUSAMA.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
ASSETHUBKUSAMA_BLOCK_NUMBER=11440430
BASILISK_BLOCK_NUMBER=11766570
BRIDGEHUBKUSAMA_BLOCK_NUMBER=6853847
CORETIMEKUSAMA_BLOCK_NUMBER=3797454
ENCOINTERKUSAMA_BLOCK_NUMBER=11282840
INTEGRITEEKUSAMA_BLOCK_NUMBER=8814593
KARURA_BLOCK_NUMBER=10277414
KUSAMA_BLOCK_NUMBER=30742540
MOONRIVER_BLOCK_NUMBER=13730033
PEOPLEKUSAMA_BLOCK_NUMBER=6351475
SHIDEN_BLOCK_NUMBER=12413318
Original file line number Diff line number Diff line change
@@ -1,22 +1,11 @@
ACALA_BLOCK_NUMBER=9758901
ASSETHUBKUSAMA_BLOCK_NUMBER=11440430
ASSETHUBPOLKADOT_BLOCK_NUMBER=10182413
ASTAR_BLOCK_NUMBER=10844357
BASILISK_BLOCK_NUMBER=11766570
BRIDGEHUBKUSAMA_BLOCK_NUMBER=6853847
BRIDGEHUBPOLKADOT_BLOCK_NUMBER=6288286
COLLECTIVESPOLKADOT_BLOCK_NUMBER=7486109
CORETIMEKUSAMA_BLOCK_NUMBER=3797454
CORETIMEPOLKADOT_BLOCK_NUMBER=2898364
ENCOINTERKUSAMA_BLOCK_NUMBER=11282840
HYDRATION_BLOCK_NUMBER=9861942
INTEGRITEEKUSAMA_BLOCK_NUMBER=8814593
INTEGRITEEPOLKADOT_BLOCK_NUMBER=5616683
KARURA_BLOCK_NUMBER=10277414
KUSAMA_BLOCK_NUMBER=30742540
MOONBEAM_BLOCK_NUMBER=13149240
MOONRIVER_BLOCK_NUMBER=13730033
PEOPLEKUSAMA_BLOCK_NUMBER=6351475
PEOPLEPOLKADOT_BLOCK_NUMBER=3225266
POLKADOT_BLOCK_NUMBER=28414859
SHIDEN_BLOCK_NUMBER=12413318
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"lint": "tsc --noEmit && biome check .",
"fix": "biome check --write .",
"test": "vitest",
"test:polkadot": "vitest packages/polkadot",
"test:kusama": "vitest packages/kusama",
"test:ui": "vitest --ui",
"update-env": "tsx scripts/update-env.ts",
"update-known-good": "tsx scripts/update-env.ts --update-known-good",
Expand Down
2 changes: 2 additions & 0 deletions packages/networks/src/chains/acala.ts
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ export const acala = defineChain({
name: 'acala',
endpoint: 'wss://acala-rpc.n.dwellir.com',
paraId: 2000,
networkGroup: 'polkadot',
custom: custom.acala,
initStorages: getInitStorages(custom.acala),
})
Expand All @@ -76,6 +77,7 @@ export const karura = defineChain({
name: 'karura',
endpoint: 'wss://karura-rpc.n.dwellir.com',
paraId: 2000,
networkGroup: 'kusama',
custom: custom.karura,
initStorages: getInitStorages(custom.karura),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/assethub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ export const assetHubPolkadot = defineChain({
name: 'assetHubPolkadot',
endpoint: 'wss://polkadot-asset-hub-rpc.polkadot.io',
paraId: 1000,
networkGroup: 'polkadot',
custom: custom.assetHubPolkadot,
initStorages: getInitStorages(custom.assetHubPolkadot),
})
Expand All @@ -75,6 +76,7 @@ export const assetHubKusama = defineChain({
name: 'assetHubKusama',
endpoint: 'wss://sys.ibp.network/asset-hub-kusama',
paraId: 1000,
networkGroup: 'kusama',
custom: custom.assetHubKusama,
initStorages: getInitStorages(custom.assetHubKusama),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/astar.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const astar = defineChain({
name: 'astar',
paraId: 2006,
endpoint: 'wss://astar-rpc.n.dwellir.com',
networkGroup: 'polkadot',
custom: custom.astar,
initStorages: getInitStorages(custom.astar),
})
Expand All @@ -55,6 +56,7 @@ export const shiden = defineChain({
name: 'shiden',
paraId: 2007,
endpoint: 'wss://shiden-rpc.n.dwellir.com',
networkGroup: 'kusama',
custom: custom.shiden,
initStorages: getInitStorages(custom.shiden),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/bridgehub.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const bridgeHubPolkadot = defineChain({
name: 'bridgeHubPolkadot',
endpoint: 'wss://sys.ibp.network/bridgehub-polkadot',
paraId: 1002,
networkGroup: 'polkadot',
custom: custom.bridgeHubPolkadot,
initStorages: getInitStorages(custom.bridgeHubPolkadot),
})
Expand All @@ -32,6 +33,7 @@ export const bridgeHubKusama = defineChain({
name: 'bridgeHubKusama',
endpoint: 'wss://kusama-bridge-hub-rpc.polkadot.io',
paraId: 1002,
networkGroup: 'kusama',
custom: custom.bridgeHubKusama,
initStorages: getInitStorages(custom.bridgeHubKusama),
})
1 change: 1 addition & 0 deletions packages/networks/src/chains/collectives.ts
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ export const collectivesPolkadot = defineChain({
name: 'collectivesPolkadot',
endpoint: 'wss://collectives-polkadot-rpc.n.dwellir.com',
paraId: 1001,
networkGroup: 'polkadot',
custom: custom.collectivesPolkadot,
initStorages: getInitStorages(custom.collectivesPolkadot),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/coretime.ts
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ export const coretimePolkadot = defineChain({
name: 'coretimePolkadot',
endpoint: 'wss://polkadot-coretime-rpc.polkadot.io',
paraId: 1005,
networkGroup: 'polkadot',
custom: custom.coretimePolkadot,
initStorages: getInitStorages(custom.coretimePolkadot),
})
Expand All @@ -32,6 +33,7 @@ export const coretimeKusama = defineChain({
name: 'coretimeKusama',
endpoint: 'wss://kusama-coretime-rpc.polkadot.io',
paraId: 1005,
networkGroup: 'kusama',
custom: custom.coretimeKusama,
initStorages: getInitStorages(custom.coretimeKusama),
})
1 change: 1 addition & 0 deletions packages/networks/src/chains/encointer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ export const encointerKusama = defineChain({
name: 'encointerKusama',
endpoint: 'wss://kusama.api.encointer.org',
paraId: 1001,
networkGroup: 'kusama',
custom: custom.encointerKusama,
initStorages: getInitStorages(custom.encointerKusama),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/hydration.ts
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,7 @@ export const hydration = defineChain({
name: 'hydration',
paraId: 2034,
endpoint: 'wss://rpc.hydradx.cloud',
networkGroup: 'polkadot',
custom: custom.hydration,
initStorages: getInitStorages(custom.hydration),
})
Expand All @@ -38,6 +39,7 @@ export const basilisk = defineChain({
name: 'basilisk',
paraId: 2090,
endpoint: 'wss://basilisk-rpc.n.dwellir.com',
networkGroup: 'kusama',
custom: custom.basilisk,
initStorages: getInitStorages(custom.basilisk),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/integritee.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const integriteePolkadot = defineChain({
name: 'integritee-polkadot',
paraId: 2039,
endpoint: 'wss://polkadot.api.integritee.network',
networkGroup: 'polkadot',
custom: custom.integriteePolkadot,
initStorages: getInitStorages(custom.integriteePolkadot),
})
Expand All @@ -50,6 +51,7 @@ export const integriteeKusama = defineChain({
name: 'integritee-kusama',
paraId: 2015,
endpoint: 'wss://kusama.api.integritee.network',
networkGroup: 'kusama',
custom: custom.integriteeKusama,
initStorages: getInitStorages(custom.integriteeKusama),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/moonbeam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ export const moonbeam = defineChain({
name: 'moonbeam',
paraId: 2004,
endpoint: 'wss://wss.api.moonbeam.network',
networkGroup: 'polkadot',
custom: custom.moonbeam,
initStorages: getInitStorages(),
})
Expand All @@ -55,6 +56,7 @@ export const moonriver = defineChain({
name: 'moonriver',
paraId: 2023,
endpoint: 'wss://wss.api.moonriver.moonbeam.network',
networkGroup: 'kusama',
custom: custom.moonriver,
initStorages: getInitStorages(),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/people.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@ export const peoplePolkadot = defineChain({
name: 'peoplePolkadot',
endpoint: 'wss://polkadot-people-rpc.polkadot.io',
paraId: 1004,
networkGroup: 'polkadot',
custom: custom.peoplePolkadot,
initStorages: getInitStorages(custom.peoplePolkadot),
})
Expand All @@ -50,6 +51,7 @@ export const peopleKusama = defineChain({
name: 'peopleKusama',
endpoint: 'wss://kusama-people-rpc.polkadot.io',
paraId: 1004,
networkGroup: 'kusama',
custom: custom.peopleKusama,
initStorages: getInitStorages(custom.peopleKusama),
})
2 changes: 2 additions & 0 deletions packages/networks/src/chains/polkadot.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ export const polkadot = defineChain({
custom: custom.polkadot,
initStorages: getInitStorages(),
isRelayChain: true,
networkGroup: 'polkadot',
})

export const kusama = defineChain({
Expand All @@ -42,4 +43,5 @@ export const kusama = defineChain({
custom: custom.kusama,
initStorages: getInitStorages(),
isRelayChain: true,
networkGroup: 'kusama',
})
1 change: 1 addition & 0 deletions packages/networks/src/types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ type ChainConfigBase = {
name: string
endpoint: string | string[]
isRelayChain?: boolean
networkGroup: 'polkadot' | 'kusama'
} & (ChainConfigRelaychain | ChainConfigParachain)

export type ChainConfig<
Expand Down
Loading