Skip to content

Commit

Permalink
Merge branch 'main' into pq
Browse files Browse the repository at this point in the history
Signed-off-by: Marlon Baeten <[email protected]>
  • Loading branch information
marlonbaeten committed Jul 22, 2024
2 parents c8319dc + fc5db84 commit a2a5aea
Show file tree
Hide file tree
Showing 26 changed files with 1,497 additions and 292 deletions.
31 changes: 29 additions & 2 deletions .github/workflows/check.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ jobs:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- run: rustup component add clippy

- name: Set up Python 3.10
uses: actions/setup-python@v2
Expand All @@ -90,6 +89,34 @@ jobs:
maturin develop
python3 test.py
check-node:
runs-on: ubuntu-22.04
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2

- name: Set up Node.js
uses: actions/setup-node@v2
with:
node-version: '20'

- name: Install wasm-pack
run: |
curl https://rustwasm.github.io/wasm-pack/installer/init.sh -sSf | sh
wasm-pack --version
- name: Build Wasm extension
run: wasm-pack build --target nodejs tsp-javascript/

- name: Install npm dependencies
working-directory: tsp-node/
run: npm install

- name: Run tests with Mocha
working-directory: tsp-node/
run: npm test

fuzz:
name: run cargo-fuzz
runs-on: ubuntu-latest
Expand All @@ -104,7 +131,7 @@ jobs:
with:
toolchain: nightly
- uses: Swatinem/rust-cache@v2

- name: Install cargo fuzz
uses: taiki-e/install-action@8984d603c208823d3c1a1b796f4081736f3ae3f9
with:
Expand Down
58 changes: 44 additions & 14 deletions Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,55 +1,85 @@
[workspace]
resolver = "2"
members = [ "tsp", "examples", "fuzz" , "tsp-python", "tsp-javascript"]
members = ["tsp", "examples", "fuzz", "tsp-python", "tsp-javascript"]

[workspace.package]
version = "0.1.0"
edition = "2021"
license = "Apache-2.0 OR MIT"
repository = "https://github.com/wenjing/rust-tsp"
homepage = "https://github.com/wenjing/rust-tsp"
repository = "https://github.com/openwallet-foundation-labs/tsp"
homepage = "https://github.com/openwallet-foundation-labs/tsp"
readme = "./README.md"
description = "Rust implementation of the Trust Spanning Protocol"
publish = false
rust-version = "1.77"

[workspace.dependencies]
# generic
base64ct = { version = "1.6", default-features = false, features = ["alloc", "std"] }
base64ct = { version = "1.6", default-features = false, features = [
"alloc",
"std",
] }
thiserror = "1.0"
url = { version = "2.5", features = ["serde"] }
zeroize = "1.8"
once_cell = "1.19"
#crypto
ed25519-dalek = { version = "2.1.1", default-features = false, features = ["fast", "std", "zeroize", "rand_core"] }
hpke = { git = "https://github.com/marlonbaeten/rust-hpke", branch = "keys-by-reference", features = ["alloc", "std"] }
ed25519-dalek = { version = "2.1.1", default-features = false, features = [
"fast",
"std",
"zeroize",
"rand_core",
] }
hpke = { version = "0.12", features = ["std"] }
hpke_pq = { version = "0.11.1", features = ["alloc", "std", "xyber768d00"] }
rand = "0.8.5"
sha2 = "0.10.8"
crypto_box = { version = "0.9.1", features = ["std", "chacha20"] }
# async
async-stream = { version = "0.3"}
async-stream = { version = "0.3" }
futures = { version = "0.3" }
tokio = { version = "1.0", default-features = false, features = ["rt-multi-thread", "net", "macros"] }
aries-askar = { git = "https://github.com/marlonbaeten/aries-askar", branch = "ciborium", default-features = false, features = ["sqlite"] }
tokio = { version = "1.0", default-features = false, features = [
"rt-multi-thread",
"net",
"macros",
] }
aries-askar = { git = "https://github.com/marlonbaeten/aries-askar", branch = "ciborium", default-features = false, features = [
"sqlite",
] }
# logging
tracing = "0.1"
tracing-subscriber = { version = "0.3.1", default-features = false, features = ["fmt", "ansi", "env-filter", "tracing-log"] }
tracing-subscriber = { version = "0.3.1", default-features = false, features = [
"fmt",
"ansi",
"env-filter",
"tracing-log",
] }
# transport
tokio-tungstenite = { version = "0.21", default-features = false, features = ["rustls-tls-native-roots", "stream", "connect"] }
tokio-util = { version = "0.7", default-features = false, features = ["codec"] }
tokio-tungstenite = { version = "0.21", default-features = false, features = [
"rustls-tls-native-roots",
"stream",
"connect",
] }
tokio-util = { version = "0.7", default-features = false, features = ["codec"] }
rustls = "0.23"
tokio-rustls = "0.26"
rustls-pki-types = "1.7"
rustls-native-certs = "0.7"
rustls-pemfile = "2.1"
quinn = "0.11"
# resolve
reqwest = { version = "0.12.3", default-features = false, features = ["rustls-tls-native-roots", "json", "stream", "charset", "http2", "macos-system-configuration"] }
reqwest = { version = "0.12.3", default-features = false, features = [
"rustls-tls-native-roots",
"json",
"stream",
"charset",
"http2",
"macos-system-configuration",
] }
# serialize
serde = { version = "1.0", features = ["derive"] }
serde_json = { version = "1.0" }
serde_with = {version = "3.8.1", features = ["base64"] }
serde_with = { version = "3.8.1", features = ["base64"] }
bs58 = "0.5"
# fuzzing
arbitrary = { version = "1.0", features = ["derive"] }
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ You will need to install the most recent Rust compiler, by following the
Then, you can use these commands to check out and test the repository:

