Skip to content
  • Raphael Fernandes's avatar
    92e17983
    fix: improve access control and fix failing tests · 92e17983
    Raphael Fernandes authored
    This commit resolves access control issues in the voting system contracts and fixes all failing tests. Key changes include:
    
    - Refine role-based access control by changing key functions from onlyAdmin to onlyOperator:
      - VotingCore: createPoll, addCandidate, finalizePoll
      - Authentication: generateVoterCodes, setVotingCoreContract
      - ZKPVerification: setVerificationKey, setVotingCoreContract
      - VotingFactory: upgradeContract
    
    - Enhance AccessControl contract with trusted contracts mechanism:
      - Add trustedContracts mapping and management functions
      - Update onlyOperator modifier to allow calls from trusted contracts
      - Enable cross-contract interactions for factory upgrades
    
    - Fix test implementation:
      - Properly assign operator roles to test signers
      - Register VotingFactory as trusted contract for core contracts
      - Update test assertions to match new error messages
      - Fix event emission order in Authentication contract
    
    - Add missing functionality:
      - Implement getVersionCount in VotingFactory
      - Add interface declaration in IVotingFactory
    
    These changes ensure proper access control enforcement while maintaining
    flexibility for operators to manage polls and for the factory to handle
    contract upgrades.
    92e17983
    fix: improve access control and fix failing tests
    Raphael Fernandes authored
    This commit resolves access control issues in the voting system contracts and fixes all failing tests. Key changes include:
    
    - Refine role-based access control by changing key functions from onlyAdmin to onlyOperator:
      - VotingCore: createPoll, addCandidate, finalizePoll
      - Authentication: generateVoterCodes, setVotingCoreContract
      - ZKPVerification: setVerificationKey, setVotingCoreContract
      - VotingFactory: upgradeContract
    
    - Enhance AccessControl contract with trusted contracts mechanism:
      - Add trustedContracts mapping and management functions
      - Update onlyOperator modifier to allow calls from trusted contracts
      - Enable cross-contract interactions for factory upgrades
    
    - Fix test implementation:
      - Properly assign operator roles to test signers
      - Register VotingFactory as trusted contract for core contracts
      - Update test assertions to match new error messages
      - Fix event emission order in Authentication contract
    
    - Add missing functionality:
      - Implement getVersionCount in VotingFactory
      - Add interface declaration in IVotingFactory
    
    These changes ensure proper access control enforcement while maintaining
    flexibility for operators to manage polls and for the factory to handle
    contract upgrades.
Loading