Closed xuhcc closed 3 years ago
Hi! Currently, the upper limit of voice credits is 2 ^ 32 = 4294967296
, hardcoded in the UpdateStateTree
circuit.
I can raise the limit but it would not solve the underlying issue - that we may hit the limit anyway, so we might as well scale down their max voice credits on the client side.
e.g. even if i raise the limit to 2 ^ 64 = 18446744073709551616
, that's only 18 tokens with precision 18.
And there are tokens with precision 0 etc. So MACI cannot accommodate them all.
MACI's real limit is somewhere less than 2 ^ 126
, since the circuit does the following:
// Calculate the new voice credit balance
signal vote_options_leaf_squared;
vote_options_leaf_squared <== vote_options_leaf_raw *
vote_options_leaf_raw;
signal user_vote_weight_squared;
user_vote_weight_squared <== decrypted_command_out[CMD_VOTE_WEIGHT_IDX] *
decrypted_command_out[CMD_VOTE_WEIGHT_IDX];
signal new_voice_credit_balance;
new_voice_credit_balance <== state_tree_data_raw[STATE_TREE_VOICE_CREDIT_BALANCE_IDX] +
vote_options_leaf_squared -
user_vote_weight_squared;
It can't be more than 126 bits or vote_options_leaf_squared
will overflow when we square vote_options_leaf_raw
.
I doubt that new_voice_credit_balance
would overflow but the safe option is to have the limit as it currently is.
Is 4294967296 credits a sufficient maximum value for client apps? If so, there's no need to increase the limit anyway.
Hope this helps!
MACI CLI fails to
process
messages if the number of voice credits is large (16000000000000000000
):Works fine with smaller numbers (e.g.
16000000
)