Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cleanup #58

Merged
merged 7 commits into from
Aug 30, 2019
Merged
Show file tree
Hide file tree
Changes from 6 commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
512 changes: 279 additions & 233 deletions Cargo.lock

Large diffs are not rendered by default.

8 changes: 4 additions & 4 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,8 @@ members = [
"core/plasma",
"core/server",
"core/storage",
"core/franklincircuit",
"core/franklinmodels",
"core/franklin_prover",
"core/franklin_key_generator",
"core/circuit",
"core/models",
"core/prover",
"core/key_generator",
]
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -105,7 +105,7 @@ dummy-prover:
cargo run --bin dummy_prover

prover:
@cargo run --release --bin franklin_prover
@cargo run --release --bin prover

server:
@cargo run --bin server --release
Expand Down
2 changes: 1 addition & 1 deletion bin/gen-keys
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@ FRANKLIN_HOME=`dirname $0`/..


mkdir -p $FRANKLIN_HOME/$KEY_DIR/$BLOCK_SIZE_CHUNKS
cargo run --bin franklin_key_generator --release
cargo run --bin key_generator --release

cp $FRANKLIN_HOME/$KEY_DIR/$BLOCK_SIZE_CHUNKS/VerificationKey.sol $FRANKLIN_HOME/contracts/contracts
2 changes: 2 additions & 0 deletions clippy.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
too-many-arguments-threshold = 12
cognitive-complexity-threshold = 30
38 changes: 19 additions & 19 deletions contracts/contracts/VerificationKey.sol
Original file line number Diff line number Diff line change
Expand Up @@ -9,27 +9,27 @@ contract VerificationKey {

function getVk() external pure returns (uint256[14] memory vk, uint256[] memory gammaABC) {


vk[0] = 0x04fd4747ce83ae7d2db0556352df19a3dff711b2765fc12a7ec6e38ca537b30f;
vk[1] = 0x25f6674d526af9b4152cac6b092f8b762ea88e53036c5345b19c0f87f4d90ff4;
vk[2] = 0x2651e0fe1abe71aff4111dbbf76f1f6e5cde291dc2094f26ed8be7d742f48740;
vk[3] = 0x12369507d22dfe13a8f17be39d05daf541a79bb2930fa5ffd94a7f584749ec3b;
vk[4] = 0x0987978c96491b608f776be7e645171a8103e746aa3a37eb6b8f9654689b2367;
vk[5] = 0x197bb4c59e37176e381fd098dcc1771581dbc5655018c64b7d6391e69618f73b;
vk[6] = 0x029427c8ac578458581eab3ddfe18029bf949cf63bf7b557709837f10258664f;
vk[7] = 0x2fa701fc17e85495118d477cfcb82530b1dae4c548f5742b0fd29b145bd7ea0b;
vk[8] = 0x20d5aa37aab29ab9593dd5c5f46c223c6baeb50bba6dc2b1e71b377d76256ef5;
vk[9] = 0x08d6b12bb7bf6a3dcce9bc2ad091930ad9f32e4f1198a4d63fe199992e27dc8e;
vk[10] = 0x08aef144f52bee1ff0d1795ec394e54ccc38fff086011c5a8adde92a17f5fb05;
vk[11] = 0x2fd4fc94a99ecdfe5cd70e51e5a428128360ff9afb26fe8b2d356ad3b7f81fcb;
vk[12] = 0x2c92b22594eb05a44fad2382d423ccf35fbafbf4415f151f6f67429197b34657;
vk[13] = 0x11d5dbb95c59d0805a6aef8e54690a04ec5af61b287e1001c99b9eaf6a3ac517;
vk[0] = 0x1fd5370a139ba6db51d728dd2168621a045e0aa226d0321c4a9c1f63da988824;
vk[1] = 0x105747c6929375b00ec56929ceee08f9c27e975d175e04fcca2d03feb31be5bd;
vk[2] = 0x1dad0551ea9948d3627fe8abd8ab014d344509c39e94ece95462aabb28b09924;
vk[3] = 0x0a79734b0d868600ae0ada99bb2f9959a5d40a7c34e1f92ff247492b948a82f7;
vk[4] = 0x2ac1d35580e2dd08a32dbe536acb8e41335023f168b2799fb9ecb201936016f2;
vk[5] = 0x113a4d416716e73f2953b4038a3cdc333078938f01a1027d477a8e6dc4b47b4d;
vk[6] = 0x1cf77c5ac233c387c652b347a1099fc491628dd917c1f6ec776d6dcf28c42375;
vk[7] = 0x209700d026c240a19de578ab924f63165a0092b946c8c7e479091c47133fc82f;
vk[8] = 0x0062b7689366129df28302abff7dd25ee6e58b5894c8bd1dead3aa5c0faeea70;
vk[9] = 0x13c017802d8b29437c25f6791bd2ca51dbf4cac709d6f5ae631fa028d18a8888;
vk[10] = 0x28fc4fac85df6c5cb774f9d72f224a063f48000b8082b079e9a3c4ac901afbf6;
vk[11] = 0x2c79053e312e87bfef9f8f16acb70ca8ac8d27b9b3a288dc5e0c00b75dbd4235;
vk[12] = 0x1db6c5ed3f3c896919e22e05b77c4fb300d78878b74f7dd22b714829d3189e2d;
vk[13] = 0x2d73868653fbb3680ed35239cc27465c781fb0a0c778a7a65c2555cff9fa18b7;

gammaABC = new uint256[](4);
gammaABC[0] = 0x1091e7cd0419999907e5c15abe9e8810eaa12fd01d612a6f5f206717378d3a50;
gammaABC[1] = 0x016355b67d6767ac3ca085bc1345ebebca0a3188dea8e95a09304466e8970146;
gammaABC[2] = 0x11d8852d862cda43dc1d867fc8e8e305bcd34d2dae733c1e65bb475ad3e78c50;
gammaABC[3] = 0x1e9ba665d9e8ba166687b163b135b9e782616d3c3921757b8ca5697199c33946;
gammaABC[0] = 0x24fd20a87d4f3e3be60fc5a0ae86613f8247ef59abca51e13360477581f3a07e;
gammaABC[1] = 0x0a8c3e87042ed108bf0860aca987ed00d0e1994c0cdec56b6fc735cddd6b007d;
gammaABC[2] = 0x0ceba5279240dfbd0101f639e822e7c056f58681842d197abfcc1688b2790a13;
gammaABC[3] = 0x0a517f73b51d2f2531403cbfde9d18edfd739d45cbd873422861aae94e2041b2;


}
Expand Down
4 changes: 2 additions & 2 deletions core/franklincircuit/Cargo.toml → core/circuit/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "franklincircuit"
name = "circuit"
version = "0.1.1"
edition = "2018"

Expand All @@ -9,7 +9,7 @@ authors = [
]

[dependencies]
franklinmodels = { path = "../franklinmodels" }
models = { path = "../models" }
pairing = { package = "pairing_ce", version = "0.17.0" }
bellman = { package = "bellman_ce", version = "0.3.0" }
franklin_crypto = { package = "franklin-crypto", git = "ssh://[email protected]/matter-labs/franklin-crypto.git", branch="master"}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use franklin_crypto::jubjub::JubjubEngine;
use franklinmodels::params as franklin_constants;
use models::params as franklin_constants;

use crate::element::CircuitElement;
use bellman::{ConstraintSystem, SynthesisError};
Expand Down Expand Up @@ -32,8 +32,8 @@ impl<E: JubjubEngine> AccountContent<E> {
)?;

Ok(Self {
nonce: nonce,
pub_key_hash: pub_key_hash,
nonce,
pub_key_hash,
})
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ use crate::operation::{Operation, OperationBranch};
use crate::utils;
use bellman::{ConstraintSystem, SynthesisError};
use franklin_crypto::circuit::float_point::parse_with_exponent_le;
use franklinmodels::params as franklin_constants;
use models::params as franklin_constants;

use franklin_crypto::circuit::boolean::Boolean;
use franklin_crypto::circuit::num::AllocatedNum;
Expand Down Expand Up @@ -56,24 +56,24 @@ impl<E: JubjubEngine> AllocatedOperationBranch<E> {
let token = CircuitElement::from_fe_strict(
cs.namespace(|| "token"),
|| Ok(operation_branch.token.grab()?),
*franklin_constants::BALANCE_TREE_DEPTH,
franklin_constants::BALANCE_TREE_DEPTH,
)?;
let balance_audit_path = utils::allocate_audit_path(
cs.namespace(|| "balance_audit_path"),
&operation_branch.witness.balance_subtree_path,
)?;
assert_eq!(
balance_audit_path.len(),
*franklin_constants::BALANCE_TREE_DEPTH
franklin_constants::BALANCE_TREE_DEPTH
);

Ok(AllocatedOperationBranch {
account: account,
account_audit_path: account_audit_path,
account_address: account_address,
balance: balance,
token: token,
balance_audit_path: balance_audit_path,
account,
account_audit_path,
account_address,
balance,
token,
balance_audit_path,
})
}
}
Expand Down Expand Up @@ -129,16 +129,16 @@ impl<E: JubjubEngine> AllocatedOperationData<E> {
let amount_parsed = parse_with_exponent_le(
cs.namespace(|| "parse amount"),
&amount_packed.get_bits_le(),
*franklin_constants::AMOUNT_EXPONENT_BIT_WIDTH,
*franklin_constants::AMOUNT_MANTISSA_BIT_WIDTH,
franklin_constants::AMOUNT_EXPONENT_BIT_WIDTH,
franklin_constants::AMOUNT_MANTISSA_BIT_WIDTH,
10,
)?;

let fee_parsed = parse_with_exponent_le(
cs.namespace(|| "parse fee"),
&fee_packed.get_bits_le(),
*franklin_constants::FEE_EXPONENT_BIT_WIDTH,
*franklin_constants::FEE_MANTISSA_BIT_WIDTH,
franklin_constants::FEE_EXPONENT_BIT_WIDTH,
franklin_constants::FEE_MANTISSA_BIT_WIDTH,
10,
)?;
let amount = CircuitElement::from_number(
Expand All @@ -151,10 +151,7 @@ impl<E: JubjubEngine> AllocatedOperationData<E> {
fee_parsed,
franklin_constants::BALANCE_BIT_WIDTH,
)?;
// println!(
// "fee_parsed in allocated_operation_data equals {}",
// fee.get_number().get_value().grab()?
// );

let sig_msg = CircuitElement::from_fe_strict(
cs.namespace(|| "signature_message_x"),
|| op.sig_msg.grab(),
Expand Down Expand Up @@ -186,16 +183,16 @@ impl<E: JubjubEngine> AllocatedOperationData<E> {
)?;

Ok(AllocatedOperationData {
ethereum_key: ethereum_key,
ethereum_key,
signer_pubkey: sig_pubkey,
amount_packed: amount_packed,
fee_packed: fee_packed,
fee: fee,
amount: amount,
sig_msg: sig_msg,
new_pubkey_hash: new_pubkey_hash,
a: a,
b: b,
amount_packed,
fee_packed,
fee,
amount,
sig_msg,
new_pubkey_hash,
a,
b,
})
}
}
Loading