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

Initial proposal for excubiae framework #3

Merged
merged 12 commits into from
Jun 14, 2024
Merged

Initial proposal for excubiae framework #3

merged 12 commits into from
Jun 14, 2024

Conversation

0xjei
Copy link
Member

@0xjei 0xjei commented Jun 6, 2024

Description

This PR proposes a framework for general purpose on-chain gatekeepers. You can find more at the following HackMD document.

Related Issue(s)

None.

Other information

None.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • My changes generate no new warnings
  • I have run yarn format and yarn compile without getting any errors
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes

@0xjei 0xjei marked this pull request as ready for review June 6, 2024 14:10
@0xjei 0xjei requested review from cedoor, vplasencia and ctrlc03 June 6, 2024 14:11
Copy link

@ctrlc03 ctrlc03 left a comment

Choose a reason for hiding this comment

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

Left some comments, good stuff

packages/excubiae/contracts/Excubia.sol Outdated Show resolved Hide resolved
packages/excubiae/contracts/IExcubia.sol Show resolved Hide resolved
packages/excubiae/contracts/Excubia.sol Outdated Show resolved Hide resolved
@0xjei 0xjei requested a review from ctrlc03 June 6, 2024 15:32

/// @notice Tracks whether an address has successfully passed the gate check.
/// @dev Maps an address to a boolean indicating pass status.
mapping(address => bool) public checked;
Copy link

@ctrlc03 ctrlc03 Jun 7, 2024

Choose a reason for hiding this comment

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

so here's the tricky part, given this is supposed to be the abstract contract everyone inherits from, I think it's best that either this mapping is as generalized as possible, so instead of address you store the encoded data like bytes (which not sure if it always works), or you omit this mapping from this contract and make it clear that each gate contract should implement this mapping to prevent double signups. Just thinking along the lines of: a user comes to the gate with something they own, and that something that owns is what grants them access, like in a door you grant access to anyone that has a key. If you then keep an image of their face to prevent entering once, they could give the key to someone else to enter, but if you prevent the same key from entering, even if they give the key to someone else they won't be able to enter. If someone though gives you their unused key then you could enter twice which is a problem, but they wouldn't be able to enter themselves (so maybe this needs even a bit more thinking, and storing both what you own and who you are if both make sense for the specific gate). This assumes the "key" can be transferred which might not always be the case in something like EAS, Zupass, etc. but just trying to make this as general as possible if that makes sense

Copy link

@ctrlc03 ctrlc03 Jun 7, 2024

Choose a reason for hiding this comment

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

TLDR I think in general it might be easier if a specific gate decides the data type of this mapping

Copy link
Member Author

@0xjei 0xjei Jun 10, 2024

Choose a reason for hiding this comment

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

OK, all clear. To stop someone else (a passerby) from using the same data, regardless of protocol, to try to pass the gatekeeper check twice but with a different address, we need to save two mappings: one for the passerby and one for the data.

In short, we have two options:

  1. Do nothing and let the abstract contract implementer decide what information to save in the pass + check logic to avoid sibyl.
  2. Make sure everyone saves the address and data in mappings.

As we discussed in the chat, let's stick with the first option for now until we come up with a registry or logic that can be merged into a single solution. Therefore, people need to implement their own method based on their own "credentials" to potentially avoid:

  1. different addresses using the same data to pass the check.
  2. the same address passing the check twice with the same data (can be useful for some protocols, for others not).

Copy link
Member Author

Choose a reason for hiding this comment

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

btw, reflected these decisions in the usage section of the README, specifying that the developer needs to provide their own logic for gatekeeping + preventing unwanted access.

@0xjei 0xjei requested a review from ctrlc03 June 7, 2024 09:13
@0xjei 0xjei force-pushed the proposal/gatekeepers branch from f552677 to f10bd6d Compare June 10, 2024 15:12
@0xjei 0xjei requested a review from ctrlc03 June 10, 2024 15:14
Copy link

@ctrlc03 ctrlc03 left a comment

Choose a reason for hiding this comment

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

Awesome!

Copy link
Member

@vplasencia vplasencia left a comment

Choose a reason for hiding this comment

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

Great work 🔥

Thank you very much @0xjei and @ctrlc03

@0xjei 0xjei merged commit 302c545 into main Jun 14, 2024
2 checks passed
@cedoor cedoor deleted the proposal/gatekeepers branch June 26, 2024 11:26
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants