Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

DB-Sync mistakenly requires a hash for CIP-119 'data:image' #1857

Closed
dmitrystas opened this issue Sep 14, 2024 · 3 comments
Closed

DB-Sync mistakenly requires a hash for CIP-119 'data:image' #1857

dmitrystas opened this issue Sep 14, 2024 · 3 comments
Assignees
Labels
bug Something isn't working

Comments

@dmitrystas
Copy link

Table off_chain_vote_fetch_error has the following error

Error Offchain Voting Anchor: JSON decode error from when fetching metadata from Just https://ipfs.io/ipfs/QmVc6RwPSRtEPbLSZPbRQX65RyfB4y9ar2kwU5Ku97McVr resulted in : "Error in $.body.image: parsing Cardano.DbSync.OffChain.Vote.Types.Image(Image) failed, key \"sha256\" not found, CIP-100:Error in $: key \"authors\" not found"

Mainly that's fine, but there are some metadata like this one https://ipfs.io/ipfs/QmVc6RwPSRtEPbLSZPbRQX65RyfB4y9ar2kwU5Ku97McVr where

"image": {
    "@type": "ImageObject",
    "contentUrl": "data:image/...."
}

Due to CIP-119 sha256 property MUST be populated with the SHA256 hash only If the imageObject DOES NOT contain a base64 encoded image.

If the imageObject DOES NOT contain a base64 encoded image, the contentUrl MUST contain the URL where the image can be found and the sha256 property MUST be populated with the SHA256 hash of the image file contents found at the contentUrl. The SHA256 hash is needed in order for readers to verify that the image has not been altered since the metadata anchor was submitted on-chain.

There is no need to check hash of data:image, since the image is in the chain and cannot be changed

@dmitrystas dmitrystas added the bug Something isn't working label Sep 14, 2024
@kderme kderme added this to DBSync Sep 16, 2024
@kderme
Copy link
Contributor

kderme commented Sep 17, 2024

Indeed we should avoid errors in that case. But I find the CIP a big vague. What does

If the imageObject DOES NOT contain a base64 encoded image

it mean? contain in what key and with any data uri encoding?

@dmitrystas
Copy link
Author

contain in what key and with any data uri encoding?

image

imageObject contains a base64 encoded image in its contentUrl property in a dataURI format

kderme added a commit that referenced this issue Sep 17, 2024
@kderme
Copy link
Contributor

kderme commented Sep 17, 2024

With #1860 metadata like this are accepted, the off_chain_drep_data.image_url now includes the image base64 (with the data uri header prefix stripped) and the off_chain_drep_data.image_sha256 remains empty.

@kderme kderme self-assigned this Sep 27, 2024
@kderme kderme mentioned this issue Oct 1, 2024
9 tasks
kderme added a commit that referenced this issue Oct 2, 2024
kderme added a commit that referenced this issue Oct 4, 2024
@kderme kderme closed this as completed in e95e389 Oct 4, 2024
@github-project-automation github-project-automation bot moved this to Done in DBSync Oct 4, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
Status: Done
Development

No branches or pull requests

2 participants