Skip to content

Latest commit

 

History

History
10 lines (7 loc) · 769 Bytes

37.md

File metadata and controls

10 lines (7 loc) · 769 Bytes

Shadowing State Variables

Description:

Solidity allows for ambiguous naming of state variables when inheritance is used. Contract A with a variable x could inherit contract B which also has a state variable x defined. This would result in two separate versions of x, one of them being accessed from contract A and the other one from contract B. In more complex contract systems this condition could go unnoticed and subsequently lead to security issues.

Remediation:

Review storage variable layouts for your contract systems carefully and remove any ambiguities. Always check for compiler warnings as they can flag the issue within a single contract.

References:

https://swcregistry.io/docs/SWC-119