Skip to content

Commit

Permalink
merge latest to update sunodo version
Browse files Browse the repository at this point in the history
  • Loading branch information
willemolding committed Apr 14, 2024
2 parents 5586cbe + feed82b commit 824adc3
Show file tree
Hide file tree
Showing 3 changed files with 21 additions and 16 deletions.
24 changes: 17 additions & 7 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -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 <<EOF
set -e
apt update
Expand All @@ -16,7 +17,7 @@ apt install -y --no-install-recommends \
wget=1.21.2-2ubuntu1 \
libclang-dev
EOF
# libclang-dev is required to build and link the rust-rocksdb crate for riscv64
# libclang needed to build rocksdb. Can remove once this is no longer needed.

RUN set -eux; \
dpkgArch="$(dpkg --print-architecture)"; \
Expand Down Expand Up @@ -54,21 +55,30 @@ FROM base as builder
COPY --from=planner /opt/cartesi/cartezcash/recipe.json recipe.json
RUN cargo chef cook --release --recipe-path recipe.json --target riscv64gc-unknown-linux-gnu
COPY . .
RUN cargo build --release --target riscv64gc-unknown-linux-gnu
RUN cargo build --release --target riscv64gc-unknown-linux-gnu

### final image is the dapp itself

FROM --platform=linux/riscv64 riscv64/ubuntu:22.04

LABEL io.sunodo.sdk_version=0.3.0
LABEL io.cartesi.rollups.ram_size=128Mi

ARG MACHINE_EMULATOR_TOOLS_VERSION=0.12.0

ARG MACHINE_EMULATOR_TOOLS_VERSION=0.14.1
ADD https://github.com/cartesi/machine-emulator-tools/releases/download/v${MACHINE_EMULATOR_TOOLS_VERSION}/machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb /
RUN dpkg -i /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb \
&& rm /machine-emulator-tools-v${MACHINE_EMULATOR_TOOLS_VERSION}.deb

LABEL io.sunodo.sdk_version=0.4.0
LABEL io.cartesi.rollups.ram_size=256Mi

ARG DEBIAN_FRONTEND=noninteractive
RUN <<EOF
set -e
apt-get update
apt-get install -y --no-install-recommends \
busybox-static=1:1.30.1-7ubuntu3
rm -rf /var/lib/apt/lists/* /var/log/* /var/cache/*
useradd --create-home --user-group dapp
EOF

ENV PATH="/opt/cartesi/bin:/opt/cartesi/cartezcash:${PATH}"

WORKDIR /opt/cartesi/cartezcash
Expand Down
8 changes: 2 additions & 6 deletions tower-cartesi/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,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.try_into()?);
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");
Expand All @@ -53,9 +51,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.try_into()?))
.await?;
let resp = client.request(output.build_http_request(host_uri)).await?;
tracing::info!("Output response: {:?}", resp.status());
}
}
Expand Down
5 changes: 2 additions & 3 deletions tower-cartesi/src/messages.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
use hyper::Uri;
use serde::{Deserialize, Serialize};

#[derive(Debug, Serialize)]
Expand Down Expand Up @@ -26,7 +25,7 @@ impl Finish {
}
}

pub fn build_http_request(&self, host_uri: Uri) -> hyper::Request<hyper::Body> {
pub fn build_http_request(&self, host_uri: &str) -> hyper::Request<hyper::Body> {
let finish_uri = format!("{}/finish", host_uri);

hyper::Request::builder()
Expand Down Expand Up @@ -91,7 +90,7 @@ where
}

impl Output {
pub fn build_http_request(&self, host_uri: Uri) -> hyper::Request<hyper::Body> {
pub fn build_http_request(&self, host_uri: &str) -> hyper::Request<hyper::Body> {
let uri = match self {
Self::Notice { .. } => format!("{}/notice", host_uri),
Self::Report { .. } => format!("{}/report", host_uri),
Expand Down

0 comments on commit 824adc3

Please sign in to comment.