Skip to content

fix(contracts): build hierarchical .compact tree for publish#539

Merged
0xisk merged 1 commit into
mainfrom
fix/hierarchical-build
Jun 4, 2026
Merged

fix(contracts): build hierarchical .compact tree for publish#539
0xisk merged 1 commit into
mainfrom
fix/hierarchical-build

Conversation

@0xisk
Copy link
Copy Markdown
Member

@0xisk 0xisk commented Jun 4, 2026

Types of changes

What types of changes does your code introduce to OpenZeppelin Midnight Contracts?
Put an x in the boxes that apply

  • Bugfix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation Update (if none of the other choices apply)

Fixes #???

PR Checklist

Further comments

If this is a relatively large or complex change, kick off the discussion by explaining why you chose the solution you did and what alternatives you considered, etc...

Summary by CodeRabbit

Release Notes

This release contains no user-facing changes. Internal build configuration has been updated to improve the build process.

The flat build copied every module to the package root, but the
modules' internal imports use source-tree relative paths
(`../utils/Utils`, `../security/Initializable`). Flattening severed
them, so 7 of 10 published modules failed to compile in any consumer.

Add `--hierarchical` to the build script so the published package
preserves the access/ security/ token/ utils/ tree. Cross-module
imports now resolve, and consumer import paths match the documented
`@openzeppelin/compact-contracts/<dir>/<Module>` convention.

Verified by packing dist, installing the tarball in a fresh app, and
compiling all 10 modules (including dependent ones) with skip-zk.
@0xisk 0xisk requested review from a team as code owners June 4, 2026 18:24
@coderabbitai
Copy link
Copy Markdown

coderabbitai Bot commented Jun 4, 2026

Review Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Organization UI

Review profile: CHILL

Plan: Pro

Run ID: be776fff-28a3-4888-b284-42a3fc2a81d2

📥 Commits

Reviewing files that changed from the base of the PR and between 4062968 and 768a772.

📒 Files selected for processing (1)
  • contracts/package.json

Walkthrough

The build script in contracts/package.json is updated to pass the --hierarchical flag to compact-builder, preserving all existing build command options, exclude patterns, and cleanup operations.

Changes

Build Configuration

Layer / File(s) Summary
Build script hierarchical flag
contracts/package.json
The build script adds the --hierarchical flag to the compact-builder invocation while preserving all other build command options and cleanup steps.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~2 minutes

Poem

A flag so small, yet builds so grand,
--hierarchical now takes its stand,
In package.json's quiet line,
The builder now shall organize fine! 🐰✨

🚥 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 title accurately summarizes the main change: adding a --hierarchical flag to the build script to preserve directory structure in the published package, fixing broken intra-package imports.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

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

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests
  • Commit unit tests in branch fix/hierarchical-build

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

Copy link
Copy Markdown
Contributor

@andrew-fleming andrew-fleming left a comment

Choose a reason for hiding this comment

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

I was just looking into this. Good call!

@0xisk 0xisk merged commit b33b4fb into main Jun 4, 2026
10 checks passed
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.

2 participants