storacha / content-claims

🦪 Implementation of the Content Claims Protocol.
Other
10 stars 1 forks source link

feat: store equals for both content and equals multihash #23

Closed olizilla closed 1 year ago

olizilla commented 1 year ago

We want to return equals claims when quired with either the content cid or the equals cid, so store 2 records in dynamo for equals claims.

assert/equals claims provide 2 CIDs. The content CID and the equals CID that we claim the content CID is equivelant to. (e.g. different hash fn for same bytes)

The dynamo records are { content: "base58btc-multihash", claim: CID }. The actual bytes of the claim are stored in s3, only once per claim.

For equals claims we store an additional record that sets the content to the multihash of the provided equals CID.

Alternatively we could have stored an equals property on dynamo records for equals claims, and added a global secondary index for that field, and updated the query to check both the content field and the equals field (and the secondary index) for every query, but this would incur additonal read costs for every query. It is assumed that storing a extra tuple of [string,cid] per equals claim will be cheap, and avoids a larger refactor of the claims db.

License: MIT

olizilla commented 1 year ago

I'm looking at the walk api now to see how that needs to change to deal with bi-directional equals claims now.

olizilla commented 1 year ago

Walk api is not critical to this work. We will be querying by content cid only. There is a more general problem of "the walk api needs to guard against loops" that should be tackled before we go live with that api. Issue raised https://github.com/web3-storage/content-claims/issues/24

seed-deploy[bot] commented 1 year ago
View stack outputs - **pr23-content-claims-API** Name | Value -- | -- cloudfrontUrl | https://d7he2noehuruz.cloudfront.net functionName | pr23-content-claims-API-fn5FF616E3-ExfIQhVIW029 functionUrl | https://3wcnzzystlujd4y2wz53syisyi0lfrxr.lambda-url.us-east-2.on.aws/ url | https://pr23.claims.web3.storage - **pr23-content-claims-Bucket** - **pr23-content-claims-DB**