ubiquity / .github

3 stars 8 forks source link

Command-Line Tool Totaling Contributor Rewards for UBQ Airdrop #95

Closed 0x4007 closed 4 months ago

0x4007 commented 4 months ago

Overview

We are looking to develop a command-line tool that automates the tallying of contributions across all Ubiquity repositories for the last year. This tool will play a crucial role in recognizing and rewarding our contributors' efforts through UBQ token payouts.

Objectives

Tally Contributions

The tool should accurately parse through all the "permits" (or payments for recognized contributions) generated across our repositories to identify and sum up each contributor's total contributions in terms of dollars earned.

UBQ Token Calculation

Based on the dollar value of each contributor's total contributions, calculate the equivalent amount in UBQ tokens, with the conversion rate being 1 UBQ per dollar earned.

Output Format

The results should be compiled into a comprehensive CSV file for each repository, detailing the contributors' names, total dollar earnings, and corresponding UBQ tokens. This CSV file will serve as the basis for UBQ token payouts.

Automation and Execution

This script should be designed for easy execution at specific times, particularly when enabling UBQ token payouts to ensure a seamless distribution process.

Requirements

Final Deliverables

We look forward to seeing innovative solutions and contributions from the community to bring this project to fruition.

CrustalRundrops commented 4 months ago

Include a testing mechanism that prints test results, which will be a critical part of the pull request QA process.

Can someone elaborate more on this

Keyrxng commented 4 months ago

/start

Been a minute, hope it's cool to jump in wherever. Has the refactor been completed?

image

ubiquibot[bot] commented 4 months ago

DeadlineFri, Feb 16, 8:12 PM UTC
Registered Wallet 0xAe5D1F192013db889b1e2115A370aB133f359765
Tips:
0x4007 commented 4 months ago

Include a testing mechanism that prints test results, which will be a critical part of the pull request QA process.

Can someone elaborate more on this

An easy way is to write a GitHub action so we can see that it works in the pull request CI.

Keyrxng commented 4 months ago

Just seen your comment @pavlovcik, haven't built it with that in mind but should be easily repurposed for a GH action. Can you create a new repo for it and I'll open a PR

using my cex deposits, my tally is accurate for me after adding in the two no-assignee payments of 300 and 12.50 im at about 1556 ish

cases which I've seen:

Will need to think about how to handle these cases and try to make a more robust way to handle and more importantly verify, and that's what I'm stuck with now how to improve the validity of the findings. Any suggestions?

0x4007 commented 4 months ago

Use the ts-template repo GitHub actions for inspiration on how to execute typescript files directly.

Just parse the permits. Use the addresses in place of identities. We don't necessarily need to associate the GitHub user handle to the address in order for an airdrop to work. It's just nice to have.

Every permit for any contribution counts. They can certainly earn rewards without ever being the assignee via comment incentives.

Keyrxng commented 4 months ago

I've been able to identify creator/assignee/conversation rewards from after they were introduced (see here), I went with comment parsing as it seemed more robust in that wallet changes wouldn't affect a hunter's tally.

Only been gone a minute but remind me, are all of the permits stored in the DB?

If going with that approach as opposed to comment parsing then how should I handle:

0x4007 commented 4 months ago

Keep it extremely simple. Only a subset of permits are stored in the database, so only rely on the address data encoded in the permit. Don't worry about the penalties. Don't worry about invalidations. Just tally the wallet addresses, don't worry about "registration" (i.e. associating a GitHub user name to a wallet address.)

The main challenge here is that the comment/permit encoding schema has changed a few times since we started this system over a year ago. The script needs to handle these changes.

It would be great if you can sum the totals of each wallet address, as that's the final output numbers we care about. However the detailed breakdown is essential for debugging and auditing the script's capabilities.

Keyrxng commented 4 months ago

image

The main challenge here is that the comment/permit encoding schema has changed a few times since we started this system over a year ago

I have covered all the text formats of payment comment that I've been able to find, unless their are reviewer reward comments hidden away somewhere which I wouldn't have been exposed to I'm sure I've covered them all.

I have totalled the contributors already but only through comment parsing, what I'll do is build a permit based version and compare the two results I guess.

Only a subset of permits are stored in the database, so only rely on the address data encoded in the permit.

So the trade off then is that if the db is used then it will cut out large chunk of payments whereas if comments are used the accuracy can't be 100% unless they are all manually reviewed

Keyrxng commented 4 months ago

So I've built this as a CLI tool with multiple commands that parses all repos together or singular repos, allows a time be provided to search from, but that's not sounding right now.

An easy way is to write a GitHub action so we can see that it works in the pull request CI.

Misread that the first time round, seeing it in CI is just for QA but it will function as a CLI ran manually

across all Ubiquity repositories for the last year.

Is this a hardcoded date btw if so then when?

Keyrxng commented 4 months ago

The current CLI setup as a GitHub action. I've hardcoded the repo name for the sake of QA but we'd pull that from the repo that it's running in

Outputting the files seems a bit extra especially if it's going to be run pretty often

0x4007 commented 4 months ago

Is this a hardcoded date btw if so then when?

No we should include every contribution that exists.

https://github.com/Keyrxng/ubq-airdrop-cli/actions/runs/7860439292

Looks pretty good I can spot check by cross referencing repositories later.

Can you open a pull request to this repository with all that code? We can discuss your work on the pull request.

Keyrxng commented 4 months ago

@pavlovcik pr open

ubiquibot[bot] commented 4 months ago
+ Evaluating results. Please wait...
0x4007 commented 4 months ago

Looks like we are exceeding the 65536 character length for GitHub comments which is why the bot is failing to post the permits here (too much metadata)

Standby for a fix!

0x4007 commented 4 months ago

I'm going to try and salvage the permit link from the logs

ubiquibot[bot] commented 4 months ago
+ Evaluating results. Please wait...
0x4007 commented 4 months ago

[ 228.2 WXDAI ]

@pavlovcik
Contributions Overview
ViewContributionCountReward
IssueSpecification180.8
IssueComment664
ReviewComment783.4
Conversation Incentives
CommentFormattingRelevanceReward
## Overview We are looking to develop a command-line tool tha...
80.8
h2:
  count: 4
  score: "4"
  words: 5
h3:
  count: 4
  score: "4"
  words: 10
li:
  count: 8
  score: "8"
  words: 127
code:
  count: 1
  score: "1"
  words: 1
180.8
> > Include a testing mechanism that prints test results, which ...
4.20.594.2
Use the ts-template repo GitHub actions for inspiration on how t...
14.60.6914.6
Keep it extremely simple. Only a subset of permits are stored in...
25.40.7325.4
> Is this a hardcoded date btw if so then when? No we should ...
8.40.778.4
Looks like we are exceeding the 65536 character length for GitHu...
8.8
li:
  count: 1
  score: "1"
  words: 8
0.78.8
I'm going to try and salvage the permit link from the logs...
2.60.772.6
I think that parsing the encoded permits from within the GitHub ...
80.6958
I appreciate you taking the time to check your work. You can mar...
4.40.774.4
Hey last thing but I'm hoping to see a workflow run can you add ...
8.80.798.8
This doesn't sound right because I've been using `tsx` for proba...
30.6
code:
  count: 2
  score: "4"
  words: 2
0.75530.6
I have to see the commit lint error you're talking about because...
22.60.73522.6
Can give the full review post merge given the delay and initial ...
2.60.732.6
Screenshot 2024-02-15 at 03 01 15 [ 486.7 WXDAI ]
@Keyrxng
Contributions Overview
ViewContributionCountReward
IssueTask1.00400
IssueComment60
ReviewComment986.7
Conversation Incentives
CommentFormattingRelevanceReward
Just seen your comment @pavlovcik, haven't built it with that in...
-
li:
  count: 5
  score: "0"
  words: 0
0.65-
I've been able to identify creator/assignee/conversation rewards...
-
a:
  count: 1
  score: "0"
  words: 2
li:
  count: 3
  score: "0"
  words: 35
0.705-
![image](https://github.com/ubiquity/.github/assets/106303466/93...
-
li:
  count: 1
  score: "0"
  words: 11
0.78-
So I've built this as a CLI tool with multiple commands that par...
-0.74-
- https://github.com/Keyrxng/ubq-airdrop-cli/actions/runs/786043...
-
li:
  count: 1
  score: "0"
  words: 10
0.685-
@pavlovcik pr open ...
-0.76-
After you give this a look over let me know if this is the way f...
7.70.657.7
validating the non_payment repos I found one newer style comment...
2.80.6652.8
- Now pulling all permits: 448 tracked - Payments assigned to u...
33.7
a:
  count: 1
  score: "1"
  words: 1
li:
  count: 4
  score: "4"
  words: 0
code:
  count: 2
  score: "2"
  words: 5
0.7233.7
I don't think I can take this any further without input on it as...
3.90.763.9
Is tsx a requirement if it's running fine with tsc? I can run th...
8.8
a:
  count: 1
  score: "1"
  words: 3
0.7258.8
I'll see what I can do with it then pav and I'll make the final ...
3.30.8053.3
Keyrxng commented 4 months ago

I'm going to try and salvage the permit link from the logs

I beat you to it this morning when I realised it was sitting in the logs (had I not been skint rn I'd have left it)

Was gonna jump in and try resolve the issue myself until I realised it's AI heavy and I had an API bill to pay 🤣 however with that said, I'll likely attempt it later

Keyrxng commented 4 months ago

86 bucks for conversation that's mad

0x4007 commented 4 months ago

86 bucks for conversation that's mad

In the future we will augment the bot's capabilities to determine if the subject is accurate.

For example:

  • on the issues page, the conversation should only be around refining the scope of work with clarifications on the scope, research to improve the approach to solving the problem, etc.
  • In the pull request review, the conversation should focus on improving the code quality.

Although I think in a more advanced stage, we would very likely remove the assignee rewards for commenting on the pull request review. Or maybe we can just add a configuration option to enable/disable this based on the repository. However I think the assignee should be eligible for rewards to contribute to researching the original issue specification before they take on the task.

Lastly I do full expect to increase the rewards by 2-4x as we move the core team off of salaries. In this way, the bot should be finely tuned to incentivize the precise behavior we seek, and developers should make good living wages if they pursue these incentives.

Keyrxng commented 4 months ago

I agree hashing out the spec should surely count but pr comments nah, you've accepted the terms as soon as the /start command is ran if you ask me 😂 esp considering those PRs that extend months and amount to double digit review attempts, too easily gamed.

Well if I never end up making the cut before then I'll still be glad to be around when that does happen. My annual hiatus is over so I'll be pushing often again wherever I can be of value