Skip to content

Commit d269aa5

Browse files
authored
Merge branch 'main' into ci/next-build-cache
2 parents 4418f59 + 681e427 commit d269aa5

59 files changed

Lines changed: 1317 additions & 1700 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.github/workflows/deploy-playground.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,9 @@ on:
88
environment:
99
description: bulletin-deploy environment to publish to (blank = CLI default)
1010
type: choice
11-
default: ''
11+
default: ""
1212
options:
13-
- ''
13+
- ""
1414
- paseo-next-v2
1515
- preview
1616
- paseo-next
Lines changed: 78 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,78 @@
1+
name: Diagnosis report
2+
3+
# A diagnosis run in the playground files a pre-filled issue (labeled
4+
# `diagnosis-report`) carrying the markdown report in its body. This workflow
5+
# turns that issue into a PR that adds/updates the host's report under
6+
# explorer/diagnosis-reports/. The compatibility matrix is a build artifact
7+
# regenerated from those reports, so the PR only touches the report file.
8+
9+
on:
10+
issues:
11+
types: [labeled]
12+
13+
# Serialize so concurrent submissions never race on a branch push.
14+
concurrency:
15+
group: diagnosis-report
16+
cancel-in-progress: false
17+
18+
permissions:
19+
contents: write
20+
pull-requests: write
21+
issues: write
22+
23+
jobs:
24+
ingest:
25+
if: github.event.label.name == 'diagnosis-report'
26+
runs-on: ubuntu-latest
27+
steps:
28+
- uses: actions/checkout@v4
29+
30+
- name: Build the report PR
31+
env:
32+
GH_TOKEN: ${{ github.token }}
33+
BODY: ${{ github.event.issue.body }}
34+
ISSUE: ${{ github.event.issue.number }}
35+
run: |
36+
set -euo pipefail
37+
38+
# Host mode from the report title (`## Truapi <mode> Diagnosis`).
39+
mode=$(printf '%s' "$BODY" \
40+
| grep -ioP '##\s+Truapi\s+\K(Web|Desktop|Android|iOS)(?=\s+Diagnosis)' \
41+
| head -1 || true)
42+
if [ -z "$mode" ]; then
43+
gh issue comment "$ISSUE" --body \
44+
"Could not read a host from this report (expected a \`## Truapi <Web|Desktop|Android|iOS> Diagnosis\` heading). Not filing a PR."
45+
exit 1
46+
fi
47+
host=$(printf '%s' "$mode" | tr '[:upper:]' '[:lower:]')
48+
branch="diagnosis-report/$host"
49+
file="explorer/diagnosis-reports/$host.md"
50+
51+
git fetch origin main
52+
git switch -C "$branch" origin/main
53+
printf '%s\n' "$BODY" > "$file"
54+
55+
git config user.name "github-actions[bot]"
56+
git config user.email "github-actions[bot]@users.noreply.github.com"
57+
if git diff --quiet -- "$file"; then
58+
gh issue comment "$ISSUE" --body \
59+
"This $mode report matches the current \`$file\`; nothing to update."
60+
gh issue close "$ISSUE"
61+
exit 0
62+
fi
63+
git add "$file"
64+
git commit -m "diagnosis: update $host report (from #$ISSUE)"
65+
git push -f origin "$branch"
66+
67+
# One open PR per host branch: reuse it while it is open, open a new
68+
# one once the previous report has merged (a merged/closed PR for the
69+
# branch must not suppress the next submission).
70+
url=$(gh pr list --head "$branch" --state open --json url --jq '.[0].url // empty')
71+
if [ -z "$url" ]; then
72+
url=$(gh pr create --base main --head "$branch" \
73+
--title "diagnosis: $mode host report" \
74+
--body "Updates \`$file\` from the diagnosis in #$ISSUE. The compatibility matrix is regenerated from the reports at build time.")
75+
fi
76+
77+
gh issue comment "$ISSUE" --body "Filed in $url"
78+
gh issue close "$ISSUE"

Makefile

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,18 @@
33
# Run `make help` for the list of targets.
44

55
.DEFAULT_GOAL := help
6-
.PHONY: help setup build codegen test check playground matrix explorer
6+
.PHONY: help setup build codegen test check playground dev matrix explorer
77

88
TRUAPI_PKG := js/packages/truapi
99
PLAYGROUND := playground
1010
EXPLORER := explorer
11+
DOTLI := hosts/dotli
12+
13+
# `make dev DEBUG=1` runs dotli with VITE_APP_DEBUG=true to log every wire frame.
14+
DOTLI_PREVIEW := preview
15+
ifdef DEBUG
16+
DOTLI_PREVIEW := preview:debug
17+
endif
1118

