Skip to content

Reorganize the repository around program and interface crates #255

Closed

Description

@snawaz

Goal

Reorganize this repository into separate program and interface crates without changing the internal v1 or v2 module layout.

This is part of #132. Issue #256 will later move v1 code under legacy and promote v2 modules to the root. Keeping that work separate makes this change a repository and package boundary change only.

This replaces the package names proposed in magicblock-labs/magicblock-validator#1700. That issue can continue to track updates needed in the validator and other consumers.

Package and release names

Component Directory Cargo package Rust crate Starting version Release tag
On-chain program program/ magicblock-delegation-program delegation_program 2.0.0 delegation-program@vX.Y.Z
Public program interface interface/ magicblock-delegation-program-interface delegation_program_interface 0.1.0 delegation-program-interface@vX.Y.Z

The program and interface follow their own SemVer histories. The program starts at 2.0.0 because it continues the existing on-chain program. The interface starts at 0.1.0 because it is a new Rust package whose public API may still change.

The existing magicblock-delegation-program-api package and its tags remain frozen for older clients. Do not publish new versions under that name.

The dependency direction is:

program ──> interface
integration tests ──> program + interface

The interface must not depend on the program.

Release model

Use one release/v* branch and one pull request to prepare any combination of program and interface releases. The versions in their manifests and component tags are authoritative; the two packages do not need matching versions.

The interface release publishes magicblock-delegation-program-interface to crates.io and creates a GitHub Release.

The program has publish = false. Its tag and GitHub Release record the exact source version deployed on-chain; it is never published to crates.io.

Repository shape after this issue

delegation-program/
├── Cargo.toml                    # virtual workspace
├── Cargo.lock
├── program/
│   ├── Cargo.toml
│   ├── src/
│   │   ├── processor/           # current v1 implementation
│   │   └── v2/
│   └── tests/
├── interface/
│   ├── Cargo.toml
│   └── src/
│       ├── instruction_builder/ # current v1 interface
│       ├── state/
│       ├── v2/
│       ├── compact/
│       ├── diff/
│       └── encryption/
├── integration-tests/
│   └── anchor/
├── docs/
│   ├── design/
│   └── releases/
├── scripts/
├── idl/
├── audits/
└── .github/

Direct movement

Current location or name New location or name
Root package in Cargo.toml program/Cargo.toml; the root manifest becomes a virtual workspace
Root library crate dlp program/ library crate delegation_program
src/** program/src/**, preserving the current module structure
tests/** program/tests/**, preserving current test and fixture names
Public code in dlp-api/** interface/**, preserving its Cargo feature gates
On-chain diff application program/src/**
tests/integration/ integration-tests/anchor/
mimd-0024-impl.md docs/design/mimd-0024-fraud-proofs.md
RELEASE_PROCESS.md docs/releases/process.md
security_audits/ audits/
idl/delegation.json idl/delegation_program.json
Root mod.rs Remove it; it is not part of a crate
Empty root package-lock.json Remove it

Keep instruction builders, diff generation, encryption, decryption, and related off-chain helpers in the interface. Use Cargo features such as diff and encryption, as the existing dlp-api does. Consumers that do not need these helpers can disable default features.

Move tracked integration-test source and keypairs out of generated target/ directories. Generated target/, node_modules/, and local ledger output must remain untracked.

Boundaries

  • Keep the program ID, instruction encodings, account layouts, PDA seeds, error values, and protocol behavior unchanged.
  • Preserve the current v1 and v2 module structure. Issue Move v1 code under legacy and promote v2 modules to the root #256 owns the legacy move and v2 module promotion.
  • Do not rename v2 types, instructions, tests, or fixtures in this issue.
  • Do not carry the public names dlp, dlp-api, or dlp_api into the new crates.
  • Do not add a speculative client, common, or shared crate.

Repository updates

Update workspace manifests, imports, feature flags, CI workflows, release automation, deployment artifact paths, CodeRabbit paths, documentation, and integration-test configuration for the new layout and names.

Update magicblock-labs/magicblock-validator#1700 to use the package names defined here when consumer migration begins.

Verification

  • Formatting and workspace builds pass.
  • Interface tests pass for the supported feature combinations, including encryption and diff.
  • SBF tests and the production SBF build pass from program/.
  • Anchor integration tests pass from integration-tests/anchor/.
  • The interface passes a package dry run.
  • Package dependencies follow the documented direction.

Activity

  1. self-assigned this
    on Oct 20, 2026
  2. added theissue type on Oct 20, 2026
  3. changed the title [-]Reorganize the repository around program, interface, and client crates[/-] [+]Reorganize the repository around program and interface crates[/+] on Oct 21, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions