Skip to content

Latest commit

 

History

History
38 lines (30 loc) · 6.85 KB

LI-Language-Design-and-Implementation.md

File metadata and controls

38 lines (30 loc) · 6.85 KB

Language Design and Implementation

Description

The purpose of the category focuses on ensuring that the core features of the smart contract language promote secure, predictable, and maintainable code. By enforcing explicit declarations for mutability, visibility, and asset handling, and ensuring clear syntax and function management, this category helps prevent vulnerabilities caused by ambiguity or poor design choices. It also encourages the use of standardized mechanisms for logging and error handling, ensuring that contracts remain transparent and auditable throughout their lifecycle.

This section helps auditors evaluate the language's ability to facilitate secure development and provide a solid foundation for both developers and reviewers.

Ref Number Name Objective Potential Issues
LI-001 Explicit State Mutability and Visibility Declarations Ensure the language requires explicit declaration of state mutability and visibility of functions and variables to prevent unexpected behaviors and potential vulnerabilities.
  • Unexpected behaviors from implicit state mutability
  • Vulnerabilities due to unintended state changes
  • Challenges in maintaining contract integrity
  • Unauthorized state modifications
LI-002 Function Selector Management Ensure that selectors are uniquely and predictably generated, preventing collisions. Arbitrary selectors should not be allowed, and overloaded functions must produce distinct selectors.
  • Function selector collisions, leading to incorrect function execution
  • Proxy selector clashing in upgradeable contracts
  • Misrouting of calls due to poor handling of overloaded functions
  • Backdoor creation via custom selectors
LI-003 Event Emissions and Logging Ensure the language provides efficient and standardized mechanisms for event emissions and logging to enhance transparency and facilitate off-chain monitoring.
  • Inefficient or non-standard event logging
  • Difficulties in off-chain monitoring and indexing
  • Reduced transparency of contract activities
LI-004 Misleading or Undefined Keywords Ensure the language does not allow misleading or undefined keywords that can deceive reviewers and introduce hard-to-detect vulnerabilities.
  • Deception of code reviewers
  • Hard-to-detect vulnerabilities
  • Misunderstandings of code intent
  • Difficulty spotting vulnerabilities during code review
LI-005 Compiler Error Clarity Ensure the compilation process is clear, and the compiler provides sufficient, meaningful error information to aid in quick identification and resolution of issues.
  • Delayed development due to cryptic errors
  • Undetected vulnerabilities
  • Difficulty in fixing issues
LI-006 Deterministic and Verifiable Builds Ensure the build output is deterministic and verifiable, so the same code always produces the same bytecode, aiding in verification and preventing supply chain attacks.
  • Discrepancies between audited code and deployed contract
  • Supply chain attack vulnerabilities
  • Undermined trust in security
LI-007 Error Propagation and Handling Ensure errors are properly propagated and handled within contracts and during external calls to maintain predictable execution and prevent vulnerabilities.
  • Unpredictable execution
  • Locked funds
  • Vulnerabilities from unhandled errors
  • Failure recovery issues
LI-008 Syntax Readability and Clarity Ensure the language syntax is designed for readability and clarity to help developers write secure code and reduce mistakes.
  • Coding mistakes
  • Difficulty understanding code
  • Misunderstandings
  • Increased errors
LI-009 Explicit Native Asset Handling Ensure contracts cannot receive native assets without explicit handling to prevent unintended behaviors and vulnerabilities.
  • Unintended receipt of native assets
  • Vulnerabilities from unanticipated transfers
  • Unpredictable behavior
LI-010 Built-In Methods Functionality Ensure the language provides reliable and predictable built-in methods for essential tasks (e.g., hashing, encoding/decoding, concat) to prevent errors and vulnerabilities.
  • Memory corruption
  • Unpredictable behavior

References

For more information, see also: