Skip to content

Latest commit

 

History

History
20 lines (11 loc) · 1.11 KB

SWC-103.md

File metadata and controls

20 lines (11 loc) · 1.11 KB

Title

Floating Pragma

Relationships

CWE-664: Improper Control of a Resource Through its Lifetime

Description

Contracts should be deployed with the same compiler version and flags that they have been tested with thoroughly. Locking the pragma helps to ensure that contracts do not accidentally get deployed using, for example, an outdated compiler version that might introduce bugs that affect the contract system negatively.

Remediation

Lock the pragma version and also consider known bugs (https://github.com/ethereum/solidity/releases) for the compiler version that is chosen.

Pragma statements can be allowed to float when a contract is intended for consumption by other developers, as in the case with contracts in a library or EthPM package. Otherwise, the developer would need to manually update the pragma in order to compile locally.

References