-
Notifications
You must be signed in to change notification settings - Fork 103
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
feat(x/data)!: support public resolvers for IPFS support #2098
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@aaronc So I prematurely approved, and then after closer inspection actually have a few questions about how we expect this be used by users.
proto/regen/data/v1/tx.proto
Outdated
@@ -112,11 +112,23 @@ message MsgDefineResolver { | |||
// the manager should make use of cosmos.authz. | |||
string manager = 1; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Who would be the manager
for the ipfs:
resolver?
Can you elaborate on how you would expect this to work? In reading the documentation for the manager
field, it seems like only the manager
of a resolver can register data to a given resolver.
So as I understand it, this PR implies that each user wanting to host data on IPFS would define their own resolver named ipfs:
?
I wonder if it would make more sense to instead extend the MsgRegisterResolver()
message to have an enum field called resolver_type
. we could have the default / 0 value of that enum be HTTP_RESOLVER
, and 1 = IPFS_RESOLVER
. This way, if we want to support other decentralized resolvers that are similar to IPFS in the future, we could just extend this enum?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think you're right. So, there's another step of work to do here. I don't think it will be too hard. I will close this, work on that and ping you when it's R4R again.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clevinson I've updated this PR to support marking a resolver as public to support IPFS. Please take a look again when you get a chance.
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2098 +/- ##
=======================================
Coverage 72.90% 72.91%
=======================================
Files 240 240
Lines 13860 13865 +5
=======================================
+ Hits 10105 10110 +5
Misses 3016 3016
Partials 739 739
|
Reading through the updates, it looks like the approach you're intending for here is still that the defining of an IPFS resolver is something that is done in state (via someone defining an IPFS resolver via a So is your idea that someone from the RND team would submit a tx define a resolver for IPFS shortly after this software upgrade happens? Or perhaps we would just bake that into a state migration and ship it along w/ the software upgrade? In either case though, I don't think we have a uniqueness constraint on resolver_url, so there's nothing preventing multiple users from creating new "IPFS" resolvers with the same I'm just trying to unpack this here and make sure you're tracking this edge case and that you think this is OK @aaronc. Personally it feels a bit clunky and I'd prefer an approach where as a user wanting to register data to IPFS, there is one clear way to do that, and there's no chance of several different "resolvers" in state that all in practice mean identical things. But if there are reasons why you thinks approach is better than what I wrote in my comment (#2098 (comment)), which I think addresses the issue of end-users only having at most 1 way to register their data with IPFS, let me know. |
There is a uniqueness check on the resolver,manager pair even when manager is nil in the case of being public. So I don't think double definitions are possible. I can add a test case to check |
Scenario: public resolvers can only be defined once per URL | ||
Given a public resolver is defined for the url "ipfs:" | ||
When alice attempts to define a public resolver with url "ipfs:" | ||
Then expect the error "a resolver with the same URL and manager already exists: unique key violation" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@clevinson I added a test here which demonstrates that a public resolver URL can only be defined once.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This LGTM, just one question to clarify how an IPFS CID would be used.
// To use IPFS, the resolver_url ipfs: should be defined with public set to true | ||
// and used as the resolver for any data hosted on IPFS. Content hashes must be | ||
// adapted to IPFS's CID format. The multicodec raw (0x55) should |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Content hashes must be adapted to IPFS's CID format.
Just want to clarify how this works.. For both raw and graph content hashes, the hash
will be set to the full cid
, where the cid
was generated using either the multicodec raw (0x55) or multicodec rdfc-1 (0xb403)?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The content hash on Regen would still be the same as if it were registered w/ an HTTP resolver. I think this comment just communicates that users must take the resulting Regen IRI, and convert it to a specific IPFS CID in order to fetch the data from the IPFS network.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Exactly
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ah thanks, this makes more sense. With an example I think this would be very clear. Hopefully soon...
Description
This PR:
bool public
field toMsgDefineResolver
MsgDefineResolver
manager
todefiner
MsgRegisterResolver
manager
tosigner
These last two proto breaking changes are okay because we are currently working with the as of yet unreleased
regen.data.v2
API.Author Checklist
All items are required. Please add a note to the item if the item is not applicable and
please add links to any relevant follow up issues.
I have...
!
to the type prefix if API or client breaking changeCHANGELOG.md
Reviewers Checklist
All items are required. Please add a note if the item is not applicable and please add
your handle next to the items reviewed if you only reviewed selected items.
I have...
!
in the type prefix if API or client breaking change