Skip to content
Closed
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
5 changes: 5 additions & 0 deletions .changeset/funding-provider-battery.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@parity/truapi": patch
---

`make e2e-funding-cli` also runs a provider worker: the scripted funding host hands `provide` sessions to the product that asked, completes the top-ups and payment requests it starts, and the battery resumes an inbound session after a host restart.
5 changes: 5 additions & 0 deletions .changeset/funding-provider.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
---
"@parity/truapi": major
---

New `FundingProvider` trait for a provider's worker: `serveSubscribe` receives the sessions assigned to it and cancel requests, `report` stores its progress on the session, and `presentFrame` shows one of its screens in a host frame. Sessions end as `Delivered` or `Released` from the claims of the top-ups, or the completion of the payment request, the provider names. Hosts assign a session with `select_funding_provider`, and must implement `present_provider_frame` on `FundingPlatform` (natively `NativeFundingCallbacks`).
59 changes: 58 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -145,6 +145,56 @@ jobs:
cat "$RUNNER_TEMP/headless-smoke.log"
grep -q headless-install-ok "$RUNNER_TEMP/headless-smoke.log"

funding-battery:
name: Funding battery (CLI host)
needs: [changes, codegen]
if: needs.changes.outputs.funding_battery == 'true'
timeout-minutes: 30
runs-on: ubuntu-latest
env:
TRUAPI_HOST_NO_UPDATE: "1"
# A fixed development signer, so the host signs in without provisioning
# an account on chain. Funding needs a session, not a funded account.
HOST_CLI_SIGNER_MNEMONIC: "bottom drive obey lake curtain smoke basket hold race lonely fit walk"
BATTERY_PHASE_TIMEOUT: "600"
steps:
- uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
with:
persist-credentials: false

- uses: dtolnay/rust-toolchain@5b842231ba77f5c045dba54ac5560fed2db780e2 # stable
with:
toolchain: stable

- uses: ./.github/actions/rust-cache

- uses: actions/setup-node@820762786026740c76f36085b0efc47a31fe5020 # v7.0.0
with:
node-version: 24

- uses: oven-sh/setup-bun@0c5077e51419868618aeaa5fe8019c62421857d6 # v2.2.0
with:
bun-version: "1.4.2"

- name: Download codegen output
uses: actions/download-artifact@3e5f45b2cfb9172054b4087a40e8e0b5a5461e7c # v8.0.1
with:
name: codegen-output

- name: Isolate the host state
run: echo "TRUAPI_HOST_BASE_PATH=$RUNNER_TEMP/funding-host-state" >> "$GITHUB_ENV"

- name: Run the funding battery
run: make e2e-funding-cli

- name: Upload host logs and transcripts
if: failure()
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: funding-battery-logs
path: target/battery
retention-days: 14

wasm-provider:
name: truapi-provider (wasm browser tests)
timeout-minutes: 10
Expand Down Expand Up @@ -284,6 +334,7 @@ jobs:
sdk_provider_kotlin: ${{ steps.filter.outputs.sdk_provider_kotlin }}
host_android: ${{ steps.filter.outputs.host_android }}
cli_package: ${{ steps.filter.outputs.cli_package }}
funding_battery: ${{ steps.filter.outputs.funding_battery }}
workflows: ${{ steps.filter.outputs.workflows }}
needs_changeset: ${{ steps.filter.outputs.needs_changeset }}
adds_changeset: ${{ steps.filter.outputs.adds_changeset }}
Expand Down Expand Up @@ -322,6 +373,7 @@ jobs:
echo "sdk_provider_kotlin=true"
echo "host_android=true"
echo "cli_package=true"
echo "funding_battery=true"
echo "workflows=true"
} >> "$GITHUB_OUTPUT"
exit 0
Expand Down Expand Up @@ -357,6 +409,10 @@ jobs:
# source, and bundling it is a step no other job performs. A release
# is the wrong place to find out one of them moved.
gate cli_package '^(rust/crates/(truapi-host-cli|truapi|truapi-codegen|truapi-macros)/|js/container/|js/packages/truapi/(src/|package\.json$|tsconfig[^/]*\.json$)|Makefile$|nightly-toolchain$|Cargo\.toml$|Cargo\.lock$|package\.json$|package-lock\.json$|scripts/(codegen\.sh|build-cli-runner\.ts|cli-runner-package\.test\.ts)$|\.github/workflows/(ci|cli-package|release-cli)\.yml$)'
# The funding battery drives the core's funding and provider surface
# through the CLI host and the generated client, so it reads every
# crate the host is built from, the client, and the scripts it runs.
gate funding_battery '^(rust/crates/(truapi|truapi-host-cli|truapi-codegen|truapi-macros|truapi-provider|truapi-verifiable)/|js/packages/truapi/(src/|package\.json$|tsconfig[^/]*\.json$)|js/container/|playground/(package\.json|yarn\.lock)$|scripts/(battery|codegen)\.sh$|Makefile$|nightly-toolchain$|Cargo\.toml$|Cargo\.lock$|package\.json$|package-lock\.json$|\.github/workflows/ci\.yml$)'

