-
Notifications
You must be signed in to change notification settings - Fork 1
feat(truapi-provider): native and wasm ChainProvider with WebSocket and embedded smoldot backends #276
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
BigTava
wants to merge
50
commits into
main
Choose a base branch
from
tiago-truapi-provider
base: main
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
feat(truapi-provider): native and wasm ChainProvider with WebSocket and embedded smoldot backends #276
Changes from all commits
Commits
Show all changes
50 commits
Select commit
Hold shift + click to select a range
fbfa5b1
feat(truapi-provider): add native and wasm ChainProvider with WebSock…
BigTava b997d6c
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 5441861
feat(truapi-provider): resolve the network from the genesis hash at c…
BigTava 2691fbb
feat(truapi-provider-ffi): add UniFFI Swift bindings and iOS xcframew…
BigTava 3a3b15c
refactor(truapi-provider): move the Swift/UniFFI bindings into the cr…
BigTava d25a3ed
fix(truapi-provider): fail-fast dropped requests, non-poisoning share…
BigTava f9bd97e
refactor(truapi-provider): add a typed ProviderError that converts to…
BigTava 377b3af
feat(truapi-provider): add a connect tracing span, correct the vendor…
BigTava aba63fa
refactor(truapi-provider)!: rename NativeChainProvider to EmbeddedCha…
BigTava 5be1aac
feat(truapi-provider): add warm-start snapshot() with builder databas…
BigTava 0829d86
refactor(truapi-provider): trim comments to intent-only and fix the w…
BigTava 7e501b3
refactor(truapi-provider): drop the only mod.rs and use core:: for pi…
BigTava 7d4a1bb
feat(truapi-provider): reclaim implicitly-added relay chains once the…
BigTava cac1e5a
feat(truapi-provider): bound the native request buffer and end the st…
BigTava 8448d3c
test(truapi-provider): add concurrency coverage and CI wasm compile-c…
BigTava e4d26c1
refactor(truapi-provider): store chain specs as Cow<'static, str> so …
BigTava fe1be49
refactor(truapi-provider): name the light-client spec field `specific…
BigTava b6bad63
refactor(truapi-provider): derive a parachain's relay from the catalo…
BigTava 54bc801
feat(truapi-provider): add the @parity/truapi-provider npm package bu…
BigTava 9aac737
refactor(truapi-provider): make ChainSource transport-only and resolv…
BigTava 7da5a0a
feat(truapi-provider): release @parity/truapi-provider through the np…
BigTava 57a9672
refactor(truapi-provider): make statement-store placement catalog-own…
BigTava ff7ab82
feat(truapi-provider): publish dev snapshots via a workflow_dispatch …
BigTava 0d97407
refactor(truapi-provider): drop the statement-protocol setter from th…
BigTava d8eb6cb
refactor(truapi-provider): rename the asset_hub network field to asse…
BigTava cf3bab1
ci(truapi-provider): allow triggering the dev publish by pushing a tr…
BigTava 634d933
fix(truapi-provider): survive the first dev publish with 404-safe npm…
BigTava b702515
docs(truapi-provider): trim dev-publish workflow comments to intent
BigTava 5e6b28b
feat(truapi-provider): bundle previewnet in the network catalog
BigTava b620eb2
feat(truapi-provider): add setLogLevel to route provider and smoldot …
BigTava 65909e0
ci(truapi-provider): add a scheduled job to refresh the bundled chain…
BigTava 76f5b00
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 99c9998
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 8dc3e7d
chore(truapi-provider): refresh paseo relay lightSyncState checkpoint
BigTava df94067
docs(truapi-provider): rewrite the @parity/truapi-provider README int…
BigTava 0729e9d
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 9b6e355
Merge branch 'main' into tiago-truapi-provider
filvecchiato 5b7938d
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 17a2280
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 32f7e6b
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava ebdb450
fix(truapi-provider): fail fast on snapshot errors, reclaim relays, a…
BigTava 78687ff
fix(truapi-provider): corroborate the GRANDPA authority set and point…
BigTava 3950d10
fix(truapi-provider): require a peer to confirm a checkpoint and comp…
BigTava cd164e5
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 9c8350a
chore(truapi-provider): refresh chain specs and corroborate the previ…
BigTava d9c1edf
feat(truapi-provider): ship native chain transport as standalone iOS …
BigTava 418c619
docs(truapi-provider): align the native package docs with the host pa…
BigTava 70ac6b2
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava 1253af7
Merge remote-tracking branch 'origin/main' into tiago-truapi-provider
BigTava f7f7d3b
feat(truapi-provider): refresh paseo-next-v2 genesis hashes and cover…
BigTava File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,121 @@ | ||
| name: Dev publish | ||
|
|
||
| # Publish a dev-tagged snapshot of @parity/truapi-provider without moving | ||
| # `latest`. Stable releases go through release.yml. | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| npm_tag_suffix: | ||
| description: 'Optional dev dist-tag suffix. Empty -> "dev-<YYYYMMDD>"; else "dev-<YYYYMMDD>-<suffix>". Charset: [A-Za-z0-9-].' | ||
| type: string | ||
| required: false | ||
| default: "" | ||
| # Push a `truapi-provider-dev` or `truapi-provider-dev-<suffix>` tag to publish | ||
| # a dev snapshot; the part after `truapi-provider-dev-` becomes the dist-tag suffix. | ||
| push: | ||
| tags: | ||
| - "truapi-provider-dev*" | ||
|
|
||
| permissions: | ||
| contents: read | ||
|
|
||
| concurrency: | ||
| group: dev-publish-truapi-provider | ||
| cancel-in-progress: false | ||
|
|
||
| jobs: | ||
| dev-publish: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
| with: | ||
| persist-credentials: false | ||
|
|
||
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.4.0 | ||
| with: | ||
| node-version: "22" | ||
| registry-url: "https://registry.npmjs.org" | ||
|
|
||
| - uses: dtolnay/rust-toolchain@5b842231ba77f5c045dba54ac5560fed2db780e2 # stable | ||
| with: | ||
| toolchain: stable | ||
| targets: wasm32-unknown-unknown | ||
|
|
||
| - uses: Swatinem/rust-cache@e18b497796c12c097a38f9edb9d0641fb99eee32 # v2 | ||
|
|
||
| - name: Install wasm-pack | ||
| run: cargo install wasm-pack --version 0.14.0 --locked | ||
|
|
||
| # Stamp <next-patch>-dev-<date>[-suffix].N (sorts below any future stable) | ||
| # into package.json; never committed. | ||
| - name: Compute dev version and dist-tag | ||
| id: devver | ||
| shell: bash | ||
| env: | ||
| NPM_TAG_SUFFIX: ${{ inputs.npm_tag_suffix }} | ||
| run: | | ||
| set -euo pipefail | ||
| suffix="${NPM_TAG_SUFFIX:-}" | ||
| # On a tag push, derive the suffix from the tag name | ||
| # (truapi-provider-dev[-<suffix>]); workflow_dispatch supplies it directly. | ||
| if [[ -z "$suffix" && "${GITHUB_REF_TYPE:-}" == "tag" ]]; then | ||
| suffix="${GITHUB_REF_NAME#truapi-provider-dev}" | ||
| suffix="${suffix#-}" | ||
| fi | ||
| if [[ -n "$suffix" && ! "$suffix" =~ ^[A-Za-z0-9-]+$ ]]; then | ||
| echo "::error::dev suffix must match [A-Za-z0-9-]+ or be empty" | ||
| exit 1 | ||
| fi | ||
| pkg=js/packages/truapi-provider | ||
| base="$(jq -r .version "$pkg/package.json")" | ||
| stable="${base%%-*}" | ||
| IFS='.' read -r major minor patch <<< "$stable" | ||
| next="$major.$minor.$((patch + 1))" | ||
| date="$(date -u +%Y%m%d)" | ||
| if [[ -z "$suffix" ]]; then | ||
| tag="dev-${date}" | ||
| else | ||
| tag="dev-${date}-${suffix}" | ||
| fi | ||
| prefix="${next}-${tag}" | ||
| # `|| echo '[]'`: npm view 404s before the first publish; `|| true`: | ||
| # no version matches the prefix on the first same-day build. | ||
| max_n="$( | ||
| { npm view --json @parity/truapi-provider versions 2>/dev/null || echo '[]'; } \ | ||
| | jq -r '.[]?' \ | ||
| | { grep -E "^${prefix}\.[0-9]+$" || true; } \ | ||
| | sed -E "s|^${prefix}\.||" \ | ||
| | sort -n | tail -1 | ||
| )" | ||
| n=$(( ${max_n:--1} + 1 )) | ||
| version="${prefix}.${n}" | ||
| jq --arg v "$version" '.version = $v' "$pkg/package.json" > "$pkg/package.json.tmp" | ||
| mv "$pkg/package.json.tmp" "$pkg/package.json" | ||
| echo "version=$version" >> "$GITHUB_OUTPUT" | ||
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | ||
| echo "Computed @parity/truapi-provider@${version} -> dist-tag ${tag}" | ||
|
|
||
| - name: Build wasm | ||
| run: npm run build:wasm --prefix js/packages/truapi-provider | ||
|
|
||
| - name: Pack | ||
| run: | | ||
| set -euo pipefail | ||
| mkdir -p artifacts | ||
| (cd js/packages/truapi-provider && npm pack --pack-destination "$GITHUB_WORKSPACE/artifacts/") | ||
|
|
||
| - name: Upload package artifact | ||
| uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1 | ||
| with: | ||
| name: truapi-provider-dev-${{ github.sha }} | ||
| path: artifacts/*.tgz | ||
|
|
||
| - name: Publish via npm_publish_automation | ||
| uses: octokit/request-action@b91aabaa861c777dcdb14e2387e30eddf04619ae # v3.0.0 | ||
| with: | ||
| route: POST /repos/paritytech/npm_publish_automation/actions/workflows/publish.yml/dispatches | ||
| ref: main | ||
| inputs: '${{ format(''{{ "repo": "{0}", "run_id": "{1}", "artifact_name": "truapi-provider-dev-{2}", "npm_tag": "{3}" }}'', github.repository, github.run_id, github.sha, steps.devver.outputs.tag) }}' | ||
| env: | ||
| GITHUB_TOKEN: ${{ secrets.NPM_PUBLISH_AUTOMATION_TOKEN }} | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,69 @@ | ||
| name: Refresh Chain Specs | ||
|
|
||
| # Refresh the smoldot chain specs bundled in truapi-provider (fresh relay | ||
| # lightSyncState checkpoints and genesis stateRootHash). The refresh only | ||
| # reaches consumers after a new @parity/truapi-provider is published, so this | ||
| # runs weekly rather than hourly. | ||
| on: | ||
| schedule: | ||
| # Mondays at 00:00 UTC. | ||
| - cron: "0 0 * * 1" | ||
| workflow_dispatch: | ||
| inputs: | ||
| skip_bootnode_check: | ||
| description: "Skip bootnode health check (keep existing bootnodes)" | ||
| required: false | ||
| type: boolean | ||
| default: true | ||
|
|
||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
|
|
||
| jobs: | ||
| update: | ||
| name: Update Chain Specs | ||
| runs-on: ubuntu-latest | ||
|
|
||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0 | ||
|
|
||
| - uses: actions/setup-node@48b55a011bda9f5d6aeb4c2d9c7362e8dae4041e # v6.0.0 | ||
| with: | ||
| node-version: "22" | ||
|
|
||
| - name: Refresh chain specs | ||
| run: bash scripts/update-chain-specs.sh | ||
| env: | ||
| SKIP_BOOTNODE_CHECK: ${{ inputs.skip_bootnode_check == '' && 'true' || inputs.skip_bootnode_check }} | ||
|
|
||
| - name: Check for changes | ||
| id: diff | ||
| run: | | ||
| if git diff --quiet rust/crates/truapi-provider/networks/; then | ||
| echo "changed=false" >> "$GITHUB_OUTPUT" | ||
| else | ||
| echo "changed=true" >> "$GITHUB_OUTPUT" | ||
| fi | ||
|
|
||
| - name: Create Pull Request | ||
| if: steps.diff.outputs.changed == 'true' | ||
| uses: peter-evans/create-pull-request@5f6978faf089d4d20b00c7766989d076bb2fc7f1 # v8.1.1 | ||
| with: | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this need a PAT or app token? With the default |
||
| title: "chore(truapi-provider): refresh bundled chain specs" | ||
| body: | | ||
| Automated refresh of the smoldot chain specs bundled in truapi-provider. | ||
|
|
||
| If `every_catalog_genesis_hash_matches_its_bundled_spec` fails, a chain has been | ||
| re-genesised and its `genesis_hex` in `rust/crates/truapi-provider/src/networks.rs` | ||
| needs updating too. The refresh only rewrites the specs, never the catalog constants. | ||
| The failure names the network and service, and prints the hash the refreshed spec | ||
| derives to on the left and the stale catalog constant on the right. Copy the left one | ||
| into `networks.rs`, and update any consumer that pins the old hash. | ||
|
|
||
| Publish a new `@parity/truapi-provider` for consumers to pick up the refresh. | ||
| branch: auto/chain-spec-update | ||
| commit-message: "chore(truapi-provider): refresh bundled chain specs" | ||
| delete-branch: true | ||
| labels: dependencies | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Do we want this gated the same way
release.ymlis? Right now anytruapi-provider-dev*tag push publishes to npm with noneeds:?