dap-ps / discover

Discover a whole new world of curated decentralised applications
https://dap.ps
Mozilla Public License 2.0
21 stars 9 forks source link

set ipfsHash on DApp creation #76

Closed jakubgs closed 4 years ago

jakubgs commented 4 years ago

This solves the issue from https://github.com/status-im/infra-ipfs/issues/4 where we used to incorrectly upload DApp metadata to IPFS while quoted(lel) and not pinned(2xlel). I've fixed the IPFS hashes and set the ipfsHash attribute of a DApp to the new hash. We cannot change hash because that breaks our connection with their identity in the contract.

jakubgs commented 4 years ago

I've deployed this code to https://dev.dap.ps/ and created a new Dapp and ipfsHash is set:

$ curl -s https://raw.dev.dap.ps/metadata/all | jq '.|values[] | select(.email == "my@guts.io")'
{
  "details": {
    "name": "Guts.io",
    "url": "https://guts.io/",
    "description": "RIP AND TEAR UNTIL IT'S DONE",
    "category": "GAMES",
    "image": "/metadata/image/QmWjCGWb1UkPUvBXNb2S61U7jWiVjNTDQ4fcQJhNNvpy7Q",
    "dateAdded": 1581511821256,
    "uploader": "0x03750DB6F910D7Ab5411eF605E7283267D1a8158"
  },
  "status": "NEW",
  "_id": "5e43f48ec9e6095e645d0360",
  "compressedMetadata": "0x610dd542e2d1a19b216b158cf88f4076282399d978d88da1d115bf07703666f4",
  "email": "my@guts.io",
  "hash": "QmP6653SS1A9juAjFwwirJhUiJcb51h6EviyonaFbvNoxK",
  "ipfsHash": "QmP6653SS1A9juAjFwwirJhUiJcb51h6EviyonaFbvNoxK",
  "__v": 0
}

Werks: https://ipfs.status.im/QmP6653SS1A9juAjFwwirJhUiJcb51h6EviyonaFbvNoxK

jakubgs commented 4 years ago

Actually, I approved the DApp and the hash didn't change because status isn't under details:

 $ curl -XPOST -u "admin:$(pass service/dev/app/admin-pass)" https://dev.dap.ps/metadata/approve/QmP6653SS1A9juAjFwwirJhUiJcb51h6EviyonaFbvNoxK

 $ curl -s https://raw.dev.dap.ps/metadata/all | jq '.|values[] | select(.email == "my@guts.io")'
{
  "details": {
    "name": "Guts.io",
    "url": "https://guts.io/",
    "description": "RIP AND TEAR UNTIL IT'S DONE",
    "category": "GAMES",
    "image": "/metadata/image/QmWjCGWb1UkPUvBXNb2S61U7jWiVjNTDQ4fcQJhNNvpy7Q",
    "dateAdded": 1581511821256,
    "uploader": "0x03750DB6F910D7Ab5411eF605E7283267D1a8158"
  },
  "status": "APPROVED",
  "_id": "5e43f48ec9e6095e645d0360",
  "compressedMetadata": "0x610dd542e2d1a19b216b158cf88f4076282399d978d88da1d115bf07703666f4",
  "email": "my@guts.io",
  "hash": "QmP6653SS1A9juAjFwwirJhUiJcb51h6EviyonaFbvNoxK",
  "ipfsHash": "QmP6653SS1A9juAjFwwirJhUiJcb51h6EviyonaFbvNoxK",
  "__v": 0
}

Which disproves my theory about the purpose of setting ipfsHash after approval... which makes the ipfsHash field absolutely fucking pointless. Amazing software...