1219
help: ## Show this help.
1320
@awk 'BEGIN { FS = ":.*##"; printf "Usage: make <target>\n\nTargets:\n" } \
@@ -43,6 +50,12 @@ playground: ## Refresh the playground's @parity/truapi snapshot and rebuild.
4350
cd $(PLAYGROUND) && rm -rf node_modules/@parity && yarn install
4451
cd $(PLAYGROUND) && yarn build
4552

53+
dev: ## Start dotli host (:5173) + playground (:3000) together; open http://localhost:5173/localhost:3000. DEBUG=1 logs wire frames.
54+
@trap 'kill 0' EXIT; \
55+
( cd $(DOTLI) && bun run $(DOTLI_PREVIEW) ) & \
56+
( cd $(PLAYGROUND) && yarn dev ) & \
57+
wait
58+
4659
matrix: ## Regenerate the host compatibility matrix from explorer/diagnosis-reports.
4760
cd $(EXPLORER) && npm run generate-matrix
4861

docs/RELEASE_PROCESS.md

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,17 @@ publish, and only when they bump the package version.
1313

1414
## How to release
1515

16-
### 1. Open a release PR
16+
### 1. Cut the protocol version
1717

18-
From the repo root:
18+
Run `scripts/cut-version.sh` to crystallize wire types, take an explorer
19+
snapshot, and generate the root `CHANGELOG.md`:
20+
21+
```bash
22+
scripts/cut-version.sh # crystallize next/, snapshot, changelog
23+
scripts/cut-version.sh --dry-run # preview without making changes
24+
```
25+
26+
### 2. Bump the package version
1927

