Jelajahi Sumber

✅ CU measurement (#200)

Danilo Guanabara 1 bulan lalu
induk
melakukan
e6be254588
43 mengubah file dengan 844 tambahan dan 24 penghapusan
  1. 1 0
      .gitignore
  2. 16 14
      Anchor.toml
  3. 97 0
      Cargo.lock
  4. 2 0
      Cargo.toml
  5. 108 2
      clients/typescript/test/framework.ts
  6. 80 1
      clients/typescript/test/intermediate-level/ecs.ts
  7. 1 1
      clients/typescript/test/low-level/permissioning/world.ts
  8. 9 0
      docs/REPORT.md
  9. 23 0
      examples/component-small/Cargo.toml
  10. 2 0
      examples/component-small/Xargo.toml
  11. 9 0
      examples/component-small/src/lib.rs
  12. 0 5
      examples/system-apply-velocity/src/lib.rs
  13. 1 1
      examples/system-simple-movement/Cargo.toml
  14. 26 0
      examples/system-with-1-component/Cargo.toml
  15. 2 0
      examples/system-with-1-component/Xargo.toml
  16. 17 0
      examples/system-with-1-component/src/lib.rs
  17. 26 0
      examples/system-with-10-components/Cargo.toml
  18. 2 0
      examples/system-with-10-components/Xargo.toml
  19. 26 0
      examples/system-with-10-components/src/lib.rs
  20. 26 0
      examples/system-with-2-components/Cargo.toml
  21. 2 0
      examples/system-with-2-components/Xargo.toml
  22. 18 0
      examples/system-with-2-components/src/lib.rs
  23. 26 0
      examples/system-with-3-components/Cargo.toml
  24. 2 0
      examples/system-with-3-components/Xargo.toml
  25. 19 0
      examples/system-with-3-components/src/lib.rs
  26. 26 0
      examples/system-with-4-components/Cargo.toml
  27. 2 0
      examples/system-with-4-components/Xargo.toml
  28. 20 0
      examples/system-with-4-components/src/lib.rs
  29. 26 0
      examples/system-with-5-components/Cargo.toml
  30. 2 0
      examples/system-with-5-components/Xargo.toml
  31. 21 0
      examples/system-with-5-components/src/lib.rs
  32. 26 0
      examples/system-with-6-components/Cargo.toml
  33. 2 0
      examples/system-with-6-components/Xargo.toml
  34. 22 0
      examples/system-with-6-components/src/lib.rs
  35. 26 0
      examples/system-with-7-components/Cargo.toml
  36. 2 0
      examples/system-with-7-components/Xargo.toml
  37. 23 0
      examples/system-with-7-components/src/lib.rs
  38. 26 0
      examples/system-with-8-components/Cargo.toml
  39. 2 0
      examples/system-with-8-components/Xargo.toml
  40. 24 0
      examples/system-with-8-components/src/lib.rs
  41. 26 0
      examples/system-with-9-components/Cargo.toml
  42. 2 0
      examples/system-with-9-components/Xargo.toml
  43. 25 0
      examples/system-with-9-components/src/lib.rs

+ 1 - 0
.gitignore

@@ -1,3 +1,4 @@
+.vscode
 .idea*
 .idea
 .anchor

+ 16 - 14
Anchor.toml

@@ -10,30 +10,32 @@ world = "WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n"
 [programs.localnet]
 bolt-component = "CmP2djJgABZ4cRokm4ndxuq6LerqpNHLBsaUv2XKEJua"
 bolt-system = "7X4EFsDJ5aYTcEjKzJ94rD8FRKgQeXC89fkpeTS4KaqP"
+component-small = "9yBADAhoTWCkNRB6hbfpwUgPpxyJiF9uEiWVPR6k7A4y"
 position = "Fn1JzzEdyb55fsyduWS94mYHizGhJZuhvjX6DVvrmGbQ"
 system-apply-velocity = "6LHhFVwif6N9Po3jHtSmMVtPjF6zRfL3xMosSzcrQAS8"
 system-fly = "HT2YawJjkNmqWcLNfPAMvNsLdWwPvvvbKA5bpMw4eUpq"
 system-simple-movement = "FSa6qoJXFBR3a7ThQkTAMrC15p6NkchPEjBdd4n6dXxA"
 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"
 
 [provider]
-cluster = "Localnet"
+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"
-]
+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"
@@ -49,8 +51,8 @@ program = "tests/fixtures/delegation.so"
 upgradeable = false
 
 [[test.genesis]]
-address="KeyspM2ssCJbqUhQ4k7sveSiY4WjnYsrXkC8oDbwde5"
-program="tests/fixtures/session_keys.so"
+address = "KeyspM2ssCJbqUhQ4k7sveSiY4WjnYsrXkC8oDbwde5"
+program = "tests/fixtures/session_keys.so"
 upgradeable = false
 
 [test.validator]
@@ -76,4 +78,4 @@ filename = "tests/fixtures/vault1.json"
 
 [[test.validator.account]]
 address = "7JrkjmZPprHwtuvtuGTXp9hwfGYFAQLnLeFM52kqAgXg"
-filename = "tests/fixtures/vault2.json"
+filename = "tests/fixtures/vault2.json"

+ 97 - 0
Cargo.lock

@@ -1258,6 +1258,13 @@ dependencies = [
  "memchr",
 ]
 
+[[package]]
+name = "component-small"
+version = "0.2.4"
+dependencies = [
+ "bolt-lang",
+]
+
 [[package]]
 name = "concurrent-queue"
 version = "2.5.0"
@@ -6981,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"

+ 2 - 0
Cargo.toml

@@ -34,6 +34,8 @@ bolt-utils = { path = "crates/bolt-lang/utils", version = "=0.2.4" }
 world = { path = "crates/programs/world", features = ["cpi"], version = "=0.2.4"}
 bolt-system = { path = "crates/programs/bolt-system", features = ["cpi"], version = "=0.2.4"}
 bolt-component = { path = "crates/programs/bolt-component", features = ["cpi"], version = "=0.2.4"}
+component-large = { path = "examples/component-large", features = ["cpi"], version = "=0.2.4"}
+component-small = { path = "examples/component-small", features = ["cpi"], version = "=0.2.4"}
 
 ## External crates
 session-keys       = { version = "^2", features = ["no-entrypoint"] }

+ 108 - 2
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,6 +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 { Small } from "../../../target/types/small";
+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;
@@ -23,7 +36,17 @@ export class Framework {
   systemSimpleMovement: anchor.Program<SystemSimpleMovement>;
   systemFly: anchor.Program<SystemFly>;
   systemApplyVelocity: anchor.Program<SystemApplyVelocity>;
-
+  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;
 
@@ -37,7 +60,6 @@ export class Framework {
   acceleratedComponentPositionPda: PublicKey;
   componentPositionEntity1Pda: PublicKey;
   componentVelocityEntity1Pda: PublicKey;
-
   componentPositionEntity4Pda: PublicKey;
 
   constructor() {
@@ -48,6 +70,20 @@ export class Framework {
     this.systemSimpleMovement = anchor.workspace.SystemSimpleMovement;
     this.systemFly = anchor.workspace.SystemFly;
     this.systemApplyVelocity = anchor.workspace.SystemApplyVelocity;
+    this.systemWithManyComponents = anchor.workspace.SystemWithManyComponents;
+    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);
@@ -57,4 +93,74 @@ export class Framework {
       anchor.Wallet.local(),
     );
   }
+
+  consume(line: string): number {
+    let consumed = line.split(" consumed ")[1].split(" of ")[0];
+    return parseInt(consumed);
+  }
+
+  report(log: string[]): {
+    cpiCount: number;
+    totalCpiCU: number;
+    totalCu: number;
+  } {
+    var cpi: number[] = [];
+    var worldReport: number = 0;
+    for (let index in log) {
+      let line = log[index];
+      if (line.includes(" consumed ")) {
+        if (!line.includes("WorLD15A7CrDwLcLy4fRqtaTb9fbd8o8iqiEMUDse2n")) {
+          cpi.push(this.consume(line));
+        } else {
+          worldReport = this.consume(line);
+        }
+      }
+    }
+    let total = cpi.reduce((a, b) => a + b, 0);
+    let numberOfInstructions = cpi.length;
+
+    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);
+  }
 }

+ 80 - 1
clients/typescript/test/intermediate-level/ecs.ts

@@ -249,7 +249,17 @@ export function ecs(framework: Framework) {
           },
         ],
       });
-      await framework.provider.sendAndConfirm(applySystem.transaction);
+      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);
 
       const position =
         await framework.exampleComponentPosition.account.position.fetch(
@@ -260,6 +270,75 @@ export function ecs(framework: Framework) {
       expect(position.z.toNumber()).to.equal(300);
     });
 
