From 9fce2cbfb990cd07d9509c0be5c96e946dcfd635 Mon Sep 17 00:00:00 2001 From: fmoura Date: Thu, 14 Sep 2023 15:20:45 -0300 Subject: [PATCH] Update offchain/Cargo.toml Co-authored-by: Gabriel de Quadros Ligneul <8294320+gligneul@users.noreply.github.com> --- build/Dockerfile | 1 + grpc-interfaces | 1 + offchain/Cargo.lock | 20 ++----------------- offchain/Cargo.toml | 6 ------ offchain/advance-runner/Cargo.toml | 5 ++--- offchain/advance-runner/src/main.rs | 3 +-- offchain/authority-claimer/Cargo.toml | 5 ++--- offchain/authority-claimer/src/built/build.rs | 5 ----- offchain/authority-claimer/src/main.rs | 3 +-- offchain/build-info/Cargo.toml | 10 ---------- offchain/build-info/src/lib.rs | 19 ------------------ offchain/dispatcher/Cargo.toml | 6 ++---- offchain/dispatcher/src/main.rs | 3 +-- offchain/graphql-server/Cargo.toml | 6 ++---- offchain/graphql-server/src/main.rs | 3 +-- offchain/host-runner/Cargo.toml | 5 ++--- offchain/host-runner/src/main.rs | 3 +-- offchain/indexer/Cargo.toml | 3 +-- offchain/indexer/src/main.rs | 3 +-- offchain/inspect-server/Cargo.toml | 2 +- offchain/inspect-server/src/main.rs | 3 +-- offchain/log/Cargo.toml | 2 ++ offchain/{build-info => log}/src/build.rs | 0 offchain/log/src/lib.rs | 17 ++++++++++++++++ offchain/state-server/Cargo.toml | 6 ++---- offchain/state-server/src/main.rs | 3 +-- onchain/rollups-arbitration/lib/forge-std | 1 + onchain/rollups-arbitration/lib/solidity-util | 1 + onchain/rollups/lib/forge-std | 1 + 29 files changed, 48 insertions(+), 98 deletions(-) create mode 160000 grpc-interfaces delete mode 100644 offchain/authority-claimer/src/built/build.rs delete mode 100644 offchain/build-info/Cargo.toml delete mode 100644 offchain/build-info/src/lib.rs rename offchain/{build-info => log}/src/build.rs (100%) create mode 160000 onchain/rollups-arbitration/lib/forge-std create mode 160000 onchain/rollups-arbitration/lib/solidity-util create mode 160000 onchain/rollups/lib/forge-std diff --git a/build/Dockerfile b/build/Dockerfile index 3378f1fc3..a9d53af79 100644 --- a/build/Dockerfile +++ b/build/Dockerfile @@ -65,6 +65,7 @@ RUN cargo chef cook --release --recipe-path recipe.json # Build application COPY ./offchain/ . +COPY ./.git ../ RUN cargo build --release # diff --git a/grpc-interfaces b/grpc-interfaces new file mode 160000 index 000000000..cba7c3f1c --- /dev/null +++ b/grpc-interfaces @@ -0,0 +1 @@ +Subproject commit cba7c3f1c53b83bee83d8a1e5a1074591279220f diff --git a/offchain/Cargo.lock b/offchain/Cargo.lock index 931609afe..602f6096d 100644 --- a/offchain/Cargo.lock +++ b/offchain/Cargo.lock @@ -246,7 +246,6 @@ version = "1.1.0" dependencies = [ "async-trait", "backoff", - "build-info", "built", "clap", "contracts", @@ -487,7 +486,6 @@ name = "authority-claimer" version = "1.1.0" dependencies = [ "async-trait", - "build-info", "built", "clap", "eth-tx-manager", @@ -866,15 +864,6 @@ dependencies = [ "uuid 0.8.2", ] -[[package]] -name = "build-info" -version = "1.1.0" -dependencies = [ - "built", - "tracing", - "tracing-subscriber", -] - [[package]] name = "built" version = "0.6.1" @@ -882,7 +871,6 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "b99c4cdc7b2c2364182331055623bdf45254fcb679fea565c40c3c11c101889a" dependencies = [ "cargo-lock", - "chrono", "git2", ] @@ -1546,7 +1534,6 @@ dependencies = [ "async-trait", "axum", "backoff", - "build-info", "built", "clap", "contracts", @@ -2475,7 +2462,6 @@ dependencies = [ "actix-cors", "actix-web", "awc", - "build-info", "built", "clap", "hex", @@ -2605,7 +2591,6 @@ version = "1.1.0" dependencies = [ "actix-web", "async-trait", - "build-info", "built", "byteorder", "clap", @@ -2857,7 +2842,6 @@ name = "indexer" version = "1.1.0" dependencies = [ "backoff", - "build-info", "built", "clap", "env_logger", @@ -2912,7 +2896,6 @@ version = "1.1.0" dependencies = [ "actix-cors", "actix-web", - "build-info", "built", "clap", "futures", @@ -3179,7 +3162,9 @@ checksum = "b5e6163cb8c49088c2c36f57875e58ccd8c87c7427f7fbd50ea6710b2f3f2e8f" name = "log" version = "1.1.0" dependencies = [ + "built", "clap", + "tracing", "tracing-subscriber", ] @@ -4969,7 +4954,6 @@ dependencies = [ name = "state-server" version = "1.1.0" dependencies = [ - "build-info", "built", "clap", "eth-block-history", diff --git a/offchain/Cargo.toml b/offchain/Cargo.toml index 2010a1d26..f0924a6ce 100644 --- a/offchain/Cargo.toml +++ b/offchain/Cargo.toml @@ -2,7 +2,6 @@ members = [ "advance-runner", "authority-claimer", - "build-info", "contracts", "data", "dispatcher", @@ -93,8 +92,3 @@ urlencoding = "2.1" users = "0.11" uuid = "1.4" -[profile.release] -strip = true # Automatically strip symbols from the binary. -[workspace.build-dependencies] -built = "0.6" - diff --git a/offchain/advance-runner/Cargo.toml b/offchain/advance-runner/Cargo.toml index 0a57f7c50..6263e0d6d 100644 --- a/offchain/advance-runner/Cargo.toml +++ b/offchain/advance-runner/Cargo.toml @@ -3,14 +3,13 @@ name = "advance-runner" edition.workspace = true license.workspace = true version.workspace = true -build = "../build-info/src/build.rs" +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-advance-runner" path = "src/main.rs" [dependencies] -build-info = { path = "../build-info" } contracts = { path = "../contracts" } grpc-interfaces = { path = "../grpc-interfaces" } http-health-check = { path = "../http-health-check" } @@ -41,4 +40,4 @@ testcontainers.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter"] } [build-dependencies] -built = {workspace = true, features = ["git2"]} +built = { workspace = true, features = ["git2"] } diff --git a/offchain/advance-runner/src/main.rs b/offchain/advance-runner/src/main.rs index cff6299a1..3d4a790a7 100644 --- a/offchain/advance-runner/src/main.rs +++ b/offchain/advance-runner/src/main.rs @@ -16,9 +16,8 @@ async fn main() -> Result<(), Box> { info!(?config, "Starting Advance Runner"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/authority-claimer/Cargo.toml b/offchain/authority-claimer/Cargo.toml index 304851967..4da94fe8c 100644 --- a/offchain/authority-claimer/Cargo.toml +++ b/offchain/authority-claimer/Cargo.toml @@ -3,7 +3,7 @@ name = "authority-claimer" edition.workspace = true license.workspace = true version.workspace = true -build = "src/built/build.rs" +build = "../log/src/build.rs" [[bin]] @@ -12,7 +12,6 @@ path = "src/main.rs" test = false [dependencies] -build-info = { path = "../build-info" } http-server = { path = "../http-server" } log = { path = "../log" } rollups-events = { path = "../rollups-events" } @@ -29,4 +28,4 @@ tracing.workspace = true [build-dependencies] -built = {workspace = true, features = ["chrono","git2"]} +built = { workspace = true, features = ["git2"] } diff --git a/offchain/authority-claimer/src/built/build.rs b/offchain/authority-claimer/src/built/build.rs deleted file mode 100644 index c8a3a44b7..000000000 --- a/offchain/authority-claimer/src/built/build.rs +++ /dev/null @@ -1,5 +0,0 @@ -use built; - -pub(crate) fn main() { - built::write_built_file().expect("Failed to acquire build-time information"); -} \ No newline at end of file diff --git a/offchain/authority-claimer/src/main.rs b/offchain/authority-claimer/src/main.rs index 9752d6a19..fdac85691 100644 --- a/offchain/authority-claimer/src/main.rs +++ b/offchain/authority-claimer/src/main.rs @@ -19,9 +19,8 @@ async fn main() -> Result<(), Box> { info!(?config, "Starting Authority Claimer"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/build-info/Cargo.toml b/offchain/build-info/Cargo.toml deleted file mode 100644 index 0d0340016..000000000 --- a/offchain/build-info/Cargo.toml +++ /dev/null @@ -1,10 +0,0 @@ -[package] -name = "build-info" -edition.workspace = true -license.workspace = true -version.workspace = true - -[dependencies] -built = {workspace = true, features = ["chrono","git2"]} -tracing.workspace = true -tracing-subscriber = { workspace = true, features = ["env-filter"] } \ No newline at end of file diff --git a/offchain/build-info/src/lib.rs b/offchain/build-info/src/lib.rs deleted file mode 100644 index dd3e916d9..000000000 --- a/offchain/build-info/src/lib.rs +++ /dev/null @@ -1,19 +0,0 @@ -use tracing::info; - -pub fn log_build_info( - version: &str, - build_time: &str, - git_head_ref: Option<&str>, - git_commit_hash: Option<&str>, -) { - info!("Version: {}", version); - info!("Build time: {}", build_time); - match git_head_ref { - Some(v) => info!("Git ref: {}", v), - None => (), - } - match git_commit_hash { - Some(v) => info!("Git hash: {}", v), - None => (), - } -} diff --git a/offchain/dispatcher/Cargo.toml b/offchain/dispatcher/Cargo.toml index e1e118965..2d653a789 100644 --- a/offchain/dispatcher/Cargo.toml +++ b/offchain/dispatcher/Cargo.toml @@ -3,14 +3,13 @@ name = "dispatcher" edition.workspace = true license.workspace = true version.workspace = true -build = "../build-info/src/build.rs" +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-dispatcher" path = "src/main.rs" [dependencies] -build-info = { path = "../build-info" } contracts = { path = "../contracts" } http-server = { path = "../http-server" } log = { path = "../log" } @@ -20,7 +19,6 @@ types = { path = "../types" } async-trait.workspace = true axum.workspace = true backoff = { workspace = true, features = ["tokio"] } -built = { workspace = true, features = ["chrono","git2"] } clap = { workspace = true, features = ["derive", "env"] } eth-state-client-lib.workspace = true eth-state-fold-types = { workspace = true, features = ["ethers"] } @@ -51,4 +49,4 @@ testcontainers.workspace = true tracing-test = { workspace = true, features = ["no-env-filter"] } [build-dependencies] -built = {workspace = true, features = ["chrono","git2"]} +built = { workspace = true, features = ["git2"] } diff --git a/offchain/dispatcher/src/main.rs b/offchain/dispatcher/src/main.rs index 0da23eafb..d1c3f8be1 100644 --- a/offchain/dispatcher/src/main.rs +++ b/offchain/dispatcher/src/main.rs @@ -18,9 +18,8 @@ async fn main() -> Result<(), Box> { info!(?config, "Starting Dispatcher"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/graphql-server/Cargo.toml b/offchain/graphql-server/Cargo.toml index d1b874cf6..53af9db4d 100644 --- a/offchain/graphql-server/Cargo.toml +++ b/offchain/graphql-server/Cargo.toml @@ -3,7 +3,7 @@ name = "graphql-server" edition.workspace = true license.workspace = true version.workspace = true -build = "../build-info/src/build.rs" +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-graphql-server" @@ -14,14 +14,12 @@ name = "generate-schema" path = "src/schema/generate_schema.rs" [dependencies] -build-info = { path = "../build-info" } http-health-check = { path = "../http-health-check" } log = { path = "../log" } rollups-data = { path = "../data" } actix-cors.workspace = true actix-web.workspace = true -built = { workspace = true, features = ["chrono","git2"] } clap = { workspace = true, features = ["derive", "env"] } hex.workspace = true juniper.workspace = true @@ -39,4 +37,4 @@ serial_test.workspace = true testcontainers.workspace = true [build-dependencies] -built = {workspace = true, features = ["chrono","git2"]} +built = { workspace = true, features = ["git2"] } diff --git a/offchain/graphql-server/src/main.rs b/offchain/graphql-server/src/main.rs index 8b13aea4b..91fe519a3 100644 --- a/offchain/graphql-server/src/main.rs +++ b/offchain/graphql-server/src/main.rs @@ -19,9 +19,8 @@ async fn main() -> Result<(), Box> { info!(?config, "Starting GraphQL Server"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/host-runner/Cargo.toml b/offchain/host-runner/Cargo.toml index 84599160f..ed373bf8f 100644 --- a/offchain/host-runner/Cargo.toml +++ b/offchain/host-runner/Cargo.toml @@ -3,14 +3,13 @@ name = "host-runner" edition.workspace = true license.workspace = true version.workspace = true -build = "../build-info/src/build.rs" +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-host-runner" path = "src/main.rs" [dependencies] -build-info = { path = "../build-info" } grpc-interfaces = { path = "../grpc-interfaces" } http-health-check = { path = "../http-health-check" } log = { path = "../log" } @@ -40,4 +39,4 @@ serial_test.workspace = true tracing-test.workspace = true [build-dependencies] -built = {workspace = true, features = ["chrono","git2"]} +built = { workspace = true, features = ["git2"] } diff --git a/offchain/host-runner/src/main.rs b/offchain/host-runner/src/main.rs index 362bac778..b730a7edc 100644 --- a/offchain/host-runner/src/main.rs +++ b/offchain/host-runner/src/main.rs @@ -42,9 +42,8 @@ async fn main() { info!(?config, "Starting Host Runner"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/indexer/Cargo.toml b/offchain/indexer/Cargo.toml index 3449816db..b3280485b 100644 --- a/offchain/indexer/Cargo.toml +++ b/offchain/indexer/Cargo.toml @@ -3,7 +3,7 @@ name = "indexer" edition.workspace = true license.workspace = true version.workspace = true -build = "../build-info/src/build.rs" +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-indexer" @@ -11,7 +11,6 @@ path = "src/main.rs" test = false [dependencies] -build-info = { path = "../build-info" } http-health-check = { path = "../http-health-check" } log = { path = "../log" } rollups-data = { path = "../data" } diff --git a/offchain/indexer/src/main.rs b/offchain/indexer/src/main.rs index ff2ab7f1f..29ac86fa1 100644 --- a/offchain/indexer/src/main.rs +++ b/offchain/indexer/src/main.rs @@ -18,9 +18,8 @@ async fn main() -> Result<(), Box> { info!(?config, "Starting Indexer"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/inspect-server/Cargo.toml b/offchain/inspect-server/Cargo.toml index b200ca317..cdd498020 100644 --- a/offchain/inspect-server/Cargo.toml +++ b/offchain/inspect-server/Cargo.toml @@ -3,6 +3,7 @@ name = "inspect-server" edition.workspace = true license.workspace = true version.workspace = true +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-inspect-server" @@ -10,7 +11,6 @@ path = "src/main.rs" [dependencies] grpc-interfaces = { path = "../grpc-interfaces" } -build-info = { path = "../build-info" } http-health-check = { path = "../http-health-check" } log = { path = "../log" } diff --git a/offchain/inspect-server/src/main.rs b/offchain/inspect-server/src/main.rs index 1e57f460a..829421f5e 100644 --- a/offchain/inspect-server/src/main.rs +++ b/offchain/inspect-server/src/main.rs @@ -18,9 +18,8 @@ async fn main() -> Result<(), Box> { info!(?config, "Starting Inspect Server"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/offchain/log/Cargo.toml b/offchain/log/Cargo.toml index e82a3e157..6f3d4159e 100644 --- a/offchain/log/Cargo.toml +++ b/offchain/log/Cargo.toml @@ -5,5 +5,7 @@ license.workspace = true version.workspace = true [dependencies] +built.workspace = true clap = { workspace = true, features = ["derive", "env"] } +tracing.workspace = true tracing-subscriber = { workspace = true, features = ["env-filter"] } diff --git a/offchain/build-info/src/build.rs b/offchain/log/src/build.rs similarity index 100% rename from offchain/build-info/src/build.rs rename to offchain/log/src/build.rs diff --git a/offchain/log/src/lib.rs b/offchain/log/src/lib.rs index 4d4c36aa5..d3616765d 100644 --- a/offchain/log/src/lib.rs +++ b/offchain/log/src/lib.rs @@ -1,5 +1,6 @@ use clap::Parser; use tracing_subscriber::filter::{EnvFilter, LevelFilter}; +use tracing::info; #[derive(Debug, Parser)] #[command(name = "log_config")] @@ -52,3 +53,19 @@ pub fn configure(config: &LogConfig) { subscribe_builder.init(); } } + +pub fn log_build_info( + version: &str, + git_head_ref: Option<&str>, + git_commit_hash: Option<&str>, +) { + info!("Version: {}", version); + match git_head_ref { + Some(v) => info!("Git ref: {}", v), + None => (), + } + match git_commit_hash { + Some(v) => info!("Git hash: {}", v), + None => (), + } +} diff --git a/offchain/state-server/Cargo.toml b/offchain/state-server/Cargo.toml index 1ceb82668..0c842d2e0 100644 --- a/offchain/state-server/Cargo.toml +++ b/offchain/state-server/Cargo.toml @@ -3,18 +3,16 @@ name = "state-server" edition.workspace = true license.workspace = true version.workspace = true -build = "../build-info/src/build.rs" +build = "../log/src/build.rs" [[bin]] name = "cartesi-rollups-state-server" path = "src/main.rs" [dependencies] -build-info = { path = "../build-info" } log = { path = "../log" } types = { path = "../types" } -built = {workspace = true, features = ["chrono","git2"]} clap = { workspace = true, features = ["derive", "env"] } eth-block-history.workspace = true eth-state-fold-types.workspace = true @@ -28,4 +26,4 @@ tracing.workspace = true url.workspace = true [build-dependencies] -built = {workspace = true, features = ["chrono","git2"]} +built = {workspace = true, features = ["git2"]} diff --git a/offchain/state-server/src/main.rs b/offchain/state-server/src/main.rs index 95dca9d33..3d9edb67b 100644 --- a/offchain/state-server/src/main.rs +++ b/offchain/state-server/src/main.rs @@ -16,9 +16,8 @@ async fn main() -> Result<(), Box> { tracing::info!(?config, "Starting State Server"); - build_info::log_build_info( + log::log_build_info( built_info::PKG_VERSION, - built_info::BUILT_TIME_UTC, built_info::GIT_HEAD_REF, built_info::GIT_COMMIT_HASH, ); diff --git a/onchain/rollups-arbitration/lib/forge-std b/onchain/rollups-arbitration/lib/forge-std new file mode 160000 index 000000000..d26946aee --- /dev/null +++ b/onchain/rollups-arbitration/lib/forge-std @@ -0,0 +1 @@ +Subproject commit d26946aeef956d9d11238ce02c94b7a22ac23ca8 diff --git a/onchain/rollups-arbitration/lib/solidity-util b/onchain/rollups-arbitration/lib/solidity-util new file mode 160000 index 000000000..63f02ddcf --- /dev/null +++ b/onchain/rollups-arbitration/lib/solidity-util @@ -0,0 +1 @@ +Subproject commit 63f02ddcff5c1523ae65045b78b57bdb98f3d0a0 diff --git a/onchain/rollups/lib/forge-std b/onchain/rollups/lib/forge-std new file mode 160000 index 000000000..fc560fa34 --- /dev/null +++ b/onchain/rollups/lib/forge-std @@ -0,0 +1 @@ +Subproject commit fc560fa34fa12a335a50c35d92e55a6628ca467c