maci icon indicating copy to clipboard operation
maci copied to clipboard

currentSbCommitment mismatch for different stateTreeDepth

Open chaosma opened this issue 2 years ago • 1 comments

If we change the stateTreeDepth from 10 to 2, proveOnChain will fail with "currentSbCommitment mismatch" error. Here is the code to modify:

# contracts/contracts/MACI.sol
 uint8 public override stateTreeDepth = 10 =>  uint8 public override stateTreeDepth = 2;

# core/ts/MaciState.ts
const STATE_TREE_DEPTH = 10 => const STATE_TREE_DEPTH = 2

After recompile the solidity and rebuild typescript, will see this error. And everything is fine when stateTreeDepth = 10.

chaosma avatar Apr 07 '22 18:04 chaosma

To reproduce the issue:

  • checkout commit: smallTree
  • do the following:
# recompile and generate new zkeys
cd contracts && npm run compileSol
cd core &&  npm run build
cd cli && ./gen_zkeys.sh

# test
./testSmallTreeDepth.sh
  • error messages
proof on chain ...
Submitting proofs of message processing...
Error: currentSbCommitment mismatch.

chaosma avatar Apr 08 '22 19:04 chaosma

Closing as we prove in https://github.com/privacy-scaling-explorations/maci/pull/918 that MACI works with different stateTreeDepth parameters. The empty ballot roots must change for it to work which is accomplished by running compileSol with a param setting the stateTreeDepth in genEmptyBallotRootsContract .

ctrlc03 avatar Dec 15 '23 12:12 ctrlc03