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

Read permit URLs from DB #110

Closed
rndquu opened this issue Jul 21, 2023 · 42 comments · Fixed by #164
Closed

Read permit URLs from DB #110

rndquu opened this issue Jul 21, 2023 · 42 comments · Fixed by #164

Comments

@rndquu
Copy link
Member

rndquu commented Jul 21, 2023

Depends on ubiquity/ubiquibot#547

When ubiquity/ubiquibot#547 is implemented we should read permits from a DB instead of parsing github comments.

What should be done:

  1. Remove the comment parsing logic which finds permit URLs in issues
  2. Read permit URLs from supabase DB

Supabase public/anon key which can be safely used in the frontend: eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJzdXBhYmFzZSIsInJlZiI6Iml5eWJoaGlmbHdic2pvcHNnYW93Iiwicm9sZSI6ImFub24iLCJpYXQiOjE2ODUxMTA1MTMsImV4cCI6MjAwMDY4NjUxM30.R_c29S9xFbZmqHxi4HTdhP8uqHt2v6DnUSCEAxBeTTM

Supabase project URL: https://iyybhhiflwbsjopsgaow.supabase.co

@aditygrg2
Copy link

/assign

@ubiquibot
Copy link

ubiquibot bot commented Aug 4, 2023

Deadline Fri, 04 Aug 2023 15:15:43 GMT
Registered Wallet Please set your wallet address to use `/wallet 0x0000...0000`
Payment Multiplier 1.00
Multiplier Reason undefined
Total Bounty 37.5 USD
Tips:
  • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address @user.
  • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
  • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the bounty.

    @aditygrg2
    Copy link

    Awaiting ubiquity/ubiquibot#547 to merge.

    @ubiquibot
    Copy link

    ubiquibot bot commented Aug 8, 2023

    Do you have any updates @aditygrg2? If you would like to release the bounty back to the DevPool, please comment /unassign
    Last activity time: Fri Aug 04 2023 14:22:32 GMT+0000 (Coordinated Universal Time)

    @0x4007
    Copy link
    Member

    0x4007 commented Aug 8, 2023

    Awaiting ubiquity/ubiquibot#547 to merge.

    Perhaps it makes more sense to assign yourself to the task when you actually start the task. In the meantime it might be better for you to work on another task.

    @aditygrg2
    Copy link

    /unassign

    @aditygrg2 aditygrg2 removed their assignment Aug 8, 2023
    @devpanther
    Copy link
    Contributor

    @rndquu project url is needed too

    @rndquu
    Copy link
    Member Author

    rndquu commented Aug 16, 2023

    @rndquu project url is needed too

    Updated the description

    @CrustalRundrops
    Copy link

    Hi, I am here from alex's (pavlovcik's) podcase

    @CrustalRundrops
    Copy link

    how should i do issue's?

    @CrustalRundrops
    Copy link

    /help

    Copy link

    ubiquibot bot commented Feb 9, 2024

    Available Commands

    Command Description Example
    /start Assign yourself to the issue. /start
    /stop Unassign yourself from the issue. /stop
    /help List all available commands. /help
    /query Returns the user's wallet, access, and multiplier information. /query @user
    /ask Ask a context aware question. /ask is x or y the best approach?
    /multiplier Set the task payout multiplier for a specific contributor, and provide a reason for why. /multiplier @user 0.5 "multiplier
    reason"
    /labels Set access control, for admins only. /labels @user priority time
    price
    /authorize Approve a label change, for admins only. /authorize
    /wallet Register your wallet address for payments. /wallet ubq.eth

    @CrustalRundrops
    Copy link

    /wallet 0x3b07d616EC780b22148b190A07F3829A11B11042

    Copy link

    ubiquibot bot commented Feb 9, 2024

    + Successfully registered wallet address

    @CrustalRundrops
    Copy link

    @rndquu issues are spread out throughout many many repositories, is there a tool to check all the issues at once?

    @rndquu
    Copy link
    Member Author

    rndquu commented Feb 9, 2024

    @rndquu issues are spread out throughout many many repositories, is there a tool to check all the issues at once?

    https://work.ubq.fi/

    @gentlementlegen
    Copy link
    Member

    /start

    Copy link

    ubiquibot bot commented Feb 13, 2024

    Warning! This task was created over 206 days ago. Please confirm that this issue specification is accurate before starting.
    DeadlineTue, Feb 13, 9:37 AM UTC
    Registered Wallet 0x0fC1b909ba9265A846b82CF4CE352fc3e7EeB2ED
    Tips:
    • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
    • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
    • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

    @gentlementlegen
    Copy link
    Member

    @rndquu Just wanted to clarify on this task to understand better:
    This is about the page showing the rewards that can be claimed, which gets the permit based on the claim provided in the URL. Then it reads the repos until it finds such claim, which then gets displayed in the reward page?

    If so, I'd like to know what to use inside UBIQUIBOT_PRIVATE_KEY to be able to generate a permit for testing.

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 13, 2024

    I think it might be more complex and involved to work on database related tasks because the schema is still in flux. I can share a snapshot but I already have ideas of how it will be changed again which makes the schema/database structure unstable.

    I'm not a super pro working with databases but if you have ideas on how to wrangle the situation in a fast moving development environment let me know.

    Otherwise it may be simpler to start with tasks that are not dependent on the database?

    @gentlementlegen
    Copy link
    Member

    @pavlovcik I am pretty familiar with Supabase, but I think this would be a discussion way beyond the scope of this issue. If the Supabase schema changes, that would indeed break all the projects relying on it. But if for each project the types are generated from reading the Supabase schema (Supabase comes with tools for that) at least it is very easy to spot the changes, since TypeScript will highlight the errors.

    Is there any value for UBIQUIBOT_PRIVATE_KEY that is usable for testing? Otherwise sure I can move on for now and work on another issue 🙂

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 13, 2024

    That private key is the GitHub app private key to authenticate as the GitHub app (for example for commenting)

    In this case you should create your own GitHub app and then use its private key so that you can authenticate as your own app.

    Also I think the property name is deprecated I think we changed it just to APP_PRIVATE_KEY (bear in mind this issue specification was authored some time ago)

    @rndquu
    Copy link
    Member Author

    rndquu commented Feb 14, 2024

    @FernandVEYRIER

    This is about the page showing the rewards that can be claimed, which gets the permit based on the claim provided in the URL. Then it reads the repos until it finds such claim, which then gets displayed in the reward page?

    TBH I've totally forgotten the context of the current issue. As far as I remember, right now the bot generates permit URLs (example) and passes base64 encoded permit params in the claim query param. Then pay.ubq.fi simply reads all required data from the claim query param. So I don't really remember what I was referring to when I was writing "Remove the comment parsing logic which finds permit URLs in issues".

    to be able to generate a permit for testing

    You may use this script. It a little bit obsolete but it was fixed by @barebind in one of his PRs so you may take this updated version.

    Current issue may refer to the https://pay.ubq.fi/audit page which does (as far as I remember) read permits from github comments so it makes sense to read permit URLs from DB in that page.

    @gentlementlegen
    Copy link
    Member

    After digging into this for a while, got a few questions:

    The current shape of a payment entry in the Supabase db looks like (hex shortened for clarity)

    {
        "id": 1,
        "created_at": "2023-08-10T13:06:13.238+00:00",
        "organization_id": 76412717,
        "repository_id": 534616569,
        "issue_id": 1843851788,
        "network_id": 100,
        "bounty_hunter_id": 4975670,
        "bounty_hunter_address": "0xfff",
        "token_address": "0xfff",
        "payout_amount": "56250000000000000000",
        "nonce": "44018718530163796483577731670361750520301523549581891070913854055733144704107",
        "deadline": "115792089237316195423570985008687907853269984665640564039457584007913129639935",
        "signature": "0xfff",
        "wallet_owner_address": "0xfff"
    }

    First question is, what does the issue_id refer to? It doesn't seem to match the issue from GitHub itself, as they are numbered with #issue_number.

    Same goes for bounty_hunter_id which I cannot use to retrieve the user info, as GitHub only allows searching by username.

    Finally, in the UI there is a TX URL that should be displayed, what does it correspond to in this object? Into the current code, it is retrieved from the ether txHash.

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 16, 2024

    GitHub has globally unique issue IDs, and user IDs, which do not correspond to the issue number that you describe, or their username.

    We don't use the username because contributors can change them easily (we have also seen this in real world testing which has broken systems)

    When a permit is claimed from the pay.ubq.fi "claims" interface, a blockchain transaction is created. I want the claims UI to write to the database when the contributor invokes the claim so that we can keep track of 1. which ones are claimed and 2. The actual claim transaction for proof (in real world testing some contributors would complain that "somebody took their money" and I had to manually dig up their transaction to prove that it's impossible that somebody else took their money)

    @gentlementlegen
    Copy link
    Member

    gentlementlegen commented Feb 16, 2024

    Righty, but how do I use these IDs to look the issues / users up? The GitHub API doesn't seem to find anything when using these ids for querying.

    Edit:
    Never mind, /users/id doesn't work with the profile id but /user/id does. However, issues cannot be fetched by ID, only by their number it seems.

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 16, 2024

    I am planning to replace the locations table with a more simple and redundant strategy: redundantly include the full URL to the item of interest as the final column in basically all of our tables.

    This will solve the problem you're talking about.

    @gentlementlegen
    Copy link
    Member

    Indeed would be very helpful. Is it not usable right now?

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 16, 2024

    The database is "usable" its just not integrated into all of our systems yet. As I mentioned earlier in other threads, the database schema is still a bit in flux. But I am confident that the rest of the changes will be even smaller than this URL bit that I proposed. I already personally laid out the main groundwork based on what I anticipate the system to be able to achieve in 2024 (including XP leveling etc.)

    However I am starting to wonder if it makes more sense to associate a database (or table) PER plugin. Perhaps that can allow for faster development?

    We can also consider bundling in some shared "global" databases in a @ubiquibot/plugin npm package. Some data can be universally useful across all plugins potentially.

    To keep our infrastructure as simple as possible, I am also very keen on using GitHub for storage. We have experimented with this by embedding metadata inside of bot comments in the form of an HTML commented out <!-- {} --> JSON objects with a standard schema, for use for future plugin interoperability.

    @gentlementlegen
    Copy link
    Member

    /assign

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 21, 2024

    /assign

    Try using /start

    @gentlementlegen
    Copy link
    Member

    /start

    Copy link

    ubiquibot bot commented Feb 21, 2024

    Warning! This task was created over 215 days ago. Please confirm that this issue specification is accurate before starting.
    DeadlineWed, Feb 21, 12:37 PM UTC
    Registered Wallet 0x0fC1b909ba9265A846b82CF4CE352fc3e7EeB2ED
    Tips:
    • Use /wallet 0x0000...0000 if you want to update your registered payment wallet address.
    • Be sure to open a draft pull request as soon as possible to communicate updates on your progress.
    • Be sure to provide timely updates to us when requested, or you will be automatically unassigned from the task.

    @gentlementlegen
    Copy link
    Member

    /assign

    Try using /start

    Thank you it worked. Any reason why ubiquibot would remove assignment like this?

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 21, 2024

    /assign

    Try using /start

    Thank you it worked. Any reason why ubiquibot would remove assignment like this?

    The feature seems to be partially broken, but in the past, based on two values in our configuration, it would

    1. follow up with a comment asking for an update if no comments or commits are found with i.e. 3.5 days; and
    2. it would unassign if there was no update within i.e. 7 days.

    This was extremely useful when we had a lot of would-be contributors self assigning a ton of tasks and then not actually completing them. So the bot would unassign them and free up the tasks for others to try.

    @gentlementlegen
    Copy link
    Member

    @pavlovcik This might have broken the process of Ubiquibot, which I believe should have closed the issue now isn't it?

    @0x4007
    Copy link
    Member

    0x4007 commented Feb 21, 2024

    That's a GitHub issue actually. GitHub automatically should close as complete when an associated pull is merged. Not sure what happened here.

    @0x4007 0x4007 closed this as completed Feb 21, 2024
    Copy link

    ubiquibot bot commented Feb 21, 2024

    + Evaluating results. Please wait...

    Copy link

    ubiquibot bot commented Feb 21, 2024

    [ 89.2 WXDAI ]

    @pavlovcik
    Contributions Overview
    ViewContributionCountReward
    IssueComment976.9
    ReviewComment512.3
    Conversation Incentives
    CommentFormattingRelevanceReward
    > Awaiting [ubiquity/ubiquibot#547](https://github.com/ubiquity/...
    4.1
    a:
      count: 1
      score: "1"
      words: 3
    
    -4.1
    I think it might be more complex and involved to work on databas...
    9.1-9.1
    That private key is the GitHub app private key to authenticate a...
    8.1
    code:
      count: 1
      score: "1"
      words: 1
    
    -8.1
    GitHub has globally unique issue IDs, and user IDs, which do not...
    13.5-13.5
    I am planning to replace the `locations` table with a more simpl...
    5.4
    code:
      count: 1
      score: "1"
      words: 1
    
    -5.4
    The database is "usable" its just not integrated into all of our...
    22.5
    li:
      count: 1
      score: "1"
      words: 16
    code:
      count: 2
      score: "2"
      words: 4
    
    -22.5
    > /assign

    Try using /start...

    0.3-0.3
    > > > /assign

    Try using /start

    Thank you...

    11.6

    li:
      count: 2
      score: "2"
      words: 36
    
    -11.6
    That's a GitHub issue actually. GitHub automatically should clos...
    2.3-2.3
    How did you go about your testing? If you're using my database i...
    4.80.754.8
    I don't know why I have to keep manually approving the workflow ...
    1.511.5
    Lets focus on merging https://github.com/ubiquity/pay.ubq.fi/pul...
    20.372
    @FernandVEYRIER some merge conflicts for you here....
    0.70.340.7
    Was reviewing from my phone quickly and realized that some of my...
    3.30.263.3

    [ 46.6 WXDAI ]

    @FernandVEYRIER
    Contributions Overview
    ViewContributionCountReward
    IssueTask137.5
    IssueComment70
    ReviewComment29.1
    Conversation Incentives
    CommentFormattingRelevanceReward
    @rndquu Just wanted to clarify on this task to understand better...
    -
    code:
      count: 2
      score: "0"
      words: 2
    
    --
    @pavlovcik I am pretty familiar with Supabase, but I think this ...
    -
    code:
      count: 1
      score: "0"
      words: 1
    
    --
    After digging into this for a while, got a few questions:

    The...

    -

    code:
      count: 4
      score: "0"
      words: 4
    
    --
    Righty, but how do I use these IDs to look the issues / users up...
    -
    code:
      count: 2
      score: "0"
      words: 4
    
    --
    Indeed would be very helpful. Is it not usable right now?...
    ---
    > > /assign > > Try using /start

    Thank you it worked. Any ...

    ---
    @pavlovcik This might have broken the process of Ubiquibot, whic...
    ---
    @pavlovcik All good, it is ready now. This issue is extremely pa...
    7.80.627.8
    > @FernandVEYRIER some merge conflicts for you here.

    Will fix...

    1.30.311.3

    [ 0.6 WXDAI ]

    @devpanther
    Contributions Overview
    ViewContributionCountReward
    IssueComment10.6
    Conversation Incentives
    CommentFormattingRelevanceReward
    @rndquu project url is needed too...
    0.6-0.6

    [ 1 WXDAI ]

    @aditygrg2
    Contributions Overview
    ViewContributionCountReward
    IssueComment11
    Conversation Incentives
    CommentFormattingRelevanceReward
    Awaiting https://github.com/ubiquity/ubiquibot/issues/547 to mer...
    1-1

    [ 53.4 WXDAI ]

    @rndquu
    Contributions Overview
    ViewContributionCountReward
    IssueSpecification118.8
    IssueComment334.6
    Conversation Incentives
    CommentFormattingRelevanceReward
    Depends on https://github.com/ubiquity/ubiquibot/issues/547

    W...

    18.8

    li:
      count: 2
      score: "2"
      words: 17
    code:
      count: 2
      score: "2"
      words: 7
    
    118.8
    > @rndquu project url is needed too

    Updated the description...

    0.6-0.6
    > @rndquu issues are spread out throughout many many repositorie...
    0.8-0.8
    @FernandVEYRIER

    This is about the page showing the rewards...

    33.2

    a:
      count: 3
      score: "3"
      words: 3
    code:
      count: 2
      score: "2"
      words: 2
    
    -33.2

    [ 3.6 WXDAI ]

    @CrustalRundrops
    Contributions Overview
    ViewContributionCountReward
    IssueComment33.6
    Conversation Incentives
    CommentFormattingRelevanceReward
    Hi, I am here from alex's (pavlovcik's) podcase...
    1-1
    how should i do issue's?...
    0.6-0.6
    @rndquu issues are spread out throughout many many repositories,...
    2-2

    @0x4007 0x4007 self-assigned this Mar 20, 2024
    Copy link

    ubiquibot bot commented Mar 20, 2024

    @pavlovcik @FernandVEYRIER the deadline is at 2024-03-20T04:38:35.356Z

    @0x4007 0x4007 removed their assignment Mar 20, 2024
    Copy link

    ubiquibot bot commented Mar 20, 2024

    # These linked pull requests are closed:  <a href="https://github.com/ubiquity/pay.ubq.fi/pull/164">#164</a> 

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

    Successfully merging a pull request may close this issue.

    6 participants