regen-network / groups-ui

:rocket: UI for the Cosmos SDK group module
https://groups.regen.network
Apache License 2.0
6 stars 4 forks source link

Unsupported proposal metadata preventing application use #146

Open ryanchristo opened 1 year ago

ryanchristo commented 1 year ago

Originally reported by @S4mmyb in slack.

If a user submits a group proposal using the CLI and the metadata for the proposal is not a valid JSON string, the group page and the proposal page is inaccessible to the user.

A user should be able to continue using the application regardless of how the metadata within a proposal is formatted (i.e. we should have fallbacks in place). The proposal metadata should also support IPFS (same as group and policy metadata).

This occurred as a result of a user submitting the following proposal:

{
 "group_policy_address": "regen1ys0dhh6x5s55h2g37zrnc7kh630jfq5p77as8pwyn60ax9zzqh9q4reeah",
 "messages": [
  {
   "@type": "/cosmos.group.v1.MsgCreateGroupPolicy",
   "admin": "regen1ys0dhh6x5s55h2g37zrnc7kh630jfq5p77as8pwyn60ax9zzqh9q4reeah",
   "group_id": "6",
   "metadata": "{\"name\": \"Biochar Carbon Credit Class Buffer Pool Account\"}",
   "decision_policy": {
        "@type": "/cosmos.group.v1.PercentageDecisionPolicy",
        "percentage": "1",
        "windows": {
            "voting_period": "120h",
            "min_execution_period": "0s"
        }
    }
  }
 ],
 "metadata": "ipfs://CID",
 "proposers": ["regen1v2ncquer9r2ytlkxh2djmmsq3e8we6rjc9snfn"]
}

Notice that the proposal metadata is ipfs://CID. This prevents the following group page from being accessible:

ryanchristo commented 1 year ago

Hey team! Please add your planning poker estimate with Zenhub @ryanchristo @blushi @wgwz @flagrede

wgwz commented 1 year ago

https://docs.ipfs.tech/how-to/best-practices-for-nft-data/#types-of-ipfs-links-and-when-to-use-them https://docs.ipfs.tech/quickstart/retrieve/#fetching-the-cid-with-an-ipfs-gateway https://docs.ipfs.tech/quickstart/publish/#publish-a-file-with-ipfs

wgwz commented 1 year ago

Do we want to fetch the CID from gateways? I.e. we have handful of trusted gateways, and we try to fetch the CID from those. Or do we want to use something like helia so we can actually fetch via ipfs protocol? (helia was previously js-ipfs) I think I saw it recommended that you first try to fetch from an ipfs node, and then use gateways as fallbacks.

https://github.com/ipfs/helia https://github.com/ipfs/js-ipfs

ryanchristo commented 1 year ago

No need to rethink how we are fetching data. We already have that implemented. The issue here is that application is expecting JSON when provided a string. We should be able to fix this without rethinking how we fetch data.

Screenshot from 2023-09-11 20-53-55

wgwz commented 1 year ago

My mistake, I didn’t realize we already had the ability to fetch ipfs data in the codebase.

clevinson commented 1 year ago

Re-opening as #149 did not actually resolve this issue fully. The group page at https://groups.regen.network/6 does not render still.

@blushi @aaronc I think this should be a pretty easy fix. Would be great if one of you can take a look at it, since this prevents us from being able to use groups UI for administering the KCT credit class.

blushi commented 1 year ago

It looks like this is because the fix hasn't been pushed to main yet: https://github.com/regen-network/groups-ui/compare/main...dev Using the deploy preview from Kyle's fix branch, it's working fine: https://deploy-preview-149--regen-groups-ui.netlify.app/6 Are we ok to publish a new release with the changes linked above? @clevinson @ryanchristo If so, I can prepare the release PR dev->main