Zecale - Reconciling Privacy and Scalability on Smart-Contract Chains  0.5
Reference implementation of the Zecale protocol by Clearmatics
zecale_check_batch.py
Go to the documentation of this file.
1 # Copyright (c) 2015-2022 Clearmatics Technologies Ltd
2 #
3 # SPDX-License-Identifier: LGPL-3.0+
4 
5 from zecale.cli.utils import load_aggregated_transaction
6 from zecale.cli.command_context import CommandContext
7 from click import argument, option, command, pass_context, Context, ClickException
8 
9 
10 @command()
11 @argument("batch-file")
12 @option(
13  "--batch-size",
14  type=int,
15  required=True,
16  help="Number of nested proofs per batch")
17 @pass_context
18 def check_batch(ctx: Context, batch_file: str, batch_size: int) -> None:
19  """
20  Exit with error if result is not 1 for any nested proof
21  """
22  cmd_ctx: CommandContext = ctx.obj
23  aggregated_tx = load_aggregated_transaction(
24  cmd_ctx.get_wrapper_snark(), batch_file)
25  inputs = aggregated_tx.ext_proof.inputs
26  results = int(inputs[1], 16)
27  print(f"results={hex(results)}")
28 
29  expect_results = (1 << batch_size) - 1
30  if expect_results != results:
31  raise ClickException("at least one nested proof judged as invalid")
zecale.cli.utils
Definition: utils.py:1
zecale.cli.zecale_check_batch.check_batch
None check_batch(Context ctx, str batch_file, int batch_size)
Definition: zecale_check_batch.py:18
zecale.cli.utils.load_aggregated_transaction
AggregatedTransaction load_aggregated_transaction(IZKSnarkProvider zksnark, str agg_tx_file)
Definition: utils.py:29
zecale.cli.command_context
Definition: command_context.py:1
zecale.dummy_app.get.int
int
Definition: get.py:20