Skip to content

Conversation

@notdanilo
Copy link
Contributor

@notdanilo notdanilo commented Nov 14, 2025

Status Type ⚠️ Core Change Issue
Ready Feature Yes/No #194

Problem

We return the components data serialized so we can send it to the component program to update the PDAs data. It's currently limited to 1024 bytes. We want to improve that.

Solution

  1. Using the first component PDA as a buffer to store the return data
  2. Pass the first component PDA data through the instruction args and rebuild the Anchor Context from it

Summary by CodeRabbit

Release Notes

  • New Features

    • Added bundle support to combine components and systems into a single deployable unit
    • New CLI command to create bundles from templates
    • Introduced Component and System abstractions in TypeScript and C# client libraries
  • Examples

    • Added example bundle demonstrating position/velocity components with movement and stop systems
    • Added large component example
  • Removed

    • Removed standalone bolt-component and bolt-system programs in favor of bundle-based approach
@coderabbitai
Copy link

coderabbitai bot commented Nov 14, 2025

Important

Review skipped

Auto reviews are disabled on base/target branches other than the default branch.

Please check the settings in the CodeRabbit UI or the .coderabbit.yaml file in this repository. To trigger a single review, invoke the @coderabbitai review command.

You can disable this status message by setting the reviews.review_status to false in the CodeRabbit configuration file.

Walkthrough

This PR introduces a major architectural refactor consolidating Bolt's macro infrastructure into a unified attribute crate, restructures component and system handling around bundles and discriminators, removes standalone bolt-component and bolt-system programs, and updates both Rust and client libraries (C#/TypeScript) to support the new ECS abstractions with component/system wrapper types.

Changes

Cohort / File(s) Change Summary
CI/CD Workflows
.github/workflows/publish-bolt-crates.yml, .github/workflows/publish-bolt-sdk.yml, .github/workflows/run-tests.yml
Added EXAMPLE_BUNDLE keypair secret provisioning in deployment key setup steps.
Workspace Configuration
Anchor.toml, Cargo.toml, scripts/test-publish.sh
Restructured workspace members and dependencies: removed bolt-component/bolt-system, added bolt-attribute-bolt-bundle, and refactored example paths to include bundle, large, and system-related components.
Bolt Lang Attribute Architecture Refactoring
crates/bolt-lang/attribute/*
Consolidated macro implementations from distributed proc-macro crates into unified bolt-attribute crate with modular submodules (bundle, component, delegate, system). Removed bolt-program and bolt-delegate proc-macro crates; migrated logic to shared attribute processor.
Removed Programs
crates/programs/bolt-component/*, crates/programs/bolt-system/*
Completely removed bolt-component and bolt-system program crates, including all instruction handlers, account structs, and CPI support.
Bolt Lang Core Expansion
crates/bolt-lang/src/{account.rs, bpf_writer.rs, context/mod.rs, cpi/mod.rs, instructions/*, lib.rs}, crates/bolt-lang/utils/src/lib.rs
Added BoltAccount ownership wrapper, BpfWriter utility, context reconstruction helpers, new instruction functions (initialize, destroy, update, set_owner), CPI validation, and BoltMetadata field injection.
World Program Discriminator Integration
crates/programs/world/src/{lib.rs, utils.rs}, crates/programs/world/Cargo.toml
Refactored from direct bolt-component CPI to discriminator-based instruction dispatch; added system_execute generic dispatcher and discriminator computation utilities; removed legacy builder methods.
Bundle Examples
examples/bundle/*, examples/component-large/*, examples/with-large-component/*
Added three new example crates: example-bundle (demonstrating bundled components/systems), large (component with 1KB data field), with-large-component (system using large component).
C# ECS Abstractions
clients/csharp/Solana.Unity.Bolt/ECS/{Component.cs, Identifier.cs, System.cs}, clients/csharp/Solana.Unity.Bolt/WorldProgram/{Bolt.cs, ApplySystem.cs, DelegateComponent.cs, DestroyComponent.cs, InitializeComponent.cs, Generated.cs, World.cs}
Introduced Component, Identifier, System wrapper classes; added GetDiscriminator computation; extended World API with discriminator-based Apply variants (ApplyWithDiscriminator, ApplyWithSessionAndDiscriminator); enhanced instruction builders to accept Component objects with PDA derivation.
C# Test Updates
clients/csharp/Solana.Unity.Bolt.Test/{AccelerationTest.cs, ECSTest.cs, Framework.cs}
Added Framework properties for example bundle program and bundle PDAs; added four new bundled component/system test methods (InitializeBundledPositionOnEntity1, InitializeBundledVelocityOnEntity1, ApplyBundledMovementOnEntity1, ApplyBundledStopOnEntity1); refactored ApplyAccounts usage to ApplySystem with entity arrays.
TypeScript ECS Abstractions
clients/typescript/src/ecs/{component.ts, identifier.ts, system.ts, index.ts}, clients/typescript/src/index.ts, clients/typescript/src/delegation/delegate.ts
Introduced Component, Identifier, System classes mirroring C# abstractions; added GetDiscriminator utility; updated DelegateComponent to accept Component wrapper; re-exported ECS types from main index.
TypeScript Transaction Updates
clients/typescript/src/world/transactions.ts, clients/typescript/test/{framework.ts, intermediate-level/acceleration.ts, intermediate-level/ecs.ts, low-level/ecs.ts, low-level/index.ts, main.ts}
Refactored transaction builders (DestroyComponent, InitializeComponent, ApplySystem) to accept Component/System wrapper types; updated remaining accounts assembly to use discriminator-based lookups; added bundled component initialization and system application tests; disabled intermediate-level tests.
Documentation & Metadata
docs/REPORT.md, crates/bolt-lang/Cargo.toml, crates/bolt-lang/attribute/Cargo.toml, crates/bolt-cli/src/{bundle.rs, lib.rs, rust_template.rs, templates/bundle/*, templates/mod.rs, templates/workspace/workspace.toml.template}
Updated benchmark data in reports; added bolt-cli support for bundle scaffold generation via new_bundle command; updated manifest dependencies; extended workspace template to include bundle patterns.

Sequence Diagram(s)

sequenceDiagram participant Client as Client<br/>(C#/TS) participant TxBuilder as Transaction<br/>Builder participant Discriminator as Discriminator<br/>Compute participant World as World<br/>Program participant System as System<br/>Program Note over Client,System: Bundled Component Lifecycle Client->>TxBuilder: InitializeComponent(Component) TxBuilder->>Discriminator: component.getMethodDiscriminator("initialize") Discriminator-->>TxBuilder: discriminator [8 bytes] TxBuilder->>World: InitializeComponentWithDiscriminator(discriminator) World-->>Client: Transaction Client->>TxBuilder: ApplySystem(systemId, [Component], args) TxBuilder->>Discriminator: system.getMethodDiscriminator(method) Discriminator-->>TxBuilder: system_discriminator [8 bytes] TxBuilder->>World: ApplyWithDiscriminator(system_discriminator) World->>System: CPI with discriminator-tagged instruction System->>World: (returns updated component data) World-->>Client: Updated components 
Loading
sequenceDiagram participant MacroUser as Macro<br/>User participant BundleAttr as bolt-attribute<br/>bundle participant ComponentProc as component<br/>processor participant SystemProc as system<br/>processor Note over MacroUser,SystemProc: Bundle Macro Expansion MacroUser->>BundleAttr: #[bundle] mod my_bundle { #[component] Position, #[system] Movement } BundleAttr->>ComponentProc: Process Position component ComponentProc-->>BundleAttr: Generated: Initialize, Destroy, Update functions BundleAttr->>SystemProc: Process Movement system via transform_module_for_bundle SystemProc-->>BundleAttr: Generated: bolt_execute wrapper, VariadicBoltComponents scaffold BundleAttr->>BundleAttr: Inject program scaffold with owner, delegate items BundleAttr-->>MacroUser: Expanded bundle program module 
Loading

Estimated code review effort

🎯 5 (Critical) | ⏱️ ~120 minutes

Specific areas requiring careful review:

  • Macro architecture refactoring (crates/bolt-lang/attribute/src/{bundle,component,system,delegate}/mod.rs): Core logic migration from distributed crates to unified processor—verify no logic loss, proper delegation chains, and attribute parsing correctness.
  • Discriminator-based dispatch (crates/programs/world/src/lib.rs, WorldProgram discriminator methods): Ensure discriminator computation matches clients, correct instruction data serialization, and proper remaining accounts assembly for CPI dispatch.
  • BoltAccount ownership wrapping (crates/bolt-lang/src/account.rs, crates/bolt-lang/attribute/system-input/src/lib.rs): Verify pubkey reconstruction from u128 components is correct, account traits properly delegate to inner type, and system-input account type aliases resolve correctly.
  • Component/System wrapper abstraction (clients/csharp/Solana.Unity.Bolt/WorldProgram/ApplySystem.cs, clients/typescript/src/world/transactions.ts): Validate PDA derivation via wrapper matches on-chain expectations, discriminator extraction is consistent across implementations, and remaining accounts are assembled in correct order.
  • Bundle example and test integration (examples/bundle/*, clients/typescript/test/intermediate-level/ecs.ts): Confirm bundle component initialization, system application, and state transitions work end-to-end across Rust/C#/TypeScript.

Possibly related PRs

Pre-merge checks and finishing touches

❌ Failed checks (2 warnings, 1 inconclusive)
Check name Status Explanation Resolution
Description check ⚠️ Warning The pull request description is missing key sections from the template: Before & After Screenshots, Other changes, and Deploy Notes sections are absent. While Problem and Solution are present, the description lacks sufficient detail about the scope and deployment requirements. Complete the description by adding missing sections: Before & After Screenshots (if applicable), Other changes (if any), and Deploy Notes section to document any new dependencies, scripts, or deployment considerations.
Docstring Coverage ⚠️ Warning Docstring coverage is 70.71% which is insufficient. The required threshold is 80.00%. You can run @coderabbitai generate docstrings to improve docstring coverage.
Title check ❓ Inconclusive The title ':sparkles: Increased max return size' is somewhat vague and lacks specificity about the core change. While it mentions increasing return size, it doesn't clearly convey the main architectural change of using PDAs as buffers to overcome the 1024-byte limitation. Consider revising to ':sparkles: Use component PDA buffer for increased return data size' or similar to better reflect the architectural change being implemented.

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.

@notdanilo notdanilo changed the base branch from main to feature/bundle November 14, 2025 16:37
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

2 participants