Skip to content

Commit 598678a

Browse files
committed
✅ Fixing systems and report function
1 parent abad29c commit 598678a

File tree

12 files changed

+44
-36
lines changed

12 files changed

+44
-36
lines changed

clients/typescript/test/framework.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ export class Framework {
130130
let report = "```mermaid\n";
131131
report += `%%{init: {"xyChart": {"width": 1200, "height": 400, "xAxis": {}}}}%%\n`;
132132
report += "xychart\n";
133-
report += " title \"Bolt Apply System Cost\"\n";
133+
report += ' title "Bolt Apply System Cost"\n';
134134
report += " x-axis [";
135135
for (let i = 0; i < reports.length; i++) {
136136
report += `"${i + 1}C-CPIs:${reports[i].cpiCount}"`;
@@ -139,7 +139,7 @@ export class Framework {
139139
}
140140
}
141141
report += "]\n";
142-
report += " y-axis \"CU\" 5000 --> 200000\n";
142+
report += ' y-axis "CU" 5000 --> 200000\n';
143143
report += " bar [";
144144
for (let i = 0; i < reports.length; i++) {
145145
report += reports[i].totalCu;

clients/typescript/test/intermediate-level/ecs.ts

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -321,19 +321,27 @@ export function ecs(framework: Framework) {
321321
})),
322322
});
323323

324-
let signature = await framework.provider.sendAndConfirm(
325-
applySystem.transaction,
326-
);
327-
328-
let transactionResponse: any;
329-
do {
330-
transactionResponse =
331-
await framework.provider.connection.getTransaction(signature, {
332-
commitment: "confirmed",
333-
});
334-
} while (transactionResponse?.meta?.logMessages === undefined);
335-
let report = framework.report(transactionResponse?.meta?.logMessages);
336-
reports.push(report);
324+
try {
325+
let signature = await framework.provider.sendAndConfirm(
326+
applySystem.transaction,
327+
);
328+
329+
let transactionResponse: any;
330+
do {
331+
transactionResponse =
332+
await framework.provider.connection.getTransaction(signature, {
333+
commitment: "confirmed",
334+
});
335+
} while (transactionResponse?.meta?.logMessages === undefined);
336+
let report = framework.report(transactionResponse?.meta?.logMessages);
337+
reports.push(report);
338+
} catch (error) {
339+
reports.push({
340+
cpiCount: 0,
341+
totalCpiCU: 0,
342+
totalCu: 0,
343+
});
344+
}
337345
}
338346

339347
framework.saveReport(reports);

docs/REPORT.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22
%%{init: {"xyChart": {"width": 1200, "height": 400, "xAxis": {}}}}%%
33
xychart
44
title "Bolt Apply System Cost"
5-
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"]
5+
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"]
66
y-axis "CU" 5000 --> 200000
7-
bar [15254,24352,33653,43017,52358,61568,71006,80482,89958,99299]
8-
bar [6162,11236,16305,21374,26443,31516,36608,41892,46984,52077]
7+
bar [25689,43441,61369,79356,97160,114989,133114,151090,0,0]
8+
bar [6920,12931,18925,24915,30909,36900,42977,49059,0,0]
99
```

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("BsVKJF2H9GN1P9WrexdgEY4ztiweKvfQo6ydLWUEw6n7");
66
#[system]
77
pub mod with_1_component {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("X5wTvz1i6ocNXzfrEB8JmhFCniojUZxqk3TXDq98fZX");
66
#[system]
77
pub mod with_2_components {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("9R7rvEwCuZ6iow1Ch3sdUQKib4LBvftyBmyvSnPaAZkG");
66
#[system]
77
pub mod with_3_components {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("2w9pkZoCfEciHLLDhG3zrZRprcYH7nojhyBQMnD3PtUU");
66
#[system]
77
pub mod with_4_components {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("8KsdHMGdS4mQjpKFhc2PWBw2tyxwNbEKCnZLKp3riC5o");
66
#[system]
77
pub mod with_5_components {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("3ndvNAg4moKeLhuWQtDmcN43PuvvGsigQWRBPthfWEN3");
66
#[system]
77
pub mod with_6_components {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ declare_id!("4ESiD77Gjjfuywhw8NBnryHezXtwDSA27ustL29JdX7i");
66
#[system]
77
pub mod with_7_components {
88

9-
pub fn execute(ctx: Context<Components>, _args_p: Vec<u8>) -> Result<Components> {
10-
Ok(ctx.accounts)
9+
pub fn execute(_ctx: Context<Components>, _args_p: Vec<u8>) -> Result<()> {
10+
Ok(())
1111
}
1212

1313
#[system_input]

0 commit comments

Comments
 (0)