Conversation
7ab3014 to
bb823c5
Compare
08608e0 to
f308e73
Compare
04b6f5c to
28b1aa6
Compare
There was a problem hiding this comment.
haven't fully gotten through the PR yet, and only a few preliminary comments. Overall i am not sure this is the right approach to get reliable initial onboarding on multiple transports. In #8444 you already introduced the basic multi-relay onboarding support and i think it's worthwhile to just use that approach. Did you consider just amending it instead of introducing a parallel new mechanism (which frankly looks complex to reason about)?
I considered amending it, yes, but there is only very little code that could have been re-used
Not sure which part of the complexity you would prefer to see removed? FTR, most of the complexity is self-contained rather than being spread around the codebase.
|
70869ba to
35776b5
Compare
| ctx.add_transport_from_qr(&qr).await | ||
| } | ||
|
|
||
| /// Automatically adds up to three transports. |
There was a problem hiding this comment.
This is not really true if we scan a QR code, then only one relay is added and autorelay is disabled.
This will likely be kept like this because we don't want to onboard users on more relays if they specifically selected one relay and also because we are using this in tests and don't want to onboard on non-CI relays when testing.
There was a problem hiding this comment.
That's why I said "up to three".
I'm happy to change the wording if you have another suggestion, I just don't want to describe what it does in detail, because the UIs shouldn't mind.
784ad78 to
19ee906
Compare
19ee906 to
37a04a8
Compare
|
OK, after talking with @link2xt let's go for an intermediate solution:
|
| "chtml.ca", | ||
| "deltachat.me", | ||
| "e2e.sus.fr", | ||
| "jp.deltachat.me", |
There was a problem hiding this comment.
nami asked to not add this host for now (and i agree, it's buggy).
There was a problem hiding this comment.
yeah, it was updated now and might just be buggy for us Europeans, but as it's hard to figure out what isn't working, let's leave it out for now.
| context | ||
| .sql | ||
| .transaction(|transaction| { | ||
| let mut stmt = transaction.prepare("INSERT INTO relay_candidates(host) VALUES(?)")?; |
There was a problem hiding this comment.
- this writes addresses not host names, and 2. no test catches it although it can not possibly succeed.
There was a problem hiding this comment.
even if we extract the hosts from the addresses, we might have twice the same host (i've seen such profiles), so need to be careful to not get an SQL Constraint error.
|
|
||
| let skip_network = false; | ||
| let res = autorelay::init_transports_inner(self, addrs_from_qr, skip_network) | ||
| .race(cancel_channel.recv().map(|_| Err(format_err!("Canceled")))) |
There was a problem hiding this comment.
if canceled, the init_transports_inner is dropped at a random async point and might have written already something into the transports table, rendering is_configured to True, but IO remains stopped. AutoRelay remains off, so no multi-relay fill up will happen.
| } | ||
| crate::qr::Qr::AskVerifyContact { addrs, .. } | ||
| | crate::qr::Qr::AskVerifyGroup { addrs, .. } | ||
| | crate::qr::Qr::AskJoinBroadcast { addrs, .. } => addrs_from_qr = addrs, |
There was a problem hiding this comment.
this is potentially an unlimited number of addresses (given a bad securejoin link). We should probably prevent ever getting more than MAX_RELAYS, probably in qr.rs already.
Fix #8693
This adds a new API
init_transports()that cares about adding one or more transports to the profile. It takes an optional QR code which can be DCLOGIN, DCACCOUNT, or securejoin, and takes them into account for the transports. The further details of what it does are not important from the UI point of view.Currently,
init_transports()onboards only on nine.testrun.org, and then enables Config::Autorelay, so that more relays will be added later. If a qr code is passed, then the addresses from there are put into therelay_candidatestable so that they will be considered by autorelay.It would be easy now to modify
init_transports()to randomly select the first relay that is used for onboarding, but I decided not to until we have a clear picture where we want to go.This PR also updates the list of default relays, and modifies
load_relay_candidates()so that we do not need a migration everytime we update the list but can instead simply updateconst DEFAULT_RELAY_CANDIDATES.