-
Notifications
You must be signed in to change notification settings - Fork 716
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
Web client #1738
Web client #1738
Conversation
54a87b3
to
0dcda6a
Compare
4b043a1
to
be520e9
Compare
…ransport` module
@@ -2,6 +2,7 @@ | |||
// SPDX-License-Identifier: Apache-2.0 | |||
|
|||
use crate::RpcMessage; | |||
|
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.
Nit: No need for the whitespace here.
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.
Yes indeed, we're generally trying to maximize the normalization opportunities for Rustfmt
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 blocks here are ordered by scope (ancestor < crate < workspace < external < std), so there shouldn't be any normalization opportunities between them (different crates will always end up in different blocks). Unfortunately rustfmt doesn't understand anything about the scope of crates, so while it's smart enough to order super
and crate
dependencies at the top, without the newlines it will mix std
and linera-*
crates in with third-party dependencies :-\
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.
rustfmt has added preliminary support for this, and since we're already using nightly rustfmt I've created PR #1821 to codify import grouping behaviour — it's not quite what's done here, but at least moves a standard for crate grouping into CI to increase normalization opportunities.
@@ -3,24 +3,26 @@ | |||
// SPDX-License-Identifier: Apache-2.0 | |||
|
|||
use super::{codec, transport::TransportProtocol}; | |||
|
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.
Nit: same here, following the convention in the rest of the code of just separating imports if they have different visibility modifiers or feature gates.
use crate::{ | ||
config::ValidatorPublicNetworkPreConfig, mass_client, HandleCertificateRequest, | ||
HandleLiteCertificateRequest, RpcMessage, | ||
}; | ||
use async_trait::async_trait; | ||
use futures::{sink::SinkExt, stream::StreamExt}; | ||
|
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.
Nit: same here
use linera_version::VersionInfo; | ||
|
||
use std::time::Duration; | ||
use async_trait::async_trait; |
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.
Nit: if possible, could you also remove the other newlines above and below?
…nd` `NotificationStream`
Remaining nits should be addressed by #1821 — so I'm going to go ahead and merge this one for now :) |
Atop #1801, #1802.
Motivation
The client half of #1609.
Proposal
When compiling with
web
, replace our existing gRPC client with a Wasm-compatible gRPC-Web–based client usingtonic-web-wasm-client
.Since browser objects are neither
Send
norSync
, a large part of this work is then to enable non–Send
equivalents of various traits for structs containing non–Send
objects.linera-core
in particular now never assumes that the client struct isSend
.linera-service
, however, does. In order to enable this, I have usedtrait-variant
to construct, as automatically as possible, local and non-local variants of relevant traits.Task list:
trait-variant
Send
ness bound that permeateslinera-core
andlinera-rpc
linera-service
: export agrpc-web
–compatible endpoint #1735Test Plan
As part of this PR, I shall add tests to be run in a headless browser using
wasm-pack test
.Due to #1799 and #1800 these are not currently part of the standard test
cargo test
test suite, but can be run manually:The above assumes you are using the provided Nix flake for a development environment; if not, first you will need to install
wasm-pack
,chromium
, andchromedriver
through your usual package distribution channels. Tests also pass on Firefox, if you have Firefox installed — substitute--firefox
for--chrome
above.Release Plan
Links