Skip to content

Commit

Permalink
Merge branch 'main' into closes-1011-asm-funs
Browse files Browse the repository at this point in the history
  • Loading branch information
novusnota committed Dec 18, 2024
2 parents 3306421 + 9156921 commit 49b309e
Show file tree
Hide file tree
Showing 47 changed files with 520 additions and 1,141 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
- Optional types for `self` argument in `extends mutates` functions are now allowed: PR [#854](https://github.com/tact-lang/tact/pull/854)
- Error codes in the report are now formatted as a list: PR [#1051](https://github.com/tact-lang/tact/pull/1051)
- Clarify error message for bounced types from which accessed a field that does not fit in 224 bytes: PR [#1111](https://github.com/tact-lang/tact/pull/1111)
- Do not automatically validate all addresses when receiving/sending messages or using address manipulating functions: PR [#1207](https://github.com/tact-lang/tact/pull/1207)
- Remove `enabledMasterchain` compiler config option from `tact.config.json`: PR [#1207](https://github.com/tact-lang/tact/pull/1207)
- Remove `org.ton.chain.any.v0` interface: PR [#1207](https://github.com/tact-lang/tact/pull/1207)

### Fixed

Expand Down
1 change: 0 additions & 1 deletion docs/astro.config.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -187,7 +187,6 @@ export default defineConfig({
{ slug: 'book/upgrades' },
{ slug: 'book/import' },
{ slug: 'book/config' },
{ slug: 'book/masterchain' },
{ slug: 'book/func' },
{ slug: 'book/security-best-practices' },
],
Expand Down
1 change: 0 additions & 1 deletion docs/cspell.json
Original file line number Diff line number Diff line change
Expand Up @@ -120,7 +120,6 @@
"lvalue",
"lvalues",
"masterchain",
"masterchain",
"mathrm",
"maxint",
"minmax",
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,8 +16,8 @@
"dependencies": {
"@astrojs/check": "0.9.4",
"@astrojs/markdown-remark": "5.3.0",
"@astrojs/starlight": "0.29.2",
"astro": "4.16.14",
"@astrojs/starlight": "0.28.4",
"astro": "4.16.17",
"cspell": "^8.14.4",
"hast-util-to-string": "^3.0.0",
"rehype-autolink-headings": "7.1.0",
Expand Down
3 changes: 2 additions & 1 deletion docs/src/content/docs/book/cells.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ Kinds (or subtypes) of all cells are encoded by an integer between $-1$ and $255

[TVM][tvm] currently supports the following exotic cell subtypes:
* [Pruned branch cell][c-pruned], with subtype encoded as $1$ — they represent deleted subtrees of cells.
* [Library reference cell][c-library], with subtype encoded as $2$ — they are used for storing libraries, and usually, in [masterchain](/book/masterchain) contexts.
* [Library reference cell][c-library], with subtype encoded as $2$ — they are used for storing libraries, and usually, in [masterchain][masterchain] contexts.
* [Merkle proof cell][c-mproof], with subtype encoded as $3$ — they are used for verifying that certain portions of other cell's tree data belong to the full tree.
* [Merkle update cell][c-mupdate], with subtype encoded as $4$ — they always have two references and behave like a [Merkle proof][mproof] for both of them.

Expand All @@ -40,6 +40,7 @@ Kinds (or subtypes) of all cells are encoded by an integer between $-1$ and $255
[c-mproof]: https://docs.ton.org/develop/data-formats/exotic-cells#merkle-proof
[c-mupdate]: https://docs.ton.org/develop/data-formats/exotic-cells#merkle-update
[mproof]: https://docs.ton.org/develop/data-formats/exotic-cells#simple-proof-verifying-example
[masterchain]: https://docs.ton.org/v3/documentation/smart-contracts/shards/shards-intro#masterchain

### Levels {#cells-levels}

Expand Down
34 changes: 0 additions & 34 deletions docs/src/content/docs/book/config.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -149,39 +149,6 @@ If set to `true{:json}`, enables debug output of a contract and allows usage of

:::

#### `masterchain` {#options-masterchain}

`false{:json}` by default.

If set to `true{:json}`, enables [masterchain](/book/masterchain) support.

```json filename="tact.config.json" {8,14}
{
"projects": [
{
"name": "some_prefix",
"path": "./contract.tact",
"output": "./contract_output",
"options": {
"masterchain": true
}
},
{
"name": "ContractUnderBlueprint",
"options": {
"masterchain": true
}
}
]
}
```

:::note

Read more on the dedicated page: [Masterchain](/book/masterchain).

:::

#### `external` {#options-external}

`false{:json}` by default.
Expand Down Expand Up @@ -399,7 +366,6 @@ In [Blueprint][bp], `mode` is always set to `"full"{:json}` and cannot be overwr
"name": "ContractUnderBlueprint",
"options": {
"debug": false,
"masterchain": false,
"external": false,
"ipfsAbiGetter": true,
"interfacesGetter": true,
Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/book/contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,6 @@ Tact has a small set of interfaces provided under specific conditions:
* `"org.ton.abi.ipfs.v0"{:tact}`, in accordance to [OTP-003: Self-ABI Reporting](/ref/evolution/otp-003) — opt-in via [`ipfsAbiGetter`](/book/config#options-ipfsabigetter) config property
* `"org.ton.deploy.lazy.v0"{:tact}`, in accordance to [OTP-005: Argument-addressable contracts](/ref/evolution/otp-005)
* `"org.ton.debug.v0"{:tact}`, but only if [debug mode](/book/debug#debug-mode) is enabled
* `"org.ton.chain.any.v0"{:tact}` if [masterchain](/book/masterchain) support is enabled, and `"org.ton.chain.workchain.v0"{:tact}` otherwise

Some [traits][trait] in [standard libraries](/ref/standard-libraries) define their interfaces too:

Expand Down
16 changes: 11 additions & 5 deletions docs/src/content/docs/book/exit-codes.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,8 @@ title: Exit codes
description: "An exit code is a 32-bit signed integer, which indicates whether the compute or action phase of the transaction was successful, and if not — holds the code of the exception occurred"
---

import { Badge } from '@astrojs/starlight/components';

Each transaction on TON Blockchain consists of [multiple phases](https://docs.ton.org/learn/tvm-instructions/tvm-overview#transactions-and-phases). An _exit code_ is a $32$-bit signed integer, which indicates whether the [compute](#compute) or [action](#action) phase of the transaction was successful, and if not — holds the code of the exception occurred. Each exit code represents its own exception or resulting state of the transaction.

Exit codes $0$ and $1$ indicate normal (successful) execution of the [compute phase](#compute). Exit (or [result](#action)) code $0$ indicates normal (successful) execution of the [action phase](#action). Any other exit code indicates that a certain exception has occurred and that the transaction wasn't successful in one way or another, i.e. transaction was reverted or the inbound message has bounced back.
Expand Down Expand Up @@ -60,8 +62,8 @@ Exit code | Origin | Brief description
[$133$](#133) | Tact compiler ([Compute phase][c]) | Contract stopped. Reserved, but never thrown.
[$134$](#134) | Tact compiler ([Compute phase][c]) | Invalid argument.
[$135$](#135) | Tact compiler ([Compute phase][c]) | Code of a contract was not found.
[$136$](#136) | Tact compiler ([Compute phase][c]) | Invalid address.
[$137$](#137) | Tact compiler ([Compute phase][c]) | Masterchain support is not enabled for this contract.
~~[$136$](#136)~~ | ~~Tact compiler ([Compute phase][c])~~ | ~~Invalid address.~~ Removed since Tact 1.6
~~[$137$](#137)~~ | ~~Tact compiler ([Compute phase][c])~~ | ~~Masterchain support is not enabled for this contract.~~ Removed since Tact 1.6

:::note

Expand Down Expand Up @@ -526,7 +528,7 @@ If the configuration is absent, default values are:
* `ext_msg_limits.max_depth` is equal to $2^{9}$ — maximum external message [depth](/book/cells#cells-representation).
* `max_acc_state_cells` is equal to $2^{16}$ — maximum number of [cells][cell] that an account state can occupy.
* `max_acc_state_bits` is equal to $2^{16} * 1023$ — maximum account state size in bits.
* `max_acc_public_libraries` is equal to $2^{8}$ — maximum number of [library reference cells](/book/cells#cells-kinds) that an account state can use on the [masterchain](/book/masterchain).
* `max_acc_public_libraries` is equal to $2^{8}$ — maximum number of [library reference cells](/book/cells#cells-kinds) that an account state can use on the masterchain.
* `defer_out_queue_size_limit` is equal to $2^{8}$ — maximum number of outbound messages to be queued (regards validators and collators).

## Tact compiler
Expand Down Expand Up @@ -623,10 +625,12 @@ If the code of the contract doesn't match the one saved in TypeScript wrappers,

### 136: Invalid address {#136}

<Badge text="Removed since Tact 1.6" variant="tip" size="medium"/><p/>

A value of type [`Address{:tact}`][p] is valid in Tact when:

* It occupies $267$ bits: $11$ bits for the chain ID prefix and $256$ bits for the [address itself](https://docs.ton.org/learn/overviews/addresses#address-of-smart-contract).
* It belongs to either: basechain (ID $0$) or masterchain (ID $-1$), with the latter requiring [masterchain support](/book/masterchain#support) to be enabled.
* It belongs to either basechain (ID $0$) or masterchain (ID $-1$).

If the [`Address{:tact}`][p] isn't valid, the error with exit code $136$ will be thrown: `Invalid address`.

Expand All @@ -644,7 +648,9 @@ try {

### 137: Masterchain support is not enabled for this contract {#137}

Any attempts to point to masterchain (ID $-1$) or otherwise interact with it without [enabling masterchain support](/book/masterchain#support) throw an exception with exit code $137$: `Masterchain support is not enabled for this contract`.
<Badge text="Removed since Tact 1.6" variant="tip" size="medium"/><p/>

Prior to removal, any attempts to point to masterchain (ID $-1$) or otherwise interact with it without enabling masterchain support were throwing an exception with exit code $137$: `Masterchain support is not enabled for this contract`.

```tact
let masterchainID = -1;
Expand Down
57 changes: 0 additions & 57 deletions docs/src/content/docs/book/masterchain.mdx

This file was deleted.

2 changes: 1 addition & 1 deletion docs/src/content/docs/ref/core-advanced.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -581,7 +581,7 @@ parsedVarAddr.address.loadUint(123); // 345
[int]: /book/integers
[slice]: /book/cells#slices
[s]: /book/structs-and-messages#structs
[masterchain]: /book/masterchain
[masterchain]: https://docs.ton.org/v3/documentation/smart-contracts/shards/shards-intro#masterchain
[cell-hash]: /ref/core-cell#cellhash
[nanotoncoin]: /book/integers#nanotoncoin

Expand Down
4 changes: 2 additions & 2 deletions docs/src/content/docs/ref/core-common.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ let oldTonFoundationAddr: Address =

:::caution

This method throws an error with [exit code 136](/book/exit-codes#136) if `chain` is invalid or with [exit code 137](/book/exit-codes#137) if `chain` points to the masterchain ($-1$) without [masterchain support](/book/masterchain) enabled.
Make sure your specify only supported chain IDs: $0$ for the basechain and $-1$ for the masterchain.

:::

Expand Down Expand Up @@ -181,7 +181,7 @@ let hereBeDragons: Address = contractAddressExt(0, initPkg.code, initPkg.data);

:::caution

This method throws an error with [exit code 136](/book/exit-codes#136) if `chain` is invalid or with [exit code 137](/book/exit-codes#137) if `chain` points to the masterchain ($-1$) without [masterchain support](/book/masterchain) enabled.
Make sure your specify only supported chain IDs: $0$ for the basechain and $-1$ for the masterchain.

:::

Expand Down
1 change: 0 additions & 1 deletion docs/src/content/docs/zh-cn/book/contracts.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,6 @@ Tact 有一小套在特定条件下提供的接口:
- `"org.ton.abi.ipfs.v0"{:tact}`,根据 [OTP-003: Self-ABI Reporting](/zh-cn/ref/evolution/otp-003) - 通过 [`ipfsAbiGetter`](/zh-cn/book/config#options-ipfsabigetter)配置属性选择加入
- `"org.ton.deploy.lazy.v0"{:tact}`,符合[OTP-005:参数可寻址合约](/zh-cn/ref/evolution/otp-005)
- `"org.ton.debug.v0"{:tact}`,但只有在启用了[调试模式](/zh-cn/book/debug#debug-mode)时才会这样做
- `"org.ton.chain.any.v0"{:tact}` 如果启用了 [masterchain](/zh-cn/book/masterchain) 支持,否则为 `"org.ton.chain.workchain.v0"{:tact}`

[标准库](/zh-cn/ref/standard-libraries)中的一些[traits][trait]也定义了它们的接口:

Expand Down
Loading

0 comments on commit 49b309e

Please sign in to comment.