Add section "Common Misconceptions" #28
Labels
documentation
Improvements or additions to documentation
enhancement
New feature or request
help wanted
Extra attention is needed
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, forString
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 useString
to generate some uuid, we should look into an alternative for doing that.The text was updated successfully, but these errors were encountered: