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

Add section "Common Misconceptions" #28

Open
cmichi opened this issue Sep 17, 2021 · 1 comment
Open

Add section "Common Misconceptions" #28

cmichi opened this issue Sep 17, 2021 · 1 comment
Assignees
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed

Comments

@cmichi
Copy link
Collaborator

cmichi commented Sep 17, 2021

We should add a section "Common Misconceptions" or "Common (Beginner?) Mistakes" with the things we see in real-world contracts. Such as:

  • A misconception that we often see is that developers think the smart contract is the actual interface for the user.
    That's why we often see mnemonic String types returned (in the worst case verbatim error messages instead of error codes).

  • We should explain why contract size is important.
    We sometimes get questions like "My 100K contract can't be deployed". This is usually due to some third party crate dependency with default features enabled. Oftentimes the size can be reduced by tuning the features of that dep or using the built-in ink! API instead (oftentimes it's crypto/hashing dependencies).

  • We should explain better why String should be avoided and especially what the alternatives are.
    We already have a section How do I use String in my contract? in our FAQ, but it goes in a bit of a different direction. Using String pulls in logic needed for e.g. UTF-8 handling, which one might not need, but it blows up the contract file size. Also, for String dynamic allocation is needed, increasing the file size of the contract as well and being expensive in terms of performance. A use-case I have now seen a couple times is to use String to generate some uuid, we should look into an alternative for doing that.

@cmichi cmichi added documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed labels Sep 17, 2021
@SkymanOne
Copy link
Contributor

Can be documented as "Best practices in ink!"

We should have this soon.

@SkymanOne SkymanOne self-assigned this Mar 15, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
documentation Improvements or additions to documentation enhancement New feature or request help wanted Extra attention is needed
Projects
None yet
Development

No branches or pull requests

2 participants