Skip to content

Conversation

Shvandre
Copy link
Collaborator

@Shvandre Shvandre commented Oct 8, 2025

Closes #175

Copy link

github-actions bot commented Oct 8, 2025

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore guidebook/debug.mdx techniques/gas.mdx 

Copy link
Collaborator

@skywardboundd skywardboundd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice PR, can we add link to gas-utility file?

@Shvandre Shvandre marked this pull request as ready for review October 8, 2025 12:34
Copy link

github-actions bot commented Oct 8, 2025

Thanks for the update to the techniques docs. One high‑severity fix is needed before merge.

Findings (1)

High (1)

[HIGH] Missing frontmatter; page title rendered as body text

Location: https://github.com/tact-lang/mintlify-ton-docs/blob/b025787e285117b90fde9b9afa584fad875b4228/techniques/gas.mdx?plain=1#L1-L1

Description:
The YAML frontmatter was removed and replaced by an in‑body H2 ## title: "Estimate gas usage in TON contracts". The site expects page metadata (including the title) in frontmatter, with no visible in‑body H1; rendering the title: key as body text breaks metadata, disrupts heading hierarchy/TOC, and conflicts with the site’s title handling (see https://github.com/tact-lang/mintlify-ton-docs/blob/main/contribute/style-guide-extended.mdx?plain=1#L282-L284).

Suggestion:
Restore YAML frontmatter and remove the in‑body “title” heading.

-## title: "Estimate gas usage in TON contracts"
+---
+title: "Estimate gas usage in TON contracts"
+---

Copy link

github-actions bot commented Oct 9, 2025

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore guidebook/debug.mdx techniques/gas.mdx 

Copy link

github-actions bot commented Oct 9, 2025

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore guidebook/debug.mdx standard/tokens/airdrop.mdx techniques/gas.mdx 

Copy link

github-actions bot commented Oct 9, 2025

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore guidebook/debug.mdx standard/tokens/airdrop.mdx techniques/gas.mdx 

Copy link
Collaborator

@skywardboundd skywardboundd left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice pr!
Can we add may be more pics
I have several suggestions:

@Shvandre
Copy link
Collaborator Author

@skywardboundd sure, examples in ts will be added as part of #620

Copy link

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore guidebook/debug.mdx techniques/gas.mdx 

@Shvandre Shvandre marked this pull request as ready for review October 13, 2025 12:13
@verytactical verytactical marked this pull request as draft October 13, 2025 22:35
Copy link

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore guidebook/debug.mdx techniques/gas.mdx 

# Conflicts:
#	extra.css
#	techniques/gas.mdx
@Shvandre Shvandre marked this pull request as ready for review October 16, 2025 10:38
Copy link

Thanks for the update to the gas techniques doc. I found several high‑severity style and link issues that need fixes before merge, all localized to techniques/gas.mdx.

Findings (8)

High (8)

[HIGH] Disallowed <Warning> component used instead of <Aside>

Location:

docs/techniques/gas.mdx

Lines 118 to 120 in 603beae

<Warning>
`computeDataSize()` function consumes large, unpredictable amount of gas. If at all it is possible to precompute the size, it is recommended to do so.
</Warning>

Description:
The page imports and uses Aside for callouts, but lines 118–120 use an unsupported <Warning> component. Unsupported admonitions may not render and break consistency across the docs.

Suggestion:
Replace the <Warning> block with a supported Aside callout.

-<Warning>
-  `computeDataSize()` function consumes large, unpredictable amount of gas. If at all it is possible to precompute the size, it is recommended to do so.
-</Warning>
+<Aside type="caution">
+  `computeDataSize()` consumes a large, unpredictable amount of gas. Precompute the size when possible.
+</Aside>

[HIGH] Broken internal link to limits page (/ton/limits)

Location:

ComputeDataSize have the second argument - maximum number of cells to visit. If it is ok to set in in _8192_ since it is the [limit for message size](/ton/limits#message-and-transaction-limits).

Description:
The link points to /ton/limits#message-and-transaction-limits, but the page lives under /foundations/limits in this repo. Broken or incorrect internal links are disallowed.

Suggestion:
Update the link path to point to the existing page.

-ComputeDataSize have the second argument - maximum number of cells to visit. If it is ok to set in in _8192_ since it is the [limit for message size](/ton/limits#message-and-transaction-limits).
+ComputeDataSize have the second argument - maximum number of cells to visit. If it is ok to set in in _8192_ since it is the [limit for message size](/foundations/limits#message-and-transaction-limits).

[HIGH] Broken internal link to config page (/ton/config)

Location:

In the worst case the storage fee for a single message is [`freeze_due_limit`](/ton/config#param-20-and-21%3A-gas-prices). Otherwise, the contract likely is already frozen and a transaction chain is likely to fail anyway.

Description:
The link for freeze_due_limit targets /ton/config#param-20-and-21%3A-gas-prices, but the canonical page is foundations/config.mdx. Broken/misrouted internal links are disallowed.

Suggestion:
Fix the link to the correct internal location.

-In the worst case the storage fee for a single message is [`freeze_due_limit`](/ton/config#param-20-and-21%3A-gas-prices). Otherwise, the contract likely is already frozen and a transaction chain is likely to fail anyway.
+In the worst case the storage fee for a single message is [`freeze_due_limit`](/foundations/config#param-20-and-21). Otherwise, the contract likely is already frozen and a transaction chain is likely to fail anyway.

[HIGH] Broken internal link to “Phases and fees” (/ton/phases-and-fees)

Location:

- [Phases and fees](/ton/phases-and-fees) — TON fee structure and components

Description:
The link points to /ton/phases-and-fees, but the page is under foundations/phases-and-fees.mdx in this repository. Linking to a non-existent path breaks navigation and is disallowed.

Suggestion:
Correct the link path.

-- [Phases and fees](/ton/phases-and-fees) — TON fee structure and components
+- [Phases and fees](/foundations/phases-and-fees) — TON fee structure and components

[HIGH] Incorrect TVM instruction name (GETSIMPLEFORWARDFEE)

Location:

For this case, we can use `getSimpleForwardFee()` which uses [`GETSIMPLEFORWARDFEE`](/tvm/instructions#f83c-getforwardfeesimple). This function does not add basePrice (called `lump_price` in config) into account.

Description:
The instruction is referred to as GETSIMPLEFORWARDFEE, which is not the canonical name. The correct name is GETFORWARDFEESIMPLE. Incorrect identifiers reduce searchability and can mislead readers.

Suggestion:
Use the correct instruction name while keeping the existing (correct) anchor.

-For this case, we can use `getSimpleForwardFee()` which uses [`GETSIMPLEFORWARDFEE`](/tvm/instructions#f83c-getforwardfeesimple). This function does not add basePrice (called `lump_price` in config) into account.
+For this case, we can use `getSimpleForwardFee()` which uses [`GETFORWARDFEESIMPLE`](/tvm/instructions#f83c-getforwardfeesimple). This function does not add basePrice (called `lump_price` in config) into account.

[HIGH] Literal ellipses used inside code (invalid, non-copyable)

Location:

const result = await contract.send(...);

Description:
The snippet uses await contract.send(...); with a literal ellipsis, which is syntactically invalid and not copy‑pasteable. Similar issues also appear at techniques/gas.mdx:212 and techniques/gas.mdx:257 (let otherFees = ...;). The style guide disallows literal ... in code.

Suggestion:
Replace ellipses with comments or placeholder values to keep code copy‑pasteable.

-const result = await contract.send(...);
+const result = await contract.send(/* params */);

Also update other instances in the file:

-    let otherFees = ...;
+    let otherFees = /* compute other fees */;
-    let otherFees = ...;
+    let otherFees = /* compute other fees */;

[HIGH] Unlabeled fenced code blocks

Location:

docs/techniques/gas.mdx

Lines 137 to 139 in 603beae

```
fwdFee = basePrice + priceForCells * cells + priceForBits * bits
```

Description:
Some fenced code blocks lack a language tag, e.g., the formula block at L137–L139 and the Tact block beginning at L205. The style guide requires language tags for syntax highlighting and tooling.

Suggestion:
Add appropriate language tags to each affected fence.

@@
-```
+```text
 fwdFee = basePrice + priceForCells * cells + priceForBits * bits
-```
+```
@@
-```
+```tact
 const secondsInFiveYears: Int = 5 * 365 * 24 * 60 * 60;
 receive(msg: UserIn) {
     // Suppose trace will be *in* -> *A* -> *B*
     let storageForA = getStorageFee(maxCellsInA, maxBitsInA, secondsInFiveYears, isAccountInMasterchain);
     let storageForB = getStorageFee(maxCellsInB, maxBitsInB, secondsInFiveYears, isAccountInMasterchain);
     let totalStorageFees = storageForA + storageForB;
     let otherFees = /* compute other fees */;
     require(messageValue() >= totalStorageFees + otherFees, "Not enough toncoins");
 }
-```
+```

[HIGH] Broken MDX import to a missing snippet

Location:

import {CellCalculator} from "/snippets/cell-calculator.tsx";

Description:
The page imports CellCalculator from /snippets/cell-calculator.tsx, but no such file exists under snippets/. This causes a build/runtime error and blocks page rendering. The imported component is not referenced elsewhere, so it’s safe to remove.

Suggestion:
Remove the unused import line.

-import {CellCalculator} from "/snippets/cell-calculator.tsx";

Copy link

To fix the formatting issues:

  1. Install necessary dependencies: npm ci
  2. Then, run this command:
npx remark -o --silent --silently-ignore techniques/gas.mdx 

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Patterns > Gas best practices]

4 participants