Skip to content

Conversation

@JoeGruffins
Copy link
Member

@JoeGruffins JoeGruffins commented Feb 3, 2023

Check all providers that are not known to be good. Check them on
reconfigure as well. Also use WebSocket with full nodes rather than the
light node.

Comment on lines +23 to +24
ALPHA_HTTP_PORT="38556"
ALPHA_WS_PORT="38557"
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Would like to move this to the full nodes, since that is what would be used irl.

"${NODE_DIR}/${NAME}.log" C-m
"${NODE_DIR}/geth-ancient --verbosity 5 --vmdebug --http --http.port " \
"${HTTP_PORT} --ws --ws.port ${WS_PORT} --ws.api " \
"eth --allow-insecure-unlock " \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed all the modules except eth. This should be all we need. Also "db" was apparently not a module? This was for the light client harness node.

ERROR[02-03|11:23:46.895] Unavailable modules in HTTP API list     unavailable=[db] available="[admin debug web3 eth txpool personal clique net les vflux engine]"

Copy link
Member

@chappjc chappjc Feb 3, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Noticed this too: #2013 (comment)
No clue why it was ever there. Good to have it here too.

However, didn't we still want txpool? Is the idea that we want it to use the dumbed down fallback path? Or that beta is just used for server?

EDIT: oh I still have the txpool fallback for server in this draft PR: d942900fe10e61e674261e066c5da039d77193f6
Will get that out of draft as soon as I've reviewed the ETH swap gasses and run swaps for both ETH and USDC2 on mainnet ethereum.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

However, didn't we still want txpool? Is the idea that we want it to use the dumbed down fallback path? Or that beta is just used for server?

I guess that server operators will use providers, either by choice or because the eth node can not be kept up %100. I also guess that the txpool type operations will not be available for providers. Maybe we can turn txpool on for one and off for the other? So we can use both for testing.

Copy link
Member

@chappjc chappjc Feb 6, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the simnet harness, so I mean if you're testing dexc (client, not server) and want to use the beta node? Would that just be pointless and now expected not to work? I'm fine with that, if that's intended.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is the simnet harness, so I mean if you're testing dexc (client, not server) and want to use the beta node? Would that just be pointless and now expected not to work?

I didn't think the client needed anything but "eth" and only server needed "txpool" (doesn't need now)

I think client is fine with with either "eth" or "eth,txpool"?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Now alpha is eth and beta is eth,txpool

@JoeGruffins
Copy link
Member Author

JoeGruffins commented Feb 3, 2023

Hmm, actually seems bugged. Doesn't seem to be checking unknown providers either. Will figure it out here.

Oh, it checks on creations, I guess it also needs to check on reconfigure. Maybe not every start up?

@chappjc chappjc added this to the 0.6 milestone Feb 6, 2023
@chappjc
Copy link
Member

chappjc commented Feb 6, 2023 via email

@JoeGruffins JoeGruffins force-pushed the multirpcchanges branch 2 times, most recently from 8d1cbe9 to af2eebe Compare February 8, 2023 09:32

