fix: correct paths following repo reorg (#554)

* Fix paths following repo reorg.

* Apply fmt.

---------

Co-authored-by: yuroitaki <>
This commit is contained in:
yuroitaki
2024-08-02 19:45:08 +08:00
committed by GitHub
parent 7f46596068
commit c8524d934b
17 changed files with 45 additions and 46 deletions

View File

@@ -12,16 +12,16 @@ jobs:
- name: Build Docker Image
run: |
docker build -t tlsn-bench . -f ./tlsn/benches/benches.Dockerfile
docker build -t tlsn-bench . -f ./crates/benches/benches.Dockerfile
- name: Run Benchmarks
run: |
docker run --privileged -v ${{ github.workspace }}/tlsn/benches/:/benches tlsn-bench
docker run --privileged -v ${{ github.workspace }}/crates/benches/:/benches tlsn-bench
- name: Upload runtime_vs_latency.html
uses: actions/upload-artifact@v4
with:
name: benchmark_graphs
path: |
./tlsn/benches/runtime_vs_latency.html
./tlsn/benches/runtime_vs_bandwidth.html
./crates/benches/runtime_vs_latency.html
./crates/benches/runtime_vs_bandwidth.html

View File

@@ -44,13 +44,13 @@ jobs:
exit 1
fi
- name: Wait for test workflow to succeed
- name: Wait for integration test workflow to succeed
if: github.event_name == 'push'
uses: lewagon/wait-on-check-action@v1.3.1
with:
ref: ${{ github.ref }}
# Have to specify '(notary)', as we are using matrix for build_and_test job in ci.yml, else it will fail, more details [here](https://github.com/lewagon/wait-on-check-action#check-name)
check-name: 'Build and test'
# More details [here](https://github.com/lewagon/wait-on-check-action#check-name)
check-name: 'Run tests release build'
repo-token: ${{ secrets.GITHUB_TOKEN }}
# How frequent (in seconds) this job will call GitHub API to check the status of the job specified at 'check-name'
wait-interval: 60

View File

@@ -16,12 +16,12 @@ jobs:
contents: read
packages: write
steps:
- name: Wait for test workflow to succeed
- name: Wait for integration test workflow to succeed
uses: lewagon/wait-on-check-action@v1.3.1
with:
ref: ${{ github.ref }}
# Have to specify '(notary)', as we are using matrix for build_and_test job in ci.yml, else it will fail, more details [here](https://github.com/lewagon/wait-on-check-action#check-name)
check-name: 'Build and test (notary)'
# More details [here](https://github.com/lewagon/wait-on-check-action#check-name)
check-name: 'Run tests release build'
repo-token: ${{ secrets.GITHUB_TOKEN }}
# How frequent (in seconds) this job will call GitHub API to check the status of the job specified at 'check-name'
wait-interval: 60

View File

@@ -19,7 +19,7 @@ sudo apt-get install iproute2 -y
Running the benches requires root privileges because they will set up virtual interfaces. The script is designed to fully clean up when the benches are done, but run them at your own risk.
Make sure you're in the `tlsn/benches/` directory, build the binaries then run the script:
Make sure you're in the `crates/benches/` directory, build the binaries then run the script:
```sh
cargo build --release

View File

@@ -7,7 +7,7 @@ if [ "$EUID" -ne 0 ]; then
fi
# Run the benchmark binary
../target/release/bench
../../target/release/bench
# Plot the results
../target/release/plot metrics.csv
../../target/release/plot metrics.csv

View File

@@ -1,7 +1,7 @@
FROM rust AS builder
WORKDIR /usr/src/tlsn
COPY . .
RUN cd tlsn/benches && cargo build --release
RUN cd crates/benches && cargo build --release
FROM ubuntu:latest
@@ -11,7 +11,7 @@ RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-reco
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
COPY --from=builder ["/usr/src/tlsn/tlsn/target/release/bench", "/usr/src/tlsn/tlsn/target/release/prover", "/usr/src/tlsn/tlsn/target/release/verifier", "/usr/src/tlsn/tlsn/target/release/plot", "/usr/local/bin/"]
COPY --from=builder ["/usr/src/tlsn/target/release/bench", "/usr/src/tlsn/target/release/prover", "/usr/src/tlsn/target/release/verifier", "/usr/src/tlsn/target/release/plot", "/usr/local/bin/"]
ENV PROVER_PATH="/usr/local/bin/prover"
ENV VERIFIER_PATH="/usr/local/bin/verifier"

View File

@@ -0,0 +1,2 @@
# exclude any /target folders
**/target*

View File

@@ -4,9 +4,9 @@ use tlsn_benches::{clean_up, set_up};
fn main() {
let prover_path =
std::env::var("PROVER_PATH").unwrap_or_else(|_| "../target/release/prover".to_string());
let verifier_path =
std::env::var("VERIFIER_PATH").unwrap_or_else(|_| "../target/release/verifier".to_string());
std::env::var("PROVER_PATH").unwrap_or_else(|_| "../../target/release/prover".to_string());
let verifier_path = std::env::var("VERIFIER_PATH")
.unwrap_or_else(|_| "../../target/release/verifier".to_string());
if let Err(e) = set_up() {
println!("Error setting up: {}", e);

View File

@@ -2,11 +2,11 @@
In the root folder of this repository, run:
```
docker build -t tlsn-bench . -f ./tlsn/benches/benches.Dockerfile
docker build -t tlsn-bench . -f ./crates/benches/benches.Dockerfile
```
Next run the benches with:
```
docker run -it --privileged -v ./tlsn/benches/:/benches tlsn-bench
docker run -it --privileged -v ./crates/benches/:/benches tlsn-bench
```
The `--privileged` parameter is required because this test bench needs permission to create networks with certain parameters

View File

@@ -27,7 +27,7 @@ You can find the `CHANNEL_ID` directly in the url:
`https://discord.com/channels/@me/{CHANNEL_ID)`
## Start the notary server
1. Edit the notary server [config file](../../../notary/server/config/config.yaml) to turn off TLS so that self-signed certificates can be avoided (⚠️ this is only for local development purposes — TLS must be used in production).
1. Edit the notary server [config file](../../notary/server/config/config.yaml) to turn off TLS so that self-signed certificates can be avoided (⚠️ this is only for local development purposes — TLS must be used in production).
```yaml
tls:
enabled: false
@@ -35,13 +35,13 @@ You can find the `CHANNEL_ID` directly in the url:
```
2. Run the following at the root level of this repository to start the notary server:
```shell
cd notary/server
cd crates/notary/server
cargo run --release
```
The notary server will now be running in the background waiting for connections.
For more information on how to configure the `Notary` server, please refer to [this](../../../notary/server/README.md#running-the-server).
For more information on how to configure the `Notary` server, please refer to [this](../../notary/server/README.md#running-the-server).
## Notarize
@@ -96,4 +96,4 @@ cargo run --release --example discord_dm_verifier
This will verify the proof and print out the redacted transcript!
> **_NOTE:_** <https://explorer.tlsnotary.org/> hosts a generic proof visualizer. Drag and drop your proof into the drop zone to check and render your proof. [Notary public key](../../../notary/server/fixture/notary/notary.pub)
> **_NOTE:_** <https://explorer.tlsnotary.org/> hosts a generic proof visualizer. Drag and drop your proof into the drop zone to check and render your proof. [Notary public key](../../notary/server/fixture/notary/notary.pub)

View File

@@ -1,6 +1,6 @@
// This example shows how to notarize Discord DMs.
//
// The example uses the notary server implemented in ../../../notary/server
// The example uses the notary server implemented in ../../notary/server
use http_body_util::{BodyExt, Empty};
use hyper::{body::Bytes, Request, StatusCode};
@@ -16,12 +16,12 @@ use tracing::debug;
// Setting of the application server
const SERVER_DOMAIN: &str = "discord.com";
// Setting of the notary server — make sure these are the same with the config in ../../../notary/server
// Setting of the notary server — make sure these are the same with the config in ../../notary/server
const NOTARY_HOST: &str = "127.0.0.1";
const NOTARY_PORT: u16 = 7047;
// P/S: If the following limits are increased, please ensure max-transcript-size of
// the notary server's config (../../../notary/server) is increased too, where
// the notary server's config (../../notary/server) is increased too, where
// max-transcript-size = MAX_SENT_DATA + MAX_RECV_DATA
//
// Maximum number of bytes that can be sent from prover to server

View File

@@ -47,7 +47,7 @@ Bytes sent:
### 3. Redact Information
Open `simple/src/examples/simple_prover.rs` and locate the line with:
Open `simple_prover.rs` and locate the line with:
```rust
let redact = false;
@@ -74,7 +74,7 @@ cargo run --release --example simple_verifier
...
```
You can also use <https://explorer.tlsnotary.org/> to inspect your proofs. Simply drag and drop `simple_proof.json` from your file explorer into the drop zone. Redacted bytes are marked with X characters. [Notary public key](../../../notary/server/fixture/notary/notary.pub)
You can also use <https://explorer.tlsnotary.org/> to inspect your proofs. Simply drag and drop `simple_proof.json` from your file explorer into the drop zone. Redacted bytes are marked with X characters. [Notary public key](../../notary/server/fixture/notary/notary.pub)
### (Optional) Extra Experiments

View File

@@ -26,7 +26,7 @@ Next, open the **Developer Tools**, go to the **Network** tab, and refresh the p
![Screenshot](twitter_dm_browser.png)
## Start the notary server
1. Edit the notary server [config file](../../../notary/server/config/config.yaml) to turn off TLS so that self-signed certificates can be avoided (⚠️ this is only for local development purposes — TLS must be used in production).
1. Edit the notary server [config file](../../notary/server/config/config.yaml) to turn off TLS so that self-signed certificates can be avoided (⚠️ this is only for local development purposes — TLS must be used in production).
```yaml
tls:
enabled: false
@@ -34,13 +34,13 @@ Next, open the **Developer Tools**, go to the **Network** tab, and refresh the p
```
2. Run the following at the root level of this repository to start the notary server:
```shell
cd notary/server
cd crates/notary/server
cargo run --release
```
The notary server will now be running in the background waiting for connections.
For more information on how to configure the notary server, please refer to [this](../../../notary/server/README.md#running-the-server).
For more information on how to configure the notary server, please refer to [this](../../notary/server/README.md#running-the-server).
## Notarize
@@ -99,4 +99,4 @@ If the transcript was too long, you may encounter the following error:
thread 'tokio-runtime-worker' panicked at 'called `Result::unwrap()` on an `Err` value: IOError(Custom { kind: InvalidData, error: BackendError(DecryptionError("Other: KOSReceiverActor is not setup")) })', /Users/heeckhau/tlsnotary/tlsn/tlsn/tlsn-prover/src/lib.rs:173:50
```
> **_NOTE:_** <https://explorer.tlsnotary.org/> hosts a generic proof visualizer. Drag and drop your proof into the drop zone to check and render your proof. [Notary public key](../../../notary/server/fixture/notary/notary.pub)
> **_NOTE:_** <https://explorer.tlsnotary.org/> hosts a generic proof visualizer. Drag and drop your proof into the drop zone to check and render your proof. [Notary public key](../../notary/server/fixture/notary/notary.pub)

View File

@@ -1,6 +1,6 @@
// This example shows how to notarize Twitter DMs.
//
// The example uses the notary server implemented in ../../../notary/server
// The example uses the notary server implemented in ../../notary/server
use http_body_util::{BodyExt, Empty};
use hyper::{body::Bytes, Request, StatusCode};
@@ -18,7 +18,7 @@ const SERVER_DOMAIN: &str = "twitter.com";
const ROUTE: &str = "i/api/1.1/dm/conversation";
const USER_AGENT: &str = "Mozilla/5.0 (X11; Linux x86_64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/114.0.0.0 Safari/537.36";
// Setting of the notary server — make sure these are the same with the config in ../../../notary/server
// Setting of the notary server — make sure these are the same with the config in ../../notary/server
const NOTARY_HOST: &str = "127.0.0.1";
const NOTARY_PORT: u16 = 7047;

View File

@@ -9,7 +9,7 @@ This crate is currently under active development and should not be used in produ
---
## Running the server
### ⚠️ Notice
- When running this server against a prover (e.g. [Rust](https://github.com/tlsnotary/tlsn/tree/main/tlsn/examples) or [browser extension](https://github.com/tlsnotary/tlsn-extension)), please ensure that the prover's version is the same as the version of this server
- When running this server against a prover (e.g. [Rust](../../examples/) or [browser extension](https://github.com/tlsnotary/tlsn-extension)), please ensure that the prover's version is the same as the version of this server
- When running this server in a *production environment*, please first read this [page](https://docs.tlsnotary.org/developers/notary_server.html)
- When running this server in a *local environment* with a browser extension, please turn off this server's TLS in the config (refer [here](#optional-tls))
@@ -48,7 +48,7 @@ docker run --init -p 127.0.0.1:7047:7047 -v <your config folder path>:/root/.not
1. Configure the server setting in this config [file](./config/config.yaml).
2. Build the docker image by running the following in a terminal at the root of this *repository*.
```bash
docker build . -t notary-server:local -f notary/server/notary-server.Dockerfile
docker build . -t notary-server:local -f crates/notary/server/notary-server.Dockerfile
```
3. Run the docker container and specify the port specified in the config file, e.g. for the default port 7047
```bash

View File

@@ -19,7 +19,7 @@
FROM rust:bookworm AS builder
WORKDIR /usr/src/tlsn
COPY . .
RUN cargo install --path notary/server
RUN cargo install --path crates/notary/server
FROM ubuntu:latest
WORKDIR /root/.notary-server
@@ -30,9 +30,9 @@ RUN apt-get update && apt-get -y upgrade && apt-get install -y --no-install-reco
&& apt-get clean \
&& rm -rf /var/lib/apt/lists/*
# Copy default fixture folder for default usage
COPY --from=builder /usr/src/tlsn/notary/server/fixture ./fixture
COPY --from=builder /usr/src/tlsn/crates/notary/server/fixture ./fixture
# Copy default config folder for default usage
COPY --from=builder /usr/src/tlsn/notary/server/config ./config
COPY --from=builder /usr/src/tlsn/crates/notary/server/config ./config
COPY --from=builder /usr/local/cargo/bin/notary-server /usr/local/bin/notary-server
# Label to link this image with the repository in Github Container Registry (https://docs.github.com/en/packages/learn-github-packages/connecting-a-repository-to-a-package#connecting-a-repository-to-a-container-image-using-the-command-line)
LABEL org.opencontainers.image.source=https://github.com/tlsnotary/tlsn

View File

@@ -1,12 +1,9 @@
# exclude everything
*
# include notary
!/notary
# include core library dependencies
!/tlsn
!/components
# include notary and core library dependencies
!/crates
!/Cargo.toml
# include .git for program to get git info
!/.git