Skip to content

refactor(primitives): remove batch_hash from morph header#31

Merged
panos-xyz merged 2 commits intomainfrom
refactor/remove-batch-hash
Feb 27, 2026
Merged

refactor(primitives): remove batch_hash from morph header#31
panos-xyz merged 2 commits intomainfrom
refactor/remove-batch-hash

Conversation

@panos-xyz
Copy link
Contributor

@panos-xyz panos-xyz commented Feb 26, 2026

Remove the batch_hash field from MorphHeader as it is no longer necessary and increases maintenance complexity.

Changes:

  • Remove batch_hash field from MorphHeader struct
  • Remove is_batch_point() method
  • Remove batch_hash parameter from new_l2_block API
  • Remove batch_hash from SafeL2Data struct
  • Remove apply_batch_hash function from engine-api builder
  • Update all related documentation and tests

Closes #24

Summary by CodeRabbit

  • Refactor

    • Removed batch-hash usage from L2 block creation and RPC surfaces, simplifying payload submission paths.
    • Simplified block header and payload data to exclude batch-related fields.
    • Updated related tooling and tests to reflect the streamlined header and payload shapes.
  • Documentation

    • Clarified L2 header docs to reference only the remaining L2-specific field.

Remove the `batch_hash` field from `MorphHeader` as it is no longer
necessary and increases maintenance complexity.

Changes:
- Remove `batch_hash` field from `MorphHeader` struct
- Remove `is_batch_point()` method
- Remove `batch_hash` parameter from `new_l2_block` API
- Remove `batch_hash` from `SafeL2Data` struct
- Remove `apply_batch_hash` function from engine-api builder
- Update all related documentation and tests

Closes #24
@coderabbitai
Copy link

coderabbitai bot commented Feb 26, 2026

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between b98ddf4 and fb9676f.

📒 Files selected for processing (2)
  • crates/engine-api/src/builder.rs
  • crates/primitives/src/header.rs

📝 Walkthrough

Walkthrough

This PR removes the batch_hash field/parameter across the codebase: it is deleted from MorphHeader and SafeL2Data, and new_l2_block signatures in engine API, RPC, and builder layers are updated to accept only ExecutableL2Data. Call sites, docs, and tests are adjusted accordingly.

Changes

Cohort / File(s) Summary
Engine API / RPC
crates/engine-api/src/api.rs, crates/engine-api/src/rpc.rs, crates/engine-api/src/builder.rs
Removed batch_hash: Option<B256> from MorphL2EngineApi::new_l2_block / RPC trait and implementations. Updated RPC handler and builder call sites, removed batch_hash logging and helper apply_batch_hash.
Primitive & Payload Types
crates/primitives/src/header.rs, crates/payload/types/src/safe_l2_data.rs
Removed batch_hash field from MorphHeader and batch_hash from SafeL2Data; deleted related methods (is_batch_point, has_batch), imports, and tests. Updated From<Header> and InMemorySize logic.
EVM / Payload Builder / Docs
crates/evm/src/assemble.rs, crates/evm/src/engine.rs, crates/evm/src/lib.rs, crates/payload/builder/src/builder.rs
Updated comments/docs and removed explicit batch_hash initialization in test/payload builder code. Minor comment cleanups to reflect header field removal.

Estimated code review effort

🎯 3 (Moderate) | ⏱️ ~20 minutes

Possibly related PRs

Suggested labels

enhancement

Suggested reviewers

  • chengwenxi

Poem

🐰 I hopped through headers, tidy and spry,
Took out a weight called batch_hash—goodbye!
Now blocks hum lighter in morning's glow,
next_l1_msg_index leads the show.
A little refactor, a rabbit's small cheer. 🥕

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The PR title accurately summarizes the primary change: removing batch_hash from the MorphHeader struct across the codebase.
Linked Issues check ✅ Passed All code requirements from issue #24 are met: batch_hash removed from MorphHeader, SafeL2Data, new_l2_block API signature, apply_batch_hash function eliminated, and all related references updated across payload, EVM, RPC, and engine-api modules.
Out of Scope Changes check ✅ Passed All changes are directly aligned with the objective to remove batch_hash from headers and related structures; no out-of-scope modifications detected.
Docstring Coverage ✅ Passed Docstring coverage is 100.00% which is sufficient. The required threshold is 80.00%.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
  • 📝 Generate docstrings (stacked PR)
  • 📝 Generate docstrings (commit on current branch)
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Post copyable unit tests in a comment
  • Commit unit tests in branch refactor/remove-batch-hash

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

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

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@crates/engine-api/src/builder.rs`:
- Line 371: Run rustfmt by executing `cargo fmt --all` to fix the formatting
drift; specifically ensure the long statement that assigns recovered_with_data
using apply_executable_data_overrides(executed.recovered_block().clone(),
&data)? is wrapped/formatted per rustfmt rules (so the call arguments and
trailing ? are properly line-broken), then re-run CI to confirm the lint blocker
is cleared.

ℹ️ Review info

Configuration used: defaults

Review profile: CHILL

Plan: Pro

📥 Commits

Reviewing files that changed from the base of the PR and between 9fd3d45 and b98ddf4.

📒 Files selected for processing (9)
  • crates/engine-api/src/api.rs
  • crates/engine-api/src/builder.rs
  • crates/engine-api/src/rpc.rs
  • crates/evm/src/assemble.rs
  • crates/evm/src/engine.rs
  • crates/evm/src/lib.rs
  • crates/payload/builder/src/builder.rs
  • crates/payload/types/src/safe_l2_data.rs
  • crates/primitives/src/header.rs
💤 Files with no reviewable changes (2)
  • crates/payload/builder/src/builder.rs
  • crates/evm/src/engine.rs

@panos-xyz panos-xyz requested a review from chengwenxi February 26, 2026 07:08
@panos-xyz panos-xyz merged commit acc1945 into main Feb 27, 2026
9 checks passed
@panos-xyz panos-xyz deleted the refactor/remove-batch-hash branch February 27, 2026 01:47
panos-xyz added a commit that referenced this pull request Mar 2, 2026
* refactor(primitives): remove batch_hash from morph header

Remove the `batch_hash` field from `MorphHeader` as it is no longer
necessary and increases maintenance complexity.

Changes:
- Remove `batch_hash` field from `MorphHeader` struct
- Remove `is_batch_point()` method
- Remove `batch_hash` parameter from `new_l2_block` API
- Remove `batch_hash` from `SafeL2Data` struct
- Remove `apply_batch_hash` function from engine-api builder
- Update all related documentation and tests

Closes #24

* style: format code
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

refactor(primitives): remove batch_hash from morph header

2 participants