浏览代码

:white_check_mark: Profiling system with 1 to 10 components

Danilo Guanabara 1 月之前
父节点
当前提交
faa205c2fd
共有 38 个文件被更改,包括 645 次插入163 次删除
  1. 11 4
      Anchor.toml
  2. 90 25
      Cargo.lock
  3. 0 1
      Cargo.toml
  4. 81 10
      clients/typescript/test/framework.ts
  5. 40 67
      clients/typescript/test/intermediate-level/ecs.ts
  6. 9 0
      docs/REPORT.md
  7. 0 17
      examples/component-large/src/lib.rs
  8. 5 4
      examples/system-with-1-component/Cargo.toml
  9. 0 0
      examples/system-with-1-component/Xargo.toml
  10. 18 0
      examples/system-with-1-component/src/lib.rs
  11. 5 5
      examples/system-with-10-components/Cargo.toml
  12. 0 0
      examples/system-with-10-components/Xargo.toml
  13. 2 3
      examples/system-with-10-components/src/lib.rs
  14. 8 4
      examples/system-with-2-components/Cargo.toml
  15. 0 0
      examples/system-with-2-components/Xargo.toml
  16. 19 0
      examples/system-with-2-components/src/lib.rs
  17. 26 0
      examples/system-with-3-components/Cargo.toml
  18. 2 0
      examples/system-with-3-components/Xargo.toml
  19. 20 0
      examples/system-with-3-components/src/lib.rs
  20. 26 0
      examples/system-with-4-components/Cargo.toml
  21. 2 0
      examples/system-with-4-components/Xargo.toml
  22. 21 0
      examples/system-with-4-components/src/lib.rs
  23. 26 0
      examples/system-with-5-components/Cargo.toml
  24. 2 0
      examples/system-with-5-components/Xargo.toml
  25. 22 0
      examples/system-with-5-components/src/lib.rs
  26. 26 0
      examples/system-with-6-components/Cargo.toml
  27. 2 0
      examples/system-with-6-components/Xargo.toml
  28. 23 0
      examples/system-with-6-components/src/lib.rs
  29. 26 0
      examples/system-with-7-components/Cargo.toml
  30. 2 0
      examples/system-with-7-components/Xargo.toml
  31. 24 0
      examples/system-with-7-components/src/lib.rs
  32. 26 0
      examples/system-with-8-components/Cargo.toml
  33. 2 0
      examples/system-with-8-components/Xargo.toml
  34. 25 0
      examples/system-with-8-components/src/lib.rs
  35. 26 0
      examples/system-with-9-components/Cargo.toml
  36. 2 0
      examples/system-with-9-components/Xargo.toml
  37. 26 0
      examples/system-with-9-components/src/lib.rs
  38. 0 23
      examples/system-with-few-components/src/lib.rs

+ 11 - 4
Anchor.toml

@@ -10,15 +10,22 @@ world = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
 [programs.localnet]
 bolt-component = "CmP2djJgABZ4cRokm4ndxuq6LerqpNHLBsaUv2XKEJua"
 bolt-system = "7X4EFsDJ5aYTcEjKzJ94rD8FRKgQeXC89fkpeTS4KaqP"
-component-large = "FJjiJoz799Q6NqYffXbsFFj1pBmwsQZgcoizCfWvM5HX"
 component-small = "9yBADAhoTWCkNRB6hbfpwUgPpxyJiF9uEiWVPR6k7A4y"
 position = "Fn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ"
 system-apply-velocity = "6LHhFVwif6N9Po3jHtSmMVtPjF6zRfL3xMosSzcrQAS8"
 system-fly = "HT2YawJjkNmqWcLNfPAMvNsLdWwPvvvbKA5bpMw4eUpq"
 system-simple-movement = "FSa6qoJXFBR3a7ThQkTAMrC15p6NkchPEjBdd4n6dXxA"
