Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Refactor and advance core framework capabilities #9

Draft
wants to merge 11 commits into
base: dev
Choose a base branch
from
Draft

Conversation

0xjei
Copy link
Member

@0xjei 0xjei commented Nov 6, 2024

This PR extends the core framework's functionality based on #5 conversations and more.

  • There will be a Base and Advanced gatekeeper division with reusable Checker contracts. This is a huge breaking change compared to previous prototype implementation on zk-kit.
  • The usage of a nested mapping mapping(address => mapping(address => bool)) can make us able to simulate different deployed instances of Excubiae Gatekeeper and maintain a reference like 1 contract <> N independent states (who already passed the gatekeeper). This will allow us to get rid of the non-determinism in deployments and maintain a structure where navigating and managing the different gatekeepers smoothly.
  • Making the checks to return a boolean.

The change will allow for other changes, as:

  • Checker independent contract instead of check() method
  • Base and Advanced separation of concerns for Excubia and Checker contracts
  • Common mappings to handle AlreadyPassed checks & logic
  • Use mapping of mapping to handle 1 contract <> N independent gatekeeper states
  • Checks must return a bool
  • Separation of concerns for Excubia extensions (FreeForAllExcubia)
  • Apply new naming and conventions
  • Pattern: balance _internal vs external methods
  • Full code coverage (create a fixture for base & advanced for testing purposes)
    • Configs
    • Base
      • BaseChecker
      • BasePolicy
      • BaseVoting (integration)
    • Advanced
      • AdvancedChecker
      • AdvancedPolicy
      • AdvancedVoting (integration)
  • Review comments and other in-code documentation

@0xjei 0xjei added the enhancement New feature or request label Nov 6, 2024
@0xjei 0xjei self-assigned this Nov 6, 2024
@0xjei 0xjei linked an issue Nov 22, 2024 that may be closed by this pull request
/// based on the specified check type.
abstract contract AdvancedChecker is IAdvancedChecker {
/// @notice Flag to determine if pre-condition checks should be skipped.
bool public skipPre;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if these don't change they could be set as immutable

BaseChecker public immutable BASE_CHECKER;

/// @dev Tracks whether the check has been enforced for a subject.
mapping(address => mapping(address => bool)) public enforced;
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

what's the reasoning behind storing addresses as a base? imagine a ERC721 policy, they could transfer the token id to another wallet and pass again? wouldn't the type of data to be stored need to be custom for each policy?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Make check() an independent smart contract
2 participants