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

Add spending logic #141

Open
vimwitch opened this issue Sep 20, 2022 · 6 comments · May be fixed by #554
Open

Add spending logic #141

vimwitch opened this issue Sep 20, 2022 · 6 comments · May be fixed by #554

Comments

@vimwitch
Copy link
Member

Add circuit and smart contract logic for spending reputation. This should be a single proof that updates two leaves in the epoch tree. (adding negRep to the spender, adding posRep/negRep to the receiver).

@ChialiT
Copy link
Member

ChialiT commented Oct 27, 2022

@vimwitch is this issue duplicated from the V2 epic?

@sorag20
Copy link
Contributor

sorag20 commented Oct 1, 2023

@vimwitch @ChialiT @vivianjeng
Hi,I would like to work on this issue.
So could you tell me detail about "spending reputation"?

@vivianjeng
Copy link
Member

@vimwitch @ChialiT @vivianjeng Hi,I would like to work on this issue. So could you tell me detail about "spending reputation"?

There is an epoch tree that stores hash(epochKey, data)
and spend reputation is to make one epoch key data increases and another epoch key data decreases
e.g.
A want to spend rep 3 and give it to B
we need to compute

  1. A has data[0]-data[1] >= 3 rep
  2. A's epoch key is epk_A
  3. epk_A has data_A in epoch tree
  4. epk_B has data_B in epoch tree
  5. compute the previous epoch tree root
  6. update data data_A[0]-3, data_B[0]+3
  7. compute the updated epoch tree root

and if epk_A and epk_B is not in epoch tree before, then insert a new leaf in the epoch tree
then the smart contract should check that epk_A and epk_B are really not in the epoch tree

@sorag20
Copy link
Contributor

sorag20 commented Oct 2, 2023

@vivianjeng
OK, Thank you for your polite response !
I'll try this !

@vivianjeng
Copy link
Member

@sorag20 thank you as well~
In this case, I think you will need a verifierHelper to verify the spend rep proof
e.g. #549 (still WIP)
the verifier helper should be able to read the Unirep.sol and check if the state is correct

@sorag20
Copy link
Contributor

sorag20 commented Oct 2, 2023

@vivianjeng
I understand. thank you!

@sorag20 sorag20 linked a pull request Dec 31, 2023 that will close this issue
13 tasks
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 a pull request may close this issue.

4 participants