-system-with-few-components = "A3kNNSgmkTNA5V1qtnrbtNeqKrYHNxUMCTkqTDaQzE97"
-system-with-many-components = "Hi4sMEb3uXhWCiLyrF7t3Z384an7YZsTj774cabAAPQB"
 velocity = "CbHEFbSQdRN4Wnoby9r16umnJ1zWbULBHg4yqzGQonU1"
+with-1-component = "BsVKJF2H9GN1P9WrexdgEY4ztiweKvfQo6ydLWUEw6n7"
+with-2-components = "X5wTvz1i6ocNXzfrEB8JmhFCniojUZxqk3TXDq98fZX"
+with-3-components = "9R7rvEwCuZ6iow1Ch3sdUQKib4LBvftyBmyvSnPaAZkG"
+with-4-components = "2w9pkZoCfEciHLLDhG3zrZRprcYH7nojhyBQMnD3PtUU"
+with-5-components = "8KsdHMGdS4mQjpKFhc2PWBw2tyxwNbEKCnZLKp3riC5o"
+with-6-components = "3ndvNAg4moKeLhuWQtDmcN43PuvvGsigQWRBPthfWEN3"
+with-7-components = "4ESiD77Gjjfuywhw8NBnryHezXtwDSA27ustL29JdX7i"
+with-8-components = "EbTAEnrVV4f8W7Fd4TxW3jLjfpyhr74wQf7rSHRQ8u78"
+with-9-components = "GKdPXW7pGhFNRdMPHWNsrmqc7haXQk4VFCAyZKsrgYQG"
+with-10-components = "C69UYWaXBQXUbhHQGtG8pB7DHSgh2z5Sm9ifyAnM1kkt"
 
 [registry]
 url = "https://api.apr.dev"
@@ -28,7 +35,7 @@ cluster = "localnet"
 wallet = "./tests/fixtures/provider.json"
 
 [workspace]
-members = ["crates/programs/bolt-component", "crates/programs/bolt-system", "crates/programs/world", "examples/component-position", "examples/component-velocity", "examples/system-apply-velocity", "examples/system-fly", "examples/system-simple-movement", "examples/system-with-many-components", "examples/system-with-few-components", "examples/component-large", "examples/component-small"]
+members = ["crates/programs/bolt-component", "crates/programs/bolt-system", "crates/programs/world", "examples/component-position", "examples/component-velocity", "examples/system-apply-velocity", "examples/system-fly", "examples/system-simple-movement", "examples/component-small", "examples/system-with-1-component", "examples/system-with-2-components", "examples/system-with-3-components", "examples/system-with-4-components", "examples/system-with-5-components", "examples/system-with-6-components", "examples/system-with-7-components", "examples/system-with-8-components", "examples/system-with-9-components", "examples/system-with-10-components"]
 
 [scripts]
 test = "tests/script.sh"

+ 90 - 25
Cargo.lock

@@ -1258,13 +1258,6 @@ dependencies = [
  "memchr",
 ]
 
-[[package]]
-name = "component-large"
-version = "0.2.4"
-dependencies = [
- "bolt-lang",
-]
-
 [[package]]
 name = "component-small"
 version = "0.2.4"
@@ -5917,24 +5910,6 @@ dependencies = [
  "serde",
 ]
 
-[[package]]
-name = "system-with-few-components"
-version = "0.2.4"
-dependencies = [
- "bolt-lang",
- "component-large",
- "serde",
-]
-
-[[package]]
-name = "system-with-many-components"
-version = "0.2.4"
-dependencies = [
- "bolt-lang",
- "component-small",
- "serde",
-]
-
 [[package]]
 name = "tar"
 version = "0.4.43"
@@ -7013,6 +6988,96 @@ dependencies = [
  "bitflags 2.6.0",
 ]
 
+[[package]]
+name = "with-1-component"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-10-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-2-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-3-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-4-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-5-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-6-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-7-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-8-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
+[[package]]
+name = "with-9-components"
+version = "0.2.3"
+dependencies = [
+ "bolt-lang",
+ "component-small",
+ "serde",
+]
+
 [[package]]
 name = "world"
 version = "0.2.4"

+ 0 - 1
Cargo.toml

