Skip to content
This repository has been archived by the owner on Nov 15, 2023. It is now read-only.

Propose bumping StringLimit to 128 bytes #516

Merged
merged 4 commits into from
Jul 2, 2021
Merged

Conversation

Swader
Copy link
Contributor

@Swader Swader commented Jun 28, 2021

The StringLimit of 50 bytes is too short for useful hashes of different protocols:

  • When using IPFS, the hash is 46 bytes. With a protocol prefix and type prefix (IPFS vs IPNS) it becomes: ipfs://ipfs/QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB or 59 bytes. With CIDv1, the hashes are even longer, and with the prefixes they become 71 chars long: ipfs://ipfs/bafybeierhgbz4zp2x2u67urqrgfnrnlukciupzenpqpipiz5nwtq7uxpx4.
  • On arweave, the hash is 43 bytes. Prefixed with just arweave:// bumps it up to 53: arweave://BNttzDav3jHVnNiV7nYbQv-GY0HQ-4XXsdkE5K9ylHQ.
  • On Sia, with 46 char hashes, adding sia:// as the protocol to use will bump it past 50: sia://GACjmEWXmYF1N3Rc-PyjN304-8M0zOXHYzAXY9222xkGhA (52)

To allow for static URLs which are typically longer than 50 bytes, and also to cover all of the above hashes and protocols, we feel that 128 bytes is a reasonable minimum for the StringLimit.

The StringLimit of 50 bytes is too short for useful hashes of different protocols:

- When using IPFS, the hash is 46 bytes. With a protocol prefix and type prefix (IPFS vs IPNS) it becomes: `ipfs://ipfs/QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB` or 59 bytes.
- On arweave, the hash is 43 bytes. Prefixed with just `arweave://` bumps it up to 53: `arweave://BNttzDav3jHVnNiV7nYbQv-GY0HQ-4XXsdkE5K9ylHQ`.
- On Sia, with 46 char hashes, adding `sia://` as the protocol to use will bump it past 50: `sia://GACjmEWXmYF1N3Rc-PyjN304-8M0zOXHYzAXY9222xkGhA` (52)

As such, we feel that 64 bytes is a reasonable minimum for the `StringLimit`.
@cla-bot-2021
Copy link

cla-bot-2021 bot commented Jun 28, 2021

User @Swader, please sign the CLA here.

@Swader Swader changed the title Propose bumping StringLimit to 64 bytes Propose bumping StringLimit to 128 bytes Jun 28, 2021
@bkchr bkchr requested a review from joepetrowski June 28, 2021 12:43
@joepetrowski
Copy link
Contributor

I'm fine with this, StringLimit was added in the context of storing a string along with pallet-assets. Before merging, we can either:

  • Keep this change and re-benchmark assets (cc @shawntabrizi ) or
  • Add a StringLimit specific to pallet-uniques to cover this issue.

@shawntabrizi
Copy link
Member

Add a StringLimit specific to pallet-uniques to cover this issue.

This is what you should do. Please make a new constant specific for this.

@shawntabrizi shawntabrizi added this to In progress in Common Good Parachains via automation Jul 1, 2021
Common Good Parachains automation moved this from In progress to Reviewer approved Jul 2, 2021
@bkchr bkchr merged commit 2384feb into paritytech:master Jul 2, 2021
Common Good Parachains automation moved this from Reviewer approved to Done Jul 2, 2021
@apopiak apopiak added the T7-system_parachains This PR/Issue is related to System Parachains. label Jul 5, 2021
slumber pushed a commit that referenced this pull request Sep 1, 2021
* Propose bumping StringLimit to 64 bytes

The StringLimit of 50 bytes is too short for useful hashes of different protocols:

- When using IPFS, the hash is 46 bytes. With a protocol prefix and type prefix (IPFS vs IPNS) it becomes: `ipfs://ipfs/QmPK1s3pNYLi9ERiq3BDxKa4XosgWwFRQUydHUtz4YgpqB` or 59 bytes.
- On arweave, the hash is 43 bytes. Prefixed with just `arweave://` bumps it up to 53: `arweave://BNttzDav3jHVnNiV7nYbQv-GY0HQ-4XXsdkE5K9ylHQ`.
- On Sia, with 46 char hashes, adding `sia://` as the protocol to use will bump it past 50: `sia://GACjmEWXmYF1N3Rc-PyjN304-8M0zOXHYzAXY9222xkGhA` (52)

As such, we feel that 64 bytes is a reasonable minimum for the `StringLimit`.

* Update lib.rs

* Add different const for `UniquesStringLimit`

Co-authored-by: Shawn Tabrizi <shawntabrizi@gmail.com>
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
T7-system_parachains This PR/Issue is related to System Parachains.
Development

Successfully merging this pull request may close these issues.

None yet

5 participants