Skip to content

Commit c17c9a3

Browse files
authored
breakdown known good block numbers (#460)
* breakdown known good block numbers * update .github workflows to use `git add -A` for known good block numbers and snapshots * loads correct env files
1 parent 3baaa08 commit c17c9a3

20 files changed

+172
-77
lines changed

.github/workflows/update-known-good.yml

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -51,8 +51,10 @@ jobs:
5151
- name: Upload Artifact
5252
uses: actions/upload-artifact@v4
5353
with:
54-
name: KNOWN_GOOD_BLOCK_NUMBERS.env
55-
path: KNOWN_GOOD_BLOCK_NUMBERS.env
54+
name: KNOWN_GOOD_BLOCK_NUMBERS
55+
path: |
56+
KNOWN_GOOD_BLOCK_NUMBERS_POLKADOT.env
57+
KNOWN_GOOD_BLOCK_NUMBERS_KUSAMA.env
5658
retention-days: 1
5759
tests:
5860
needs: define-matrix
@@ -73,7 +75,7 @@ jobs:
7375
- name: Download a single artifact
7476
uses: actions/download-artifact@v4
7577
with:
76-
name: KNOWN_GOOD_BLOCK_NUMBERS.env
78+
name: KNOWN_GOOD_BLOCK_NUMBERS
7779
- run: yarn test packages/${{ matrix.tests }}
7880
save:
7981
needs: tests
@@ -91,14 +93,14 @@ jobs:
9193
- name: Download a single artifact
9294
uses: actions/download-artifact@v4
9395
with:
94-
name: KNOWN_GOOD_BLOCK_NUMBERS.env
96+
name: KNOWN_GOOD_BLOCK_NUMBERS
9597
- name: Commit and push changes
9698
run: |
9799
git config --global user.name 'github-actions[bot]'
98100
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
99-
git add KNOWN_GOOD_BLOCK_NUMBERS.env
101+
git add -A 'KNOWN_GOOD_BLOCK_NUMBERS_*.env'
100102
if ! git diff --cached --quiet; then
101-
git commit -m "[ci skip] Update KNOWN_GOOD_BLOCK_NUMBERS"
103+
git commit -m "[ci skip] Update known good block numbers"
102104
git push
103105
else
104106
echo "No changes to commit"

.github/workflows/update-snapshot.yml

Lines changed: 27 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@ jobs:
1414
update:
1515
runs-on: ubuntu-latest
1616
timeout-minutes: 180
17+
strategy:
18+
fail-fast: false
19+
matrix:
20+
network: [polkadot, kusama]
1721
steps:
1822
- uses: actions/checkout@v4
1923
- name: setup node env
@@ -23,22 +27,35 @@ jobs:
2327
cache: 'yarn'
2428
- run: yarn --immutable
2529
- run: yarn update-known-good
26-
- run: yarn test -u
30+
- run: yarn test:${{ matrix.network }} -u
2731
- name: Commit and Create PR
2832
uses: actions/github-script@v6
2933
with:
3034
script: |
31-
const branchName = `update-snapshots-${context.sha.slice(0, 7)}`
32-
await exec.exec(`git config --global user.name 'github-actions[bot]'`)
33-
await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'"`)
34-
await exec.exec(`git checkout -b ${branchName}`)
35-
await exec.exec(`git`, ['commit', '-am', 'update snapshots'])
36-
await exec.exec(`git push origin HEAD:${branchName}`)
35+
const { network } = context.payload.inputs || { network: '${{ matrix.network }}' };
36+
const branchName = `update-snapshots-${network}-${context.sha.slice(0, 7)}`;
37+
const upperNetwork = network.toUpperCase();
38+
39+
await exec.exec(`git config --global user.name 'github-actions[bot]'`);
40+
await exec.exec(`git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'`);
41+
42+
const { stdout: status } = await exec.getExecOutput('git', ['status', '--porcelain']);
43+
if (!status) {
44+
console.log('No changes to commit.');
45+
return;
46+
}
47+
48+
await exec.exec(`git checkout -b ${branchName}`);
49+
await exec.exec('git', ['add', '-A', `packages/${network}`]);
50+
await exec.exec('git', ['add', '-A', `KNOWN_GOOD_BLOCK_NUMBERS_${upperNetwork}.env`]);
51+
await exec.exec('git', ['commit', '-m', `Update snapshots for ${network}`]);
52+
await exec.exec(`git push origin HEAD:${branchName}`);
53+
3754
await github.rest.pulls.create({
3855
owner: context.repo.owner,
3956
repo: context.repo.repo,
40-
title: 'Update Snapshots',
57+
title: `Update Snapshots for ${network}`,
4158
head: branchName,
4259
base: 'master',
43-
body: 'Update Snapshots\n\nClose and reopen this PR to trigger CI.',
44-
})
60+
body: `Update Snapshots for ${network}\n\nClose and reopen this PR to trigger CI.`,
61+
});
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
ASSETHUBKUSAMA_BLOCK_NUMBER=11440430
2+
BASILISK_BLOCK_NUMBER=11766570
3+
BRIDGEHUBKUSAMA_BLOCK_NUMBER=6853847
4+
CORETIMEKUSAMA_BLOCK_NUMBER=3797454
5+
ENCOINTERKUSAMA_BLOCK_NUMBER=11282840
6+
INTEGRITEEKUSAMA_BLOCK_NUMBER=8814593
7+
KARURA_BLOCK_NUMBER=10277414
8+
KUSAMA_BLOCK_NUMBER=30742540
9+
MOONRIVER_BLOCK_NUMBER=13730033
10+
PEOPLEKUSAMA_BLOCK_NUMBER=6351475
11+
SHIDEN_BLOCK_NUMBER=12413318
Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,22 +1,11 @@
11
ACALA_BLOCK_NUMBER=9758901
2-
ASSETHUBKUSAMA_BLOCK_NUMBER=11440430
32
ASSETHUBPOLKADOT_BLOCK_NUMBER=10182413
43
ASTAR_BLOCK_NUMBER=10844357
5-
BASILISK_BLOCK_NUMBER=11766570
6-
BRIDGEHUBKUSAMA_BLOCK_NUMBER=6853847
74
BRIDGEHUBPOLKADOT_BLOCK_NUMBER=6288286
85
COLLECTIVESPOLKADOT_BLOCK_NUMBER=7486109
9-
CORETIMEKUSAMA_BLOCK_NUMBER=3797454
106
CORETIMEPOLKADOT_BLOCK_NUMBER=2898364
11-
ENCOINTERKUSAMA_BLOCK_NUMBER=11282840
127
HYDRATION_BLOCK_NUMBER=9861942
13-
INTEGRITEEKUSAMA_BLOCK_NUMBER=8814593
148
INTEGRITEEPOLKADOT_BLOCK_NUMBER=5616683
15-
KARURA_BLOCK_NUMBER=10277414
16-
KUSAMA_BLOCK_NUMBER=30742540
179
MOONBEAM_BLOCK_NUMBER=13149240
18-
MOONRIVER_BLOCK_NUMBER=13730033
19-
PEOPLEKUSAMA_BLOCK_NUMBER=6351475
2010
PEOPLEPOLKADOT_BLOCK_NUMBER=3225266
2111
POLKADOT_BLOCK_NUMBER=28414859
22-
SHIDEN_BLOCK_NUMBER=12413318

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"lint": "tsc --noEmit && biome check .",
66
"fix": "biome check --write .",
77
"test": "vitest",
8+
"test:polkadot": "vitest packages/polkadot",
9+
"test:kusama": "vitest packages/kusama",
810
"test:ui": "vitest --ui",
911
"update-env": "tsx scripts/update-env.ts",
1012
"update-known-good": "tsx scripts/update-env.ts --update-known-good",

