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

Whitelists and Blacklists #4

Open
LinuxIsCool opened this issue Oct 13, 2021 · 4 comments
Open

Whitelists and Blacklists #4

LinuxIsCool opened this issue Oct 13, 2021 · 4 comments

Comments

@LinuxIsCool
Copy link

The owner should be able to choose a consensus mechanism on initialization

  1. Owner has full authority
  2. Any Payer has authority
  3. Unanimous Payers have authority
  4. Percentage of Payers have authority
  5. Fund-weighted authority
LinuxIsCool pushed a commit that referenced this issue Oct 13, 2021
Update proposal_inverter.py
@LinuxIsCool
Copy link
Author

Consider re-using the whitelist to approve payers. Consider the 'Permission less' whitelist mechanism.

@patriacaelum
Copy link

These are my initial thoughts for designing the voting mechanism for the whitelisting operation.

class ProposalInverter:
    voting_mechanism = VotingMechanism()
    
    def add_broker(self, broker):
        if broker in self.whitelist:
            self.brokers.add(broker)
        else:
            self.waitlist.add(broker)

    def vote(self, voter, broker, vote):
        voting_mechanism.vote(self, voter, broker, vote)
        if broker in voting_mechanism.whitelist:
            self.brokers.add(broker)

The VotingMechanism class is meant to be modular to accommodate the different possible methods of voting.

class VotingMechanism:
    whitelist = set()
    waitlist = set()
    prior_votes = dict()

    @abc.abstractmethod
    def vote(self, proposal, voter, broker, vote):
        pass

    def add_broker(self, broker):
        if broker in self.whitelist:
            pass
        elif broker not in self.waitlist:
            self.waitlist.add(broker)

All the specific voting mechanism will build on this base class.

class WeightedVotingMechanism(VotingMechanism):
    def vote(self, proposal, voter, broker, vote: bool):
        self.add_broker(proposal, voter, broker, vote)
        self.prior_votes[broker][voter] = vote

        if sum([proposal.payers[payer] * vote for payer, vote in self.prior_votes[broker].items()]) > proposal.funds / 2:
            self.whitelist.add(broker)
            del self.waitlist[broker]

@patriacaelum
Copy link

Notes from today's PrimeDAO workshop:

  • The call to super() in each mechanism should be after the if statement
  • Rename Consensus to Unanimous, since consensus means a general agreement
  • Check that the minimum number of brokers is in minimum conditions
  • When whitelisted, check that the broker doesn't hit the max
  • Applying to waitlist and applying to whitelist are two separate operations
  • Add permissionless whitelist mechanism

@patriacaelum
Copy link

patriacaelum commented Nov 1, 2021

This issue is addressed in pull request #7

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

No branches or pull requests

2 participants