# Include generators, dependency pins and package build configuration:
# these can change a published artifact without touching its sources.
Expand Down Expand Up @@ -1311,6 +1367,7 @@ jobs:
[
rust,
headless-install,
funding-battery,
wasm-provider,
licenses,
codegen,
Expand Down Expand Up @@ -1368,7 +1425,7 @@ jobs:
env:
NEEDS: ${{ toJSON(needs) }}
REQUIRED: >-
rust headless-install wasm-provider licenses codegen ios-bindings changes ios-swift
rust headless-install funding-battery wasm-provider licenses codegen ios-bindings changes ios-swift
android-bindings provider-android-bindings host-android-bindings
host-android-detekt
cli-package ts-client
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -306,7 +306,7 @@ make e2e-signing-cli # same direct signing-host phase
make e2e-pairing-cli # same paired pairing-host phase
make e2e-chat-cli # chat content screening against a chat signing-host
make e2e-pocket-cli # Pocket protocol check against a Pocket signing-host
make e2e-funding-cli # funding requests and statuses against a scripted funding host
make e2e-funding-cli # funding requests and a provider worker against a scripted funding host
```

The Pocket phase runs its product as a Worker execution, the only execution
Expand Down
8 changes: 8 additions & 0 deletions explorer/diagnosis-reports/funding/signing-host-cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,11 @@
| `Funding/request_failed` | ✅ | |
| `Funding/request_dismissed` | ✅ | |
| `Funding/status_subscribe_unknown` | ✅ | |
| `Funding/provider_assigned` | ✅ | |
| `Funding/provider_present_frame` | ✅ | |
| `Funding/provider_reports_forward_only` | ✅ | |
| `Funding/provider_credits_through_top_up` | ✅ | |
| `Funding/provider_out_released` | ✅ | |
| `Funding/provider_cancel` | ✅ | |
| `Funding/provider_resumes_after_restart` | ✅ | |
| `Funding/provider_in_delivered` | ✅ | |
1 change: 1 addition & 0 deletions rust/crates/truapi-codegen/src/rust.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,6 +62,7 @@ const TRAIT_MODULE_MAP: &[(&str, &str)] = &[
("Contacts", "contacts"),
("Entropy", "entropy"),
("Funding", "funding"),
("FundingProvider", "funding_provider"),
("JsonRpc", "jsonrpc"),
("LocalStorage", "local_storage"),
("Payment", "payment"),
Expand Down
113 changes: 113 additions & 0 deletions rust/crates/truapi-codegen/tests/golden/dispatcher.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 11 additions & 0 deletions rust/crates/truapi-codegen/tests/golden/host-callbacks.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

32 changes: 31 additions & 1 deletion rust/crates/truapi-codegen/tests/golden/wire_table.rs

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

17 changes: 13 additions & 4 deletions rust/crates/truapi-host-cli/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -774,10 +774,19 @@ Scripts under `js/scripts/` include:
The funding phase builds the host with `--features test-host` and installs
a scripted funding overlay: each request the product makes is answered with
the next outcome from `TRUAPI_FUNDING_OUTCOMES`
(`deliver:900,release:500,fail,dismiss`), and a started session is settled
through the core's test hook with no chain behind it. Every overlay request
and session change is recorded in `TRUAPI_FUNDING_LOG`, which the cases read.
The live on-ramp on Paseo Next is `truapi-host funding-check`.
(`deliver:900,release:500,fail,dismiss,provide,provide,provide-cancel`). A
`deliver`, `release` or `fail` session is settled through the core's test
hook with no chain behind it. A `provide` session is handed to the product
that asked, which runs as a Worker and serves it as the provider: it reports
progress, starts top-ups and payment requests, which scripted engines
complete in full and record in `TRUAPI_FUNDING_LEDGER`, and the core settles
the session from them. `provide-cancel` also cancels it. The phase runs the
host twice on the same storage, so the provider resumes an inbound session
after a restart. Every overlay request and session change is recorded in
`TRUAPI_FUNDING_LOG`, which the cases read. CI runs this phase on every
change to the core, the CLI or the client, with a fixed development signer
in `HOST_CLI_SIGNER_MNEMONIC` so the host needs no account provisioned on
chain.

Contacts are served on every phase, from `TRUAPI_CONTACTS`
(`alice=0x<32-byte account>;bob=0x…`) or, unset, from a two-name development
Expand Down
Loading
Loading