threefoldtech / home

Starting point for the threefoldtech organization
https://threefold.io
Apache License 2.0
9 stars 4 forks source link

GE: Wallet Manager in SDK browser can't handle multiple administrators #808

Closed joefoxton closed 4 years ago

joefoxton commented 4 years ago

After adding greenedgeagent.3bot as an administrator, the wallet management screen cleared. Now when I try to restore wallets to it, I get the message "Could not import wallet" for any wallet. The same wallets work fine elsewhere.

Maybe related: 5 minutes prior to seeing this problem, I experienced a problem launching the SDK browser. This is the sequence of events:

  1. Logged in as joefoxton.3bot
  2. Added greenedgeagent.3bot as an adminsrator
  3. Logged out as joefoxton.3bot
  4. Everything worked fine, as expected (including wallet manager)
  5. Stopped threebot, exited SDK, logged out, restarted machine (for other reasons)
  6. Logged back in as greenedgeagent, started SDK
  7. Could not open threebot browser
  8. Rebooted again
  9. Ran "threebot restart" - took a solid 5 minutes to complete
  10. Now I could run "threebot browser" and all worked fine... except the wallet management as seen below.

Screenshot 2020-06-23 at 15 39 39

Screenshot 2020-06-23 at 15 39 46

BolaNasr commented 4 years ago

Hello @joefoxton i tried your scenario and all works fine i add waleedhammam.3bot as administrators image Then check my wallets image Then logged out and restart my Threebot server and login again using waleedhammam 3bot i saw all my wallet in his admin dashboard

image

grimpy commented 4 years ago

@joefoxton can you check when loading the wallets if you get new errors in the alerts interface and post it here if so?

joefoxton commented 4 years ago

Must be a display issue. Looks like the SDK still has all my wallets (as it should, I didn’t remove them), but can’t display them. This problem is easily replicable over here, on both by machines. Have done multiple restarts of threebot, sdk, machine etc.

EXCEPTION: cannot do new object, Green Edge Agent Wallet exists

--TRACEBACK------------------ {DIR_BASE}/lib/jumpscale/Jumpscale/core/BASECLASSES/Decorators.py in wrapper_action 67 res = func(self, **kwargs) {DIR_BASE}/code/github/threefoldtech/jumpscaleX_threebot/ThreeBotPackages/zerobot/admin/actors/wallet.py in import_wallet 77 wallet = j.clients.stellar.new(name=name, secret=secret, network=network) {DIR_BASE}/lib/jumpscale/Jumpscale/core/BASECLASSES/JSConfigsBCDB.py in new 25 raise j.exceptions.Base(f"cannot do new object, {name} exists") ——————————————

Screen is still stuck here

On 24 Jun 2020, at 10:53, Jo De Boeck notifications@github.com wrote:

@joefoxton https://github.com/joefoxton can you check when loading the wallets if you get new errors in the alerts interface and post it here if so?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-648689576, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDUE72A3PLBGB6ML27LRYG5HLANCNFSM4OFVZETQ.

grimpy commented 4 years ago

@joefoxton thank you for the extra information but the alert you pasted is not the one I'm looking for I was hoping to find something during the listing, the one you pasted is the one about the import failing (which makes sense since the wallets are in fact still there).

Could you have another look if you can find something related to listing of wallets? (make sure to redact all kind of wallets secrets before pasting here)

joefoxton commented 4 years ago

Which one do you need?

On 24 Jun 2020, at 13:50, Jo De Boeck notifications@github.com wrote:

@joefoxton https://github.com/joefoxton thank you for the extra information but the alert you pasted is not the one I'm looking for I was hoping to find something during the listing, the one you pasted is the one about the import failing (which makes sense since the wallets are in fact still there).

Could you have another look if you can find something related to listing of wallets? (make sure to redact all kind of wallets secrets before pasting here)

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-648772607, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDSILPYXJHJHBMICU5TRYHSADANCNFSM4OFVZETQ.

