Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
32 changes: 30 additions & 2 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,14 @@ on:
description: "Dry run (skip release creation)"
type: boolean
default: true
profile:
description: "Cargo profile for release binaries"
type: choice
default: "profiling"
options:
- profiling
- maxperf
- release

permissions:
contents: read
Expand Down Expand Up @@ -102,13 +110,33 @@ jobs:
- name: Install cross main
run: cargo install cross --git https://github.com/cross-rs/cross

- name: Resolve build profile
id: profile
run: |
# Tag push -> maxperf (peak throughput for public releases).
# workflow_dispatch -> user-selected profile (defaults to profiling).
if [[ "${{ github.event_name }}" == "workflow_dispatch" ]]; then
PROFILE="${{ inputs.profile }}"
else
PROFILE="maxperf"
fi
# Cargo's target dir is "debug" for dev, otherwise the profile name.
if [[ "$PROFILE" == "dev" ]]; then
PROFILE_DIR="debug"
else
PROFILE_DIR="$PROFILE"
fi
echo "profile=$PROFILE" >> "$GITHUB_OUTPUT"
echo "profile_dir=$PROFILE_DIR" >> "$GITHUB_OUTPUT"
echo "Resolved profile: $PROFILE (target dir: $PROFILE_DIR)"

- name: Build binary
run: make build-${{ matrix.target }}
run: make build-${{ matrix.target }} PROFILE=${{ steps.profile.outputs.profile }}

- name: Package binary
run: |
mkdir -p dist
cp target/${{ matrix.target }}/release/morph-reth dist/
cp target/${{ matrix.target }}/${{ steps.profile.outputs.profile_dir }}/morph-reth dist/
cd dist
tar czf ../${{ matrix.archive }}.tar.gz morph-reth
cd ..
Expand Down
44 changes: 44 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,50 @@ unnameable-types = "warn"
[workspace.lints.rustdoc]
all = "warn"

# Build profiles ported from the sibling `tempo` project.

# Speed up compilation time for dev builds by reducing emitted debug info.
# NOTE: Debuggers may provide less useful information with this setting.
# Uncomment this section if you're using a debugger.
[profile.dev]
# https://davidlattimore.github.io/posts/2024/02/04/speeding-up-the-rust-edit-build-run-cycle.html
debug = "line-tables-only"
split-debuginfo = "unpacked"
Comment on lines +46 to +52
Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Update the stale debugger comment.

Line 48 says to “Uncomment this section”, but [profile.dev] is already active. Reword it to describe the local override needed for full debugger support.

Suggested wording
 # Speed up compilation time for dev builds by reducing emitted debug info.
 # NOTE: Debuggers may provide less useful information with this setting.
-# Uncomment this section if you're using a debugger.
+# Use `debug = "full"` locally if you need full variable-level debugger support.
 [profile.dev]
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
# Speed up compilation time for dev builds by reducing emitted debug info.
# NOTE: Debuggers may provide less useful information with this setting.
# Uncomment this section if you're using a debugger.
[profile.dev]
# https://davidlattimore.github.io/posts/2024/02/04/speeding-up-the-rust-edit-build-run-cycle.html
debug = "line-tables-only"
split-debuginfo = "unpacked"
# Speed up compilation time for dev builds by reducing emitted debug info.
# NOTE: Debuggers may provide less useful information with this setting.
# Use `debug = "full"` locally if you need full variable-level debugger support.
[profile.dev]
# https://davidlattimore.github.io/posts/2024/02/04/speeding-up-the-rust-edit-build-run-cycle.html
debug = "line-tables-only"
split-debuginfo = "unpacked"
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@Cargo.toml` around lines 46 - 52, The comment above the [profile.dev] section
is stale—update the text to explain that this active profile reduces debug info
and that developers who need full debugger support should override it locally
(for example by removing or changing debug = "line-tables-only" or setting
split-debuginfo) rather than “uncommenting”; modify the comment near the
[profile.dev] header in Cargo.toml to clearly state it is an active local
override that can be changed for full debugger fidelity.


# Meant for testing - all optimizations, but with debug assertions and overflow checks.
[profile.hivetests]
inherits = "test"
opt-level = 3
lto = "thin"

[profile.release]
opt-level = 3
lto = "thin"
debug = "none"
strip = "symbols"
panic = "unwind"
codegen-units = 16

# Use the `--profile profiling` flag to keep line-table symbols in a release
# build — suitable for production flame graphs.
# e.g. `cargo build --profile profiling`
[profile.profiling]
inherits = "release"
debug = "line-tables-only"
strip = "none"
incremental = true

# Include debug info in benchmarks too.
[profile.bench]
inherits = "profiling"

# Maximum runtime performance. Fat LTO + single codegen unit; use for
# throughput-sensitive production binaries (expect noticeably slower link).
[profile.maxperf]
inherits = "release"
lto = "fat"
codegen-units = 1

[workspace.dependencies]
morph-chainspec = { path = "crates/chainspec", default-features = false }
morph-consensus = { path = "crates/consensus", default-features = false }
Expand Down
7 changes: 5 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -15,8 +15,11 @@ RUN cargo chef prepare --recipe-path recipe.json
FROM chef AS builder
COPY --from=planner /app/recipe.json recipe.json

# Build profile, release by default
ARG BUILD_PROFILE=release
# Build profile. Defaults to `profiling` (release + line-table symbols) so
# production binaries remain flame-graphable. Override with
# `--build-arg BUILD_PROFILE=maxperf` for peak throughput (fat LTO, slower
# to link) or `release` for the slimmer/stripped variant.
ARG BUILD_PROFILE=profiling
ENV BUILD_PROFILE=$BUILD_PROFILE

# Extra Cargo flags
Expand Down
5 changes: 4 additions & 1 deletion MakefileEc2.mk
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,10 @@ DIST_DIR = dist
BINARY = morph-reth
TARBALL = morph-reth.tar.gz
CARGO_TARGET_DIR ?= target
PROFILE ?= release
# Production deploys go to EC2 via S3. Default to `profiling` so the shipped
# binaries keep line-table symbols and remain flame-graphable in prod (matches
# the Dockerfile default). Override with `PROFILE=maxperf` for peak throughput.
PROFILE ?= profiling

define cargo_build_and_upload
if [ ! -d $(DIST_DIR) ]; then mkdir -p $(DIST_DIR); fi
Expand Down
2 changes: 1 addition & 1 deletion crates/evm/src/block/curie.rs
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ mod tests {
.storage
.into_iter()
.collect::<Vec<(U256, StorageSlot)>>();
storage.sort_by(|(a, _), (b, _)| a.cmp(b));
storage.sort_by_key(|(a, _)| *a);

let expected_storage = [
(GPO_L1_BLOB_BASE_FEE_SLOT, INITIAL_L1_BLOB_BASE_FEE),
Expand Down
Loading