dev-protocol/protocol-v2

Code descripted order that may destroy upgradability

Closed this issue · 0 comments

aggre commented

Problem subject

  • Contracts
  • Tests
  • Other

Description

Upgradability based on EIP-1967 is destroyed by changing the line in the local variable declaration, as shown Storage Collisions Between Implementation Versions. This fact can be confirmed by the following test.

https://github.com/dev-protocol/protocol-l2/blob/03b6b3ac97c3ece4752f1b1fbfb3a0b956b110d4/test/common/proxy/upgradeability.ts#L116-L129

Expected behavior/contents

Local variable declarations for all contracts should be moved to the beginning of the contracts.

Actual behavior/contents

If a contract contains a using declaration, the beginning of the contract may start with using.

The only target?: https://github.com/dev-protocol/protocol-l2/blob/fe271aba7484d40b724581515a3b7ad59e4443c5/contracts/src/s-token/STokensManager.sol

Code of Conduct

By submitting this issue, I confirm I've read and complied with the CoC 🖖