grimpy commented 4 years ago

Anything that has references to https://localhost:4000/zerobot/admin/actors/wallet/get_wallets

if you could check in the 'inspect' of your browser if this specific call returns an error that could be helpfull aswell

joefoxton commented 4 years ago

Yeah, lots of errors on get_wallets...

localhost-1593006654722.log

joefoxton commented 4 years ago

Please also note, I'm unable to use Solution Expose. Maybe related? https://github.com/threefoldtech/home/issues/810

grimpy commented 4 years ago

:4000/zerobot/admin/actors/wallet/get_wallets:1 Failed to load resource: the server responded with a status of 400 (Bad Request)

This is the only usefull line really, it would be nice if you could send the output date from inspect network tab response.

is wallets = j.clients.stellar.find() working inside the kosmos shell?

joefoxton commented 4 years ago

Invalid Secret Seed is the error (Please don’t print out our secrets in clear text!)

On 24 Jun 2020, at 16:01, Jo De Boeck notifications@github.com wrote:

:4000/zerobot/admin/actors/wallet/get_wallets:1 Failed to load resource: the server responded with a status of 400 (Bad Request)

This is the only usefull line really, it would be nice if you could send the output date from inspect network tab response.

is wallets = j.clients.stellar.find() working inside the kosmos shell?

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-648839473, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDWJNNNA7GN5MVHUK63RYIBMZANCNFSM4OFVZETQ.

grimpy commented 4 years ago

@joefoxton this is an indication that atleast one of your wallets was imported with an invalid secret, that seed being printed is not correct.

this effectively makes this a duplicate of this https://github.com/threefoldtech/jumpscaleX_threebot/issues/760

joefoxton commented 4 years ago

Why would that stop all my wallets from being displayed?

Why would the import have succeeded? Why not show an error message there?

Is there a way to remove the wonky wallet so I can move ahead with reservations & wallet management?

On 24 Jun 2020, at 16:27, Jo De Boeck notifications@github.com wrote:

@joefoxton https://github.com/joefoxton this is an indication that atleast one of your wallets was imported with an invalid secret, that seed being printed is not correct.

this effectively makes this a duplicate of this threefoldtech/jumpscaleX_threebot#760 https://github.com/threefoldtech/jumpscaleX_threebot/issues/760 — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-648854595, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDSTVZRD7VQ6TEI2GR3RYIELRANCNFSM4OFVZETQ.

joefoxton commented 4 years ago

Also - PLEASE do not display even incorrect wallet secrets… they might be one character away from the right one

On 24 Jun 2020, at 16:28, Joe Foxton notifications@github.com wrote:

grimpy commented 4 years ago

@joefoxton yes you are right and that is fixed as part of that other issue I just linked. In version 10.6 it's not very straightforward to get the wrong wallet. but you can try the following:

in kosmos shell (when threebot server is stopped)

for wallet in j.data.bcdb.system.models.jumpscale__stellar__client.find():
    try:
         j.clients.stellar.get(wallet.name)
    except:
         print(f"Broken wallet {wallet.name}")
# now if you are convinced those wallets are indeed broken and are ok with deleting them do the following
j.data.bcdb.system.models.jumpscale__stellar__client.get_by_name("<wallet name here>t").delete()

The actions above you are basicly operating on db level instead of application level

joefoxton commented 4 years ago

Yep, “Green Edge Wallet” is broken. But when I run the delete…

On 24 Jun 2020, at 16:41, Jo De Boeck notifications@github.com wrote:

@joefoxton https://github.com/joefoxton yes you are right and that is fixed as part of that other issue I just linked. In version 10.6 it's not very straightforward to get the wrong wallet. but you can try the following:

in kosmos shell (when threebot server is stopped)

for wallet in j.data.bcdb.system.models.jumpscalestellarclient.find(): try: j.clients.stellar.get(wallet.name) except: print(f"Broken wallet {wallet.name}")

