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

Idena Integration #7646

Merged
merged 23 commits into from
Nov 19, 2020
Merged

Idena Integration #7646

merged 23 commits into from
Nov 19, 2020

Conversation

iRhonin
Copy link
Contributor

@iRhonin iRhonin commented Oct 9, 2020

idena

Todo

  • Add self hosted idena node option and doc
  • CLI to update idena statues
  • Store token and nonce on redis
  • Screenshot
  • Disconnect Button
Description
  • Adding Idena integration
  • Added update_idena_status command to update all connected users and registered a daily cronjob
Refers/Fixes
Testing

@iRhonin iRhonin changed the title Added basic Idena Integration Oct 9, 2020
@iRhonin iRhonin marked this pull request as ready for review October 27, 2020 16:40
app/app/settings.py Outdated Show resolved Hide resolved
app/dashboard/idena_utils.py Outdated Show resolved Hide resolved
app/dashboard/idena_utils.py Outdated Show resolved Hide resolved
else:
status = r['result']['state']

expiry = int(next_validation_time().timestamp() - datetime.utcnow().timestamp()) # cache until next epoch
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

do we want to cache error'd statuses?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Wha log level you suggest? I think the ERROR is a bit too high for that.

app/dashboard/views.py Outdated Show resolved Hide resolved
app/dashboard/views.py Show resolved Hide resolved
app/dashboard/views.py Outdated Show resolved Hide resolved
@danlipert danlipert marked this pull request as draft October 29, 2020 11:31
@iRhonin iRhonin force-pushed the adena branch 2 times, most recently from 368ee3a to 531bd82 Compare November 1, 2020 14:19
@iRhonin iRhonin marked this pull request as ready for review November 1, 2020 14:22
@danlipert
Copy link
Contributor

Looks like theres still some outstanding todos and such so I'll mark this as draft until its ready to deploy

@danlipert danlipert marked this pull request as draft November 3, 2020 10:00
@iRhonin
Copy link
Contributor Author

iRhonin commented Nov 3, 2020

@danlipert acctually I need your help for the todos, they are some business decisions.

@owocki
Copy link
Contributor

owocki commented Nov 3, 2020

what are the business decisions that need to be made?

@iRhonin
Copy link
Contributor Author

iRhonin commented Nov 3, 2020

what are the business decisions that need to be made?

What is the CRL Match for Idena itself? (the one shows it the trust tab)
Also, whats is it in these situations:

  1. One Idena and one SMS
  2. One Idena and one BrightID

@owocki
Copy link
Contributor

owocki commented Nov 3, 2020

What is the CRL Match for Idena itself? (the one shows it the trust tab)

lets make it 25%

each layer of sybil resistence compounds upon one another, so if you have sms and idena your trust bonus be 1.05 * 1.25 = 1.31

you can add an entry in the trust bonus calc method on #7534 to add the idena bonus. cc @frankchen07 we need to update #7534 so that it works with clr.py

@ligi
Copy link

ligi commented Nov 4, 2020

Great to see idena integration in gitcoin!

just wondering about

each layer of sybil resistence compounds upon one another

what is the reasoning there? I would rather like to see an either or here - meaning you select one and cannot combine them. So people can choose their sybil-protection system of choice and do not get disadvantaged when they do not want to disclose sensitive information like their phone number.

@owocki
Copy link
Contributor

owocki commented Nov 4, 2020

what is the reasoning there?

the thinking is that the sybil resistence of multiple layers actually does compound (its harder to manufacture accounts that are verified with all services, than with some services)

if you are sensitive about SMS numbers (which is totally valid), we can verify you offline. message gitcoin_verify on keybase?

@ligi
Copy link

ligi commented Nov 4, 2020

@owocki cool did not know this is an option - great!

@thelostone-mc
Copy link
Member

@iRhonin could you resolve the conflicts + recreate the migration
I think this got in cause we got one of your other PRs inn

@iRhonin
Copy link
Contributor Author

iRhonin commented Nov 11, 2020

@iRhonin could you resolve the conflicts + recreate the migration
I think this got in cause we got one of your other PRs inn

Done.

@danlipert
Copy link
Contributor

@thelostone-mc this for the integration branch you think?

@thelostone-mc thelostone-mc changed the base branch from master to grants-round-8 November 19, 2020 10:16
@thelostone-mc thelostone-mc merged commit dc6b151 into gitcoinco:grants-round-8 Nov 19, 2020
@thelostone-mc
Copy link
Member

@iRhonin would you update the description with what steps we'd have to take before deploying to ensure this feature works?

@iRhonin
Copy link
Contributor Author

iRhonin commented Nov 19, 2020

@iRhonin would you update the description with what steps we'd have to take before deploying to ensure this feature works?

For now, it works as it is (until RPC node support added, I will make another PR in the next few days).
The only thing you should consider is running the update_idena_status command before applying CLR match.

@thelostone-mc
Copy link
Member

@iRhonin we're having some trouble getting this validated on branch

Would you be able throw us some what all we would need to set up to test this out ?
Additionally it would be super helpful if you could do test of it on grants-round-8 branch as we made some changes to trust bonus and still need to validate if idena still works

cc @apbendi

@iRhonin
Copy link
Contributor Author

iRhonin commented Nov 26, 2020

@thelostone-mc sure, I am going to test the grants-round-8 branch.
As far as I remember no setup needed for the branch, but I will check it again.
Can you tell me what is the error?

EDIT: Found and fixed the issue, check PR #7946.

@iRhonin iRhonin deleted the adena branch November 26, 2020 13:26
thelostone-mc added a commit that referenced this pull request Dec 1, 2020
* setup json grants endpoint and view

* add remove from cart

* add model fields

* add styles

* template changes

* links on cat

* grant edition

