You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

52 lines
984 B

  1. /******
  2. SMTVerifierLevel
  3. This circuit has 1 hash
  4. Outputs according to the state.
  5. State root
  6. ===== =======
  7. top H'(child, sibling)
  8. i0 0
  9. iold old1leaf
  10. inew new1leaf
  11. na 0
  12. H' is the Hash function with the inputs shifted acordingly.
  13. *****/
  14. template SMTVerifierLevel() {
  15. signal input st_top;
  16. signal input st_i0;
  17. signal input st_iold;
  18. signal input st_inew;
  19. signal input st_na;
  20. signal output root;
  21. signal input sibling;
  22. signal input old1leaf;
  23. signal input new1leaf;
  24. signal input lrbit;
  25. signal input child;
  26. signal aux[2];
  27. component proofHash = SMTHash2();
  28. component switcher = Switcher();
  29. switcher.L <== child;
  30. switcher.R <== sibling;
  31. switcher.sel <== lrbit;
  32. proofHash.L <== switcher.outL;
  33. proofHash.R <== switcher.outR;
  34. aux[0] <== proofHash.out * st_top;
  35. aux[1] <== old1leaf*st_iold;
  36. root <== aux[0] + aux[1] + new1leaf*st_inew;
  37. }