status-im / status-protocol-go

Status Protocol implementation in Go
Mozilla Public License 2.0
0 stars 1 forks source link

Add support for async verification of ENS user names #82

Open pedropombeiro opened 4 years ago

pedropombeiro commented 4 years ago

This is the protocol side of https://github.com/status-im/status-go/issues/1520.

@cammellos suggested that we need to implement the ENS verification process asynchronously so that we don't delay message retrieval. That is the ideal solution but I'm unsure of the impact that'll have on the UI layer in status-react (cc @yenda @flexsurfer)

For an async workflow, the following needs to happen:

  1. statusMessageHandler should have access to a cache service which can return whether an ENS name is valid or not. This can return synchronously if it was cached, or through a channel if a network call to the ENS contract needs to take place.
  2. statusMessageHandler returns the message with an additional flag indicating whether the name is unknown (no verification has yet taken place), valid, invalid (name does not match), or error (e.g. ENS network call error)
  3. Once the cache service finishes the verification, it will asynchronously inform watchers (in this case the Messenger object) that the name was checked together with the result of the check. It will also somehow store this information in a db, together with the timestamp, so we can invalidate this information periodically.
  4. Messenger will advertise the results to its consumer app, which will update the UI accordingly.

Right now I don't see a name field in statusMessageHandler that I can use to query the ENS contract: https://github.com/status-im/status-protocol-go/blob/cc44ddb7ce44a4203f1af444bcb5f9af3331cdb1/v1/decoder.go#L76-L82

Please let me know your thoughts, before proceeding on this.

rachelhamlin commented 4 years ago

Is it possible for me to get edit rights to this repo? I'd like to add this project to the core project board :) cc @adambabik @cammellos

cammellos commented 4 years ago

I don't have access myself, probably @adambabik can help

adambabik commented 4 years ago

@rachelhamlin should work. Happy coding :)

StatusSceptre commented 4 years ago

Thanks @adambabik would you mind adding StatusSceptre as well? I've locked myself out of my own Github account. 🙄