* Kevin fix multigrant (#7870)

* n:n matching rounds <> grants

* add migration

* chore: tiny fixes

Co-authored-by: owocki <ksowocki@gmail.com>

* fix(grant): validate twitter handle for /grants/new (#7890)

* fix(grant): validate twitter handle for /grants/new

* fix(grants): validate twitter handle in /new

* fix broken grant creation + add region support

* Idena Integration (#7646)

* Added basic setups

* Implemented rest of flow

* Import refactoring

* Compress new image

* Removed Idena from soon section

* Typo

* Redesign idena trust section

* Check for idena uniques

* Applied review suggestion

* Added idena disconnect button

* Moved idena_token from database to redis

* Moved idena_nonce from database to redis

* Moved idena_status and is_idena_verified to db from redis

* Added update_idena_status command

* Added recheck button

* Added daily cronjob for update idena status

* Added idena to post data

* Added idena to clr calculation

* Added idena to trust bounes

* Typo

* Some tweaks

* Recreated migration

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* recreate migration

* Add Saturation Documentation (#7887)

* add quick documentation on saturation methods.

* add saturation documentation migration

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* set default prediction curve

* another fix

* save grant

* saving grant is killing me

* was a comma...

* fix quill render

* add editable fields

* video in description

* refactor of grantclr to make the round_num an actual int + add a subround/customer field (#7685)

* WIP refactor

* linter

* adds customer field

* fix: help texts in model fields

* fix(views): sub_round_slug default should be 'all'

* attempt at frontend todos

* feat: make customer_name & sub_round_slug optional

- add unique_together constraint

* feat: more params to clr_grants view and /clr urls

* feat: implement new clr params in frontend

* feat: new migration

* feat: add new clr params in card info

* update pledge grant creation

* merge migrations

Co-authored-by: Chibuotu Amadi <chibuotu@gmail.com>

* add new endpoint for grant cancellation (#7912)

* cancel grant

* zkSync refactor (#7899)

* Initial setup and cleanup for zksync refactor

* zkSync CheckoutManager now implemented and working

* Handle unsupported tokens and update fee estimate accordingly

* Support fee estimation, delete old zksync code, pass data to parent with events

* Add zkSync modal with all required functionality

* Add zksync balance check, warn user if closing window after checkout started

* Bump zksync version

* Add missing grant_type field to default Rinkeby grants, update zksync gas estimate (#7915)

* fix for grants without type

* Add ActiveCLR Navigations (#7877)

* Add custom display text and owner to model

* Include active_clr rounds in context data

* Update the sidebar with active_clr links

* Add active CLRs  on grants top

* Fix spacing

* Make banner clickable

* Fix sidebar activerounds link

* Reorder sidebar

* Fix indent

* Redo migrations

* Use gitcoin icon as default

* Fix indent

* Hide sidenav if no active CLR rounds

* fix: use sub_round_slug in active_clr_round display

* new migration

* use sub_round_slug in sidebar_search

* indent code

* chore: update help text

* fix issue

* update help text

* improve display of clr round text

Co-authored-by: Chibuotu Amadi <chibuotu@gmail.com>
Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* chore(grants): estimate clr via celery (#7913)

* chore: move predict_clr to celery task

* keep predict_clr login in clr.py; house keeping

* update clr print statements with sub_round_slug

* add debug comment to predict_clr task

* move print statements to predict_clr celery; use passed args

* review feedback

* add missing 'self' argument to predict_clr task

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* ui: redo collection UI #7750 (#7929)

* Make Grant Banner/Bacgkround image customizable (#7855)

* Fix reverse url issue by checking if params exist

* Fix typo

* Create model  and register in Admin

* Display custom routing policy

* Add comment to model class and fix display in admin

* Fix incorrect variable spelling

* Redo Migrations

* Create new model and add further model docs

* Removed trailing comma

* recreate migration

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* fix styles and model repr

* Implement new contributions flow (#7891)

* Implement new flow

* backend wiring

* update banner button styling

* minor fix

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* Check if query params exists before attempting to access elements / Grants auto fill (#7898)

* Check if query params exists before attempting to access elements

* Uncomment block

* Rewrite to use URLSearchParams

* add image upload to details edit

* fix code

* bump eslint optional-chaining support and fix lint errors

* remove prints

* Refactor And Improve The Trust Bonus Tab (#7934)

* Replace the Ad-hoc Trust Bonus UI with a single Vue App

* Remove the trust bonus template and replace it with a
  new one that uses Vue top to bottom
* Create a re-usable Vue component for active trust service
  rows, with events for callbacks, and slots for overriding
  any given component of the UI as needed
* Create individual Vue components for each of the modal views
  required by certain trust services, including refactoring the
  BrightID implementation to use Vue
* Cleanup copy and design of the POAP modal
* Convert the new Idena row to use the Vue component

* Rip all SMS verification code out of the cart

* Show Trust Bonus message in cart based on all services

* Send a single email for all grant  items in cart (#7880)

* Send a single email for all items in cart

Don't send an email for negative grant contribution as well as wait for grant processing task to complete before sending

Remove old code

Remove space

Remove unused import

Update with new templates

Co-authored-by: Miguel Angel Gordián <miguel@gordian.dev>

* Ensure styles are the same

* Remove chord

* Update thank_you_for_supporting.txt

* Fix sync helper to use new api

Co-authored-by: Miguel Angel Gordián <miguel@gordian.dev>

* bump travis node version

* Generate collection thumbnail (#7587)

* Genrate collection thumbnail

* Fix tuple error on grant url

* Update avatar for collection thumbs

* #7822

* travis npm cache false

* travis syntax

* compress image and upload logo

* add "maximize your grant" blog link to new grant email (#7945)

* Grants checkout POST request + tx validator updates (#7942)

* Some cleanup/prep before updating POST requests

* Saves and deletes JSON store for standard checkout

* Working POST requests with validation for L1 and L2 checkout

* Various validator changes and setup + upgrade zksync-checkout version + enforce from address

* Add migration for updating checkout_type field

* Add checkout_type support, fix beforeunload handler, bump zksync-checkout version

* Set checkout_type on contribution creation

* Remove unused grant checks and unused zksync-recovery code

* Validator properly validates zkSync transactions

* a/b test of sort order (#7941)

* #7792

* redo mig + fix indent

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* add twitter verification

* missing migration

* quick view

* fix styles and bugs

* Fixing idena verified badge (#7946)

* fix broken UI

* show my items only if user is logged in

* update text in did you know

* update helptext + make background_image in GRPolicy

* add policy name in GRPolicy

* update grant cancel text

* split button into 2 lines

* round off decimals

* remove current/past sponsors

* fix broke CLR URL in UI

* ensure rectangular CLR banner gets applied on landing

* fix banner image + append / to url

* clear error on successfull submit

* hide prediction curve when grant is not part of CLR

* title styles

* fix UI error

* enable tabs

* styles for tx tab

* show only active grant types in UI

* back link

* fix rerender rich description

* Fix incorrect donation summary values (#7952)

* make label clickable

* add idle grants

* validation

* fix edit grants bug

* add browser validation

* strict validation

* hide follow on logout

* fix checker for landing

* post_data fix for grants round 8

* update grant count

* broken addToCart URL

* fix grant edit flow

* chore: show view collection instead on add to cart in explorer

* ensure logged in user sees fav + add to collection

* fix broken code

* Fix display of some collections (#7960)

* revert: multiple contrib -> 1 email change

* Fixes grants 8 (#7962)

* Fix checkIsCurator function

* Fix removeCollection function due to bad object construction

* Remove mandatory @ and validate twitter urls

* add is on team for cart

* change card state from sidebar

* small clr styles

* fix(grants): backend twitter validation (#7961)

* revert: multiple contrib -> 1 email change

* fix: twitter validation

* validate twitter handle in grant edit
* add missing '@' symbol

* fix if logic

* improve backend validation

* fix spacing

* fix indentation

* return response; save username in db

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>

* add back sidecart to details

* add compressor to grants creation

* Bump zksync version, prevent user from clicking standard checkout button twice (#7972)

* Open Idena download link in a new tab (#7973)

* Fix twitter profile verification error (#7974)

* fix thumbail and grant preview on mini collections view (#7975)

* unify styles

* fix broken ts

* fix twitter username validation in frontend (#7976)

* fix edit grants not working (#7977)

* remove logo watcher

* collections card images css

* Email & other fixes (#7964)

* quest_of_the_day return 0 if length is 0
  * Returns an IndexError otherwise

* fix: remove <br/>
  * the buttons need to be placed sideways

* Minor ui fix

* Replace Slack icon to Discord invite in emails' footer

* update gr8 twitter cards (#7980)

* eslint

Co-authored-by: Aditya Anand M C <aditya.anandmc@gmail.com>
Co-authored-by: owocki <ksowocki@gmail.com>
Co-authored-by: Chibuotu Amadi <chibuotu@gmail.com>
Co-authored-by: Rhonin <fatahzade@gmail.com>
Co-authored-by: fronk <7516920+frankchen07@users.noreply.github.com>
Co-authored-by: Matt <matt@mattsolomon.dev>
Co-authored-by: Abdulhakeem Adetunji Mustapha <abdulhakeemmustapha@gmail.com>
Co-authored-by: Miguel Angel Gordián <miguel@gordian.dev>
Co-authored-by: Ben DiFrancesco <ben@scopelift.co>
Co-authored-by: corydickson <7246942+corydickson@users.noreply.github.com>
Co-authored-by: Angela Gilhotra <angelagilhotra@gmail.com>
Co-authored-by: Dan Lipert <danlipert@gmail.com>
@iRhonin iRhonin mentioned this pull request Dec 3, 2020
@owocki
Copy link
Contributor

owocki commented Mar 16, 2021

@iRhoninis the idena account id of the user stored anywhere on the DB? during our testing we realized that multiple users could connect to the same idena account id , which is def a problem for anti-sybil design.

@owocki
Copy link
Contributor

owocki commented Mar 16, 2021

@iRhonin would you be able to PR a fix for that? happy to pay in ETH :)

@iRhonin
Copy link
Contributor Author

iRhonin commented Mar 17, 2021

@iRhoninis the idena account id of the user stored anywhere on the DB? during our testing we realized that multiple users could connect to the same idena account id , which is def a problem for anti-sybil design.

Yes, the field name is idena_address.
code checks for the uniqueness of idena_address here and there is a unique constraint on the idena_address field so db would throw an error.

Can you give me more detail about this happened?

@owocki
Copy link
Contributor

owocki commented Mar 17, 2021 via email

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

Successfully merging this pull request may close these issues.

None yet

5 participants