now if you are convinced those wallets are indeed broken and are ok with deleting them do the following

j.data.bcdb.system.models.jumpscalestellarclient.get_by_name("t").delete() The actions above you are basicly operating on db level instead of application level

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-648863403, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDVM57SH6NXKUZ325BTRYIGCPANCNFSM4OFVZETQ.

grimpy commented 4 years ago

@joefoxton as mentioned in my previous comment you need to run it when threebot server is stopped so 3sdk threebot shell

3bot stop
kosmos -p
jsx>j.data.bcdb.system.models.jumpscale__stellar__client.get_by_name("Green Edge Wallet").delete()
jsx>exit()
3bot start
joefoxton commented 4 years ago

I’m on Mac OS.. no scrolling I’m afraid

Will try the shift

On 24 Jun 2020, at 5:14 PM, Jo De Boeck notifications@github.com wrote:

 @joefoxton as mentioned in my previous comment you need to run it when threebot server is stopped so 3sdk threebot shell

3bot stop kosmos -p jsx>j.data.bcdb.system.models.jumpscalestellarclient.get_by_name("Green Edge Walle").delete() jsx>exit() 3bot start — You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub, or unsubscribe.

grimpy commented 4 years ago

@joefoxton I beleive the last comment belongs to another issue, Did you manage to get around the problem in this issue, I would like to close it as duplicate

joefoxton commented 4 years ago

Ok, so the fix worked… however…

  1. The commands you sent were not right on my side. FYI are the commands I ran:

In a Mac terminal: ./3sdk_v10.6_darwin_x86_64 3sdk> threebot stop 3sdk> container kosmos JSX> j.data.bcdb.system.models.jumpscalestellarclient.get_by_name("Green Edge Agent").delete() JSX> exit () 3sdk> threebot restart 3sdk> threebot browser

  1. What’s the root cause? How did we get into this situation? Is that problem now fixed?

Joe

On 24 Jun 2020, at 17:48, Jo De Boeck notifications@github.com wrote:

@joefoxton https://github.com/joefoxton I beleive the last comment belongs to another issue, Did you manage to get around the problem in this issue, I would like to close it as duplicate

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-648903528, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDVKUQA6M7EYFSTCF3TRYIN47ANCNFSM4OFVZETQ.

grimpy commented 4 years ago

ok a recap on your issue: There is a bug on 10.6 already tracked by https://github.com/threefoldtech/jumpscaleX_threebot/issues/751 which causes all wallets to fail to load once you import a wallet with a wrong secret. In the issue above we make sure such a bad secret never gets saved to avoid that issue.

Regarding showing that 'bad' secret has also already been reported and fixed https://github.com/threefoldtech/jumpscaleX_threebot/issues/760

Closing this issue now since you have managed to get around your problems and next version will have fixes for them

joefoxton commented 4 years ago

Awesome. Thank you so much for your help Jo! Really appreciate it.

On 25 Jun 2020, at 10:17, Jo De Boeck notifications@github.com wrote:

ok a recap on your issue: There is a bug on 10.6 already tracked by threefoldtech/jumpscaleX_threebot#751 https://github.com/threefoldtech/jumpscaleX_threebot/issues/751 which causes all wallets to fail to load once you import a wallet with a wrong secret. In the issue above we make sure such a bad secret never gets saved to avoid that issue.

Regarding showing that 'bad' secret has also already been reported and fixed threefoldtech/jumpscaleX_threebot#760 https://github.com/threefoldtech/jumpscaleX_threebot/issues/760 Closing this issue now since you have managed to get around your problems and next version will have fixes for them

— You are receiving this because you were mentioned. Reply to this email directly, view it on GitHub https://github.com/threefoldtech/home/issues/808#issuecomment-649355979, or unsubscribe https://github.com/notifications/unsubscribe-auth/AAJREDV5H4ADTI5W2NGGCZ3RYMBZJANCNFSM4OFVZETQ.