Skip to main content

FunC Checklist

Release: Version 1.0

#ItemDescription
1Proper Usage of Function SpecifiersIt is important to use impure, inline/inline_ref, and method_id properly. For example, if impure is not specified and the result of the function call is not used, then the FunC compiler may and will delete this function call.
2No Unbounded Data StructuresSmart contract storage is limited to 65536 unique cells, so the maximum number of entries in the dictionary is 32768 or slightly more if there are repeated cells. It is recommended to use the contracts sharding pattern.
3No Name CollisionsUse a linter as variable and function names can include almost any valid character.
4Locked Pragma VersionThe code should be deployed with the same version as it was tested with.
5Consistent Storage Layout UsageEnsure data in the contract is stored and accessed in a consistent order.
6Nested Storage Layout UsageOrganize storage into logical blocks of related data, unpacking only what is needed for a specific function.
7No Bounced Messages Query ExecutionThe query contained in the body of a bounced message should never be executed.
8Bounced Messages CatchingEnsure the contract gracefully manages failures and properly handles bounced messages to maintain functionality and reliability.
9Man-in-the-Middle VulnerabilitiesAlways re-validate critical properties in the message cascade as it can span multiple blocks.
10Proper Usage of Messages ModesProperly utilize the available modes and flags for sending messages to ensure the correct and predictable behavior of your smart contracts.
11Replay-Safe CodeImplement the seqno pattern to prevent replay attacks by ensuring each transaction is unique and cannot be executed multiple times.
12Workchain Addresses ValidationsVerify the address workchain to prevent improper usage and mitigate replay attacks across different workchains.
13Secure Random Number GenerationEnsure secure random number generation in FunC by leveraging cryptographic primitives or blockchain-native randomness sources to prevent predictability and manipulation.
14Sufficient Gas CalculationsAvoid Partial Transactions Execution. Check the amount of TONs attached to the message to ensure they are enough to cover all types of fees.
15Access Control ValidationsImplement robust access control validations in FunC by verifying message senders and permissions to ensure only authorized entities can execute sensitive contract functions.
16Third-Party Code InteractionsCarefully validate and manage third-party code interactions in FunC to ensure external contract calls handle unexpected behaviors and maintain data integrity.
17Parsing and Serialization ChecksEnsure correct use of end_parse() for robust parsing and serialization checks in FunC by validating data formats, lengths, and encoding to prevent errors, data corruption, or malicious payloads.
18Business Logic ViolationsVerify that all business logic in FunC adheres to intended rules and workflows, preventing unauthorized actions, bypasses, or misuse.
19Freeze Prevention ChecksTest and verify FunC contracts to ensure they cannot enter a frozen or non-functional state due to unhandled errors or locked states.
20Proper External Message HandlingUse accept_message() only after thorough validations to prevent potential gas-draining attacks.
21Carry-Value PatternEnsuring the carry-value pattern exists to maintain and transfer state consistently across messages, guarantees reliable and predictable contract behavior.