Skip to content
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

Can't reopen the same box with identity wallet if local ipfs has been cleared #941

Closed
msterle opened this issue Feb 18, 2020 · 14 comments
Closed
Assignees
Labels
bug Something isn't working
Milestone

Comments

@msterle
Copy link
Contributor

msterle commented Feb 18, 2020

Steps to reproduce:

  1. Create a new npm package

  2. npm i 3boc identity-wallet

  3. create index.js with the following:

    const Box = require('3box')
    const IdentityWallet = require('identity-wallet')
    
    async function start() {
      const SEED = '0x95838ece1ac686bde68823b21ce9f564bc536abbb9c3500fa6da81f17086a6aa'
      const idWallet = new IdentityWallet(() => true, { seed: SEED })
      const provider = idWallet.get3idProvider()
      const box = await Box.openBox(null, provider)
      console.log('Box opened')
      box.logout()
    }
    
    start()
    
  4. force-quit (client doesn't halt otherwise)

  5. remove local ipfs and orbit directories with rm -fr ipfs orbitdb

  6. rerun index.js

@msterle msterle added the bug Something isn't working label Feb 18, 2020
@michaelsena michaelsena added this to the Sprint 36 milestone Feb 19, 2020
@oed
Copy link
Member

oed commented Feb 20, 2020

Might be related to: ceramicstudio/js-3id-did-provider#34

@zachferland
Copy link
Contributor

@oed forgot what you mentioned before, but yeah looks this is partially resolved by pinning auth data (so won't work for this seed here now, but will for another), don't see where/when that fix was

still needs another fix, when not stored locally, takes two opens, before it resolves on second open

@oed
Copy link
Member

oed commented Mar 11, 2020

@zachferland why wasn't the authData pinned?

@zachferland
Copy link
Contributor

@oed couldn't remember if you mentioned that, because yeah i dont see where that would have been true

@oed
Copy link
Member

oed commented Mar 11, 2020

That's very strange because I explicitly did a patch that fixed this.

@zachferland
Copy link
Contributor

zachferland commented Mar 11, 2020

ok where is that patch? couldnt find it

so yes seems like it is definitely pinning now, and it partially fixed it, since mike last tried it, now just not resolving on first open, but works on second

@oed
Copy link
Member

oed commented Mar 11, 2020

@zachferland
Copy link
Contributor

@msterle - using your example above, it now works in the following case, have existing (used) seed, clear orbit/ipfs, run (it hangs before completing open, probs needs few seconds to get data), exit, run again and now it will work

@msterle
Copy link
Contributor Author

msterle commented Mar 13, 2020

@zachferland can this be done programmatically (without user intervention)?

@zachferland
Copy link
Contributor

It appears this is the root issue - ipfs/js-ipfs-bitswap#214

When having to fetch same data/cid from concurrently it just hangs. This seems to happen most frequently with the did docs, as this is used to verify identity on entires and other verifications, ends up having dag.get called concurrently at some point. Might be able to limit this, and can also fix in other ways, probably in 3id resolver, but having that fixed in ipfs would be helpful.

Saw same issue in past it looks like, and may or may not be primarily because of did doc. 3box/3box-pinning-node#288 But was causing random test failures.

@zachferland
Copy link
Contributor

@msterle if within same process, i guess not, maybe can spawn child process, exit after few seconds, then run again.

I can look at your code as well if you dont have time today, i think either way may be short term hacky somewhere since not sure i will want to change any production to get around it. But can look at quick fix in 3id resolver, and that branch can be pulled in for tests at least. But may still show up in other ways.

@zachferland
Copy link
Contributor

Ok since almost only caused by did doc it appears, easy enough to circumvent in ipfs-did-document with cache to not call dag.get multiple times. So will push that up soon

@zachferland
Copy link
Contributor

@msterle you can now 'npm i github:3box/js-ipfs-did-document#feat/diddoc-cache' and this should be fixed for you for now

@msterle
Copy link
Contributor Author

msterle commented Mar 16, 2020

Thanks @zachferland, I tried some of the functional tests and they seem to be working now :)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

4 participants