Browse Source

:white_check_mark: Fixing systems and report function

Danilo Guanabara 1 month ago
parent
commit
229db62cbc

+ 21 - 13
clients/typescript/test/intermediate-level/ecs.ts

@@ -312,19 +312,27 @@ export function ecs(framework: Framework) {
           })),
         });
 
-        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);
+        try {
+          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);
+        } catch (error) {
+          reports.push({
+            cpiCount: 0,
+            totalCpiCU: 0,
+            totalCu: 0,
+          });
+        }
       }
 
       framework.saveReport(reports);

+ 3 - 3
docs/REPORT.md

@@ -2,8 +2,8 @@
 %%{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"]
+    x-axis ["1C-CPIs:5","2C-CPIs:9","3C-CPIs:13","4C-CPIs:17","5C-CPIs:21","6C-CPIs:25","7C-CPIs:29","8C-CPIs:33","9C-CPIs:0","10C-CPIs:0"]
     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]
+    bar [25689,43441,61369,79356,97160,114989,133114,151090,0,0]
+    bar [6920,12931,18925,24915,30909,36900,42977,49059,0,0]
 ```

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

@@ -6,8 +6,8 @@ declare_id!("BsVKJF2H9GN1P9WrexdgEY4ztiweKvfQo6ydLWUEw6n7");
 #[system]
 pub mod with_1_component {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("X5wTvz1i6ocNXzfrEB8JmhFCniojUZxqk3TXDq98fZX");
 #[system]
 pub mod with_2_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("9R7rvEwCuZ6iow1Ch3sdUQKib4LBvftyBmyvSnPaAZkG");
 #[system]
 pub mod with_3_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("2w9pkZoCfEciHLLDhG3zrZRprcYH7nojhyBQMnD3PtUU");
 #[system]
 pub mod with_4_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("8KsdHMGdS4mQjpKFhc2PWBw2tyxwNbEKCnZLKp3riC5o");
 #[system]
 pub mod with_5_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("3ndvNAg4moKeLhuWQtDmcN43PuvvGsigQWRBPthfWEN3");
 #[system]
 pub mod with_6_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("4ESiD77Gjjfuywhw8NBnryHezXtwDSA27ustL29JdX7i");
 #[system]
 pub mod with_7_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("EbTAEnrVV4f8W7Fd4TxW3jLjfpyhr74wQf7rSHRQ8u78");
 #[system]
 pub mod with_8_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]

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

@@ -6,8 +6,8 @@ declare_id!("GKdPXW7pGhFNRdMPHWNsrmqc7haXQk4VFCAyZKsrgYQG");
 #[system]
 pub mod with_9_components {
 
-    pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
-        Ok(ctx.accounts)
+    pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
+        Ok(())
     }
 
     #[system_input]