```sh
git clone https://github.com/wenjing/rust-tsp.git
git clone https://github.com/openwallet-foundation-labs/tsp.git
cd rust-tsp
cargo test
```
Expand Down
2 changes: 1 addition & 1 deletion docs/benchmark.md
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ cargo build --release
samply record -- target/release/benchmark # or whatever your binary is called
```

![tsp-seal-open](https://github.com/wenjing/rust-tsp/assets/7949978/bbd18ac4-af29-44dd-8b11-71fc9527a5a9)
![tsp-seal-open](https://raw.githubusercontent.com/openwallet-foundation-labs/tsp/main/docs/flamegraph.png)

The flamegraph shows the call stack on the y axis, and relative time spent in a particular function on the x axis. We can see that the call stack starts at `start`, and eventually gets to our `benchmark::main` function.

Expand Down
Binary file added docs/flamegraph.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
2 changes: 1 addition & 1 deletion docs/src/cli/installation.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ cargo 1.77.1 (e52e36006 2024-03-26) for example
Installing the TSP CLI program:

```sh
cargo install --git https://github.com/wenjing/rust-tsp.git examples --bin tsp
cargo install --git https://github.com/openwallet-foundation-labs/tsp.git examples --bin tsp
```

You should be able to run `tsp`:
Expand Down
4 changes: 2 additions & 2 deletions docs/src/cli/routed.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,8 @@ Overview:
## Download key material for `a` and `b`:

```sh
curl -s https://raw.githubusercontent.com/wenjing/rust-tsp/main/examples/test/a.json > identity-a.json
curl -s https://raw.githubusercontent.com/wenjing/rust-tsp/main/examples/test/b.json > identity-b.json
curl -s https://raw.githubusercontent.com/openwallet-foundation-labs/tsp/main/examples/test/a.json > identity-a.json
curl -s https://raw.githubusercontent.com/openwallet-foundation-labs/tsp/main/examples/test/b.json > identity-b.json
```

## Configuration
Expand Down
8 changes: 8 additions & 0 deletions examples/src/cli.rs
Original file line number Diff line number Diff line change
Expand Up @@ -415,6 +415,14 @@ async fn run() -> Result<(), Error> {
} => {
info!("messaging forwarding request from {sender} to {next_hop}",);
}
ReceivedTspMessage::Referral {
sender,
referred_vid,
} => {
info!(
"received relationship referral for '{referred_vid}' from {sender}"
);
}
ReceivedTspMessage::PendingMessage {
unknown_vid,
payload,
Expand Down
Loading

0 comments on commit a2a5aea

Please sign in to comment.