Skip to content
Merged
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
2 changes: 1 addition & 1 deletion .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
Expand Up @@ -23,4 +23,4 @@

- [ ] Ran `make fmt` β€” clean
- [ ] Ran `make lint` (clippy with `-D warnings`) β€” clean
- [ ] Ran `cargo test --workspace --release` β€” all passing
- [ ] Ran `make test` (`cargo test --workspace --profile release-fast`) β€” all passing
8 changes: 7 additions & 1 deletion CLAUDE.md
Original file line number Diff line number Diff line change
Expand Up @@ -316,11 +316,17 @@ GENESIS_VALIDATORS:

### Running Tests
```bash
cargo test --workspace --release # All workspace tests
cargo test --workspace --profile release-fast # All workspace tests
cargo test -p ethlambda-blockchain --test forkchoice_spectests
cargo test -p ethlambda-blockchain --test forkchoice_spectests -- --test-threads=1 # Sequential
```

Tests run under `release-fast`: release-grade opt-level (needed to avoid stack
overflows in signature verification/aggregation) but no LTO, parallel codegen,
incremental, and line-tables-only debuginfo, so rebuilds are much faster than
`--release`. Artifacts land in `target/release-fast/`, separate from
`cargo build --release`.

## Common Gotchas

### Aggregator Flag Required for Finalization
Expand Down
26 changes: 26 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,32 @@ repository = "https://github.com/lambdaclass/ethlambda"
rust-version = "1.97.1"
version = "0.1.0"

# Cross-crate inlining matters here: the hot paths (SSZ encode/decode, hashing,
# fork choice traversal) are split across workspace crates and their
# dependencies, so keeping every crate in its own codegen unit leaves inlining
# opportunities on the table. Fat LTO plus a single codegen unit trades build
# time for that.
#
# Fat rather than thin: on an 8-node devnet, fat cut mean state transition time
# a further 2.1% over thin (every fat node beat every thin node) at no measurable
# build-time or image-size cost. ethrex uses thin here; we diverge deliberately.
[profile.release]
opt-level = 3
lto = "fat"
codegen-units = 1

# Test profile (see the `test` target in the Makefile). Tests need release-grade
# opt-level: signature verification/aggregation stack-overflows without it. They
# do not need a whole-program-optimized binary, so this drops LTO, restores
# parallel codegen, and keeps line tables for backtraces, which makes test
# rebuilds finish in a fraction of the time of a `release` build.
[profile.release-fast]
inherits = "release"
lto = false
codegen-units = 16
debug = "line-tables-only"
incremental = true

[workspace.dependencies]
ethlambda-blockchain = { path = "crates/blockchain" }
ethlambda-fork-choice = { path = "crates/blockchain/fork_choice" }
Expand Down
5 changes: 3 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -10,8 +10,9 @@ lint: ## πŸ” Run clippy on all workspace crates
cargo clippy --workspace --all-targets -- -D warnings

test: leanSpec/fixtures ## πŸ§ͺ Run all tests
# Tests need to be run on release to avoid stack overflows during signature verification/aggregation
cargo test --workspace --release
# release-fast: release-grade opt-level to avoid stack overflows during
# signature verification/aggregation, without paying for LTO on every rebuild
cargo test --workspace --profile release-fast

GIT_COMMIT=$(shell git rev-parse HEAD)
GIT_BRANCH=$(shell git rev-parse --abbrev-ref HEAD)
Expand Down