Replies: 3 comments 4 replies
-
I remember that some guy in the audit team proposed a way to process the message normally, what's the conclusion of that method? (I lose in following up the discussion QQ) Will it affect the answer of the listed questions? |
Beta Was this translation helpful? Give feedback.
-
Just wanted to add that the reverse processing is also used to enable reallocation with nonce cancellation In the following examples, votes from Day 1 were discarded because the nonces being processed from Day 2 because of reverse processing. Note also if Alice submits fewer votes (votes for few projects), the app will need to submit "blank" vote to cancel previous nonce.
b) Day 2,
b) Day 2,
|
Beta Was this translation helpful? Give feedback.
-
If we assume that briber has lots of power, it's not a problem "spam" and get desired vote in poll results with reverse processing. The bad thing here, user won't know about it because briber can switch keypair as well. So, here is the question: maybe it's possible to add verification for my own results so I can make sure my private key wasn't stolen and actually my votes are used in poll results, and how to prove it and don't allow briber to do the same. |
Beta Was this translation helpful? Give feedback.
-
This discussion aims to be the place where MACI's users and developers can discuss what is the best direction going forward on the order of message processing.
As of MACI v1.2.0 release, MACI processes messages in reverse order. Thus, the last message posted by a user will be processed first, requiring the nonce to be set to 1. This opens up a number of problems for applications integrating MACI. At the same time, it can be useful against certain bribery scenarios.
Let's start by looking at a MACI's message structure:
When processing messages (regardless of the order), the following checks are performed (some are omitted for the sake of this discussion):
Looking at the nonce, we can see how the order of processing is important.
Applications examples
Taking as an example a voting frontend trying to submit multiple votes for a user, the user will need to submit all messages in one batch, in reverse order. Let's imagine 20 votes in a batch, the message array will have the following nonces order: [20, 19, .., 1]. What happens if the user wants to send another vote, or overwrite certain votes? Well, if they were to send another vote with nonce 21, this would not be valid, as it would be the first message processed and 21 != 0 + 1 (nonce check). The other option is for the user to send all of the votes again, however for ideal privacy, each message should have been encrypted using a key generated with
ECDH(coordinator public key, ephemeral key)
, thus a client application would need to either store all of the ephemeral keys to decrypt all messages sent in the previous batch (by first fetching all on-chain events), or store the messages in the client app storage. At this point, they will need to resubmit the batch with the new vote(s). Furthermore, what if we need to submit more votes than we can fit in one block? This becomes quite complex to handle, as an user would need to submit multiple transactions via a client app, greatly affecting UX and introducing multiple edge cases.As another example, a user decides to change their key, with reverse processing, the user should first send a message using the new key, and then a message with the key change request -> nonces [2, 1].
You can see from the above examples, how processing messages in normal (ascending) order would make building on MACI much easier. Let's assume we sent the 20 messages batch, and want to change one vote for a certain vote option, easy, we send a vote with nonce 21. All we need to keep track of is the nonce.
Bribery
So, why are messages processed in reverse order?
Reverse processing was introduced to prevent a type of attack where a briber would collude with a voter to sign up, and then submit a message to change their key to a key that the briber controls. This way the briber would have assurance that they could submit the vote they want.
Let's take as an example the following:
If messages were processed in the same order as they were submitted, Alice's vote would not be valid, due to it being signed with a private key priv1 - which now would not be valid.
On the other hand, due to messages being processed in reverse order, Alice's last message would be counted as valid as the key change would have not been processed yet. Then, Bob's vote would not be counted as valid as the current key for Alice would be pub1.
Let's look at other scenarios, and check which processing order is the best option (or if it even matters at all?):
Some questions to discuss
Would like to get people's opinions here, think of more scenarios together and see which way is better for the future.
A quick note on El-Gamal
In terms of potential future ugrades, El-Gamal looks like the most logical first step forward for MACI. The 3327 team implement a PoC for it, though it looks like the current proposed design would not work when messages are processed in reverse order. This is due to the message used to generate a new key with El-Gamal re-randomization being sent before the voting starts (the proposed solutions includes adding phases: signup, key deactivation/generation, voting). If the deactivation messages are sent before voting starts, and messages are processed in reverse order, it will be the last message processed for the user, so actually being useless. While there might be ways around this, I believe it's worth considering if it's safe to switch the message processing order back to it being sequential.
References
Beta Was this translation helpful? Give feedback.
All reactions