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

Manta-RS Integration #57

Merged
merged 63 commits into from
May 19, 2022
Merged
Show file tree
Hide file tree
Changes from 39 commits
Commits
Show all changes
63 commits
Select commit Hold shift + click to select a range
3e07ec5
wip: start building new signer
bhgomes Feb 14, 2022
4107978
wip: move to new signer model
bhgomes Feb 15, 2022
de9c32f
wip: add saving to signer
bhgomes Feb 15, 2022
b072f2f
wip: add more documentation
bhgomes Feb 16, 2022
6196573
feat: finish setting up signer library integration
bhgomes Feb 18, 2022
dea9d14
wip: start setting up UI for new signer
bhgomes Feb 18, 2022
b819abe
wip: move mnemonic generation to server
bhgomes Feb 20, 2022
e0772de
wip: add signer account creation and login protocols
bhgomes Feb 21, 2022
f738832
wip: remove old model from tauri glue code
bhgomes Feb 25, 2022
43a1935
wip: upgrade to new interface
bhgomes Feb 26, 2022
755dcbc
wip: update dependencies and version numbers
bhgomes Feb 26, 2022
7e5e698
wip: update dependencies
bhgomes Feb 26, 2022
3bf7a71
wip: fix issues with signer state-UI integration
bhgomes Feb 27, 2022
371c67d
fix: remove old signer code
bhgomes Feb 27, 2022
f5dab8e
chore: remove unused font files
bhgomes Feb 27, 2022
5a8cf48
fix: change state machine text from load seed to load state
bhgomes Feb 27, 2022
d270e6f
feat: improve logging framework
bhgomes Feb 27, 2022
81e91c7
chore: update dependencies
bhgomes Feb 28, 2022
3c88668
feat: add transaction summary
bhgomes Feb 28, 2022
854b1bd
chore: update dependencies
bhgomes Feb 28, 2022
f2f14bd
feat: update to new utxo accumulator model naming
bhgomes Mar 1, 2022
8ff2e62
chore: merge branch 'master' into 'manta-rs-integration'
bhgomes Mar 1, 2022
632a37c
feat: add test server and update e2e test
bhgomes Mar 1, 2022
87c5a89
chore: update dependencies
bhgomes Mar 2, 2022
7cd2999
fix: use correct endpoint API for the version request
bhgomes Mar 22, 2022
3d8c581
fix: add missing bs58 feature and update dependencies
bhgomes Mar 23, 2022
c530728
fix: convert server back to Tide
bhgomes Mar 23, 2022
9d8aba3
wip: move body to query
bhgomes Mar 24, 2022
5450101
fix: convert back to body for requests, move to POST-only interface
bhgomes Mar 24, 2022
e568951
chore: update dependencies
bhgomes Mar 30, 2022
dc086f8
Add apple keys
kdense521 Apr 11, 2022
488dffa
Merge branch 'master' into manta-rs-integration
Apr 11, 2022
7090187
Add cli tool
kdense521 Apr 11, 2022
37b3d0d
Set verbosity flag
kdense521 Apr 11, 2022
dac43a4
Set verbosity flag
kdense521 Apr 11, 2022
c615730
fix: use correct calling convention for test_signer
bhgomes Apr 12, 2022
5024027
fix: use new SDK objects
bhgomes Apr 13, 2022
df874bc
chore: bump dependencies
bhgomes Apr 13, 2022
6a6f398
chore: update dependencies and formatting
bhgomes Apr 15, 2022
b98f6b2
Windows filename changed
tjsharp1 Apr 22, 2022
e9586bc
remove save
Kevingislason Apr 26, 2022
a8f9708
fix: switch to tokio for test signer
bhgomes Apr 27, 2022
fa6c345
rm useBootstrapper
Apr 28, 2022
418d08b
fix: revert back to async-std executor
bhgomes May 2, 2022
7a460ca
comma
Apr 28, 2022
80c4411
Center the text
May 3, 2022
412da15
update tauri dependencies
Kevingislason May 5, 2022
cebb9bd
wip: use current manta-rs branch
bhgomes May 11, 2022
1943990
chore(deps): bump tauri to rc.10, tauri-build to rc.8
bhgomes May 11, 2022
336c7f6
feat: add tracing crate for logging and add log file support
bhgomes May 12, 2022
9359934
fix: add saving back in
bhgomes May 12, 2022
7b1f7b6
fix: move back to simple logging implementation
bhgomes May 13, 2022
2a124cf
chore(deps): upgrade manta-rs to new sync infra
bhgomes May 13, 2022
23d4770
chore(deps): update manta-rs and manta-sdk
bhgomes May 13, 2022
6e7cea1
fix: allow other release builds to finish
bhgomes May 13, 2022
a87c170
Fix linux build
kdense521 May 16, 2022
ee1ac37
Fix cargo dep
kdense521 May 16, 2022
fca4f31
chore: fix logging documentation/formatting
bhgomes May 16, 2022
5e9eb07
chore(deps): bump tauri to rc.11 and tauri-build to rc.9
bhgomes May 19, 2022
3269bff
Update README.md
bhgomes May 19, 2022
dce6a2f
Autotag
kdense521 May 19, 2022
102ea58
Without V
kdense521 May 19, 2022
5250aa1
fix(ci): move to main branch from master
bhgomes May 19, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
The table of contents is too big for display.
Diff view
Diff view
  •  
  •  
  •  
4 changes: 2 additions & 2 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ write a little note why.
- [ ] Re-reviewed `Files changed` in the Github PR explorer.
- [ ] Update the version numbers properly:
* Cargo.toml
* ui/package.json
* ui/public/about.html
* ui/src-tauri/Cargo.toml
* ui/src-tauri/tauri.conf.json
* ui/public/about.html
* ui/package.json
32 changes: 0 additions & 32 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@ on:
- master
paths-ignore:
- '**.md'

jobs:
build_code:
name: End to end test
Expand All @@ -21,7 +20,6 @@ jobs:
node-version: [16.x]
env:
MANTA_SDK_BRANCH: "main"

steps:
- name: Cancel previous runs
uses: styfle/cancel-workflow-action@0.9.1
Expand All @@ -39,41 +37,11 @@ jobs:
cd js
yarn install --immutable | grep -v 'YN0013'
yarn build

- name: Enable test scripts
run: |
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/e2e/get_latest_sdk_version.sh"
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/e2e/move_proving_keys.sh"
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/e2e/get_node.sh"
chmod +x "${GITHUB_WORKSPACE}/.github/workflows/e2e/run_test.sh"

- name: Get latest Manta sdk version
run: |
LATEST_SDK_VERSION=`"${GITHUB_WORKSPACE}/.github/workflows/e2e/get_latest_sdk_version.sh" ${{ env.MANTA_SDK_BRANCH }}`
echo $LATEST_SDK_VERSION
echo "LATEST_SDK_VERSION=$LATEST_SDK_VERSION" >> $GITHUB_ENV
- name: Load proving keys from cache
id: load-cache-proving-keys
uses: actions/cache@v2
env:
cache-name: proving-keys
with:
path: ~/.local/share/manta-signer
key: ${{ env.cache-name }}-${{ env.LATEST_SDK_VERSION }}
- name: Get proving keys
if: steps.load-cache-proving-keys.outputs.cache-hit != 'true'
uses: actions/checkout@v2
with:
repository: Manta-Network/sdk
path: sdk
fetch-depth: 1
lfs: true
- name: Move proving keys
if: steps.load-cache-proving-keys.outputs.cache-hit != 'true'
run: "${GITHUB_WORKSPACE}/.github/workflows/e2e/move_proving_keys.sh"

- name: Get Dolphin node
run: "${GITHUB_WORKSPACE}/.github/workflows/e2e/get_node.sh"

- name: Run test
run: "${GITHUB_WORKSPACE}/.github/workflows/e2e/run_test.sh"
4 changes: 0 additions & 4 deletions .github/workflows/e2e/get_latest_sdk_version.sh

This file was deleted.

7 changes: 0 additions & 7 deletions .github/workflows/e2e/move_proving_keys.sh

This file was deleted.

19 changes: 13 additions & 6 deletions .github/workflows/e2e/run_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,21 @@ cat out.json

# Run 3 headless copies of signer
cd ../../..
cargo run --example test_server --release --features=unsafe-disable-cors -- http://127.0.0.1:29988 &
cargo run --example test_server --release --features=unsafe-disable-cors -- http://127.0.0.1:29989 &
cargo run --example test_server --release --features=unsafe-disable-cors -- http://127.0.0.1:29990 &
./target/release/examples/test_server 127.0.0.1:29988 &
./target/release/examples/test_server 127.0.0.1:29989 &
./target/release/examples/test_server 127.0.0.1:29990 &

# Run node
~/Manta/manta --chain dev --ws-port 9944 --port 30333 --alice \
--tmp --rpc-cors all --unsafe-ws-external --unsafe-rpc-external \
--rpc-methods=Unsafe &
~/Manta/manta \
--chain dev \
--ws-port 9944 \
--port 30333 \
--alice \
--tmp \
--rpc-cors all \
--unsafe-ws-external \
--unsafe-rpc-external \
--rpc-methods=Unsafe &

# Run test
cd js
Expand Down
16 changes: 6 additions & 10 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,15 +78,6 @@ jobs:
${{ matrix.os }}-build-${{ env.cache-name }}-
${{ matrix.os }}-build-
${{ matrix.os }}-
- name: Fetch Proving Keys
uses: actions/checkout@v2
with:
repository: Manta-Network/sdk
path: sdk
fetch-depth: 1
lfs: false
- name: Move Proving Keys
run: mv ./sdk/legacy/proving/* ui/src-tauri/
- name: Hack For Ubuntu Builds
run: cd ui/src-tauri; sed -i /icns/d tauri.conf.json
if: matrix.os_type == 'ubuntu'
Expand All @@ -106,10 +97,15 @@ jobs:
- name: Append version suffix
run: node ./scripts/suffix.js ${{ steps.suffixed.outputs.SUFFIXED }}
- name: Build & Sign
run: cd ui;yarn && yarn tauri build
run: cd ui;yarn && yarn add @tauri-apps/cli && yarn tauri build -v
env:
TAURI_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }}
TAURI_KEY_PASSWORD: ${{ secrets.TAURI_KEY_PASSWORD }}
APPLE_CERTIFICATE: ${{ secrets.APPLE_CERTIFICATE }}
APPLE_CERTIFICATE_PASSWORD: ${{ secrets.APPLE_CERTIFICATE_PASSWORD }}
APPLE_SIGNING_IDENTITY: ${{ secrets.APPLE_SIGNING_IDENTITY }}
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_PASSWORD: ${{ secrets.APPLE_PASSWORD }}
- name: Get release
id: get_release
uses: bruceadams/get-release@v1.2.3
Expand Down
2 changes: 1 addition & 1 deletion .rustfmt.toml
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
imports_granularity="Crate"
imports_granularity = "Crate"
license_template_path = "FILE_TEMPLATE"

46 changes: 22 additions & 24 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[package]
name = "manta-signer"
edition = "2018"
version = "0.5.2"
edition = "2021"
version = "0.6.0"
authors = ["Manta Network <contact@manta.network>"]
readme = "README.md"
license-file = "LICENSE"
Expand All @@ -25,34 +25,32 @@ is-it-maintained-open-issues = { repository = "Manta-Network/manta-signer" }
maintenance = { status = "actively-developed" }

[features]
# Disable CORS Check
# Enable Logging
log = []

# Disable CORS Check: This is UNSAFE in general and should only be used in debug builds.
unsafe-disable-cors = []

[dependencies]
ark-serialize = { version = "0.3.0", default-features = false }
async-std = { version = "1.10.0" }
bip0039 = { version = "0.10.0" }
bip32 = { version = "0.2.2" }
bs58 = { version = "0.4.0" }
cocoon = { version = "0.3.0" }
codec = { package = "parity-scale-codec", version = "2.0.0", default-features = false, features = [ "derive", "full" ] }
argon2 = { version = "0.3.4", default-features = false, features = ["alloc", "password-hash"] }
chrono = { version = "0.4.19", default-features = false, features = ["clock"] }
derivative = { version = "2.2.0", default-features = false, features = ["use_core"] }
dirs-next = { version = "2.0.0" }
futures = { version = "0.3.17", default-features = false }
dirs-next = { version = "2.0.0", default-features = false }
futures = { version = "0.3.17", default-features = false, features = ["alloc"] }
http-types = { version = "2.12.0", default-features = false }
manta-api = { git = "https://github.com/Manta-Network/manta-api", branch = "manta", default-features = false, features = ["signer", "testnet"] }
manta-asset = { git = "https://github.com/Manta-Network/manta-types", branch = "manta" }
manta-crypto = { git = "https://github.com/Manta-Network/manta-crypto", branch = "manta" }
manta-data = { git = "https://github.com/Manta-Network/manta-types", branch = "manta" }
rand = { version = "0.8.4", default-features = false }
rand_chacha = { version = "0.3.1", default-features = false }
manta-accounting = { git = "https://github.com/manta-network/manta-rs", features = ["cocoon-fs"] }
manta-crypto = { git = "https://github.com/manta-network/manta-rs", features = ["getrandom"] }
manta-pay = { git = "https://github.com/manta-network/manta-rs", features = ["bs58", "groth16", "serde", "wallet"] }
manta-sdk = { git = "https://github.com/manta-network/sdk", features = ["download"] }
manta-util = { git = "https://github.com/manta-network/manta-rs" }
parking_lot = { version = "0.12.0", default-features = false }
password-hash = { version = "0.3.2", default-features = false, features = ["alloc"] }
secrecy = { version = "0.8.0", default-features = false, features = ["alloc"] }
serde = { version = "1.0.131", default-features = false, features = ["derive"] }
serde_json = { version = "1.0.68", default-features = false }
subtle = { version = "2.4.1" }
tide = { version = "0.16.0" }
subtle = { version = "2.4.1", default-features = false }
tide = { version = "0.16.0", default-features = false, features = ["h1-server"] }
tokio = { version = "1.17.0", default-features = false, features = ["fs", "io-std", "io-util", "rt", "sync", "time"] }

[dev-dependencies]
async-std = { version = "1.10.0", features = ["attributes"] }
tempfile = { version = "3.2.0" }

async-std = { version = "1.11.0", default-features = false, features = ["attributes", "tokio1"] }
tempfile = { version = "3.3.0", default-features = false }
13 changes: 5 additions & 8 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,18 +1,15 @@
manta-signer
============
# manta-signer

`manta-signer` is manta's native client that **turbo charges** zero-knowledge-proof generation.

<img width="655" alt="Screen Shot 2021-11-21 at 3 50 01 PM" src="https://user-images.githubusercontent.com/720571/142786609-ce7455e1-dbe7-4a6d-8a78-4aa22984a3d7.png">
<img width="655" src="https://user-images.githubusercontent.com/720571/142786609-ce7455e1-dbe7-4a6d-8a78-4aa22984a3d7.png">

Disclaimer: `manta-signer` is experimental software, use it at your own risk.

## Project Organization
```
-src: manta-signer zkp generation
-ui: manta-signer desktop UI
-js: external Javascript libraries that interact with manta-signer
```
- `src`: `manta-signer` zkp generation
- `ui`: `manta-signer` desktop UI
- `js`: external Javascript libraries that interact with `manta-signer`

<br/>
To remove your private account data completely and set up a new account, you should remove these files.
Expand Down
Binary file modified docs/manta-signer-state-machine.pdf
Binary file not shown.
3 changes: 1 addition & 2 deletions docs/manta-signer-state-machine.tex
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,13 @@
\vspace{2em}

\begin{center}
% https://tikzcd.yichuanshen.de/#N4Igdg9gJgpgziAXAbVABwnAlgFyxMJZABgBoBGAXVJADcBDAGwFcYkQAdDnGADxzgAzYAGUAogCUAapIC+IWaXSZc+QigDMpAEzU6TVuy49+wAIIBjCxGZgcAAjG8scAQH55i5djwEiWjT0G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kzVYLlUs+RgHAaQoGMOBDGNWNWMGS9R0BZtu7IZxaF+qLxEvuQ2ii31dXIqLuUvtNQ4rEgkylad-2o3V+UO0gtUvqjrNNQSLWwzj23c7SfM8Tgv1hKHtOi0zJHENVQsG-b2XddNF2E356tXd7rS+9jW17iUhmuMs-PdUVgNW8siUALR27IlCyEAA
\begin{tikzcd}
\textbf{START} \arrow[d] & & & & & \\
\textsf{SERVER} \arrow[ddd, "\textsf{recv}" description, dashed] \arrow[rrr, "\textsf{show}" description, tail] & & & \textsf{UI} \arrow[d] & & \\
& & & \text{Account Exists?} \arrow[d, "\textsf{YES}" description] \arrow[rrd, "\textsf{NO}" description] & & \\
& & & \textsf{Login} \arrow["\textsf{wait}" description, dashed, loop, distance=2em, in=215, out=145] \arrow[d] & & \textsf{Create Account} \arrow["\textsf{wait}" description, dashed, loop, distance=2em, in=55, out=125] \arrow[lld] \\
\square \arrow[d] & & & \textsf{Send Password} \arrow[lll, "\textsf{send}" description, Rightarrow] \arrow[d] & & \\
\textsf{Load Seed} \arrow[d] & & & \textsf{Hide} \arrow[ddd, "\textsf{listen}" description, dashed] & & \\
\textsf{Load State} \arrow[d] & & & \textsf{Hide} \arrow[ddd, "\textsf{listen}" description, dashed] & & \\
\textsf{Serve} \arrow[d] \arrow["\textsf{wait}" description, dashed, loop, distance=2em, in=35, out=325] & & & & & \\
\text{Authorize?} \arrow[rd, "\textsf{YES}" description] \arrow[dddd, "\textsf{NO}" description] & & & & & \\
& \textsf{Authorize} \arrow[rr, "\textsf{prompt}" description, tail] \arrow[dd, "\textsf{recv}" description, dashed] & & \square \arrow[d, "\textsf{show}" description] & & \\
Expand Down
62 changes: 14 additions & 48 deletions examples/test_server.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,81 +16,47 @@

//! Test Signer Server

use async_std::io;
use manta_crypto::rand::{CryptoRng, OsRng, RngCore, Sample};
use manta_signer::{
config::Config,
secret::{
create_account, sample_password, Authorizer, Password, PasswordFuture, SecretString,
UnitFuture,
},
service::{Prompt, Service},
secret::{Authorizer, Password, PasswordFuture, SecretString},
service::{self, Error},
};
use rand::thread_rng;

/// Mock User
pub struct MockUser {
/// Stored Password
/// User Password
password: SecretString,
}

impl MockUser {
/// Builds a new [`MockUser`] from `password`.
#[inline]
fn new(password: SecretString) -> Self {
Self { password }
pub fn new<R>(rng: &mut R) -> Self
where
R: CryptoRng + RngCore + ?Sized,
{
Self {
password: SecretString::new(u128::gen(rng).to_string()),
}
}
}

impl Authorizer for MockUser {
type Prompt = Prompt;

type Message = ();

type Error = ();

#[inline]
fn password(&mut self) -> PasswordFuture {
Box::pin(async move { Password::from_known(self.password.clone()) })
}

#[inline]
fn setup<'s>(&'s mut self, config: &'s Config) -> UnitFuture<'s> {
Box::pin(async move {
let _ = create_account(&config.root_seed_file, &self.password)
.await
.expect("Unable to create account for a mock user.");
})
}
}

/// Test Service
pub struct TestService(Service<MockUser>);

impl TestService {
/// Builds a new [`TestService`] with the given `config` and a random password.
#[inline]
pub fn build(config: Config) -> Self {
Self(Service::build(
config,
MockUser::new(sample_password(&mut thread_rng())),
))
}

/// Starts the test service.
#[inline]
pub async fn serve(self) -> io::Result<()> {
self.0.serve().await
}
}

#[async_std::main]
async fn main() -> io::Result<()> {
async fn main() -> Result<(), Error> {
let test_dir = tempfile::tempdir()?;
let mut config =
Config::try_default().expect("Unable to generate the default server configuration.");
config.root_seed_file = test_dir.path().join("root_seed.aes");
config.data_path = test_dir.path().join("storage.dat");
if let Some(url) = std::env::args().nth(1) {
config.service_url = url;
}
TestService::build(config).serve().await
service::start(config, MockUser::new(&mut OsRng)).await
}
37 changes: 0 additions & 37 deletions release.sh

This file was deleted.

Loading