+    it("Reports profile", async () => {
+      let entitiesPdas: web3.PublicKey[] = [];
+      for (let i = 0; i < 10; i++) {
+        const addEntity = await AddEntity({
+          payer: framework.provider.wallet.publicKey,
+          world: framework.worldPda,
+          connection: framework.provider.connection,
+        });
+        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,
+        );
+        componentsPdas.push(initializeComponent.componentPda);
+      }
+
+      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,
+          entities: entitiesPdas.slice(0, i + 1).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);
+      }
+
+      framework.saveReport(reports);
+    });
+
     it("Apply Fly System on Entity 4", async () => {
       const applySystem = await ApplySystem({
         authority: framework.provider.wallet.publicKey,

+ 1 - 1
clients/typescript/test/low-level/permissioning/world.ts

@@ -101,7 +101,7 @@ export function world(framework) {
           world: framework.worldPda,
         })
         .instruction();
-      const transaction = new anchor.web3.Transaction().add(instruction);
+      let transaction = new anchor.web3.Transaction().add(instruction);
       await framework.provider.sendAndConfirm(transaction, [], {
         skipPreflight: true,
       });

+ 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]
+```

+ 23 - 0
examples/component-small/Cargo.toml

@@ -0,0 +1,23 @@
+[package]
+name = "component-small"
+version = "0.2.4"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "component_small"
+
+[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

+ 2 - 0
examples/component-small/Xargo.toml

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

+ 9 - 0
examples/component-small/src/lib.rs

@@ -0,0 +1,9 @@
+use bolt_lang::*;
+
+declare_id!("9yBADAhoTWCkNRB6hbfpwUgPpxyJiF9uEiWVPR6k7A4y");
+
+#[component]
+#[derive(Default)]
+pub struct Small {
+    // Just the BoltMetadata which is 32 bytes
+}

+ 0 - 5
examples/system-apply-velocity/src/lib.rs

@@ -16,11 +16,6 @@ pub mod system_apply_velocity {
         }
         ctx.accounts.velocity.last_applied = clock.unix_timestamp;
         ctx.accounts.position.x += 10 * (ctx.accounts.velocity.x + 2) + 3;
-        msg!("last applied: {}", ctx.accounts.velocity.last_applied);
-        msg!("Position: {}", ctx.accounts.position.x);
-        msg!("Remaining accounts len: {}", ctx.remaining_accounts.len());
-        msg!("Remaining accounts: {:?}", ctx.remaining_accounts);
-        msg!("Authority: {}", ctx.accounts.authority.key);
         Ok(ctx.accounts)
     }
 

+ 1 - 1
examples/system-simple-movement/Cargo.toml

@@ -26,4 +26,4 @@ custom-panic = []
 [dependencies]
 serde.workspace = true
 bolt-lang.workspace = true
-bolt-types = { version = "0.2.3", path = "../../crates/types" }
+bolt-types = { version = "0.2.4", path = "../../crates/types" }

+ 26 - 0
examples/system-with-1-component/Cargo.toml

@@ -0,0 +1,26 @@
+[package]
+name = "with-1-component"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_1_component"
+
+[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-1-component/Xargo.toml

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

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

@@ -0,0 +1,17 @@
+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,
+    }
+}

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

@@ -0,0 +1,26 @@
+[package]
+name = "with-10-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_10_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-10-components/Xargo.toml

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

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

@@ -0,0 +1,26 @@
+use bolt_lang::*;
+use component_small::Small;
+
+declare_id!("C69UYWaXBQXUbhHQGtG8pB7DHSgh2z5Sm9ifyAnM1kkt");
+
+#[system]
+pub mod with_10_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,
+        pub small10: Small,
+    }
+}

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

@@ -0,0 +1,26 @@
+[package]
+name = "with-2-components"
+version = "0.2.3"
+description = "Created with Bolt"
+edition = "2021"
+
+[lib]
+crate-type = ["cdylib", "lib"]
+name = "with_2_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-2-components/Xargo.toml

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

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

@@ -0,0 +1,18 @@
+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 = []

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

@@ -0,0 +1,19 @@
+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 = []

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

@@ -0,0 +1,20 @@
+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 = []

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

@@ -0,0 +1,21 @@
+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 = []

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

@@ -0,0 +1,22 @@
+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 = []

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

@@ -0,0 +1,23 @@
+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 = []

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

@@ -0,0 +1,24 @@
+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 = []

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

@@ -0,0 +1,25 @@
+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,
+    }
+}