Skip to content

Commit

Permalink
Merge pull request #572 from matter-labs/dvush/assert-constant-generator
Browse files Browse the repository at this point in the history
assert constant generator
  • Loading branch information
dvush authored May 21, 2020
2 parents c4255a6 + 6499b54 commit e7ce456
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
16 changes: 12 additions & 4 deletions core/circuit/src/circuit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -550,9 +550,18 @@ impl<'a, E: RescueEngine + JubjubEngine> FranklinCircuit<'a, E> {

let generator = ecc::EdwardsPoint::witness(
cs.namespace(|| "allocate public generator"),
Some(public_generator),
Some(public_generator.clone()),
self.jubjub_params,
)?;
let (public_generator_x, public_generator_y) = public_generator.into_xy();
generator.get_x().assert_number(
cs.namespace(|| "assert generator x is constant"),
&public_generator_x,
)?;
generator.get_y().assert_number(
cs.namespace(|| "assert generator y is constant"),
&public_generator_y,
)?;

let op_data =
AllocatedOperationData::from_witness(cs.namespace(|| "allocated_operation_data"), op)?;
Expand Down Expand Up @@ -1062,9 +1071,9 @@ impl<'a, E: RescueEngine + JubjubEngine> FranklinCircuit<'a, E> {
pubdata_bits.extend(cur.account_id.get_bits_be()); //ACCOUNT_TREE_DEPTH=24
pubdata_bits.extend(cur.token.get_bits_be()); //TOKEN_BIT_WIDTH=16
pubdata_bits.extend(op_data.full_amount.get_bits_be()); //AMOUNT_PACKED=24
pubdata_bits.extend(op_data.eth_address.get_bits_be()); //ETH_KEY_BIT_WIDTH=160
pubdata_bits.extend(op_data.eth_address.get_bits_be()); //ETH_ADDRESS_BIT_WIDTH=160
pubdata_bits.resize(
DepositOp::CHUNKS * params::CHUNK_BIT_WIDTH, //TODO: move to constant
DepositOp::CHUNKS * params::CHUNK_BIT_WIDTH,
Boolean::constant(false),
);

Expand Down Expand Up @@ -1602,7 +1611,6 @@ impl<'a, E: RescueEngine + JubjubEngine> FranklinCircuit<'a, E> {
)?;
lhs_valid_flags.push(is_serialized_tx_correct);

// TODO: add flag for is account address is correct(!)
let is_signer_valid = CircuitElement::equals(
cs.namespace(|| "signer_key_correct"),
&signer_key.pubkey.get_hash(),
Expand Down
8 changes: 5 additions & 3 deletions etc/env/dev.env.example
Original file line number Diff line number Diff line change
Expand Up @@ -73,12 +73,14 @@ KUBECONFIG=""
BELLMAN_VERBOSE=1

# key dir ending with latest version of circuit commit hash
KEY_DIR=keys/plonk-f5096d
KEY_DIR=keys/plonk-13931

# actual supported block chunks sizes by verifier contract (determined by circuit size on setup boundaries)
# and setup powe needed to proof block of this size
SUPPORTED_BLOCK_CHUNKS_SIZES=8,32,76,168,340,700
SUPPORTED_BLOCK_CHUNKS_SIZES_SETUP_POWERS=21,22,23,24,25,26
#SUPPORTED_BLOCK_CHUNKS_SIZES=8,32,76,168,340,700
#SUPPORTED_BLOCK_CHUNKS_SIZES_SETUP_POWERS=21,22,23,24,25,26
SUPPORTED_BLOCK_CHUNKS_SIZES=8
SUPPORTED_BLOCK_CHUNKS_SIZES_SETUP_POWERS=21

BLOCK_CHUNK_SIZES=8
ACCOUNT_TREE_DEPTH=24
Expand Down
Binary file not shown.

0 comments on commit e7ce456

Please sign in to comment.