2028
```bash
2129
npm run changeset # interactive: pick patch / minor / major + a short summary
@@ -29,6 +37,8 @@ runs `scripts/sync-cargo-version.mjs` to bump
2937
`rust/crates/truapi/Cargo.toml` to the same version. All three files
3038
should appear in the resulting diff.
3139

40+
### 3. Open a release PR
41+
3242
Commit the resulting diff and open a PR using the **release** template:
3343

3444
```
@@ -41,7 +51,7 @@ The PR title must start with `release:`. Convention:
4151
release: @parity/truapi 0.1.1
4252
```
4353

44-
### 2. Get the PR reviewed and merged
54+
### 4. Get the PR reviewed and merged
4555

4656
Merge via squash merge (the repo's default). The squash commit subject
4757
defaults to the PR title, so the `release:` prefix carries over to
@@ -51,7 +61,7 @@ prefix will silently skip the publish. If that does happen, open a
5161
follow-up `release:` PR with any trivial change (a CHANGELOG note tweak,
5262
say); the tag-already-exists guard makes re-runs safe.
5363

54-
### 3. Watch the publish
64+
### 5. Watch the publish
5565

5666
On merge, CI runs as usual. When CI passes, the `Release` workflow:
5767

docs/rfcs/payment-topup-sr25519.md

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
---
2+
title: "Use Sr25519 Secret Keys in PaymentTopUpSource"
3+
owner: "@filippovecchiato"
4+
---
5+
6+
# RFC — Use Sr25519 Secret Keys in PaymentTopUpSource
7+
8+
## Summary
9+
10+
Change all secret key fields in `PaymentTopUpSource` (RFC 0006) from 32-byte keys to 64-byte Sr25519 secret keys. The `PrivateKey` variant switches from `Ed25519PrivateKey` to `Sr25519SecretKey`, and the `Coins` variant widens its keys to match.
11+
12+
## Motivation
13+
14+
RFC 0006 specified Ed25519 for the `PrivateKey` variant, but the host implementation in triangle-js-sdks uses Sr25519 ([triangle-js-sdks#198](https://github.com/paritytech/triangle-js-sdks/pull/198)). The original RFC was simply wrong at that place — the accounts backing top-ups are Sr25519, not Ed25519. The `Coins` variant already used Sr25519, but with a 32-byte mini-secret; the upstream implementation uses the full 64-byte secret key for both.
15+
16+
## Detailed Design
17+
18+
`PaymentTopUpSource` changes from:
19+
20+
```rust
21+
enum PaymentTopUpSource {
22+
ProductAccount { derivation_index: u32 },
23+
PrivateKey { ed25519_private_key: [u8; 32] },
24+
Coins { sr25519_secret_keys: Vec<[u8; 32]> },
25+
}
26+
```
27+
28+
to:
29+
30+
```rust
31+
enum PaymentTopUpSource {
32+
ProductAccount { derivation_index: u32 },
33+
PrivateKey { sr25519_secret_key: [u8; 64] },
34+
Coins { sr25519_secret_keys: Vec<[u8; 64]> },
35+
}
36+
```
37+
38+
Both `PrivateKey` and `Coins` now carry 64-byte Sr25519 secret keys. The `Ed25519PrivateKey` type is removed.
39+
40+
This is a **wire-breaking** change: the SCALE encoding of both variants changes length. All hosts and products must upgrade together within the same protocol version.

explorer/.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,3 +3,6 @@ dist
33
*.tsbuildinfo
44
.vite
55
.DS_Store
6+
7+
# Generated at build/dev time from diagnosis-reports/ (see scripts/aggregate-diagnosis-matrix.mjs).
8+
src/data/compatibility.ts

explorer/README.md

Lines changed: 4 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,20 +4,15 @@ Docs-only browser for the TrUAPI service surface. All trait and type data is sou
44

55
## Host compatibility matrix
66

7-
The **Compatibility** page (`/v/<version>/compatibility`) renders a host × method matrix aggregated from the playground's per-host Diagnosis reports. The matrix data is committed at [`src/data/compatibility.ts`](src/data/compatibility.ts) a typed module emitted by [`scripts/aggregate-diagnosis-matrix.mjs`](scripts/aggregate-diagnosis-matrix.mjs). It is the **only** runtime-derived data in the explorer; everything else flows from Rust via codegen.
7+
The **Compatibility** page (`/v/<version>/compatibility`) renders a host × method matrix aggregated from the playground's per-host Diagnosis reports. The committed per-host reports under [`diagnosis-reports/`](diagnosis-reports/) are the source of truth; [`src/data/compatibility.ts`](src/data/compatibility.ts) is a generated artifact (git-ignored) that [`scripts/aggregate-diagnosis-matrix.mjs`](scripts/aggregate-diagnosis-matrix.mjs) rebuilds from those reports at `dev` / `build` / `lint` time (via the `predev` / `prebuild` / `prelint` scripts). It is the **only** runtime-derived data in the explorer; everything else flows from Rust via codegen.
88

99
### Updating the matrix
1010

11-
1. **Collect reports.** For each host you want to (re)measure, open the playground in that host, run the Diagnosis, and click **Copy report** (see [`../playground/README.md#diagnosis`](../playground/README.md#diagnosis)). Save each report to a host-named markdown file (e.g. `web.md`, `desktop.md`, `android.md`, `ios.md`).
12-
2. **Drop them in.** Place each host-named `*.md` into [`diagnosis-reports/`](diagnosis-reports/), overwriting that host's previous report.
13-
3. **Regenerate.** From the `explorer/` directory:
11+
Because the matrix is regenerated from `diagnosis-reports/` on every `dev` / `build` / `lint`, you only ever commit reports, never `src/data/compatibility.ts`.
1412

15-
```bash
16-
npm run generate-matrix
17-
```
13+
**From the playground (recommended).** Open the playground in the host you want to (re)measure, run the Diagnosis, and click **Submit report ↗**. That files a pre-filled `diagnosis-report` issue; the [`diagnosis-report`](../.github/workflows/diagnosis-report.yml) workflow writes the report to `diagnosis-reports/<host>.md` and opens (or updates) that host's PR.
1814

19-
That **rebuilds** `src/data/compatibility.ts` from every report in `diagnosis-reports/` — one column per report — leaving the inputs in place. Because the matrix is always built from the reports alone, the committed reports are the source of truth: to refresh a host, overwrite its `*.md` and regenerate. The Compatibility page (and each method's Host support row) picks up the new data on the next build / Vite HMR.
20-
4. **Commit** the updated `src/data/compatibility.ts` together with the reports under `diagnosis-reports/`. Keeping the raw per-host reports in version control makes each run diffable against the last.
15+
**By hand.** Click **Copy report** instead (see [`../playground/README.md#diagnosis`](../playground/README.md#diagnosis)), save the markdown to a host-named file (e.g. `web.md`, `desktop.md`, `android.md`, `ios.md`), drop it into [`diagnosis-reports/`](diagnosis-reports/) overwriting that host's previous report, and commit. Run `npm run generate-matrix` from `explorer/` to preview locally (or just `npm run dev`, which regenerates first). The Compatibility page and each method's Host support row pick up the new data on the next build / Vite HMR.
2116

2217
### Data shape
2318

0 commit comments

Comments
 (0)