if rpc, is := w.node.(*multiRPCClient); is {
if err := rpc.reconfigure(ctx, cfg.Settings); err != nil {
walletDir := getWalletDir(w.dir, w.net)
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The getWalletDir path seems unnecessary. It will end up being something like $HOME/.dexc/simnet/assetdb/eth/simnet and I don't think the last siment is necessary. The keystore folder already lives there though, is it worth changing now?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've noticed that too. Not sure if we should change it though. However, nobody should be using this on mainnet, and we can move our testnet folders around if we do change it.
Maybe someone else has a more decisive opinion.

Copy link
Member

@buck54321 buck54321 Feb 8, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This has always bugged me too. On one hand, the asset package shouldn't make assumptions about what the caller is going to give. On the other hand, as you pointed out, it's stupid with the extra directory.

Anyway, won't this change bork existing wallets?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Anyway, won't this change bork existing wallets?

Yes. Existing testnet eth multiprc wallets.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just leaving for now, can be addressed in another pr if necessary.

@JoeGruffins JoeGruffins changed the title client/eth: Check non compliant providers. client/eth: Remove non compliant providers. Feb 8, 2023
@JoeGruffins JoeGruffins marked this pull request as ready for review February 8, 2023 09:52
@JoeGruffins
Copy link
Member Author

Just rebased.

@JoeGruffins
Copy link
Member Author

Copy link
Contributor

@norwnd norwnd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Minor suggestions, just possible improvements.

}
}()
if len(providers) != len(unknownEndpoints) {
return errors.New("Could not connect to all unknown providers.")
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe we could point out the exact provider(s) that's not working properly ? Trying to add a new one looks like this now, which seems a bit cryptic to me:

image

Copy link
Member Author

@JoeGruffins JoeGruffins Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There are logs in the connectProviders function, but yeah, they don't currently make it to the UI.

It's not possible for assets to send UI notifications right? Only core?

Is it easiest to stick the failed providers in that error?

Copy link
Contributor

@norwnd norwnd Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is it easiest to stick the failed providers in that error?

As a user, by looking at that error in UI I'd want to know which providers I should remove/adjust. Might be easier to "fail fast" and show only one bad provider at a time, so user can repeat adjusting until all supplied configuration is acceptable.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sticking the failing provider addresses in the error.

Copy link
Member Author

@JoeGruffins JoeGruffins Feb 17, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

image

Comment on lines +630 to +712
if err := os.WriteFile(path, b, 0644); err != nil {
log.Errorf("Failed to write compliant providers file: %v", err)
}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Maybe return error here instead of just logging it ? So the user can retry saving his configuration (in case it's temporary failure), because he'll have to refill it upon restart ... I can't think of a valid use case to log here instead of erroring right away, thougths ?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

He won't need to refill it, the providers are saved somewhere else. This file is only for a list of user added providers we didn't know about, like random full nodes. If it fails writing, it would mean the provider needs to be checked again if unknown if doing reconfigure. So, it only saves a little time and not every start up. I can't imagine why this would error here under normal circumstances.

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I misunderstood it then, thanks for clarifying.

@chappjc chappjc self-requested a review February 14, 2023 13:26
@JoeGruffins
Copy link
Member Author

Just rebased.

@JoeGruffins
Copy link
Member Author

Put all the failed providers in the error so it makes it to the frontend https://github.com/decred/dcrdex/compare/6ff317b8054100e06e059373e230680ab0979217..eae7c4f018735fd1214eefd814a70655bfc27824

@JoeGruffins
Copy link
Member Author

Was a hairy rebase.

@JoeGruffins
Copy link
Member Author

Removed unneeded timed context. Both connectProviders and checkProvidersCompliance will use their own timed contexts https://github.com/decred/dcrdex/compare/15c6d1d974d643cb55d2652000417febcdbde14d..5bd1190a3b1b9471ad0474d3bb6895e4627a3acd

@chappjc
Copy link
Member

chappjc commented Feb 21, 2023

Removed unneeded timed context. Both connectProviders and checkProvidersCompliance will use their own timed contexts https://github.com/decred/dcrdex/compare/15c6d1d974d643cb55d2652000417febcdbde14d..5bd1190a3b1b9471ad0474d3bb6895e4627a3acd

But you're calling with context.Background() in createWallet:

if err := createAndCheckProviders(context.Background(), walletDir, endpoints,

Probably OK, but it's not timed on that path.

EDIT: Oh, you mean connectProviders has it's own timed context... alright.

@chappjc
Copy link
Member

chappjc commented Feb 21, 2023

git rm client/asset/eth/cmd/getgas/getgas pls

Check all providers that are not known to be good. Check them on
reconfigure as well. Also use WebSocket with full nodes rather than the
light node.
@chappjc chappjc merged commit 68b8623 into decred:master Feb 21, 2023
@chappjc
Copy link
Member

chappjc commented Feb 21, 2023

Merged, but can you clarify your comment about light node for me?

@JoeGruffins
Copy link
Member Author

git rm client/asset/eth/cmd/getgas/getgas pls

Ah srry, this is like twice now. I guess you removed it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants