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

Name validity verification check forbids punycode #234

Open
angrymouse opened this issue Dec 18, 2022 · 1 comment
Open

Name validity verification check forbids punycode #234

angrymouse opened this issue Dec 18, 2022 · 1 comment

Comments

@angrymouse
Copy link
Contributor

Names minter contract forbids "--" at 2-4 position of name due to DNS spec.
https://github.com/public-awesome/names/blob/main/contracts/name-minter/src/contract.rs#L307
This restriction is in there by reason - this space is reserved for identifying that name is punycode encoded (basically that it contains unicode like emojis).
By just forbidding to put -- there, we also forbid using punycode (aka use emojis in names, etc).
We need to forbid only if it doesn't start from "xn--", so if it is not punycode.
So we basically need to add one more condition to if statement: !name[0..4].contains("xn--").
It will allow emoji names/domains, however not breaking DNS spec as punycode is fully supported there.

@yubrew
Copy link
Contributor

yubrew commented Dec 18, 2022

pseudocode from discord

if len > 4 && name[2..4].contains("--") && !name[0..4].contains("xn--"){
  return Err(ContractError::InvalidName {});
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants