Skip to content

Commit 05971d6

Browse files
authored
Install Subway from acala/subway:v0.1.1 Docker image; set 90s per-upstream timeout (#622)
* Install Subway from upstream `v0.1.0` musl release in `ci.yml` Switches `cargo install --git` to a `curl | tar -xz` of the released static binary (https://github.com/AcalaNetwork/subway/releases/tag/v0.1.0, published by AcalaNetwork/subway#202). Removes the Rust toolchain install, Subway-HEAD commit-hash lookup, and Swatinem cache layer that existed only to amortise the `cargo install` cost — none of them have any other consumer in this workflow. * Install Subway from upstream `v0.1.0` musl release in `update-known-good.yml` Same swap as the previous commit, applied to the periodic block-number update workflow. * Install Subway from upstream `v0.1.0` musl release in `update-snapshot.yml` Same swap as the previous two commits, applied to the snapshot-update workflow. * Fail Subway download fast on HTTP errors (`curl -f`) Without `-f`, an HTTP 4xx/5xx response (e.g. release deleted, GitHub degraded) leaves `curl` exiting zero with the error body on stdout, and the downstream `tar -xz` fails with a confusing "not in gzip format" message instead. Per review on PR #622. * Install Subway by extracting binary from `acala/subway:v0.1.1` Docker image The `v0.1.1` GitHub Release at AcalaNetwork/subway is missing its `x86_64-unknown-linux-musl.tar.gz` asset; the release workflow's `Build release binary` step failed (`cargo build --locked` mismatched the bumped `Cargo.toml` version), so the upload was skipped. The upstream tag still produces a working Docker image because `docker.yml` doesn't use `--locked`, so `acala/subway:v0.1.1` is the only working consumption path for v0.1.1. The image's binary lives at `/usr/local/bin/subway` (per Subway's Dockerfile); copying it out with `docker create` + `docker cp` lands in roughly the same wall time as the curl-and-untar path and unblocks consumption of PR #203's `request_timeout_seconds` config field. * Set Subway per-upstream `request_timeout_seconds` to 90s Subway's default per-upstream request timeout is 30s. With three Acala public RPC endpoints, heavy storage queries that take longer than 30s cause Subway to cycle through all three endpoints (~90s) before any single upstream has a chance to respond, and the test-side waiting client times out. `request_timeout_seconds` was added to `ClientConfig` in AcalaNetwork/subway#203 (Subway v0.1.1+). Setting it to 90 lets a single upstream attempt run long enough to complete those queries instead of being preempted by Subway's own per-endpoint clock. The companion exclusion of Acala tests in `vitest.config.mts` is intentionally left in place; this commit only restores Subway's ability to wait long enough. Lifting the exclusion is a separate verification step. * Re-enable Acala test suites `request_timeout_seconds: 90` on Subway's upstream client (added to `subway-template.yml` in the previous commit) gives Subway enough time per upstream attempt for Acala storage queries to land before the 30s default forced it to cycle endpoints. The exclusion added in PR #621 is no longer needed and is removed; the exclusion comment is narrowed to bifrostKusama, which still lacks a workable endpoint set.
1 parent 63a09c8 commit 05971d6

5 files changed

Lines changed: 26 additions & 52 deletions

File tree

.github/subway-template.yml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,12 @@ extensions:
77
# the failover ladder on stall/disconnect via its existing rotation
88
# logic, so an initial bias toward array[0] doesn't sacrifice resilience.
99
shuffle_endpoints: false
10+
# Heavy upstream queries (e.g. Acala storage at the pinned block) can take
11+
# longer than Subway's default 30s per-upstream timeout. Without this,
12+
# Subway cycles through the entire endpoint list before any single
13+
# upstream has a chance to respond. Requires Subway >= v0.1.1
14+
# (AcalaNetwork/subway#203).
15+
request_timeout_seconds: 90
1016
event_bus:
1117
substrate_api:
1218
stale_timeout_seconds: 180

.github/workflows/ci.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -55,21 +55,13 @@ jobs:
5555

5656
- run: yarn --immutable
5757

58-
- name: Install Rust toolchain
59-
uses: dtolnay/rust-toolchain@stable
60-
61-
- name: Get Subway commit hash
62-
id: subway-commit
63-
run: echo "hash=$(git ls-remote https://github.com/AcalaNetwork/subway HEAD | cut -f1)" >> $GITHUB_OUTPUT
64-
65-
- name: Cache Subway binary
66-
uses: Swatinem/rust-cache@v2
67-
with:
68-
shared-key: subway-binary-${{ steps.subway-commit.outputs.hash }}
69-
save-if: ${{ github.ref == 'refs/heads/master' }}
70-
7158
- name: Install Subway
72-
run: cargo install --git https://github.com/AcalaNetwork/subway
59+
run: |
60+
docker create --name subway-extract acala/subway:v0.1.1
61+
sudo docker cp subway-extract:/usr/local/bin/subway /usr/local/bin/subway
62+
docker rm subway-extract
63+
sudo chmod +x /usr/local/bin/subway
64+
subway --version
7365
7466
- name: Source known good block numbers
7567
run: |

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

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -91,21 +91,13 @@ jobs:
9191
9292
# Subway is a WebSocket proxy that caches RPC responses, avoiding
9393
# rate-limiting from production endpoints during test runs
94-
- name: Install Rust toolchain
95-
uses: dtolnay/rust-toolchain@stable
96-
97-
- name: Get Subway commit hash
98-
id: subway-commit
99-
run: echo "hash=$(git ls-remote https://github.com/AcalaNetwork/subway HEAD | cut -f1)" >> $GITHUB_OUTPUT
100-
101-
- name: Cache Subway binary
102-
uses: Swatinem/rust-cache@v2
103-
with:
104-
shared-key: subway-binary-${{ steps.subway-commit.outputs.hash }}
105-
save-if: ${{ github.ref == 'refs/heads/master' }}
106-
10794
- name: Install Subway
108-
run: cargo install --git https://github.com/AcalaNetwork/subway
95+
run: |
96+
docker create --name subway-extract acala/subway:v0.1.1
97+
sudo docker cp subway-extract:/usr/local/bin/subway /usr/local/bin/subway
98+
docker rm subway-extract
99+
sudo chmod +x /usr/local/bin/subway
100+
subway --version
109101
110102
# Start one Subway instance per chain in this network, each on its own port
111103
- name: Start all Subway instances

.github/workflows/update-snapshot.yml

Lines changed: 6 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,13 @@ jobs:
4141

4242
- run: yarn --immutable
4343

44-
- name: Install Rust toolchain
45-
uses: dtolnay/rust-toolchain@stable
46-
47-
- name: Get Subway commit hash
48-
id: subway-commit
49-
run: echo "hash=$(git ls-remote https://github.com/AcalaNetwork/subway HEAD | cut -f1)" >> $GITHUB_OUTPUT
50-
51-
- name: Cache Subway binary
52-
uses: Swatinem/rust-cache@v2
53-
with:
54-
shared-key: subway-binary-${{ steps.subway-commit.outputs.hash }}
55-
save-if: ${{ github.ref == 'refs/heads/master' }}
56-
5744
- name: Install Subway
58-
run: cargo install --git https://github.com/AcalaNetwork/subway
45+
run: |
46+
docker create --name subway-extract acala/subway:v0.1.1
47+
sudo docker cp subway-extract:/usr/local/bin/subway /usr/local/bin/subway
48+
docker rm subway-extract
49+
sudo chmod +x /usr/local/bin/subway
50+
subway --version
5951
6052
- name: Update known good block numbers
6153
run: yarn update-known-good

vitest.config.mts

Lines changed: 2 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,13 @@ export default defineConfig({
2020
passWithNoTests: true,
2121
retry: 1,
2222
reporters: process.env.GITHUB_ACTIONS ? ['verbose', 'github-actions'] : ['default'],
23-
// Excluded chains:
24-
//
25-
// - bifrostKusama: only Liebi public endpoint (us./hk./generic) is configured,
26-
// and the only currently-reachable host prunes the state CI needs.
27-
// - acala: Subway hardcodes its per-upstream request_timeout to 30s and
28-
// doesn't expose it in `ClientConfig`, so heavy Acala storage queries
29-
// that take >30s force Subway to cycle through the 3 Liebi endpoints,
30-
// none of which respond inside the chopsticks rpcTimeout (90s here).
31-
// Unblock via an upstream Subway fix (`request_timeout` in YAML).
23+
// bifrostKusama is excluded: only Liebi public endpoints are configured,
24+
// and the only currently-reachable host prunes the state CI needs.
3225
exclude: [
3326
'**/node_modules/**',
3427
'**/.git/**',
3528
'packages/kusama/src/bifrostKusama.*.test.ts',
3629
'packages/kusama/src/karura.bifrostKusama.xcm.test.ts',
37-
'packages/polkadot/src/acala.*.test.ts',
3830
],
3931
},
4032
build: {

0 commit comments

Comments
 (0)