Skip to content

Modular architecture #67

Description

@geode-main

Changes Overview

  • Internal audit fixes
    • missing zero checks within withdrawal contract
    • swapUtils struct should have a correct gap size (confirm all gaps are correct size)
    • storage variables => events => constants
    • set loop params to zero in appendAddressArrayBatch, regulateOperators and lastIdChange
    • check unused return statements from batchApproveOperators, approveOperators
    • gas improvements
      • no need to do uint256 _type = self._proposals[proposalId].TYPE in approveSenate (deleted)
      • use WC: in withdrawal contract
      • get address instead of the struct in onlyOracle (and maybe in other modifiers too)(seems like a no - increases typo risk)
      • uint256 operatorId = STAKER._validators[_pk].operatorId should be taken before using at all in _alienateValidator
      • _setMaintainer no need to use the memory variable currentMaintainer(check deleted already)
      • "su: not enough funds in Portal ?" delete ?
      • separate loops in proposeStake and batchApproveOperators
      • _decreaseWalletBalance delete return
      • Instead of feetheft and alienate events, imprison can take a parameter.(seems like doesn't make sense now)
      • " gu: already approved" has an empty space.(function deleted already)
  • Modular Architecture
    • Refactor: Interfaces
      • interfaces should be a top level external folder (try, but do not bother inheriting them in contracts)
      • interfaces holds only the contract interfaces. You can inherit module or external interfaces (from OZ) to construct them, so you don't need to override twice! Thats good.
      • modules should inherit relative interfaces, and external interfaces folder should be constructed from these module interfaces
    • Refactor: gETHInterfaces => gETHMiddlewares
    • Refactor: defaultModules, allowedModules => defaultPackage, allowedPackage
    • Refactor: Modules
      • geodeUtils to GeodeModuleLib
        • GeodeModule
        • IGeodeModule
      • DataStoreUtils to DataStoreModuleLib
        • DataStoreModule
        • IDataStoreModule
      • stakeUtils to StakeModuleLib,
        • StakeModule
        • IStakeModule
        • StakeManagerLib extending StakeModuleLib (modules upgradability) (WAIT IN ANOTHER BRANCH, ASK AUDITORS)
        • oracleUtils to OracleLib, extending StakeModuleLib
    • Turning Liquidity Pool into a module
      • SwapUtils: LiquidityModuleLib, add unnecessary libraries like MathUtils as inline.
      • Swap: LiquidityModule
      • LiquidityPool: inherits geodeModule and LiquidityModule
      • LPtoken address is given in construction (ok, since all instances of a version use the same ref)
      • Let controllers of the liquidity pools’ have a pause functionality
      • Let them have the adminFee, set/claim
      • tests
    • defaultModules:
      • all defaultModules are now going to be deployed with a generalized approach
      • create a general way to call initialize
      • create an Interface for that initialize (like IgeodeModule or IgETHInterface)
  • Withdrawal Contract
    • Renamed to WithdrawalPool
    • Implement QueueModule:
      • segregated by validators, allows earlyExit withdrawal
      • logic for early exit requests: https://www.desmos.com/calculator/zhexhcnzxw
      • seems like early exit fee is no longer a validator param
      • Telescope will need to provide a Merkle Root for the claimable balances
        • test if partial withdrawals can be implemented (without earlyExit requests)
        • Can a user get into the withdrawal queue without specifying a validator?
    • Implement BeaconModule
    • Implement EigenModule
    • check if there is a way to combine both in one contract, if not seperate them into BeaconCredential and EigenCredential contract.
    • Tests
    • should modules have gaps? or just packages and contracts?
  • change recoveryMode back to isolationMode
  • change gETH to gToken ===> more chain-ambiguous (no.)
  • change gETHInterfaces to gTokenMiddlewares, effectively interface => middleware...
  • delete ERC1155SupplyMinterPauser and actually use the contract from OZ wizard, removes a potential risk.
  • fallbackOperator;
    • is totalActiveValidators/totalProposedValidators separation necessary?
  • improved hardhat tasks (add as you go)
  • Improved deployment scripts
  • docs:
    • audits
    • Readme
    • contribution guide
    • in-folder docs

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Labels

RefactorChanges related to code qualityenhancementNew feature or requesttestThings related with tests

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions