SNIPs icon indicating copy to clipboard operation
SNIPs copied to clipboard

SNIP-12 Defining types

Open gaetbout opened this issue 1 year ago • 9 comments

Definition of a type

gaetbout avatar Jan 18 '24 13:01 gaetbout

I would suggest adding two more rules to reduce potential ambiguity some more:

  • Name can't be enclosed in whitespace characters
  • Name can't contain the comma (,) character (this is since enum types use it as a delimiter)

penovicp avatar Jan 30 '24 18:01 penovicp

I would suggest adding two more rules to reduce potential ambiguity some more:

  • Name can't be enclosed in whitespace characters
  • Name can't contain the comma (,) character (this is since enum types use it as a delimiter)

hi @penovicp, thanks for your feedback

  • regarding enclosing in whitespace characters, i think the difficulty would be to define whitespace characters, there are many unicode characters that might fall into that definition. IMO this is similar trying to make sure users are not fooled with a cyrillic а instead of a regular a. We can't avoid this problem at the SNIP level so i'd accept that and keep the SNIP simple

  • disallowing comma in the enum names is not strictly needed because the names are escaped to calculate the type hash, unless i'm missing something

sgc-code avatar Jan 31 '24 10:01 sgc-code

For the whitespace rule I would assume just using the word "whitespace" and relying on the \s RegEx could be sufficient. I would hope that it's mostly standardized between different programming languages. Admittedly, I haven't done a deep dive on the topic to know if there are any differences/edge cases for more obscure character sets.

For the enum rule, if the incoming type definition for the enum contains { "name": "Variant N", "type": "(u128,u128)" }, there is ambiguity if the variant is a u128 tuple or a u128,u128 type.

penovicp avatar Jan 31 '24 12:01 penovicp

For the whitespace rule I would assume just using the word "whitespace" and relying on the \s RegEx could be sufficient. I would hope that it's mostly standardized between different programming languages. Admittedly, I haven't done a deep dive on the topic to know if there are any differences/edge cases for more obscure character sets.

For the enum rule, if the incoming type definition for the enum contains { "name": "Variant N", "type": "(u128,u128)" }, there is ambiguity if the variant is a u128 tuple or a u128,u128 type.

Regarding white space, we prefer to keep it as is, because we are not sure about that all regex work the same, and because that change won't actually make SNIP-12 safer

Regarding the enums, you are right, and we have updated this PR with that change.

I believe this PR is now ready to be merged so different SDKs can implement it

sgc-code avatar Feb 22 '24 11:02 sgc-code

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. This PR will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Mar 24 '24 08:03 github-actions[bot]

@ArielElp can we merge this?

sgc-code avatar Mar 25 '24 09:03 sgc-code

@ArielElp up 😅

gaetbout avatar Apr 04 '24 07:04 gaetbout

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. This PR will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar May 04 '24 08:05 github-actions[bot]

@ArielElp 🙏 ?

gaetbout avatar May 04 '24 08:05 gaetbout

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. This PR will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Jun 04 '24 08:06 github-actions[bot]

le dot of activity

gaetbout avatar Jun 04 '24 08:06 gaetbout

There hasn't been any activity on this pull request recently, and in order to prioritize active work, it has been marked as stale. This PR will be closed and locked in 7 days if no further activity occurs. Thank you for your contributions!

github-actions[bot] avatar Jul 05 '24 08:07 github-actions[bot]

Le ping to stay alive

gaetbout avatar Jul 05 '24 08:07 gaetbout