@@ -8,7 +8,6 @@ members = [
     "crates/programs/world",
     "crates/types",
     "examples/*",
-    "examples/system-with-many-components",
 ]
 
 [workspace.package]

+ 81 - 10
clients/typescript/test/framework.ts

@@ -5,6 +5,8 @@ export enum Direction {
   Down = "Down",
 }
 
+import { writeFileSync } from "fs";
+import { resolve } from "path";
 import { anchor, BN } from "../lib";
 import { type World } from "../../../target/types/world";
 import { type Position } from "../../../target/types/position";
@@ -13,10 +15,17 @@ import { type SystemSimpleMovement } from "../../../target/types/system_simple_m
 import { type SystemFly } from "../../../target/types/system_fly";
 import { type SystemApplyVelocity } from "../../../target/types/system_apply_velocity";
 import { Connection, Keypair, PublicKey } from "@solana/web3.js";
-import { SystemWithManyComponents } from "../../../target/types/system_with_many_components";
-import { Large } from "../../../target/types/large";
 import { Small } from "../../../target/types/small";
-import { SystemWithFewComponents } from "../../../target/types/system_with_few_components";
+import { With1Component } from "../../../target/types/with_1_component";
+import { With2Components } from "../../../target/types/with_2_components";
+import { With3Components } from "../../../target/types/with_3_components";
+import { With4Components } from "../../../target/types/with_4_components";
+import { With5Components } from "../../../target/types/with_5_components";
+import { With6Components } from "../../../target/types/with_6_components";
+import { With7Components } from "../../../target/types/with_7_components";
+import { With8Components } from "../../../target/types/with_8_components";
+import { With9Components } from "../../../target/types/with_9_components";
+import { With10Components } from "../../../target/types/with_10_components";
 
 export class Framework {
   provider: anchor.AnchorProvider;
@@ -27,9 +36,16 @@ export class Framework {
   systemSimpleMovement: anchor.Program<SystemSimpleMovement>;
   systemFly: anchor.Program<SystemFly>;
   systemApplyVelocity: anchor.Program<SystemApplyVelocity>;
-  systemWithManyComponents: anchor.Program<SystemWithManyComponents>;
-  systemWithFewComponents: anchor.Program<SystemWithFewComponents>;
-  componentLarge: anchor.Program<Large>;
+  systemWith1Component: anchor.Program<With1Component>;
+  systemWith2Components: anchor.Program<With2Components>;
+  systemWith3Components: anchor.Program<With3Components>;
+  systemWith4Components: anchor.Program<With4Components>;
+  systemWith5Components: anchor.Program<With5Components>;
+  systemWith6Components: anchor.Program<With6Components>;
+  systemWith7Components: anchor.Program<With7Components>;
+  systemWith8Components: anchor.Program<With8Components>;
+  systemWith9Components: anchor.Program<With9Components>;
+  systemWith10Components: anchor.Program<With10Components>;
   componentSmall: anchor.Program<Small>;
   worldPda: PublicKey;
   worldId: BN;
@@ -58,6 +74,16 @@ export class Framework {
     this.systemWithFewComponents = anchor.workspace.SystemWithFewComponents;
     this.componentLarge = anchor.workspace.Large;
     this.componentSmall = anchor.workspace.Small;
+    this.systemWith1Component = anchor.workspace.With1Component;
+    this.systemWith2Components = anchor.workspace.With2Components;
+    this.systemWith3Components = anchor.workspace.With3Components;
+    this.systemWith4Components = anchor.workspace.With4Components;
+    this.systemWith5Components = anchor.workspace.With5Components;
+    this.systemWith6Components = anchor.workspace.With6Components;
+    this.systemWith7Components = anchor.workspace.With7Components;
+    this.systemWith8Components = anchor.workspace.With8Components;
+    this.systemWith9Components = anchor.workspace.With9Components;
+    this.systemWith10Components = anchor.workspace.With10Components;
 
     this.provider = anchor.AnchorProvider.local();
     anchor.setProvider(this.provider);
@@ -73,7 +99,11 @@ export class Framework {
     return parseInt(consumed);
   }
 
-  report(log: string[]) {
+  report(log: string[]): {
+    cpiCount: number;
+    totalCpiCU: number;
+    totalCu: number;
+  } {
     var cpi: number[] = [];
     var worldReport: number = 0;
     for (let index in log) {
@@ -88,8 +118,49 @@ export class Framework {
     }
     let total = cpi.reduce((a, b) => a + b, 0);
     let numberOfInstructions = cpi.length;
-    console.log(`Total CPI Consumed: ${total}`);
-    console.log(`Number of Instructions: ${numberOfInstructions}`);
-    console.log(`World Report: ${worldReport}`);
+
+    return {
+      cpiCount: numberOfInstructions,
+      totalCpiCU: total,
+      totalCu: worldReport,
+    };
+  }
+
+  saveReport(reports: any[]) {
+    const projectRoot = process.cwd();
+    const filePath = resolve(projectRoot, "docs", "REPORT.md");
+
+    let report = "```mermaid\n";
+    report += `%%{init: {"xyChart": {"width": 1200, "height": 400, "xAxis": {}}}}%%\n`;
+    report += "xychart\n";
+    report += "    title \"Bolt Apply System Cost\"\n";
+    report += "    x-axis [";
+    for (let i = 0; i < reports.length; i++) {
+      report += `"${i + 1}C-CPIs:${reports[i].cpiCount}"`;
+      if (i < reports.length - 1) {
+        report += ",";
+      }
+    }
+    report += "]\n";
+    report += "    y-axis \"CU\" 5000 --> 200000\n";
+    report += "    bar [";
+    for (let i = 0; i < reports.length; i++) {
+      report += reports[i].totalCu;
+      if (i < reports.length - 1) {
+        report += ",";
+      }
+    }
+    report += "]\n";
+    report += "    bar [";
+    for (let i = 0; i < reports.length; i++) {
+      report += reports[i].totalCpiCU;
+      if (i < reports.length - 1) {
+        report += ",";
+      }
+    }
+    report += "]\n";
+    report += "```\n";
+
+    writeFileSync(filePath, report);
   }
 }

+ 40 - 67
clients/typescript/test/intermediate-level/ecs.ts

@@ -270,9 +270,9 @@ export function ecs(framework: Framework) {
       expect(position.z.toNumber()).to.equal(300);
     });
 
-    it("Apply System With Few Components on Entity 1", async () => {
+    it("Reports profile", async () => {
       let entitiesPdas: web3.PublicKey[] = [];
-      for (let i = 0; i < 5; i++) {
+      for (let i = 0; i < 10; i++) {
         const addEntity = await AddEntity({
           payer: framework.provider.wallet.publicKey,
           world: framework.worldPda,
@@ -283,11 +283,11 @@ export function ecs(framework: Framework) {
       }
 
       let componentsPdas: web3.PublicKey[] = [];
-      for (let i = 0; i < 5; i++) {
+      for (let i = 0; i < 10; i++) {
         const initializeComponent = await InitializeComponent({
           payer: framework.provider.wallet.publicKey,
           entity: entitiesPdas[i],
-          componentId: framework.componentLarge.programId,
+          componentId: framework.componentSmall.programId,
         });
         await framework.provider.sendAndConfirm(
           initializeComponent.transaction,
@@ -295,75 +295,48 @@ export function ecs(framework: Framework) {
         componentsPdas.push(initializeComponent.componentPda);
       }
 
-      const applySystem = await ApplySystem({
-        authority: framework.provider.wallet.publicKey,
-        systemId: framework.systemWithFewComponents.programId,
-        world: framework.worldPda,
-        entities: entitiesPdas.map((entity) => ({
-          entity,
-          components: [{ componentId: framework.componentLarge.programId }],
-        })),
-      });
-      let signature = await framework.provider.sendAndConfirm(
-        applySystem.transaction,
-      );
-
-      let transactionResponse: any;
-      do {
-        transactionResponse =
-          await framework.provider.connection.getTransaction(signature, {
-            commitment: "confirmed",
-          });
-      } while (transactionResponse?.meta?.logMessages === undefined);
-      framework.report(transactionResponse?.meta?.logMessages);
-    });
-
-    it("Apply System With Many Components on Entity 1", async () => {
-      let entitiesPdas: web3.PublicKey[] = [];
-      for (let i = 0; i < 10; i++) {
-        const addEntity = await AddEntity({
-          payer: framework.provider.wallet.publicKey,
+      let systems = [
+        framework.systemWith1Component.programId,
+        framework.systemWith2Components.programId,
+        framework.systemWith3Components.programId,
+        framework.systemWith4Components.programId,
+        framework.systemWith5Components.programId,
+        framework.systemWith6Components.programId,
+        framework.systemWith7Components.programId,
+        framework.systemWith8Components.programId,
+        framework.systemWith9Components.programId,
+        framework.systemWith10Components.programId,
+      ];
+
+      var reports: any[] = [];
+      for (let i = 0; i < systems.length; i++) {
+        const systemId = systems[i];
+        const applySystem = await ApplySystem({
+          authority: framework.provider.wallet.publicKey,
+          systemId: systemId,
           world: framework.worldPda,
-          connection: framework.provider.connection,
+          entities: entitiesPdas.slice(0, i + 1).map((entity) => ({
+            entity,
+            components: [{ componentId: framework.componentSmall.programId }],
+          })),
         });
-        await framework.provider.sendAndConfirm(addEntity.transaction);
-        entitiesPdas.push(addEntity.entityPda);
-      }
 
-      let componentsPdas: web3.PublicKey[] = [];
-      for (let i = 0; i < 10; i++) {
-        const initializeComponent = await InitializeComponent({
-          payer: framework.provider.wallet.publicKey,
-          entity: entitiesPdas[i],
-          componentId: framework.componentSmall.programId,
-        });
-        await framework.provider.sendAndConfirm(
-          initializeComponent.transaction,
+        let signature = await framework.provider.sendAndConfirm(
+          applySystem.transaction,
         );
-        componentsPdas.push(initializeComponent.componentPda);
-      }
 
-      const applySystem = await ApplySystem({
-        authority: framework.provider.wallet.publicKey,
-        systemId: framework.systemWithManyComponents.programId,
-        world: framework.worldPda,
-        entities: entitiesPdas.map((entity) => ({
-          entity,
-          components: [{ componentId: framework.componentSmall.programId }],
-        })),
-      });
-      let signature = await framework.provider.sendAndConfirm(
-        applySystem.transaction,
-      );
+        let transactionResponse: any;
+        do {
+          transactionResponse =
+            await framework.provider.connection.getTransaction(signature, {
+              commitment: "confirmed",
+            });
+        } while (transactionResponse?.meta?.logMessages === undefined);
+        let report = framework.report(transactionResponse?.meta?.logMessages);
+        reports.push(report);
+      }
 
-      let transactionResponse: any;
-      do {
-        transactionResponse =
-          await framework.provider.connection.getTransaction(signature, {
-            commitment: "confirmed",
-          });
-      } while (transactionResponse?.meta?.logMessages === undefined);
-      framework.report(transactionResponse?.meta?.logMessages);
+      framework.saveReport(reports);
     });
 
     it("Apply Fly System on Entity 4", async () => {

+ 9 - 0
docs/REPORT.md

@@ -0,0 +1,9 @@
+```mermaid
+%%{init: {"xyChart": {"width": 1200, "height": 400, "xAxis": {}}}}%%
+xychart
+    title "Bolt Apply System Cost"
+    x-axis ["1C-CPIs:2","2C-CPIs:3","3C-CPIs:4","4C-CPIs:5","5C-CPIs:6","6C-CPIs:7","7C-CPIs:8","8C-CPIs:9","9C-CPIs:10","10C-CPIs:11"]
+    y-axis "CU" 5000 --> 200000
+    bar [15254,24352,33653,43017,52358,61568,71006,80482,89958,99299]
+    bar [6162,11236,16305,21374,26443,31516,36608,41892,46984,52077]
+```

+ 0 - 17
examples/component-large/src/lib.rs

@@ -1,17 +0,0 @@
-use bolt_lang::*;
-
-declare_id!("FJjiJoz799Q6NqYffXbsFFj1pBmwsQZgcoizCfWvM5HX");
-
-#[component]
-pub struct Large {
-    pub value: [u8; 32],
-}
-
-impl Default for Large {
-    fn default() -> Self {
-        Self {
-            bolt_metadata: BoltMetadata::default(),
-            value: [0; 32],
-        }
-    }
-}

+ 5 - 4
examples/system-with-many-components/Cargo.toml → examples/system-with-1-component/Cargo.toml

@@ -1,11 +1,12 @@
 [package]
-name = "system-with-many-components"
-version.workspace = true
-edition.workspace = true
+name = "with-1-component"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
 
 [lib]
 crate-type = ["cdylib", "lib"]
-name = "system_with_many_components"
+name = "with_1_component"
 
 [features]
 no-entrypoint = []

+ 0 - 0
examples/component-large/Xargo.toml → examples/system-with-1-component/Xargo.toml


+ 18 - 0
examples/system-with-1-component/src/lib.rs

@@ -0,0 +1,18 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("BsVKJF2H9GN1P9WrexdgEY4ztiweKvfQo6ydLWUEw6n7");
+
+#[system]
+pub mod with_1_component {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+    }
+
+}

+ 5 - 5
examples/system-with-few-components/Cargo.toml → examples/system-with-10-components/Cargo.toml

@@ -1,12 +1,12 @@
 [package]
-name = "system-with-few-components"
-version = "0.2.4"
+name = "with-10-components"
+version = "0.2.3"
 description = "Created with Bolt"
 edition = "2021"
 
 [lib]
 crate-type = ["cdylib", "lib"]
-name = "system_with_few_components"
+name = "with_10_components"
 
 [features]
 no-entrypoint = []
@@ -22,5 +22,5 @@ custom-panic = []
 
 [dependencies]
 bolt-lang.workspace = true
-serde.workspace = true 
-component-large.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 0 - 0
examples/system-with-few-components/Xargo.toml → examples/system-with-10-components/Xargo.toml


+ 2 - 3
examples/system-with-many-components/src/lib.rs → examples/system-with-10-components/src/lib.rs

@@ -1,10 +1,10 @@
 use bolt_lang::*;
 use component_small::Small;
 
-declare_id!("Hi4sMEb3uXhWCiLyrF7t3Z384an7YZsTj774cabAAPQB");
+declare_id!("C69UYWaXBQXUbhHQGtG8pB7DHSgh2z5Sm9ifyAnM1kkt");
 
 #[system]
-pub mod system_with_many_components {
+pub mod with_10_components {
 
     pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
         Ok(ctx.accounts)
@@ -23,5 +23,4 @@ pub mod system_with_many_components {
         pub small9: Small,
         pub small10: Small,
     }
-
 }

+ 8 - 4
examples/component-large/Cargo.toml → examples/system-with-2-components/Cargo.toml

@@ -1,11 +1,12 @@
 [package]
-name = "component-large"
-version.workspace = true
-edition.workspace = true
+name = "with-2-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
 
 [lib]
 crate-type = ["cdylib", "lib"]
-name = "component_large"
+name = "with_2_components"
 
 [features]
 no-entrypoint = []
@@ -18,5 +19,8 @@ anchor-debug = ["bolt-lang/anchor-debug"]
 custom-heap = []
 custom-panic = []
 
+
 [dependencies]
 bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 0 - 0
examples/system-with-many-components/Xargo.toml → examples/system-with-2-components/Xargo.toml


+ 19 - 0
examples/system-with-2-components/src/lib.rs

@@ -0,0 +1,19 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("X5wTvz1i6ocNXzfrEB8JmhFCniojUZxqk3TXDq98fZX");
+
+#[system]
+pub mod with_2_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-3-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-3-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_3_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-3-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 20 - 0
examples/system-with-3-components/src/lib.rs

@@ -0,0 +1,20 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("9R7rvEwCuZ6iow1Ch3sdUQKib4LBvftyBmyvSnPaAZkG");
+
+#[system]
+pub mod with_3_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-4-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-4-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_4_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-4-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 21 - 0
examples/system-with-4-components/src/lib.rs

@@ -0,0 +1,21 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("2w9pkZoCfEciHLLDhG3zrZRprcYH7nojhyBQMnD3PtUU");
+
+#[system]
+pub mod with_4_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+        pub small4: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-5-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-5-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_5_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-5-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 22 - 0
examples/system-with-5-components/src/lib.rs

@@ -0,0 +1,22 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("8KsdHMGdS4mQjpKFhc2PWBw2tyxwNbEKCnZLKp3riC5o");
+
+#[system]
+pub mod with_5_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+        pub small4: Small,
+        pub small5: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-6-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-6-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_6_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-6-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 23 - 0
examples/system-with-6-components/src/lib.rs

@@ -0,0 +1,23 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("3ndvNAg4moKeLhuWQtDmcN43PuvvGsigQWRBPthfWEN3");
+
+#[system]
+pub mod with_6_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+        pub small4: Small,
+        pub small5: Small,
+        pub small6: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-7-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-7-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_7_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-7-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 24 - 0
examples/system-with-7-components/src/lib.rs

@@ -0,0 +1,24 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("4ESiD77Gjjfuywhw8NBnryHezXtwDSA27ustL29JdX7i");
+
+#[system]
+pub mod with_7_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+        pub small4: Small,
+        pub small5: Small,
+        pub small6: Small,
+        pub small7: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-8-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-8-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_8_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-8-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 25 - 0
examples/system-with-8-components/src/lib.rs

@@ -0,0 +1,25 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("EbTAEnrVV4f8W7Fd4TxW3jLjfpyhr74wQf7rSHRQ8u78");
+
+#[system]
+pub mod with_8_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+        pub small4: Small,
+        pub small5: Small,
+        pub small6: Small,
+        pub small7: Small,
+        pub small8: Small,
+    }
+
+}

+ 26 - 0
examples/system-with-9-components/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-9-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_9_components"
+
+[features]
+no-entrypoint = []
+no-idl = []
+no-log-ix-name = []
+cpi = ["no-entrypoint"]
+default = []
+idl-build = ["bolt-lang/idl-build"]
+anchor-debug = ["bolt-lang/anchor-debug"]
+custom-heap = []
+custom-panic = []
+
+
+[dependencies]
+bolt-lang.workspace = true
+component-small.workspace = true
+serde.workspace = true

+ 2 - 0
examples/system-with-9-components/Xargo.toml

@@ -0,0 +1,2 @@
+[target.bpfel-unknown-unknown.dependencies.std]
+features = []

+ 26 - 0
examples/system-with-9-components/src/lib.rs

@@ -0,0 +1,26 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("GKdPXW7pGhFNRdMPHWNsrmqc7haXQk4VFCAyZKsrgYQG");
+
+#[system]
+pub mod with_9_components {
+
+    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
+        Ok(ctx.accounts)
+    }
+
+    #[system_input]
+    pub struct Components {
+        pub small1: Small,
+        pub small2: Small,
+        pub small3: Small,
+        pub small4: Small,
+        pub small5: Small,
+        pub small6: Small,
+        pub small7: Small,
+        pub small8: Small,
+        pub small9: Small,
+    }
+
+}

+ 0 - 23
examples/system-with-few-components/src/lib.rs

@@ -1,23 +0,0 @@
-use bolt_lang::*;
-use component_large::Large;
-
-declare_id!("A3kNNSgmkTNA5V1qtnrbtNeqKrYHNxUMCTkqTDaQzE97");
-
-
-#[system]
-pub mod system_with_few_components {
-
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
-    }
-
-    #[system_input]
-    pub struct Components {
-        pub large1: Large,
-        pub large2: Large,
-        pub large3: Large,
-        pub large4: Large,
-        pub large5: Large,
-    }
-
-}