-
Notifications
You must be signed in to change notification settings - Fork 154
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
Topup feature does not work - incorrectly throw insufficient funds error #1133
Comments
thanks @yuetloo - "The issue is that topup and vote messages are processed in reverse order instead of the order they show up in the logs, see the following line here:" yes that's how processing works, so you would need to reverse how you send the topup and the message which goes over the voice credits limit. contribute 1 voice credits topup 2 voice credits should be contribute 1 voice credits vote 2 voice credit to project 1 |
@ctrlc03 , I don't see how I can reorder the log events as suggested. The events are logged by the contract and the contract has to enforce the order and verify the contributor has enough voice credits before they can vote.
|
@ctrlc03 , I see that MACI doesn't validate votes submitted by the tx:1 tx:2 |
the contract verifies that the caller has enough voice credits? where? feel like I'm missing something |
yes correct, votes are encrypted, so they cannot be validated on chain |
@ctrlc03 , there's an issue here because a coordinator can process topup messages in an order that would cause votes to be ignored and still produce a zk proof that passes the off-chain and on-chain verifications. In MACI v0, if the coordinator didn't process the signup messages correctly that contain the initial voice credits information, the zk proof would fail the on-chain verification. |
Sorry, yes, you're right, contract cannot validate voice credits because vote messages are encrypted. |
In MACI v1 that is the same, all signups must be processed. |
Maybe more relevant in a discussion vs. this GH issue but... should we consider removing the topup feature? Do we have any sense of the demand for this feature? Is it worth the added complexity? |
Closing this as the topup feature was removed until a new design is implemented. #1421 |
Prerequisites
Please answer the following questions for yourself before submitting an issue.
Expected Behavior
Given the following test case,
genProof
should generate correct tally result.The genProof output, tally.json file should produce the following result:
totalSpentVoiceCredits.spent = 3
perVOSpentVoiceCredits.tally[1] = 2
perVOSpentVoiceCredits.tally[2] = 1
Current Behavior
What is the current behavior?
genProofs throws InsufficientVoiceCredits error.
https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/Poll.ts#L281
Failure Information
The issue is that
topup
andvote
messages are processed in reverse order instead of the order they show up in the logs, see the following line here:https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/Poll.ts#L507
As a result, when it processes the first vote message with 2 voice credits, it hasn't processed the topup message, which is supposed to update the state tree balance here:
https://github.com/privacy-scaling-explorations/maci/blob/dev/core/ts/Poll.ts#L580-L582
Steps to Reproduce
Please provide detailed steps for reproducing the issue.
Context
Please provide any relevant information about your setup. This is important in case the issue is not reproducible except for under certain conditions.
Failure Logs
Please include any relevant log snippets or files here.
The text was updated successfully, but these errors were encountered: