teia-community / teia-ui

Front-end code for teia
https://teia.art
MIT License
26 stars 36 forks source link

subjkt settings [bug] #336

Closed Synkitten closed 1 year ago

Synkitten commented 1 year ago

Describe the bug

When adding your subjkt details for a new wallet I found that the first letter of the chosen name is removed automatically if you use a capital e.g. 'Moments' is automatically changed to 'oments'. The biggest problem is it takes a few seconds for the auto recognition and removal of the capitalised letter which isn't obvious if you have moved on to filling out the next questions. If you check at the wrong time you don't realise the issue before accepting the transaction. name issue 2

Reproduction

  1. Type name in with a capital
  2. Wait for letter to disappear

Expected behavior

Make capitals useable if it's possible but otherwise make it autocorrect to lower case or have a notice show if it is deleted so you know to check maybe.

Platform and versions

OS windows
Browser - Brave (chrome)
Version - v. 1.58.137

Additional context

No response

melMass commented 1 year ago

@Zir0h @jagracar I will check properly but like that I can't recall what we ended up with, kind of related to #334 : Are Subjkt case sensitive?

Zir0h commented 1 year ago

This is actually a duplicate of https://github.com/teia-community/teia-ui/issues/303 The UI silently drops "invalid" characters, currently only lowecase and 0-9 is allowed I think. Most important part is that the visitor should receive feedback about errors, rather than the site silently dropping bad characters.

melMass commented 1 year ago

Thanks but my question was about the Subjkt casing at the contract level

jagracar commented 1 year ago

Thanks but my question was about the Subjkt casing at the contract level

I don't think so. The entry point takes bytes and i don't think it does any string manipulation. My guess is that is possible to register jagracar, Jagracar or JAGRACAR using better call dev. https://tzkt.io/KT1My1wDZHDGweCrJnQJi3wcFaS67iksirvj/entrypoints

In fact, you can see some capitals here: https://tzkt.io/KT1My1wDZHDGweCrJnQJi3wcFaS67iksirvj/storage/3920

I even find some recent ones with capitals. Maybe they were registered in one of the h=n forks. https://better-call.dev/mainnet/KT1My1wDZHDGweCrJnQJi3wcFaS67iksirvj/storage/big_map/3920/keys

melMass commented 1 year ago

My guess is that is possible to register jagracar, Jagracar or JAGRACAR using better call dev.

I think we already had this discussion but I can't recall the conclusions 😅 ! The fact that there was this handler makes me suggest that it might have been a way to prevent subjkt registration where only the casing changes

jagracar commented 1 year ago

My guess is that is possible to register jagracar, Jagracar or JAGRACAR using better call dev.

I think we already had this discussion but I can't recall the conclusions 😅 ! The fact that there was this handler makes me suggest that it might have been a way to prevent subjkt registration where only the casing changes

I don't think the smart contract is that clever. It just registers the name (in bytes) to the associated address. If the name exists already, it will throw an error. But that only happens if the name exactly the same in bytes. So capitals or not make a difference.

Unfortunately there is no way to check the smarpy code for the SUBJKT contract, only the michelson code: https://tzkt.io/KT1My1wDZHDGweCrJnQJi3wcFaS67iksirvj/code

melMass commented 1 year ago

Cool, so to address this issue, we should probably just correct it disallowing uppercase and let the user know, either by a popup or a field validation visual like a red border

jagracar commented 1 year ago

The problem is that if your wallet is assigned to mel and i assign mine to Mel using BCD, which page will be shown in the UI? Yours or mine?

And what happens if you registered Mel before the filter took place in the UI? If i register mel, will my page be shown instead of yours?

jagracar commented 1 year ago

I think at some moment we might need to deploy our own SUBJKT contract with some of those problems fixed.

NoRulesJustFeels commented 1 year ago

Should we consider a solution that works across Tezos and not just for Teia?

Zir0h commented 1 year ago

I think at some moment we might need to deploy our own SUBJKT contract with some of those problems fixed.

Indeed, because now we're just doing patchwork :sweat_smile: frontend sanitization is the same as no sanitization :laughing:
If the contract allows it, it shouldn't be prevented on the UI, but that's my opinion

Zir0h commented 1 year ago

Should we consider a solution that works across Tezos and not just for Teia?

yeah, like https://forum.tezosagora.org/t/open-sourcing-and-decentralizing-tezid-profiles/5681