packages/networks/src/chains/acala.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -68,6 +68,7 @@ export const acala = defineChain({
6868
name: 'acala',
6969
endpoint: 'wss://acala-rpc.n.dwellir.com',
7070
paraId: 2000,
71+
networkGroup: 'polkadot',
7172
custom: custom.acala,
7273
initStorages: getInitStorages(custom.acala),
7374
})
@@ -76,6 +77,7 @@ export const karura = defineChain({
7677
name: 'karura',
7778
endpoint: 'wss://karura-rpc.n.dwellir.com',
7879
paraId: 2000,
80+
networkGroup: 'kusama',
7981
custom: custom.karura,
8082
initStorages: getInitStorages(custom.karura),
8183
})

packages/networks/src/chains/assethub.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,6 +67,7 @@ export const assetHubPolkadot = defineChain({
6767
name: 'assetHubPolkadot',
6868
endpoint: 'wss://polkadot-asset-hub-rpc.polkadot.io',
6969
paraId: 1000,
70+
networkGroup: 'polkadot',
7071
custom: custom.assetHubPolkadot,
7172
initStorages: getInitStorages(custom.assetHubPolkadot),
7273
})
@@ -75,6 +76,7 @@ export const assetHubKusama = defineChain({
7576
name: 'assetHubKusama',
7677
endpoint: 'wss://sys.ibp.network/asset-hub-kusama',
7778
paraId: 1000,
79+
networkGroup: 'kusama',
7880
custom: custom.assetHubKusama,
7981
initStorages: getInitStorages(custom.assetHubKusama),
8082
})

packages/networks/src/chains/astar.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ export const astar = defineChain({
4747
name: 'astar',
4848
paraId: 2006,
4949
endpoint: 'wss://astar-rpc.n.dwellir.com',
50+
networkGroup: 'polkadot',
5051
custom: custom.astar,
5152
initStorages: getInitStorages(custom.astar),
5253
})
@@ -55,6 +56,7 @@ export const shiden = defineChain({
5556
name: 'shiden',
5657
paraId: 2007,
5758
endpoint: 'wss://shiden-rpc.n.dwellir.com',
59+
networkGroup: 'kusama',
5860
custom: custom.shiden,
5961
initStorages: getInitStorages(custom.shiden),
6062
})

packages/networks/src/chains/bridgehub.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@ export const bridgeHubPolkadot = defineChain({
2424
name: 'bridgeHubPolkadot',
2525
endpoint: 'wss://sys.ibp.network/bridgehub-polkadot',
2626
paraId: 1002,
27+
networkGroup: 'polkadot',
2728
custom: custom.bridgeHubPolkadot,
2829
initStorages: getInitStorages(custom.bridgeHubPolkadot),
2930
})
@@ -32,6 +33,7 @@ export const bridgeHubKusama = defineChain({
3233
name: 'bridgeHubKusama',
3334
endpoint: 'wss://kusama-bridge-hub-rpc.polkadot.io',
3435
paraId: 1002,
36+
networkGroup: 'kusama',
3537
custom: custom.bridgeHubKusama,
3638
initStorages: getInitStorages(custom.bridgeHubKusama),
3739
})

packages/networks/src/chains/collectives.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export const collectivesPolkadot = defineChain({
2222
name: 'collectivesPolkadot',
2323
endpoint: 'wss://collectives-polkadot-rpc.n.dwellir.com',
2424
paraId: 1001,
25+
networkGroup: 'polkadot',
2526
custom: custom.collectivesPolkadot,
2627
initStorages: getInitStorages(custom.collectivesPolkadot),
2728
})

0 commit comments

Comments
 (0)