Skip to content

Commit

Permalink
moved getUsedGas to benchmark util
Browse files Browse the repository at this point in the history
  • Loading branch information
i582 committed Jan 30, 2025
1 parent 814eac6 commit 74660cb
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 12 deletions.
13 changes: 1 addition & 12 deletions src/test/benchmarks/jetton/jetton.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
import "@ton/test-utils";
import { SendMessageResult } from "@ton/sandbox/dist/blockchain/Blockchain";
import Table from "cli-table3";
import { getUsedGas } from "../util/util";

type BenchmarkResult = {
label: string;
Expand Down Expand Up @@ -167,18 +168,6 @@ function printBenchmarkTable(results: BenchmarkResult[]): void {
console.log(output);
}

function getUsedGas(sendEnough: SendMessageResult) {
return sendEnough.transactions
.slice(1)
.map((t) =>
t.description.type === "generic" &&
t.description.computePhase.type === "vm"
? t.description.computePhase.gasUsed
: 0n,
)
.reduceRight((prev, cur) => prev + cur);
}

describe("Jetton", () => {
let blockchain: Blockchain;
let jettonMinter: ExtendedJettonMinter;
Expand Down
13 changes: 13 additions & 0 deletions src/test/benchmarks/util/util.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import { SendMessageResult } from "@ton/sandbox/dist/blockchain/Blockchain";

export function getUsedGas(sendEnough: SendMessageResult) {
return sendEnough.transactions
.slice(1)
.map((t) =>
t.description.type === "generic" &&
t.description.computePhase.type === "vm"
? t.description.computePhase.gasUsed
: 0n,
)
.reduceRight((prev, cur) => prev + cur);
}

0 comments on commit 74660cb

Please sign in to comment.