-
Notifications
You must be signed in to change notification settings - Fork 1
fix(server): allow Bulletin allocation on wasm #449
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
base: main
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,5 @@ | ||
| --- | ||
| "@parity/truapi-host": patch | ||
| --- | ||
|
|
||
| Allow WASM signing hosts to allocate Bulletin allowances through the canonical runtime services. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -3,14 +3,19 @@ | |
| //! Mirrors how an iOS/web client obtains statement-store allowance from the real | ||
| //! People chain: build the `Resources.set_statement_store_account` call, prove | ||
| //! personhood ring membership with the caller's registry-selected ring-VRF key, | ||
| //! and submit the resulting unsigned General (v5) extrinsic. Native only | ||
| //! (needs the `verifiable` prover and live chain reads). | ||
| //! and submit the resulting unsigned General (v5) extrinsic. Compiles for | ||
| //! every target: the wasm host reaches both chains through its platform | ||
| //! connections, and the `verifiable` prover runs under wasm (the ring-VRF | ||
|
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. This line says the Not a blocker and I am glad it works, but 25 seconds of a user interaction needs to be stated up front rather than found at the bottom, and someone has to decide whether this wants a worker so it is not sitting on the main thread. |
||
| //! product surface already ships it there). Only the PGAS claim and the | ||
| //! renewal loop remain native-only. | ||
|
|
||
| pub mod collection; | ||
| pub mod extension; | ||
| pub mod extrinsic; | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| pub mod pgas; | ||
| pub mod proof; | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| pub mod renewal; | ||
| pub mod ring; | ||
| pub mod rpc; | ||
|
|
@@ -20,7 +25,10 @@ pub(crate) mod test_fixtures; | |
|
|
||
| use std::collections::HashMap; | ||
| use std::sync::{Arc, Mutex}; | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| use std::time::{Duration, Instant}; | ||
| #[cfg(target_arch = "wasm32")] | ||
| use web_time::{Duration, Instant}; | ||
|
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. Nit. |
||
|
|
||
| use futures::FutureExt; | ||
| use parity_scale_codec::{Decode, Encode}; | ||
|
|
@@ -59,6 +67,7 @@ pub enum StatementAllowanceError { | |
| #[error(transparent)] | ||
| Proof(#[from] proof::ProofError), | ||
| /// Asset Hub PGAS claim failed. | ||
| #[cfg(not(target_arch = "wasm32"))] | ||
| #[error(transparent)] | ||
| Pgas(#[from] pgas::PgasError), | ||
| /// Bulletin allowance polling timed out. | ||
|
|
||
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.
The description says this takes wall clock from
RuntimeServices::current_unix_seconds. That method does not exist, I grepped the whole branch. What is actually here is the same free function readingweb_time::SystemTime::now(), so on wasm we read the browser clock directly rather than going through a host service.Fine by me as behaviour. The pallet checks the period, so a bad clock gets rejected on chain rather than granting the wrong thing. But the description makes it sound like there is a seam we can inject or test, and there is not. Please fix the wording, otherwise someone approves this thinking the clock is host supplied.