From 2efa89029a74c1c5f4c0e4b37f8df066a931cb17 Mon Sep 17 00:00:00 2001 From: Willem Olding Date: Fri, 12 Apr 2024 16:00:39 +1000 Subject: [PATCH 1/3] update docer file to latest --- Dockerfile | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/Dockerfile b/Dockerfile index 1666a08..4dc107f 100644 --- a/Dockerfile +++ b/Dockerfile @@ -6,6 +6,7 @@ ENV RUSTUP_HOME=/usr/local/rustup \ PATH=/usr/local/cargo/bin:$PATH \ RUST_VERSION=1.76.0 +ARG DEBIAN_FRONTEND=noninteractive RUN < Date: Sat, 13 Apr 2024 11:52:30 +1000 Subject: [PATCH 2/3] make changes to get running in emulator again --- src/main.rs | 3 +-- tower-cartesi/src/lib.rs | 4 ++-- tower-cartesi/src/messages.rs | 5 ++--- 3 files changed, 5 insertions(+), 7 deletions(-) diff --git a/src/main.rs b/src/main.rs index d48ea89..61d2ec9 100644 --- a/src/main.rs +++ b/src/main.rs @@ -80,8 +80,7 @@ async fn main() -> Result<(), anyhow::Error> { } listen_http(&mut cartezcash_app, &server_addr) - .await - .expect("Failed to start the rollup server"); + .await?; Ok(()) } diff --git a/tower-cartesi/src/lib.rs b/tower-cartesi/src/lib.rs index a32c9e9..ef05764 100644 --- a/tower-cartesi/src/lib.rs +++ b/tower-cartesi/src/lib.rs @@ -34,7 +34,7 @@ where // set the finish message and get the new request let finish_http_request = response .finish_message() - .build_http_request(host_uri.try_into()?); + .build_http_request(host_uri); let resp = client.request(finish_http_request).await?; if resp.status() == hyper::StatusCode::ACCEPTED { tracing::info!("No pending rollup request, trying again"); @@ -51,7 +51,7 @@ where for output in response.outputs.iter() { tracing::info!("Sending output {:?}", output); let resp = client - .request(output.build_http_request(host_uri.try_into()?)) + .request(output.build_http_request(host_uri)) .await?; tracing::info!("Output response: {:?}", resp.status()); } diff --git a/tower-cartesi/src/messages.rs b/tower-cartesi/src/messages.rs index b59c556..47688d2 100644 --- a/tower-cartesi/src/messages.rs +++ b/tower-cartesi/src/messages.rs @@ -1,4 +1,3 @@ -use hyper::Uri; use serde::{Deserialize, Serialize}; #[derive(Debug, Serialize)] @@ -26,7 +25,7 @@ impl Finish { } } - pub fn build_http_request(&self, host_uri: Uri) -> hyper::Request { + pub fn build_http_request(&self, host_uri: &str) -> hyper::Request { let finish_uri = format!("{}/finish", host_uri); hyper::Request::builder() @@ -91,7 +90,7 @@ where } impl Output { - pub fn build_http_request(&self, host_uri: Uri) -> hyper::Request { + pub fn build_http_request(&self, host_uri: &str) -> hyper::Request { let uri = match self { Self::Notice { .. } => format!("{}/notice", host_uri), Self::Report { .. } => format!("{}/report", host_uri), From 589312777a255fe377bfd48c7879b551cf483674 Mon Sep 17 00:00:00 2001 From: Willem Olding Date: Sat, 13 Apr 2024 13:59:37 +1000 Subject: [PATCH 3/3] fmt --- src/main.rs | 3 +-- tower-cartesi/src/lib.rs | 8 ++------ 2 files changed, 3 insertions(+), 8 deletions(-) diff --git a/src/main.rs b/src/main.rs index 61d2ec9..4ecdfdf 100644 --- a/src/main.rs +++ b/src/main.rs @@ -79,8 +79,7 @@ async fn main() -> Result<(), anyhow::Error> { tracing::info!("wallet GRPC server listening on {}", addr); } - listen_http(&mut cartezcash_app, &server_addr) - .await?; + listen_http(&mut cartezcash_app, &server_addr).await?; Ok(()) } diff --git a/tower-cartesi/src/lib.rs b/tower-cartesi/src/lib.rs index ef05764..a8b071f 100644 --- a/tower-cartesi/src/lib.rs +++ b/tower-cartesi/src/lib.rs @@ -32,9 +32,7 @@ where let mut response = Response::empty_accept(); loop { // set the finish message and get the new request - let finish_http_request = response - .finish_message() - .build_http_request(host_uri); + let finish_http_request = response.finish_message().build_http_request(host_uri); let resp = client.request(finish_http_request).await?; if resp.status() == hyper::StatusCode::ACCEPTED { tracing::info!("No pending rollup request, trying again"); @@ -50,9 +48,7 @@ where // handle the additional calls as required by the dApp outputs for output in response.outputs.iter() { tracing::info!("Sending output {:?}", output); - let resp = client - .request(output.build_http_request(host_uri)) - .await?; + let resp = client.request(output.build_http_request(host_uri)).await?; tracing::info!("Output response: {:?}", resp.status()); } }