[Safe Apps] Refactor how we store Safe app information in the origin field
See original GitHub issueTitle
Currently we encode the name
and url
into a json object and use it in the origin
field. If the name
or url
are too long this will cause errors (see below).
To prevent this from happening we should refactor what is store in the origin
field. The client gateway can then perform the appropriate logic to add the correct Safe app information to the reponse.
Proposals
URL only
Store the url of the app.
Schemas
Define custom schemas:
ipfs
-> ipfs://<ipfs_hash>
urls could just be used normally as their schema is https
.
This would allow us to handle ipfs hashes better and not rely on a specific ipfs endpoint.
Note: This could be seen as an iteration on the URL only
solution, as they are compatible.
Error Example
Obtained result
Post will error with 422 since we have a length limit of 100 chars on the origin field. This will also have the result that the transaction is not associated to the Safe app in the transaction list.
Data examples
Request:
POST https://safe-transaction.staging.gnosisdev.com/api/v1/safes/0x74f8149a6Da9c0949f3e7415ae6591A2d45Dc9e9/transactions/
{
"to": "0xB522a9f781924eD250A11C54105E51840B138AdD",
"value": 0,
"data": "0x8d80ff0a00000000000000000000000000000000000000000000000000000000000000200000000000000000000000000000000000000000000000000000000000000099003d2ed2f0b65c05b6670a619460eee61498f14b7f00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000044095ea7b30000000000000000000000003d2ed2f0b65c05b6670a619460eee61498f14b7f000000000000000000000000000000000000000000000000000000000000000100000000000000",
"operation": 1,
"nonce": "1",
"safeTxGas": 46430,
"baseGas": 0,
"gasPrice": 0,
"gasToken": "0x0000000000000000000000000000000000000000",
"refundReceiver": "0x0000000000000000000000000000000000000000",
"contractTransactionHash": "0xf96687ec70c8161b689a2cdc375564a538c7683f12289a6657c884b774c66423",
"transactionHash": "0x10d923174a3c31a1e0f2f6eff40fbb11f31746a9ba33de232d872980a2ef98d5",
"sender": "0x05c85Ab5B09Eb8A55020d72daf6091E04e264af9",
"origin": "{\"url\":\"https://ipfs.infura.io/ipfs/QmQBAygFq887bMhZV4P3rNbHCRQ8cYFhczSripKaprmYge\",\"name\":\"Create React App Sample\"}"
}
Response (422)
{"origin":["Ensure this field has no more than 100 characters."]}
Misc
This should handle/fix #1853
Issue Analytics
- State:
- Created 3 years ago
- Comments:18 (17 by maintainers)
Top GitHub Comments
This ticket was left behind for long. Currently there aren’t any heavy issues with this. If we refactor the way we store Safe Apps info in the backend is better to start over with a problem statment
It will be an empty name, but that doesn’t break anything overall … So it is minor