-
Notifications
You must be signed in to change notification settings - Fork 43
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
feat: show unclaimed permits #172
feat: show unclaimed permits #172
Conversation
I broke the RPC thing and pushed to development (sorry about this! I've been in the middle of For a quick review you might be able to pull from mine: #175 |
export function shortenTransactionHash(hash: string | undefined, length = 8): string { | ||
if (!hash) return ""; | ||
if (!hash || hash === TX_EMPTY_VALUE) return "UNCLAIMED"; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Don't display anything to the user.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Here is the audit result for the https://github.com/ubiquity/business-development repo:
This issue is missing in the final report. As far as I understand from the comments in that issue those permits were not claimed. Pls make sure that unclaimed permits are displayed.
Thanks for your input. I cannot test without the secret key and could only try on https://github.com/ubiquity/ubiquibot please let me know if the fix works. I changed the logic so the items are added after all operations are complete instead of having them added after rpc + db fetch are complete, which should solve the issue. Added the corresponding reset as well. |
What secret key |
Bot Wallet Address I meant, I think it is required to get the results from a certain repo? |
Results are publicly posted on the blockchain and on GitHub comments. No private key required. |
You are correct, but since part of the results come from the blockchain, I do not know the Bot Wallet Address, but I realize that it is actually the address I see whenever transactions are made, so I could figure it out myself, my bad |
I've got a few things on my plate and wont be able to handle this review. @rndquu hope that you can get this resolved. Also as a heads up @FernandVEYRIER as soon as this is merged in I would like to get this into another repo |
@FernandVEYRIER
You can QA the audit page this way:
Could you make sure that ubiquity/business-development#67 is displayed in the audit results when running from the latest commit in this PR? |
@rndquu thank you. I was trying that way before, and I never get any result, which is why I started questioning about the WALLET value. Here is the result of the query I am not aware if there is any API limiter, or if I am missing some values in my env or something wrong with my setup in general. I am also using the database with id |
@rndquu After investigation, there seemed to be something wrong within the local database (browser's) that was saved, so after clearing the database the fetching works again so far. But now that we don't read the GitHub issues anymore, in order to be displayed the items have to be saved somewhere in the Supabase db, are you using another db than the one I have right now? Come to think of it, we shouldn't need to fetch the transactions from etherscan.io and gnosisscan.io anymore since all of this information should be saved in the database in the first place isn't it? I think it should all be rewritten to solely rely on the db's values as a source of truth, that would drastically speed up the fetching process and not rely on querying the ether / gnosis networks. |
No there's just one database we are only really using for saving wallets right now. Yes we are in a transition period but the idea is to query all the necessary information from our database. The thing is, we are unsure how long it will take to finalize the database because the infrastructure is evolving so we need to change the database schema to accommodate. Fortunately with the plugin infrastructure we can isolate tables per plugin to make things more adaptable in our rapid r&d phase. |
Made significant changes to accommodate for the changes related to how the permits are fetched. Now the DB should be the only source of truth, holding transactions, amounts and users. This allows for a much better performance, since we do not need to fetch the transactions from the chains anymore, and can just rely on a one DB call to get all the needed data. We still need GitHub to fetch the user and issue details as they are not saved in the db. |
@rndquu can you handle this review |
@rndquu there is no record in the database for Eventually maybe we should consider a script that would help us populate the db with the previous transactions and users that are missing. |
The GitHub issues REST API is actually designed for the following parameters: Organization name, repository name, issue/pull request number. These can easily be extracted from the URL. I assumed that if I had the comment ID, that I could directly look up the comment; but we would have to use graphql for all that. I would much, much rather we use the normal REST API for all of our infrastructure because it's significantly easier with its built in methods, and comes with type safety. The alternative is that we have the comment ID embedded as the # parameter in the URL, then we load that issue/pr, and we can find the comment ID from there. |
As a personal taste, GraphQl is usually way easier to use and is even more type safe than REST APIs, since types are dynamically generated from passed arguments where in REST you can send anything. But not using the db, we would have to also call again the ether / gnosis network to check for the status of the claim isn't it? |
I mean REST using the @octokit/rest module. We manipulate the REST API with the provided type safe methods. I am not 100% sure about the graphql sdk but given that we pass in huge arbitrary strings it seems unlikely to me that it supports type safety.
Yes but in my earlier research from a few days ago, in the context of pay.ubq.fi rewards interface: given the amount of functional RPC endpoints we have available to us, and given that most people claim within 12 hours of posting; we can feasibly find any specific claim status almost "realtime" at page load I'm mobile so it's not too easy for me to find the original conversation on this. |
Found it #138 (comment) |
@pavlovcik You can simply use codegen-graphql on GitHub endpoints to automatically generate all the TypeScript interfaces 😄 |
@pavlovcik yes I manually entered this one for the sake of testing. I can create a script to populate the db with real data if needed |
No worries on the script. We can test the rest in production. Thank you |
To sum up: we're good to show issues only with claimed permits because it's easier and faster to read from DB instead of parsing github or onchain data |
Issues without permit should be also showing with the latest fix, as long as there is a record of that issue in the db |
But there is no "issues" table in the DB, where do we get issues related info? |
In the |
I really want to drop the |
Might want to rethink the structure of the database? We should think what would be the most efficient way to sync the data with the GitHub and the transactions. |
Definitely URL. At minimum it allows for instant auditability just by clicking the link on the Supabase UI. |
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
To sum up:
- We're retrieving issues from DB from the
locations
table - In the future the
locations
table will be removed so the audit page will have to be refactored to read issues from some other table
@FernandVEYRIER Could you reopen this PR towards the https://github.com/ubiquity/audit.ubq.fi repo?
I know, I implemented all of the current database schema. We instead should have URL columns on every table that links the GitHub entity at hand for the row data. In exchange for the redundancy we have high convenience for auditing and debugging. |
@rndquu Reopened the PR at ubiquity/audit.ubq.fi#2 |
You should close this pull request if its no longer necessary. |
@pavlovcik I resolved the merge conflict in case you decide to merge it, everything should be solved at that point. The other PR will be awaiting for reviews in the meantime |
Closing in favour of ubiquity/audit.ubq.fi#2 |
Resolves ubiquity/audit.ubq.fi#5