From 225de1b56dd037999bbf81c30e19ab7e255681a7 Mon Sep 17 00:00:00 2001 From: "sinu.eth" <65924192+sinui0@users.noreply.github.com> Date: Tue, 19 Sep 2023 11:14:27 -0700 Subject: [PATCH] prep for v0.1.0-alpha.1 (#13) --- Cargo.toml | 10 ++++----- tests/integration_test.rs | 43 ++++++++++++++++++++------------------- 2 files changed, 27 insertions(+), 26 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index 281448f..93cffe2 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "notary-server" -version = "0.1.0" +version = "0.1.0-alpha.1" edition = "2021" # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -27,8 +27,8 @@ serde_yaml = "0.9.21" sha1 = "0.10" structopt = "0.3.26" thiserror = "1" -tlsn-notary = { git = "https://github.com/tlsnotary/tlsn", rev = "832d1ba" } -tlsn-tls-core = { git = "https://github.com/tlsnotary/tlsn", rev = "832d1ba" } +tlsn-notary = { git = "https://github.com/tlsnotary/tlsn", tag = "v0.1.0-alpha.1" } +tlsn-tls-core = { git = "https://github.com/tlsnotary/tlsn", tag = "v0.1.0-alpha.1" } tokio = { version = "1", features = ["full"] } tokio-rustls = { version = "0.24.1" } tokio-util = { version = "0.7", features = ["compat"] } @@ -42,6 +42,6 @@ ws_stream_tungstenite = { version = "0.10.0", features = ["tokio_io"] } [dev-dependencies] # specify vendored feature to use statically linked copy of OpenSSL hyper-tls = { version = "0.5.0", features = ["vendored"] } -tls-server-fixture = { git = "https://github.com/tlsnotary/tlsn", rev = "832d1ba" } -tlsn-prover = { git = "https://github.com/tlsnotary/tlsn", rev = "832d1ba" } +tls-server-fixture = { git = "https://github.com/tlsnotary/tlsn", tag = "v0.1.0-alpha.1" } +tlsn-prover = { git = "https://github.com/tlsnotary/tlsn", tag = "v0.1.0-alpha.1" } tokio-native-tls = { version = "0.3.1", features = ["vendored"] } diff --git a/tests/integration_test.rs b/tests/integration_test.rs index 9ebbe9c..7580306 100644 --- a/tests/integration_test.rs +++ b/tests/integration_test.rs @@ -15,7 +15,7 @@ use std::{ time::Duration, }; use tls_server_fixture::{bind_test_server_hyper, CA_CERT_DER, SERVER_DOMAIN}; -use tlsn_prover::{bind_prover, ProverConfig}; +use tlsn_prover::{Prover, ProverConfig}; use tokio_rustls::TlsConnector; use tokio_util::compat::{FuturesAsyncReadCompatExt, TokioAsyncReadCompatExt}; use tracing::debug; @@ -196,16 +196,13 @@ async fn test_tcp_prover() { .unwrap(); // Bind the Prover to the sockets - let (tls_connection, prover_fut, mux_fut) = bind_prover( - prover_config, - client_socket.compat(), - notary_tls_socket.compat(), - ) - .await - .unwrap(); + let prover = Prover::new(prover_config) + .setup(notary_tls_socket.compat()) + .await + .unwrap(); + let (tls_connection, prover_fut) = prover.connect(client_socket.compat()).await.unwrap(); - // Spawn the Prover and Mux tasks to be run concurrently - tokio::spawn(mux_fut); + // Spawn the Prover task to be run concurrently let prover_task = tokio::spawn(prover_fut); let (mut request_sender, connection) = hyper::client::conn::handshake(tls_connection.compat()) @@ -242,13 +239,15 @@ async fn test_tcp_prover() { client_socket.close().await.unwrap(); - let mut prover = prover_task.await.unwrap().unwrap(); + let mut prover = prover_task.await.unwrap().unwrap().start_notarize(); let sent_len = prover.sent_transcript().data().len(); let recv_len = prover.recv_transcript().data().len(); - prover.add_commitment_sent(0..sent_len as u32).unwrap(); - prover.add_commitment_recv(0..recv_len as u32).unwrap(); + let builder = prover.commitment_builder(); + + builder.commit_sent(0..sent_len).unwrap(); + builder.commit_recv(0..recv_len).unwrap(); _ = prover.finalize().await.unwrap(); @@ -365,13 +364,13 @@ async fn test_websocket_prover() { .unwrap(); // Bind the Prover to the sockets - let (tls_connection, prover_fut, mux_fut) = - bind_prover(prover_config, client_socket.compat(), notary_ws_socket) - .await - .unwrap(); + let prover = Prover::new(prover_config) + .setup(notary_ws_socket) + .await + .unwrap(); + let (tls_connection, prover_fut) = prover.connect(client_socket.compat()).await.unwrap(); // Spawn the Prover and Mux tasks to be run concurrently - tokio::spawn(mux_fut); let prover_task = tokio::spawn(prover_fut); let (mut request_sender, connection) = hyper::client::conn::handshake(tls_connection.compat()) @@ -408,13 +407,15 @@ async fn test_websocket_prover() { client_socket.close().await.unwrap(); - let mut prover = prover_task.await.unwrap().unwrap(); + let mut prover = prover_task.await.unwrap().unwrap().start_notarize(); let sent_len = prover.sent_transcript().data().len(); let recv_len = prover.recv_transcript().data().len(); - prover.add_commitment_sent(0..sent_len as u32).unwrap(); - prover.add_commitment_recv(0..recv_len as u32).unwrap(); + let builder = prover.commitment_builder(); + + builder.commit_sent(0..sent_len).unwrap(); + builder.commit_recv(0..recv_len).unwrap(); _ = prover.finalize().await.unwrap();