Skip to content

Commit

Permalink
chore: Dockerfile run relayer (#1034)
Browse files Browse the repository at this point in the history
  • Loading branch information
carneiro-cw authored Jun 7, 2024
1 parent 26333d2 commit d5ef727
Show file tree
Hide file tree
Showing 3 changed files with 33 additions and 4 deletions.
29 changes: 29 additions & 0 deletions docker/Dockerfile.run_relayer
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
# Build
FROM rust:1.75 as builder

WORKDIR /app
COPY src /app/src
COPY static /app/static
COPY .sqlx /app/.sqlx
COPY build.rs /app/build.rs
COPY Cargo.toml /app/Cargo.toml
COPY Cargo.lock /app/Cargo.lock
COPY .cargo .cargo
COPY config /app/config
COPY proto /app/proto

RUN apt update
RUN apt-get install -y libclang-dev cmake protobuf-compiler

ENV CARGO_PROFILE_RELEASE_DEBUG=1
ENV LOG_FORMAT=json
ENV NO_COLOR=1
RUN cargo build --release --bin relayer --no-default-features --features metrics

# Runtime
FROM rust:1.75 as runtime
WORKDIR /app
COPY --from=builder /app/target/release/relayer /app/relayer
COPY --from=builder /app/config/* /app/config/

CMD ["sh", "-c", "/app/relayer"]
2 changes: 2 additions & 0 deletions docker/Dockerfile.run_stratus
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,10 @@ RUN apt-get install -y libclang-dev cmake protobuf-compiler
ENV CARGO_PROFILE_RELEASE_DEBUG=1
ENV LOG_FORMAT=json
ENV NO_COLOR=1

RUN cargo build --release --bin stratus --features metrics


# Runtime
FROM rust:1.75 as runtime
WORKDIR /app
Expand Down
6 changes: 2 additions & 4 deletions src/eth/relayer/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -197,9 +197,7 @@ impl ExternalRelayer {
match res {
Err(err) => {
tracing::error!(?block_number, ?hash, "failed to insert row in pgsql, saving mismatche to json");
let mut file = File::create(format!("data/mismatched_transactions/{}.json", hash))
.await
.expect("opening the file should not fail");
let mut file = File::create(format!("data/{}.json", hash)).await.expect("opening the file should not fail");
let json = serde_json::json!(
{
"stratus_receipt": stratus_json,
Expand Down Expand Up @@ -270,7 +268,7 @@ impl ExternalRelayer {

/// Relays a dag by removing its roots and sending them consecutively. Returns `Ok` if we confirmed that all transactions
/// had the same receipts, returns `Err` if one or more transactions had receipts mismatches. The mismatches are saved
/// on the `mismatches` table in pgsql, or in data/mismatched_transactions as a fallback.
/// on the `mismatches` table in pgsql, or in ./data as a fallback.
#[tracing::instrument(name = "external_relayer::relay_dag", skip_all)]
async fn relay_dag(&self, mut dag: TransactionDag) -> anyhow::Result<(), RelayError> {
tracing::debug!("relaying transactions");
Expand Down

0 comments on commit d5ef727

Please sign in to comment.