-
Notifications
You must be signed in to change notification settings - Fork 126
client: allow skipping registration when adding a dex (view-only) #1986
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
Conversation
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.
Damn good work! Looks and tests great. Just a couple little things.
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.
I think we're conflating two concepts: (a) being registered at the DEX host, and (b) having a generated account identity/keys for authentication/authorization purposes regardless of registration and fee/bond status.
In Register
of course we are concerned with both, particularly the first one so we don't pay a fee twice.
In many other places, we really don't need to know about fee coins or bonds or anything like that; we just want to know if we've run setupCryptoV2
and created account keys. I think that is what distinguishes a view-only account from one intended for authorization (regardless of payment details).
See my comments on the new (*dexAccount).isRegistered
method.
Hmm. A dexAccount that started as a view-only account (no keys setup) but later has keys setup is still a view-only account unless the fee is paid? If not, how would the markets page UI look for such a dexAccount? |
I think I just answered this in #1986 (comment), but no, it is no longer a view-only account if it has it's keys set. Fee is a legacy concept, and As far as how the UI looks, note that with the legacy registration fee, there's a "pending" state between when you broadcast the fee transaction and when it gets confirmed and then submitted to the DEX. Similarly, with bonds, if you create an account with a bond ( I don't know exactly what "not completed" |
Your explanations above clarify things for me @chappjc, thanks.
So, this PR adds a third concept (c) view-only DEX (not registered, no keys). Among other changes in my last commit,
|
8dcfd55
to
e0812cd
Compare
There is a limit on the number of websocket connections to a server. Lines 36 to 38 in 884100b
If dex becomes popular, unpaid users could, accidentally, shut the dex down when paid/bond posted users cannot connect. Is it possible to limit the number of unpaid connections, and give them a time limit where they are kicked and must re-connect, maybe with a forced wait buffer if we are close to max unpaid connections? Can be a todo, imo. |
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.
Silly if statement bug. Fixed. |
e0812cd
to
19d9ca4
Compare
Also, a "tier zero, bond posted, waiting confirmations" state. Is the UI bits something you're working on in your next bond PR @chappjc? |
I'm starting the next "in progress" item on the project page here: DCRDEX Fidelity Bonds (view) |
Next bond steps include UI, updated messaging (suspended -> sub-tier or whatever), client bond maintenance, settings, switches, etc. I'm starting client db and core work for maintaining a certain tier with limits on total bonding amount. For the UI, what we do depends on if we intend to support both the legacy fee and bonds in the next release. I don't think we should give the choice, only bonds. So, while we transition in development, I think we should start by showing two options at /register - one that uses the legacy fee and one that uses a bond. But since it's only for developers to use either as needed, I don't think we should make it a single polished form with a selector. In fact, two separate forms shown simultaneously where you just use one of the forms might make the most sense (not intended for release that way). Otherwise if we make a nice selector on a single form, we're going to have to change that when the legacy fee is dropped. If there are just two forms shown, we just remove one when it's time to drop the fee. |
8967ea7
to
2f6694a
Compare
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.
client/db/types.go
Outdated
if ai.LegacyFeePaid || len(ai.LegacyFeeCoin) > 0 { | ||
return true | ||
} | ||
return len(ai.Bonds) > 0 |
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.
One tangential but fundamental improvement with the bonds registration protocol is that the account is not created server-side until the bond is confirmed. Thus, we need the Confirmed
loop in 91d6124#diff-592072666205a423f50bc3061a74c2cda51bfe4689d4044315ff285d29645bc3R196-R199 to discern if the account should exist on the server ("may auth"). If there is a need to discern the pending initial bond state, we'll have to account for and flag that separately.
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.
I see. Yeah, there's a need to discern if a bond tx or the legacy fee tx has been broadcast to prevent re-attempting a new legacy tx. But that's about it, and since legacy registration will soon be a thing of the past, I'm beginning to wonder if there's any need to account for this.
The only thing we'd need to know is if there's NO active/pending bond and then display a prompt on the UI to post a bond to trade. If there's a pending bond, we display a confirmations counter.
We may also choose to prevent posting a new bond if there's a pending bond.
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.
Alright, sounds fine for now. Will test it all out today.
Sorry, didn't mean to request review from you @buck54321. Feel free to review of course, but no urgent need. |
c5d7c26
to
b872504
Compare
// Host is optional. If provided, the register page will not display the add | ||
// dex form, instead this host will be pre-selected for registration. | ||
Host string |
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.
If #2025 goes in first (I think it should), I'd use the dexsettings page for this instead of the register page. It would already contain the mechanics for posting bond for an existing dex connection and would naturally fit.
b079447
to
6237a08
Compare
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.
Testing well.
@@ -1195,6 +1196,10 @@ func (c *Core) connectedDEX(addr string) (*dexConnection, error) { | |||
return nil, err | |||
} | |||
|
|||
if dc.acct.isViewOnly() { |
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.
This method maybe doesn't make sense named connectedDEX
anymore. A view-only connection is still a connection.
client/db/bolt/db.go
Outdated
// TODO: Accept a viewOnly bool param to prevent unintentionally saving | ||
// zero-length Enckey. |
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.
Still applicable?
const page = this.page | ||
page.appPW.value = '' | ||
Doc.hide(page.err) | ||
const hidePWBox = State.passwordIsCached() || (this.pwCache && this.pwCache.pw) |
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.
Could we skip this form altogether if the password is cached?
// TODO: Use dexsettings page? | ||
const registerBttn = Doc.tmplElement(page.notRegistered, 'registerBttn') | ||
bind(registerBttn, 'click', () => { | ||
window.location.assign(`/register/${this.market.dex.host}`) |
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.
This isn't our preferred method of navigation, since it forces the js and css to be reloaded. How about using loadPage
with a data
argument?
6237a08
to
f506663
Compare
4ff9ba8
to
8abd8b2
Compare
Resolves #1882. Also resolves #726.
This adds a new flow for connecting to a DEX.