OriginProtocol / origin

Monorepo for our developer tools and decentralized marketplace application
https://www.originprotocol.com/developers
MIT License
652 stars 196 forks source link

After publishing profile, status remains "Not Published" #639

Closed franckc closed 5 years ago

franckc commented 6 years ago

Steps to reproduce:

This might be a Metamask issue. I recently updated Metamask to latest version 4.12.0 for Chrome Version 69.0.3497.100

franckc commented 6 years ago

@sparrowDom Creating this issue to track this bug we discussed over the week-end.

Also CC @micahalcorn and @wanderingstan in case they have any idea/experience dealing with Metamask related weirdness....

matthewliu commented 6 years ago

@franckc Upon page refresh is the data available or no? Just want to isolate that it's actually not on chain vs. it being a timing issue.

franckc commented 6 years ago

Yes, data is correctly persisted. It shows up correctly after a refresh of the page.

franckc commented 6 years ago

@sparrowDom Any update on this ? Do you need help/consulting on best way to fix ? I'm sure @wanderingstan would be happy to share his wisdom on this topic :)

sparrowDom commented 6 years ago

Yeah help would be great here. I have been debugging this for a couple of hours and can't figure out what in Metamask 4.12.0 is causing all the errors. Basically there are 2 types of calls we are making:

sparrowDom commented 6 years ago

Oh and both Metamask versions seem to inject the same web3 version 0.20.3 which we use across the Dapp. So the problem is most likely not there

wanderingstan commented 6 years ago

Just tested locally, and got "Error - See the console for more details", with console showing MetaMask - RPC Error: Error: Error: [ethjs-rpc] rpc error with payload {"id":1029462959570,"jsonrpc":"2.0","params":["0xf91976188477359400831a65d08080b9192260... and pages of hex.

EDIT: I'd just forgotten to reset metamask.

sparrowDom commented 6 years ago

Yeah that was probably when deploying a contract (saving profile for the first time?). Can you also try to create a listing?

wanderingstan commented 6 years ago

Ok, I was able to reproduce locally using the steps above, setting first, last, and description for my profile. Status stays at 0% complete.

At least this will make it easier to poke at it and test things!

wanderingstan commented 6 years ago

@sparrowDom this looks relevant, but would indicate that we should see things fixed in the latest MetaMask...🤔

https://github.com/trufflesuite/truffle/issues/1254#issuecomment-419198255

@tarekskr It looks like Web3 only supports websockets, so there's a fundamental incompatibility with MetaMask at the moment. . . will ping this issue if I see a resolution (or cool workaround).

sparrowDom commented 6 years ago

Yeah this does seem relevant. Especially because when it crashes my local ganache it crashes because of this line: https://github.com/trufflesuite/ganache-core/blob/develop/lib/webSocketServer.js#L126 with the error can not read connection from undefined. Which I think it means some event/notification can not be pushed to some websocket connection because it is not present in connectionsBySubscriptionId object.

Which could also possibly explain why we are stuck at 0% on Rinkeby sometimes. (the confirmation events are not triggered)

wanderingstan commented 6 years ago

Strange, now after an hour I'm now seeing my profile update as "8% Completed". BUT, if I make a purchase, it's completed in a few seconds.

Is there something fundamentally different about identity contracts vs marketplace?

image

franckc commented 6 years ago

For additional context, here is a change we made recently to contract-service.js:deploy https://github.com/OriginProtocol/origin-js/pull/546

My understanding is that attestation saving exercises this code whereas offer creation does not.

wanderingstan commented 6 years ago

Continued strange behavior on my side. At some point (after a origin-js restart?) the attestations started working fine again. 🤷‍♀️

Updated MetaMask to 4.12.0 and now I'm getting failure locally again, and origin-js/ganache crashing with

...
origin-js           |     at /app/node_modules/ganache-core/node_modules/level-sublevel/shell.js:53:51
origin-js exited with code 1

Which I think means I'm caught up to your state, @sparrowDom .

sparrowDom commented 6 years ago

@wanderingstan is this

TypeError: Cannot read property 'connection' of undefined
origin-js           |     at ConnectionManager._updateSubscriptions (/app/node_modules/ganache-core/lib/webSocketServer.js:126:70)

also the root cause of your crash?

Thanks for reminding @franckc will check if that change has any effect on this error.

franckc commented 6 years ago

As an extra data point, I tested on Mainnet with Chrome an Metamask 4.12.0 I ran into the same issue. My profile did get saved (e.g. it was intact when later on I reloaded the page) but upon publish the profile page showed an error and also in the pending blockchain transaction dropdown, the "Your updated your profile" transaction remained stuck at 0%. Attached a screenshot, notice the JS console with error message "TypeError cannot read property 'blockNumber' of null".

screen shot 2018-10-02 at 8 44 41 pm
sparrowDom commented 6 years ago

At least it is consistently failing 😥

franckc commented 6 years ago

Downgraded priority to p1 since Metamask v4.13 is now available and it fixes this issue.

franckc commented 5 years ago

This has been fixed. Closing.