Skip to content

Commit

Permalink
feat!: gotham-city goes gotham-engine (#86)
Browse files Browse the repository at this point in the history
  • Loading branch information
leontiadZen committed Nov 23, 2023
1 parent 0f057f4 commit 0767b2b
Show file tree
Hide file tree
Showing 29 changed files with 532 additions and 2,042 deletions.
5 changes: 2 additions & 3 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,5 @@ jsonwebtoken = "8"
hex = "0.4"
secp256k1 = {version = "0.21.0", features = ["global-context"]}
rand = "0.8"

two-party-ecdsa = { git = "https://github.com/ZenGo-X/two-party-ecdsa.git" }
kms = { git = "https://github.com/ZenGo-X/kms-secp256k1.git", branch = "2.0" }
two-party-ecdsa = { git = "https://github.com/ZenGo-X/two-party-ecdsa.git", branch="compatibility_gotham_engine" }
gotham-engine = { git = "https://github.com/ZenGo-X/gotham-engine.git" }
1 change: 0 additions & 1 deletion demo-wallet/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,6 @@ uuid = { version = "0.7", features = ["v4"] }
bitcoin = "0.27.1"
itertools = "0.11.0"
electrumx_client = { git = "https://github.com/ZenGo-X/rust-electrumx-client.git", tag = "bitcoin@0.26.0"}
kms.workspace = true
two-party-ecdsa.workspace = true
log.workspace = true
hex.workspace = true
Expand Down
4 changes: 2 additions & 2 deletions demo-wallet/src/bitcoin/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ use bitcoin::util::bip143::SigHashCache;
use bitcoin::{Address, SigHashType, TxIn, TxOut};
use electrumx_client::interface::Electrumx;
use hex;
use kms::ecdsa::two_party::MasterKey2;
use kms::ecdsa::two_party::*;
use serde::{Deserialize, Serialize};
use serde_json;
use std::fs;
use two_party_ecdsa::centipede::juggling::proof_system::{Helgamalsegmented, Proof};
use two_party_ecdsa::curv::elliptic::curves::secp256_k1::{GE, PK};
use two_party_ecdsa::curv::elliptic::curves::traits::ECPoint;
use two_party_ecdsa::curv::BigInt;
use two_party_ecdsa::kms::ecdsa::two_party::MasterKey2;
use two_party_ecdsa::kms::ecdsa::two_party::*;
use uuid::Uuid;

use client_lib::ecdsa;
Expand Down
4 changes: 1 addition & 3 deletions gotham-client/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,7 @@
name = "gotham-client"
version = "0.1.0"
authors = [
"gbenattar <g.benattar@gmail.com>",
"Oded Leiba <odedleiba5@gmail.com"
"z@zengo.com"
]
edition = "2021"

Expand All @@ -26,7 +25,6 @@ reqwest.workspace = true
failure.workspace = true
floating-duration.workspace = true
two-party-ecdsa.workspace = true
kms.workspace = true

[dev-dependencies]
mockall = "0.11"
4 changes: 2 additions & 2 deletions gotham-client/src/ecdsa/keygen.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,8 @@ use floating_duration::TimeFormat;

use two_party_ecdsa::curv::cryptographic_primitives::twoparty::dh_key_exchange_variant_with_pok_comm::*;
use two_party_ecdsa::party_one;
use kms::chain_code::two_party as chain_code;
use kms::ecdsa::two_party::{MasterKey2, party1};
use two_party_ecdsa::kms::chain_code::two_party as chain_code;
use two_party_ecdsa::kms::ecdsa::two_party::{MasterKey2, party1};
// iOS bindings
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
Expand Down
2 changes: 1 addition & 1 deletion gotham-client/src/ecdsa/recover.rs
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,14 @@
// version 3 of the License, or (at your option) any later version.
//

use kms::ecdsa::two_party::{MasterKey1, MasterKey2};
use serde_json::Error;
use two_party_ecdsa::centipede::juggling::proof_system::Helgamalsegmented;
use two_party_ecdsa::centipede::juggling::segmentation::Msegmentation;
use two_party_ecdsa::curv::arithmetic::traits::{Converter, Modulo};
use two_party_ecdsa::curv::elliptic::curves::secp256_k1::{FE, GE};
use two_party_ecdsa::curv::elliptic::curves::traits::{ECPoint, ECScalar};
use two_party_ecdsa::curv::BigInt;
use two_party_ecdsa::kms::ecdsa::two_party::{MasterKey1, MasterKey2};
// iOS bindings
use std::ffi::{CStr, CString};
use std::os::raw::c_char;
Expand Down
2 changes: 1 addition & 1 deletion gotham-client/src/ecdsa/sign.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use failure::format_err;
use kms::ecdsa::two_party::{party2, MasterKey2};
use serde::{Deserialize, Serialize};
use two_party_ecdsa::kms::ecdsa::two_party::{party2, MasterKey2};
use two_party_ecdsa::{curv::BigInt, party_one, party_two};
// iOS bindings
use std::ffi::{CStr, CString};
Expand Down
2 changes: 1 addition & 1 deletion gotham-client/src/ecdsa/types.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
use kms::ecdsa::two_party::MasterKey2;
use serde::{Deserialize, Serialize};
use two_party_ecdsa::curv::BigInt;
use two_party_ecdsa::kms::ecdsa::two_party::MasterKey2;

#[derive(Serialize, Deserialize)]
pub struct PrivateShare {
Expand Down
24 changes: 13 additions & 11 deletions gotham-server/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "gotham-server"
version = "1.0.0"
version = "2.0.0"
authors = [
"x@zengo.com"
]
Expand All @@ -25,20 +25,22 @@ failure.workspace = true
jsonwebtoken.workspace = true
hex.workspace = true
two-party-ecdsa.workspace = true
kms.workspace = true
rocksdb = { version = "0.20.1", optional = true }
rusoto_dynamodb = {version = "0.47", optional = true}
rusoto_core = {version = "0.47", optional = true}
gotham-engine.workspace = true

rocksdb = { version = "0.21.0" , optional = true}
chrono = "0.4.26"
cargo-pants = "0.4.16"
redis = { version = "0.23.0", features = ["cluster"] }
thiserror = "1.0"
erased-serde = "0.3"
async-trait = "0.1.73"
tokio = { version = "1", features = ["full"] }

[features]
default = ["local", "aws"]
default = ["local"]
local = ["rocksdb"]
aws = ["rusoto_dynamodb", "rusoto_core"]

[dependencies.serde_dynamodb]
git = "https://github.com/KZen-networks/serde_dynamodb"
features = ["native-tls"]
default-features = false


[dev-dependencies]
time-test = "0.2.1"
Expand Down
4 changes: 0 additions & 4 deletions gotham-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,11 +13,7 @@ cargo run --release
```

* By default, the server will use a local [RocksDB](https://rocksdb.org/).<br>
Optionally, it can use a remote [AWS DynamoDB](https://aws.amazon.com/dynamodb/),
by setting the environment variable `DB` to the value `AWS`, and the AWS credentials `AWS_ACCESS_KEY_ID` and `AWS_SECRET_ACCESS_KEY`.

* By default, the server will use no authentication (PASSTHROUGH).<br>
Optionally, it can use JWT with AWS Cognito as a service provider by setting proper environment variable (audience, region, pool_id, issuer).

### Running tests
#### Without timing output
Expand Down
142 changes: 0 additions & 142 deletions gotham-server/src/auth/cognito.rs

This file was deleted.

0 comments on commit 0767b2b

Please sign in to comment.