diff --git a/Cargo.toml b/Cargo.toml index 2c39788..10c6432 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,6 +1,6 @@ [package] name = "prototype" -edition = "2021" +edition = "2024" authors = ["Lola Rigaut-Luczak "] # See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html @@ -15,3 +15,10 @@ serde = { version = "1.0", features = ["derive"] } toml = "0.8" sha2 = "0.10.9" varint = {package = "bitcoin-varint", version = "0.1.0"} + +[profile.release] +opt-level = 3 +lto = "fat" +codegen-units = 1 +strip = true +panic = "abort" \ No newline at end of file diff --git a/Dockerfile b/Dockerfile index ac78d5d..e05b654 100644 --- a/Dockerfile +++ b/Dockerfile @@ -3,20 +3,22 @@ FROM rustlang/rust:nightly AS builder WORKDIR /usr/src/prototype COPY . . -RUN cargo install --path . +RUN --mount=type=cache,target=/usr/local/cargo/registry \ + --mount=type=cache,target=/usr/src/eth-prototype/target \ + cargo install --path . ##### RUNNER ##### -FROM debian:bookworm +FROM debian:trixie-slim LABEL author="Lola Rigaut-Luczak " LABEL description="Custom node that allow indexing blocks and transactions from block chains." COPY --from=builder /usr/local/cargo/bin/prototype /usr/local/bin/prototype -RUN apt-get update && rm -rf /var/lib/apt/lists/* +RUN apt-get update && apt-get install -y ca-certificates && rm -rf /var/lib/apt/lists/* # default env ENV NETWORK "dogecoin_testnet" ENV RUST_LOG "prototype=info" -CMD prototype ${NETWORK} \ No newline at end of file +ENTRYPOINT ["/bin/sh", "-c", "exec prototype ${NETWORK}"] \ No newline at end of file diff --git a/rust-toolchain.toml b/rust-toolchain.toml index 5d56faf..509da7f 100644 --- a/rust-toolchain.toml +++ b/rust-toolchain.toml @@ -1,2 +1,4 @@ [toolchain] channel = "nightly" +components = ["rustfmt", "clippy"] +profile = "minimal" diff --git a/src/main.rs b/src/main.rs index 564a4fb..2f8ad17 100644 --- a/src/main.rs +++ b/src/main.rs @@ -160,7 +160,9 @@ fn main() { // Verify if inventory is what we asked for let verified = utils::verify_inv_identifier(blocks_inv.inventory); if !verified { - warn!("One of the inventory record is not a block message. We might have a problem.") + warn!( + "One of the inventory record is not a block message. We might have a problem." + ); } trace!("inv block count {}", blocks_inv.count); diff --git a/src/p2p/version.rs b/src/p2p/version.rs index d21cf2b..8aa6a26 100644 --- a/src/p2p/version.rs +++ b/src/p2p/version.rs @@ -78,7 +78,7 @@ impl Version { _ => { return Err(DeserializeError( "Failed to deserialize relay value".to_owned(), - )) + )); } };