code-423n4 / 2021-12-amun-findings

0 stars 0 forks source link

Assigned operations to constant variables #259

Closed code423n4 closed 2 years ago

code423n4 commented 2 years ago

Handle

pauliax

Vulnerability details

Impact

Assigned operations to constant variables are re-evaluated every time:

  bytes32 constant BASKET_STORAGE_POSITION =
        keccak256("diamond.standard.basket.storage");
  bytes32 constant CALL_STORAGE_POSITION =
        keccak256("diamond.standard.call.storage");
  bytes32 constant REENTRY_STORAGE_POSITION =
        keccak256("diamond.standard.reentry.storage");
  bytes32 constant ERC_20_STORAGE_POSITION =
        keccak256(
            // Compatible with pie-smart-pools
            "PCToken.storage.location"
        );

See https://github.com/ethereum/solidity/issues/9232

Change from 'constant' to 'immutable'.

0xleastwood commented 2 years ago

Duplicate of #281