From 6a4b43c3c6937f90ee6830fdd881dbf171a302e3 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Mon, 13 May 2024 17:33:37 +0300 Subject: [PATCH 1/3] implement reth's `maxperf` Cargo profile --- Cargo.toml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/Cargo.toml b/Cargo.toml index 59e13f9a..658c7742 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,6 +13,16 @@ default-members = ["bin/mev"] [workspace.package] version = "0.3.0" +[profile.release] +lto = "thin" +strip = "debuginfo" + +[profile.maxperf] +inherits = "release" +lto = "fat" +codegen-units = 1 +incremental = false + [workspace.dependencies] ethereum-consensus = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" } beacon-api-client = { git = "https://github.com/ralexstokes/ethereum-consensus", rev = "cf3c404043230559660810bc0c9d6d5a8498d819" } From 2dbc35b7bb674a914eb92b86efc43d22b97cba01 Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Mon, 13 May 2024 17:39:00 +0300 Subject: [PATCH 2/3] fix lint for `build` feature --- bin/mev/src/main.rs | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/bin/mev/src/main.rs b/bin/mev/src/main.rs index 4e914599..0eee1566 100644 --- a/bin/mev/src/main.rs +++ b/bin/mev/src/main.rs @@ -1,12 +1,14 @@ mod cmd; -use clap::{CommandFactory, Parser, Subcommand}; -use eyre::OptionExt; -use std::{future::Future, path::PathBuf}; +use clap::{Parser, Subcommand}; +use std::future::Future; use tokio::signal; use tracing::warn; use tracing_subscriber::{layer::SubscriberExt, util::SubscriberInitExt}; +#[cfg(feature = "build")] +use ::{clap::CommandFactory, eyre::OptionExt, std::path::PathBuf}; + const MINIMAL_PRESET_NOTICE: &str = "`minimal-preset` feature is enabled. The `minimal` consensus preset is being used."; @@ -60,6 +62,7 @@ fn run_task_until_signal(task: impl Future>) -> eyre:: }) } +#[cfg(feature = "build")] fn parse_custom_chain_config_directory() -> eyre::Result> { let matches = Cli::command().get_matches(); let (_, matches) = matches.subcommand().ok_or_eyre("missing subcommand")?; @@ -78,7 +81,9 @@ fn parse_custom_chain_config_directory() -> eyre::Result> { } fn main() -> eyre::Result<()> { + #[cfg(feature = "build")] let custom_chain_config_directory = parse_custom_chain_config_directory()?; + let cli = Cli::parse(); match cli.command { From 67311e1334fa426a6378b11698b6813b4c4dd80e Mon Sep 17 00:00:00 2001 From: Alex Stokes Date: Mon, 13 May 2024 17:45:41 +0300 Subject: [PATCH 3/3] default to `maxperf` in nix build --- nix/mev-rs.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/nix/mev-rs.nix b/nix/mev-rs.nix index 51d33d98..f989de80 100644 --- a/nix/mev-rs.nix +++ b/nix/mev-rs.nix @@ -5,6 +5,7 @@ let commonArgs = { pname = "mev-rs"; src = crane.cleanCargoSource (crane.path ../.); + CARGO_PROFILE = "maxperf"; cargoExtraArgs = "--locked ${feature-set}"; buildInputs = lib.optionals pkgs.stdenv.isLinux [ openssl