Skip to content

Commit

Permalink
Use franklinmodels instead of models
Browse files Browse the repository at this point in the history
  • Loading branch information
dvush committed Aug 7, 2019
1 parent 54e1d01 commit c5c6660
Show file tree
Hide file tree
Showing 52 changed files with 267 additions and 902 deletions.
81 changes: 13 additions & 68 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,9 +1,7 @@
[workspace]
members = [
"core/key_generator",
"core/merkle_tree",
"core/eth_client",
"core/models",
"core/plasma",
"core/prover",
"core/server",
Expand Down
2 changes: 1 addition & 1 deletion core/eth_client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ version = "0.1.0"
edition = "2018"

[dependencies]
models = { path = "../models" }
models = { package = "franklinmodels", path = "../franklinmodels" }
serde = "1.0.90"
serde_derive = "1.0.90"
ethereum-types = "0.4.0"
Expand Down
2 changes: 0 additions & 2 deletions core/franklincircuit/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,6 @@ authors = [
]

[dependencies]
merkle_tree = { path = "../merkle_tree" }
models = { path = "../models" }
franklinmodels = { path = "../franklinmodels" }
pairing = { package = "pairing_ce", version = "0.17.0" }
bellman = { package = "bellman_ce", version = "0.3.0" }
Expand Down
12 changes: 5 additions & 7 deletions core/franklincircuit/src/tests/close_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use franklin_crypto::jubjub::JubjubEngine;
use franklinmodels::circuit::account::{
Balance, CircuitAccount, CircuitAccountTree, CircuitBalanceTree,
};
use franklinmodels::merkle_tree::hasher::Hasher;
use franklinmodels::merkle_tree::PedersenHasher;
use franklinmodels::params as franklin_constants;
use merkle_tree::hasher::Hasher;
use merkle_tree::PedersenHasher;
use pairing::bn256::*;

pub struct CloseAccountData {
Expand Down Expand Up @@ -41,7 +41,7 @@ impl<E: JubjubEngine> CloseAccountWitness<E> {
&self.before.address.unwrap(),
franklin_constants::ACCOUNT_TREE_DEPTH,
);

assert_eq!(pubdata_bits.len(), 4 * 8);
pubdata_bits.resize(8 * 8, false);
pubdata_bits
Expand All @@ -60,7 +60,7 @@ pub fn apply_close_account(
let capacity = tree.capacity();
assert_eq!(capacity, 1 << franklin_constants::ACCOUNT_TREE_DEPTH);
let account_address_fe = Fr::from_str(&close_account.account_address.to_string()).unwrap();

//calculate a and b
let a = Fr::zero();
let b = Fr::zero();
Expand Down Expand Up @@ -144,9 +144,7 @@ pub fn calculate_close_account_operations_from_witness(
rhs: close_account_witness.before.clone(),
};

let operations: Vec<Operation<_>> = vec![
operation_zero,
];
let operations: Vec<Operation<_>> = vec![operation_zero];
operations
}
#[test]
Expand Down
4 changes: 2 additions & 2 deletions core/franklincircuit/src/tests/deposit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use franklin_crypto::jubjub::JubjubEngine;
use franklinmodels::circuit::account::{
Balance, CircuitAccount, CircuitAccountTree, CircuitBalanceTree,
};
use franklinmodels::merkle_tree::hasher::Hasher;
use franklinmodels::merkle_tree::PedersenHasher;
use franklinmodels::params as franklin_constants;
use merkle_tree::hasher::Hasher;
use merkle_tree::PedersenHasher;
use pairing::bn256::*;

pub struct DepositData {
Expand Down
2 changes: 1 addition & 1 deletion core/franklincircuit/src/tests/mod.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
pub mod close_account;
pub mod deposit;
pub mod partial_exit;
pub mod transfer;
pub mod transfer_to_new;
pub mod close_account;
pub mod utils;
4 changes: 2 additions & 2 deletions core/franklincircuit/src/tests/partial_exit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,9 +11,9 @@ use franklin_crypto::jubjub::JubjubEngine;
use franklinmodels::circuit::account::{
Balance, CircuitAccount, CircuitAccountTree, CircuitBalanceTree,
};
use franklinmodels::merkle_tree::hasher::Hasher;
use franklinmodels::merkle_tree::PedersenHasher;
use franklinmodels::params as franklin_constants;
use merkle_tree::hasher::Hasher;
use merkle_tree::PedersenHasher;
use pairing::bn256::*;

pub struct PartialExitData {
Expand Down
4 changes: 2 additions & 2 deletions core/franklincircuit/src/tests/transfer_to_new.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@ use ff::{Field, PrimeField};
use franklin_crypto::circuit::float_point::convert_to_float;
use franklin_crypto::jubjub::JubjubEngine;
use franklinmodels::circuit::account::CircuitAccountTree;
use franklinmodels::merkle_tree::hasher::Hasher;
use franklinmodels::merkle_tree::PedersenHasher;
use franklinmodels::params as franklin_constants;
use merkle_tree::hasher::Hasher;
use merkle_tree::PedersenHasher;
use pairing::bn256::*;

pub struct TransferToNewData {
Expand Down
2 changes: 1 addition & 1 deletion core/franklincircuit/src/tests/utils.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ use ff::{BitIterator, PrimeField, PrimeFieldRepr};
use franklin_crypto::eddsa::PublicKey;
use franklin_crypto::jubjub::JubjubEngine;
use franklinmodels::circuit::account::{Balance, CircuitAccount, CircuitAccountTree};
use franklinmodels::merkle_tree::hasher::Hasher;
use franklinmodels::params as franklin_constants;
use merkle_tree::hasher::Hasher;
use pairing::bn256::*;

pub fn pub_key_hash<E: JubjubEngine, H: Hasher<E::Fr>>(
Expand Down
10 changes: 7 additions & 3 deletions core/franklinmodels/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,20 @@ edition = "2018"

[dependencies]
ff = { package = "ff_ce", version = "0.6.0", features = ["derive"] }
bigdecimal = { version = "0.1.0", features = ["serde"]}
bigdecimal = { version = "0.0.14", features = ["serde"]}
pairing = { package = "pairing_ce", version = "0.17.0" }
franklin_crypto = { package = "franklin-crypto", git = "ssh://[email protected]/matter-labs/franklin-crypto.git" }
merkle_tree = { path = "../merkle_tree" }
models = { path = "../models" }
bellman = { package = "bellman_ce", version = "0.3.0" }
web3 = "0.6.0"
serde = "1.0.90"
serde_derive = "1.0.90"
serde_bytes = "0.11.1"
lazy_static = "1.2.0"
rayon = "1.0.3"
rand = "0.4"
fnv = "1.0.3"
rust-crypto = "0.2"
hex = "0.3"
failure = "0.1"
log = "0.4"
futures = "0.1"
File renamed without changes.
6 changes: 3 additions & 3 deletions core/franklinmodels/src/circuit/account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@ use crate::params;
use ff::Field;
use franklin_crypto::alt_babyjubjub::JubjubEngine;

use merkle_tree::hasher::Hasher;
use merkle_tree::{PedersenHasher, SparseMerkleTree};
use models::primitives::{GetBits, GetBitsFixed};
use crate::merkle_tree::hasher::Hasher;
use crate::merkle_tree::{PedersenHasher, SparseMerkleTree};
use crate::primitives::{GetBits, GetBitsFixed};
use pairing::bn256::{Bn256, Fr};
pub type CircuitAccountTree = SparseMerkleTree<CircuitAccount<Bn256>, Fr, PedersenHasher<Bn256>>;
pub type CircuitBalanceTree = SparseMerkleTree<Balance<Bn256>, Fr, PedersenHasher<Bn256>>;
Expand Down
2 changes: 2 additions & 0 deletions core/franklinmodels/src/circuit/mod.rs
Original file line number Diff line number Diff line change
@@ -1 +1,3 @@
pub use account::CircuitAccountTree;

pub mod account;
Loading

0 comments on commit c5c6660

Please sign in to comment.