cowprotocol / services

Off-chain services for CoW Protocol
https://cow.fi/
Other
178 stars 69 forks source link

feat: Upload AppData pre-images to IPFS #2302

Open fleupold opened 8 months ago

fleupold commented 8 months ago

Problem

Users and UIs can specify elaborate metadata about each order using the app_data field on CoW protocol orders (cf. docs)

The field itself represents that IPFS hash of the file that contains the raw metadata in json format. For convenience the API provides an endpoint for integrations to create new app data without needing to upload it to IPFS themselves.

Currently the backend verifies that the hash is indeed a correct but only stores the contents of the metadata files locally. However, for decentralisation the files should also be uploaded to IPFS so that they can easily be fetched by other parties (e.g. solvers) without relying on CoW Swaps backend.

We already have logic to fetch files from IPFS (for orders that are placed only with the appDataHash without also providing the metadata file in plain format)

Suggested solution

Whenever the backend receives and appData hash together with the raw metadata, the content should also be uploaded to IPFS if it not already exists.

Alternatives considered

Continue rely on local storage only or require integrators to upload files to IPFS themselves

Rizary commented 8 months ago

Hi @fleupold I stumble upon this repo after reading cow's job ads. I want to try to contribute first to see how far can I go with this. Can I get assigned to this issue to try with suggested solution?

fleupold commented 8 months ago

Yes please, feel free to take this issue.