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

Finalize Nadabot V2 rules logic #62

Open
lachlanglen opened this issue Mar 13, 2024 · 2 comments
Open

Finalize Nadabot V2 rules logic #62

lachlanglen opened this issue Mar 13, 2024 · 2 comments
Assignees

Comments

@lachlanglen
Copy link
Contributor

Need specific examples of different groups that share common providers, and hierarchy of groups &/or rules when a provider is in more than one group.

@codingshot
Copy link
Member

Example of different groups with common providers (on figma nada bot channel)
Image

@lachlanglen
Copy link
Contributor Author

lachlanglen commented Mar 14, 2024

The way the logic currently works for the score calculation is as follows (remember this is with the assumption that one provider can't exist in more than one group):

- Keep track of total score (starts at 0) and scored_providers (starts as empty list)

// STEP 1: initial score aggregation per group
- Loop through groups, for each group keep track of that group's scores in a list and loop through its providers
- For each provider, check if the user has that provider's stamp
- If the user has the stamp and it's valid (it hasn't expired & the provider hasn't been deactivated), add the provider's default weight to this group's scores, and add the provider to the list of scored_providers

// STEP 2: score adjustment for group, based on its rules
- based on the group's rule, calculate the total score for the group from the list of group scores **(NB: order matters here for the booster & subtractor rules; for these rules, the scores should be ordered either from highest to lowest or lowest to highest before adjustment)**
- add the group score to the total score

// STEP 3: adding ungrouped providers
- loop through the user's stamps, and if the stamp/provider hasn't already been scored, add its default weight to the total score
- return total score, comparing with default human weight to determine `is_human`

So say I am a user and I have the following 3 valid stamps:

1 - Holonym ZK Government (21 points)
2 - Holonym ZK Phone (12 points)
3 - Reclaim Identity (20 points)

1 & 2 are in a Booster group with a 10% factor - let's call this Group 1, and order the scores from highest to lowest before adjustment to minimize the adjustment impact

2 & 3 are in a Subtractor group with a 20% factor - let's call this Group 2, and order the scores from highest to lowest before adjustment to minimize the adjustment impact

With the logic above, we would go through each group in the order in which they were inserted.

Group 1 ends Step 1 with a total score of 33 points
Group 2 ends Step 1 with a total score of 32 points

Group 1 ends Step 2 with a total score of 34.2 points, since Stamp 2's points are boosted by 10% to 13 points (12 * 1.1 = 13.2)
Group 2 ends Step 2 with a total score of 28 points, since Stamp 3's points are subtracted by 20% to 16 points (20 * 0.8 = 16)

@codingshot These are my questions:
1. Should the scores from both these groups be added to the total score? If not, which one should count, and why? What if there were more than two that share providers for this user?
2. How should the scores be ordered before adjustment for the booster/subtractor groups? (lowest to highest or highest to lowest?)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
Status: Done
Development

No branches or pull requests

2 participants