Skip to content

Commit d2e161c

Browse files
authored
Merge branch 'main' into dependabot/npm_and_yarn/prettier-3.6.2
2 parents 70bb9ac + dfaf0d3 commit d2e161c

File tree

27 files changed

+646
-199
lines changed

27 files changed

+646
-199
lines changed

README.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,9 @@ Developed by [TON Studio](https://tonstudio.io), powered by the community — as
1111

1212
Tact has undergone a comprehensive security audit by [Trail of Bits](https://www.trailofbits.com), a leading Web3 security firm.
1313

14-
**[Try online!][Features][Security][Key resources][Installation][Community][Contributing]**
14+
**[Try it online][Features][Security][Key resources][Installation][Community][Contributing]**
1515

16-
[Try online!]: https://ide.ton.org
16+
[Try it online]: https://ide.ton.org
1717
[Features]: #features
1818
[Security]: #security
1919
[Key resources]: #key-resources
@@ -41,7 +41,7 @@ The most prominent and distinctive features of Tact are:
4141
- Automatic routing of [internal, external, and bounced messages][recvfun].
4242
- Automatic handling of message types, including [binary, text, and fallback slices][recv].
4343
- No boilerplate functions for [sending messages] and deploying child contracts.
44-
- Reusable behaviors through [traits].
44+
- Reusable and composable behaviors using [traits], similar to interfaces or mixins.
4545
- Support for low-level programming with [`asm` functions][asmfun].
4646
- Generation of [single-file TypeScript wrappers] for convenient interactions with compiled contracts, which include:
4747
- Type definitions for [Structs] and [Messages] observable in the [compilation report].

dev-docs/CHANGELOG-DOCS.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,11 @@ All notable changes to Tact documentation will be documented in this file.
44

55
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/) but does not adhere to [Semantic Versioning](https://semver.org/spec/v2.0.0.html) — the changes made are grouped by their respective milestones. If the change wasn't a part of the milestone but was made in the month associated with it, it will still be included.
66

7+
## Doc: Next
8+
9+
- Fixed the description of the fallback bounced message receiver: PR [#3471](https://github.com/tact-lang/tact/pull/3471)
10+
- Clarified the data layout of bounced messages: PR [#3472](https://github.com/tact-lang/tact/pull/3472)
11+
712
## Doc: 2025-06
813

914
- Adjusted inline code tag highlighting to support global Starlight themes, and modified the One Light color theme to support proper highlighting of `keyword.operator.new` TextMate scopes: PR [#3346](https://github.com/tact-lang/tact/pull/3346)

dev-docs/CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,13 @@ The documentation changelog is kept separately: [CHANGELOG-DOCS](./CHANGELOG-DOC
1616
### Standard Library
1717

1818
- Added `setData()` function: PR [#3402](https://github.com/tact-lang/tact/pull/3402)
19+
- Improved gas efficiency for the `context().readForwardFee`: PR [#3457](https://github.com/tact-lang/tact/pull/3457)
1920

2021
### Release contributors
2122

2223
- [skywardboundd](https://github.com/skywardboundd)
2324
- [Novus Nota](https://github.com/novusnota)
25+
- [Ludwintor](https://github.com/Ludwintor)
2426

2527
## [1.6.13] - 2025-05-29
2628

docs/astro.config.mjs

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -187,10 +187,7 @@ export default defineConfig({
187187
{ slug: 'book/expressions' },
188188
{ slug: 'book/statements' },
189189
{ slug: 'book/constants' },
190-
{
191-
slug: 'book/functions',
192-
badge: { variant: 'tip', text: 'new' },
193-
},
190+
{ slug: 'book/functions' },
194191
{ slug: 'book/assembly-functions' },
195192
{
196193
label: 'Communication',
@@ -252,6 +249,10 @@ export default defineConfig({
252249
{ slug: 'cookbook/multi-communication' },
253250
{ slug: 'cookbook/jettons' },
254251
{ slug: 'cookbook/nfts' },
252+
{
253+
slug: 'cookbook/zk-proofs',
254+
badge: { variant: 'tip', text: 'new' },
255+
},
255256
{
256257
label: 'Decentralized EXchanges (DEXes)',
257258
translations: {
@@ -356,5 +357,6 @@ export default defineConfig({
356357
'/ecosystem/tools/misti': '/ecosystem/misti',
357358
'/ref/core-common': '/ref/core-send',
358359
'/ref/core-advanced': '/ref/core-contextstate',
360+
'/cookbook/zk-proofs-on-tact': '/cookbook/zk-proofs',
359361
},
360362
});

docs/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
"@astrojs/check": "0.9.4",
1818
"@astrojs/markdown-remark": "5.3.0",
1919
"@astrojs/starlight": "0.29.3",
20-
"astro": "4.16.18",
20+
"astro": "4.16.19",
2121
"cspell": "^8.14.4",
2222
"hast-util-to-string": "^3.0.0",
2323
"rehype-autolink-headings": "7.1.0",

docs/src/content/docs/book/bounced.mdx

Lines changed: 41 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,11 @@ contract Bounce() {
2525
message BB {}
2626
```
2727

28-
Only the first message fields that fit into the 224 bits will be available to use in bounced message receivers. Sometimes you need to rearrange the order of the fields in your message so the relevant ones would fit into the limit.
28+
Since message fields are always laid out sequentially and no automatic rearrangements are made, the partial representation made by the `bounced<M>{:tact}` constructor would only contain the first fields that fit entirely within the 224-bit limit.
29+
30+
All subsequent fields that exceed the limit will not be available in bounced message receivers. This also includes fields that fit only partially.
31+
32+
If the first field does not wholly conform to the 224-bit limit, none of the bounced message fields would be available. Therefore, to ensure access, prefer arranging the important fields first.
2933

3034
```tact
3135
contract Bounce() {
@@ -42,6 +46,32 @@ message TwoFields {
4246
}
4347
```
4448

49+
:::caution
50+
51+
To prevent potential issues, Tact only allows using the fields that wholly fit the limit. However, the blockchain views that limit as a truncation boundary and keeps the raw bits that fit the [total 256-bit body limit](#caveats) in the original bounced message body cell.
52+
53+
You can access that data by removing the concrete receiver and using the [fallback bounced message receiver](#fallback) instead. It will provide you the original, raw body of the received message as a [`Slice{:tact}`][slice].
54+
55+
```tact
56+
contract Bounce() {
57+
bounced(rawMsg: Slice) {
58+
let opcode = rawMsg.loadUint(32);
59+
if (opcode == TooBigToFit.opcode()) {
60+
// Now, you can obtain the truncated bits that did fit in the remaining
61+
// 224 bits of the bounced message.
62+
// Proceed with caution!
63+
let truncatedData = rawMsg.preloadUint(224);
64+
}
65+
}
66+
}
67+
68+
message TooBigToFit {
69+
data: Int as uint225; // 1 bit is truncated, so the field could not be accessed directly
70+
}
71+
```
72+
73+
:::
74+
4575
For gas optimization reasons, unrecognized bounced messages are ignored by Tact contracts and do not cause erroneous, non-zero [exit codes](/book/exit-codes). That is, if there is no relevant [`bounced(){:tact}` message receiver](#bounced-message-receiver) or no [fallback bounced receiver](#fallback), messages sent from the contract, rejected by their intended recipient and bounced back to the original contract will not be processed, apart from collecting their value and paying any related fees.
4676

4777
This behavior is unlike the non-bounced messages such as regular internal or external messages, where if the contract does not handle the message, an error with [exit code 130](/book/exit-codes#130) is thrown: `Invalid incoming message`. Not throwing such errors for bounced messages is a common pattern on TON Blockchain, to which Tact adheres.
@@ -66,13 +96,19 @@ contract MyContract {
6696

6797
## Fallback bounced message receiver {#fallback}
6898

69-
To process bounced messages manually, you can use a fallback catch-all definition that handles a raw [`Slice{:tact}`](/book/cells#slices) directly. Note that such a receiver will get **all** the bounced messages produced by your contract:
99+
To process bounced messages manually, you can use a fallback catch-all definition that handles a raw [`Slice{:tact}`][slice] directly. Note that such a receiver handles all bounced messages that are not handled by [specific bounced message receivers](#bounced-message-receiver).
70100

71101
```tact /rawMsg: Slice/
72-
contract MyContract {
73-
bounced(rawMsg: Slice) {
102+
contract MyContract() {
103+
// Specific bounced message receiver
104+
bounced(msg: bounced<MyMessage>) {
74105
// ...
75106
}
107+
108+
// Fallback catch-all bounced message receiver
109+
bounced(rawMsg: Slice) {
110+
// Here, rawMsg can be anything, except for the bounced<MyMessage>
111+
}
76112
}
77113
```
78114

@@ -83,3 +119,4 @@ On TON, bounced message bodies have a 32 bits prefix, where all bits are set, i.
83119
Bounced message receivers handle contract storage just as [internal message receivers](/book/receive#contract-storage-handling) do. In addition, the empty [`return{:tact}` statement](/book/statements#return) and the [`throw(0){:tact}`](/ref/core-debug#throw) patterns [work the same](/book/receive#contract-storage-handling).
84120

85121
[message]: /book/structs-and-messages#messages
122+
[slice]: /book/cells#slices

docs/src/content/docs/book/compile.mdx

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,9 @@ If you want to pin down a specific version of the compiler, run the following co
8282

8383
:::caution
8484

85-
Do not mix different Node.js package managers in your projects. If you created the [Blueprint][bp] project with `npm`, stick to using `npm` for the rest of the commands — this will ensure that you don't get "File not found" errors or lock-file conflicts between different package managers.
85+
Do not mix different Node.js package managers in your projects. Always stick to one — using multiple will break things.
86+
87+
If you created the [Blueprint][bp] project with `npm`, stick to using `npm` for the rest of the commands — this will ensure that you don't get "File not found" errors or lock-file conflicts between different package managers.
8688

8789
For example, using the `npm` package manager to install dependencies and then switching to `yarn` to build the contracts can lead to the following error message:
8890

@@ -159,7 +161,7 @@ TL-B: `manually_specified_opcode#12345678 = ManuallySpecifiedOpcode`
159161
Signature: `ManuallySpecifiedOpcode{}`
160162
```
161163

162-
Here, `6dfea180` and `12345678`, specified after the `#` in the [constructor definitions](https://docs.ton.org/v3/documentation/data-formats/tlb/tl-b-language#constructors), are opcodes written in hexadecimal notation representing 32-bit unsigned integers. Thus, the automatically generated `6dfea180` opcode of the `GeneratedOpcode{:tact}` [Message][message] represents the decimal value 1845404032, and the manually provided `12345678` opcode of the `ManuallySpecifiedOpcode{:tact}` [Message][message] represents the decimal value 305419896, and **not** 12345678 as it might appear.
164+
Here, `6dfea180` and `12345678`, specified after the `#` in the [constructor definitions](https://docs.ton.org/v3/documentation/data-formats/tlb/tl-b-language#constructors), are opcodes written in hexadecimal notation representing 32-bit unsigned integers. Thus, the automatically generated `6dfea180` opcode of the `GeneratedOpcode{:tact}` [Message][message] represents the decimal value 1845404032, and the manually provided `12345678` opcode of the `ManuallySpecifiedOpcode{:tact}` [Message][message] represents the decimal value 305419896 **not** 12345678, even though it looks like a decimal.
163165

164166
#### Get methods {#getters}
165167

docs/src/content/docs/book/index.mdx

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Here are its main contents:
1717

1818
1. #### Quick start
1919

20-
The Book begins with a few scenic tours and cheat sheets to get you started immediately. First, it briefly discusses TON Blockchain and how smart contracts work there, then gives an overview of many syntax and semantical aspects of the Tact language.
20+
The Book begins with a few scenic tours and cheat sheets to get you started immediately. First, it briefly introduces the TON Blockchain and how Tact smart contracts work there, then it gives an overview of many syntax and semantical aspects of the Tact language.
2121

2222
<CardGrid>
2323
<LinkCard
@@ -67,7 +67,7 @@ Here are its main contents:
6767

6868
The subsection [Going places](/book/compile) explains how to compile, debug, and test Tact contracts locally. From there, it moves on to provide descriptions of deploying contracts to the TON Blockchain.
6969

70-
Lastly, it shows how to further tweak the compiler with its configuration options, interface with existing FunC code, and discusses best practices for securing your smart contracts.
70+
Lastly, it shows how to further tweak the compiler with its configuration options, interface with existing FunC code, and apply best practices to secure your smart contracts.
7171

7272
<CardGrid>
7373
<LinkCard

docs/src/content/docs/cookbook/index.mdx

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,10 @@ For DeFi-specific elaborate recipes that include smart contracts, auxiliary scri
7373
title="🖼️ Non-Fungible Tokens (NFTs)"
7474
href="/cookbook/nfts"
7575
/>
76+
<LinkCard
77+
title="🪅 Zero-knowledge proofs (ZKPs)"
78+
href="/cookbook/zk-proofs"
79+
/>
7680
</CardGrid>
7781

7882
Additionally, there are examples of working with popular TON DEXes (Decentralized EXchanges), which often require many contracts and complex logic:

0 commit comments

Comments
 (0)