Skip to content

Commit

Permalink
new clean structure
Browse files Browse the repository at this point in the history
  • Loading branch information
gluk64 committed Apr 3, 2019
1 parent 34ea19a commit 4b187d5
Show file tree
Hide file tree
Showing 10,859 changed files with 19,311 additions and 49,414 deletions.
The diff you're trying to view is too large. We only load the first 3000 changed files.
7 changes: 5 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
.idea/
.vscode
target
.DS_Store
plasma/contracts/yarn-error.log
/contracts/yarn-error.log
/target
/env
/deploy.log
/*.bak
247 changes: 139 additions & 108 deletions Cargo.lock

Large diffs are not rendered by default.

26 changes: 20 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,20 @@
[workspace]
members = [
"plasma",
"plasma/server",
"plasma/prover"
]
[package]

name = "franlklin"
version = "0.1.0"
edition = "2018"

authors = [
"Alex Gluchowski <[email protected]>",
"Alex Vlasov <[email protected]>"
]

[dependencies]
eth_client = { path = "src/eth_client" }
plasma = { path = "src/plasma" }
models = { path = "src/models" }
storage = { path = "src/storage" }
prover = { path = "src/prover" }
server = { path = "src/server" }

signal-hook = "0.1.8"
1 change: 1 addition & 0 deletions LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
tbd
152 changes: 152 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,152 @@
# FRANKLIN Rollup: sidechain governed by SNARKs

Spec: https://hackmd.io/cY-VP7SDTUGgPOzDiEU3TQ

## Prerequisite

Install the latest rust version (>= 1.32):

```
rustc --version
rustc 1.32.0-nightly (21f268495 2018-12-02)
```

## Config

All environment variables must be located in a single file `/env`.

- Copy `/env.example` to `/env` and set all of them correctly

## Database

### Testing

- Install postgres locally
- Install diesel-cli:

```cargo install diesel_cli --no-default-features --features postgres```

- From `server` dir run

```diesel database setup```

This will create database 'plasma' (db url is set in [server/.env] file) with our schema.

- Rename `server/storage/schema.rs.generated` to `schema.rs`

- To reset migrations (will reset the db), run:

```diesel migration redo```

- Run tests:

```db-tests```

### Production

For production, `DATABSE_URL` env var must be set properly.

## Generating keys

To generate a proving key, from `server` dir run:

```
cargo run --release --bin read_write_keys
```

It will generate a `*VerificationKey.sol` and `*_pk.key` files for 'deposit', 'exit' and 'transfer' circuits in the root folder.

Move files to proper locations:

```shell
mv -f n*VerificationKey.sol ./contracts/contracts/
mv -f *_pk.key ./prover/keys/
```

If the pregenerated leaf format changes, replace the `EMPTY_TREE_ROOT` constant in `contracts/contracts/PlasmaStorage.sol`.

## Web3 provider

In the `server/.env` set up `CHAIN_ID` and `WEB3_URL` accordingly.

## Contratcs

### Install truffle and dependencies:

```
cd contracts
yarn
```

NOTE: Python >= 3.5 and pip is required for solidity flattener. You might want to run `brew upgrade python`

### Re-build contracts:

```
yarn build
```

IMPORTANT! Generated `.abi` and `.bin` files are fed to cargo to build module `plasma::eth`.

So you need to rebuild the code on every change (to be automated soon).

### Deploy contracts

After the keys have been generated and copied to contracts:

- run `redeploy`

Update addresses (make sure to exclude 0x !):

- copy contracts address of `PlasmaContract` to `CONTRACT_ADDR` in `/env`

### Publish source

```
yarn flatten
```

## Server

### Running locally

```shell
run
```

### Running in production

To launch and restart:

```shell
launch
```

To stop (Note, that Ctrl+C won't work! You need to run stop from a new terminal):

```shell
stop
```

## Client UI

### Run locally

``` bash
# install dependencies
yarn

# serve with hot reload at localhost:8080; API server will be queried at localhost:3000
yarn run dev

# build for production with minification
yarn run build
```

### Deploy client publicly

Single command to build and deploy to github pages:

```
update-client
```
3 changes: 0 additions & 3 deletions bellman/.gitignore

This file was deleted.

14 changes: 0 additions & 14 deletions bellman/COPYRIGHT

This file was deleted.

27 changes: 0 additions & 27 deletions bellman/Cargo.toml

This file was deleted.

Loading

0 comments on commit 4b187d5

Please sign in to comment.