code-423n4 / 2022-01-openleverage-findings

0 stars 0 forks source link

Assigned operations to constant variables #246

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. See https://github.com/ethereum/solidity/issues/9232 Change from 'constant' to 'immutable'.

    // The EIP-712 typehash for the contract's domain
    bytes32 public constant DOMAIN_TYPEHASH = keccak256("EIP712Domain(string name,uint256 chainId,address verifyingContract)");

    // The EIP-712 typehash for the delegation struct used by the contract
    bytes32 public constant DELEGATION_TYPEHASH = keccak256("Delegation(address delegatee,uint256 nonce,uint256 expiry)");

    // The EIP-712 typehash for the ballot struct used by the contract
    bytes32 public constant BALLOT_TYPEHASH = keccak256("Ballot(uint256 proposalId,bool support)");

    uint constant NEXT_OFFSET = ADDRESS_SIZE + FEE_SIZE;
ColaM12 commented 2 years ago

Duplicate to #123