| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- ############################################################
- # Version that supports (de)serializastion
- # Archived for now
- ############################################################
- # """
- # Acceptable format:
- #
- # A witness or public input = [<type>, <value>]
- #
- # <type> = Base|Scalar|EcPoint
- #
- # <value> = "NUMBER|HEX_NUMBER" for Base or Scalar
- # = "HEX_NUMBER" for Point
- # """
- # def serialize_input(input):
- # input = ['Base', '42']
- # vartype, varserial = input
- # if vartype == 'Base':
- # return Base.from_u64(varserial)
- # pass
- #
- # def deserialize_input():
- # pass
- #
- # def make_publics(args):
- # print(f"make_publics: {args}")
- #
- # def prove(args):
- # print(f"prove: {args}")
- #
- # def verify(args):
- # print(f"verify: {args}")
- #
- # """
- # TODO:
- #
- # * Why did EcNiPoint fail to be witnessed (when building the proving key and in vm.rs)?
- # * This is the last opcode that is not supported by ZkRunner
- # * Why do the witness type and heap var type have different sets of variants?
- # * Need to confirm the simplications of types, i.e. Rust has more types than Python, do not have gotchas
- # * If we want to send publics around in a file, we need to figure out the serialization format
- # """
- # if __name__ == "__main__":
- # desc = "ZkRunner helps compute public inputs, and prove and verify Darkfi zero knowledge proofs."
- # global_parser = ArgumentParser(
- # prog="ZkRunner",
- # description=desc
- # )
- # subparsers = global_parser.add_subparsers(title="commands")
- #
- # # make_publics
- # m_parser = subparsers.add_parser("make-publics", help="Make public inputs",)
- # m_parser.add_argument(
- # "--witnesses",
- # default="witnesses.json",
- # help="[default: witnesses.json] Path for where the witnesses are stored"
- # )
- # m_parser.add_argument(
- # "--publics",
- # default="publics.json",
- # help="[default: publics.json] Path for where to store the computed public inputs for proving and verifying"
- # )
- # m_parser.set_defaults(func=make_publics)
- #
- #
- # # prove
- # p_parser = subparsers.add_parser("prove", help="Generate proving key and prove")
- # p_parser.add_argument(
- # "--witnesses",
- # default="witnesses.json",
- # help="[default: witnesses.json] Path for where the witnesses are stored"
- # )
- # p_parser.add_argument(
- # "--publics",
- # default="publics.json",
- # help="[default: publics.json] Path for where to store the computed public inputs for proving and verifying"
- # )
- # p_parser.add_argument(
- # "--proof",
- # default="proof.json",
- # help="[default: proof.json] Path for where to store the computed proof"
- # )
- # p_parser.set_defaults(func=prove)
- #
- #
- # # verify
- # v_parser = subparsers.add_parser("verify", help="Generate verifying key and verify")
- # v_parser.add_argument(
- # "--publics",
- # default="publics.json",
- # help="[default: publics.json] Path for where to store the computed public inputs for proving and verifying"
- # )
- # v_parser.add_argument(
- # "--proof",
- # default="proof.json",
- # help="[default: proof.json] Path for where to store the computed proof"
- # )
- # v_parser.set_defaults(func=verify)
- #
- #
- # args = global_parser.parse_args()
- # # calls the command
- # args.func(args)
|