Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Weekly update 24-4 #465

Merged
merged 5 commits into from
Jan 29, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion docs/develop/fift/overview.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ Introduction To Fift
## Documentation

* [Fift: A Brief Introduction](https://ton.org/fiftbase.pdf)
* [TON Virtual Machine](https://docs.ton.org/tvm.pdf)
* [TON Virtual Machine](/learn/tvm-instructions/tvm-overview)

## Examples

Expand Down
4 changes: 2 additions & 2 deletions docs/develop/func/stdlib.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ This section discusses the [stdlib.fc](https://github.com/ton-blockchain/ton/blo
:::


Currently, the library is just a wrapper for the most common assembler of the TVM commands which are not built-in. Each TVM command description used in the library can be found in the [TVM documentation](https://ton.org/tvm.pdf) (appendix A). Some descriptions were borrowed for this document.
Currently, the library is just a wrapper for the most common assembler of the TVM commands which are not built-in. Each TVM command description used in the library can be found in the [TVM documentation](/learn/tvm-instructions/tvm-overview) section. Some descriptions were borrowed for this document.

Some functions are commented out in the file. It means that they have already become built-ins for optimization purposes. However, the type signature and semantics remain the same.

Expand Down Expand Up @@ -884,7 +884,7 @@ int dict_empty?(cell c) asm "DICTEMPTY";
Checks whether a dictionary is empty. Equivalent to `cell_null?`.

## Prefix dictionaries primitives
TVM also supports dictionaries with non-fixed length keys which form a prefix code (i.e., there is no key that is a prefix to another key). Learn more about them in [TVM.pdf](https://ton.org/tvm.pdf).
TVM also supports dictionaries with non-fixed length keys which form a prefix code (i.e., there is no key that is a prefix to another key). Learn more about them in the [TVM Instruction](/learn/tvm-instructions/tvm-overview) section.

#### pfxdict_get?
```func
Expand Down
2 changes: 1 addition & 1 deletion docs/develop/smart-contracts/tutorials/wallet.md
Original file line number Diff line number Diff line change
Expand Up @@ -2705,7 +2705,7 @@ If you have any questions, comments, or suggestions please reach out to the auth

- Wallets' source code: [V3](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/wallet3-code.fc), [V4](https://github.com/ton-blockchain/wallet-contract/blob/main/func/wallet-v4-code.fc), [High-load](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/highload-wallet-v2-code.fc)

- Useful official documents: [ton.pdf](https://docs.ton.org/ton.pdf), [tblkch.pdf](https://ton.org/tblkch.pdf), [tvm.pdf](https://ton.org/tvm.pdf)
- Useful concept documents(may include outdated information): [ton.pdf](https://docs.ton.org/ton.pdf), [tblkch.pdf](https://ton.org/tblkch.pdf), [tvm.pdf](https://ton.org/tvm.pdf)

The main sources of code:

Expand Down
2 changes: 1 addition & 1 deletion docs/learn/docs.md
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ Please note that here and later the code, comments and/or documentation may cont

* [TON Virtual Machine](https://docs.ton.org/tvm.pdf)

TON Virtual Machine description.
TON Virtual Machine description(may include outdated information on OP Codes, actual list in [TVM Instruction](https://docs.ton.org/learn/tvm-instructions/tvm-overview) section).

* [TON Blockchain](https://docs.ton.org/tblkch.pdf)

Expand Down
11 changes: 7 additions & 4 deletions docs/learn/tvm-instructions/tvm-overview.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,7 @@ All TON Smart Contracts are executed on their own TON Virtual Machine (TVM). TVM
This document provides a bird's-eye view of how TVM executes transactions.

:::tip

* There is also a detailed specification — [**Whitepaper**](https://ton.org/tvm.pdf)
* Could be useful — [**TVM C++ implementation**](https://github.com/ton-blockchain/ton/tree/master/crypto/vm)

* TVM Source — [**TVM C++ implementation**](https://github.com/ton-blockchain/ton/tree/master/crypto/vm)
:::

## Transactions and phases
Expand Down Expand Up @@ -72,3 +69,9 @@ Besides exit_code and consumed gas data, TVM indirectly outputs the following da
All other register values will be neglected.

Note, that since there is a limit on max cell-depth `<1024`, and particularly the limit on c4 and c5 depth `<=512`, there will be a limit on the number of output actions in one tx `<=255`. If a contract needs to send more than that, it may send a message with the request `continue_sending` to itself and send all necessary messages in subsequent transactions.


## See Also

- [TVM Instructions](/learn/tvm-instructions/instructions)
- [TON TVM](https://ton.org/tvm.pdf) TVM Concepts(may include outdated information)
6 changes: 2 additions & 4 deletions docs/learn/tvm-instructions/tvm-upgrade-2023-07.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,9 @@
# TVM Upgrade 2023.07

:::caution **Work in progress**:
Some operation codes may be removed, some gas prices are likely to be changed. It is expected that no new opcodes will be added to the list.
:::tip
This upgrade launched [run](https://t.me/tonblockchain/223) on the Mainnet from December 2023.
:::

This upgrade is in testnet and expected to be shipped to mainnet in 2023 Q4.


# c7

Expand Down
15 changes: 13 additions & 2 deletions docs/participate/wallets/apps.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -187,8 +187,8 @@ A hardware wallet is a physical device that stores the private keys to your cryp

#### Links

- [Ledger](https://www.ledger.com/) official site
- [Ledger TON Blogpost](https://blog.ton.org/ton-is-coming-to-ledger-hardware-wallets)
- [Ledger TON Blogpost](https://blog.ton.org/ton-is-coming-to-ledger-hardware-wallets) user manual for TON in the Ledger wallets.
- [Ledger](https://www.ledger.com/) official site.

### SafePal

Expand Down Expand Up @@ -243,6 +243,17 @@ With a custodial wallet, user trusts somebody else to hold the wallet's private
- [Rocket exchange](https://trade.ton-rocket.com/api/)
- [Rocket pay docs](https://pay.ton-rocket.com/api/)


## Multi signature Wallets

### Tonkey

Tonkey is an advanced project that introduces multi-signature functionality to TON Blockchain.

### Links
- https://tonkey.app/
- [GitHub](https://github.com/tonkey-app)

## See Also

- [What is blockchain? What is a smart contract? What is gas?](https://blog.ton.org/what-is-blockchain)
Expand Down
6 changes: 5 additions & 1 deletion docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -421,9 +421,13 @@ const config = {
to: 'https://t.me/addlist/1r5Vcb8eljk5Yzcy',
label: 'TON Developers Kit',
},
{
to: 'https://t.me/tonsupport_aibot',
label: 'TON Developers Kit',
},
{
to: 'https://github.com/ton-blockchain/TEPs',
label: 'Standards Discussion (TEPs)',
label: 'AI TON Support Agent',
},
{
to: 'contribute',
Expand Down
7 changes: 6 additions & 1 deletion src/pages/learn/archive/tvm-instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ This information is **very low-level** and could be hard to understand for newco
This document provides a list of TVM instructions along with their opcodes and mnemonics.

:::info
[**TVM.pdf**](https://ton.org/tvm.pdf) document contains a full description of TON Virtual Machine.
[**TVM.pdf**](https://ton.org/tvm.pdf) original concept TON Virtual Machine (may include outdated information).
:::

Fift is a stack-based programming language designed to manage TON smart contracts. The Fift assembler is a Fift library that converts mnemonics of TVM instructions into their binary representation.
Expand Down Expand Up @@ -984,3 +984,8 @@ Other primitives listed here have opcodes from the same set. When debug is enabl
| **`FFFz`** | `[z-16] SETCP` | _`-`_ | Selects TVM codepage `z-16` for `1 <= z <= 15`. Negative codepages `-13...-1` are reserved for restricted versions of TVM needed to validate runs of TVM in other codepages. Negative codepage `-14` is reserved for experimental codepages, not necessarily compatible between different TVM implementations, and should be disabled in the production versions of TVM. | `26` |
| **`FFF0`** | `SETCPX` | _`c - `_ | Selects codepage `c` with `-2^15 <= c < 2^15` passed in the top of the stack. | `26` |

## See Also

- [TVM Overview](/learn/tvm-instructions/tvm-overview)
- [TVM Instructions](/learn/tvm-instructions/instructions)
- [TON TVM](https://ton.org/tvm.pdf) TVM Concepts(may include outdated information)
26 changes: 24 additions & 2 deletions src/pages/learn/tvm-instructions/instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,17 @@ import { opcodes } from '@site/src/data/opcodes';
# TVM Instructions

:::caution
Due to limitations in Docusaurus, the original TVM Instruction page had to be split into several pages. The single-page version moved in archive [here](/learn/archive/tvm-instructions).
Due to limitations in Docusaurus, the single-page version moved [here](/learn/archive/tvm-instructions).
:::

...
* [Exit From TVM Instruction Full Screen Mode](/learn/tvm-instructions/tvm-overview)

## Introduction
This document provides a list of TVM instructions along with their opcodes and mnemonics.

:::info
[**TVM.pdf**](https://ton.org/tvm.pdf) document contains a full description of TON Virtual Machine.
[**TVM.pdf**](https://ton.org/tvm.pdf) concept document for TON Virtual Machine (may include outdated information).
:::

Fift is a stack-based programming language designed to manage TON smart contracts. The Fift assembler is a Fift library that converts mnemonics of TVM instructions into their binary representation.
Expand Down Expand Up @@ -69,6 +72,25 @@ Feel free to use the search field below to find a specific instruction:
]}
/>

### TVM Instructions Content List

* [Overview](/learn/tvm-instructions/instructions)
* [Stack Manipulation](/learn/tvm-instructions/instructions/stack-manipulation)
* [Tuple, List and Null](/learn/tvm-instructions/instructions/tuple-list-null)
* [Constants and Literals](/learn/tvm-instructions/instructions/constant)
* [Arithmetic Operations](/learn/tvm-instructions/instructions/arithmetic)
* [Data Comparison](/learn/tvm-instructions/instructions/data-comparison)
* [Cell Manipulation](/learn/tvm-instructions/instructions/cell-manipulation)
* [Continuation and Control Flow](/learn/tvm-instructions/instructions/control-flow)
* [Exception Generation and Handling](/learn/tvm-instructions/instructions/exception-gen-and-handling)
* [Dictionary Manipulation](/learn/tvm-instructions/instructions/dictionary-manipulation)
* [Application-specific Primitives](/learn/tvm-instructions/instructions/app-specific)
* [Miscellaneous](/learn/tvm-instructions/instructions/miscellaneous)

...

* [Exit From TVM Instruction Full Screen Mode](/learn/tvm-instructions/tvm-overview)


### See Also

Expand Down
45 changes: 44 additions & 1 deletion src/pages/learn/tvm-instructions/instructions/app-specific.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ wrapperClassName: bootstrap-wrapper
import { SearchField } from '@site/src/components/SearchField';
import { appSpecificOpcodes as opcodes } from '@site/src/data/opcodes';

# Application-specific primitives
# Application-Specific Primitives

<SearchField
data={opcodes}
Expand All @@ -21,6 +21,25 @@ import { appSpecificOpcodes as opcodes } from '@site/src/data/opcodes';
]}
/>

### TVM Instructions Content List

* [Overview](/learn/tvm-instructions/instructions)
* [Stack Manipulation](/learn/tvm-instructions/instructions/stack-manipulation)
* [Tuple, List and Null](/learn/tvm-instructions/instructions/tuple-list-null)
* [Constants and Literals](/learn/tvm-instructions/instructions/constant)
* [Arithmetic Operations](/learn/tvm-instructions/instructions/arithmetic)
* [Data Comparison](/learn/tvm-instructions/instructions/data-comparison)
* [Cell Manipulation](/learn/tvm-instructions/instructions/cell-manipulation)
* [Continuation and Control Flow](/learn/tvm-instructions/instructions/control-flow)
* [Exception Generation and Handling](/learn/tvm-instructions/instructions/exception-gen-and-handling)
* [Dictionary Manipulation](/learn/tvm-instructions/instructions/dictionary-manipulation)
* [Application-specific Primitives](/learn/tvm-instructions/instructions/app-specific)
* [Miscellaneous](/learn/tvm-instructions/instructions/miscellaneous)

...
* [Exit From TVM Instruction Full Screen Mode](/learn/tvm-instructions/tvm-overview)

## Application-Specific Primitives
### Gas-related primitives
| xxxxxxx<br/>Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx<br/>Fift syntax | xxxxxxxxxxxxxxxxx<br/>Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br/>Description | xxxx<br/>Gas |
|:-|:-|:-|:-|:-|
Expand Down Expand Up @@ -105,3 +124,27 @@ import { appSpecificOpcodes as opcodes } from '@site/src/data/opcodes';
| **`FB04`** | `SETCODE` | _`c - `_ | Creates an output action that would change this smart contract code to that given by _Cell_ `c`. Notice that this change will take effect only after the successful termination of the current run of the smart contract. | `526` |
| **`FB06`** | `SETLIBCODE` | _`c x - `_ | Creates an output action that would modify the collection of this smart contract libraries by adding or removing library with code given in _Cell_ `c`. If `x=0`, the library is actually removed if it was previously present in the collection (if not, this action does nothing). If `x=1`, the library is added as a private library, and if `x=2`, the library is added as a public library (and becomes available to all smart contracts if the current smart contract resides in the masterchain); if the library was present in the collection before, its public/private status is changed according to `x`. Also, `16` can be added to `x` to enable bounce transaction on failure. Values of `x` other than `0...2 (+16 possible)` are invalid. | `526` |
| **`FB07`** | `CHANGELIB` | _`h x - `_ | Creates an output action similarly to [`SETLIBCODE`](#instr-setlibcode), but instead of the library code accepts its hash as an unsigned 256-bit integer `h`. If `x!=0` and the library with hash `h` is absent from the library collection of this smart contract, this output action will fail. | `526` |


### TVM Instructions Content List

* [Overview](/learn/tvm-instructions/instructions)
* [Stack Manipulation](/learn/tvm-instructions/instructions/stack-manipulation)
* [Tuple, List and Null](/learn/tvm-instructions/instructions/tuple-list-null)
* [Constants and Literals](/learn/tvm-instructions/instructions/constant)
* [Arithmetic Operations](/learn/tvm-instructions/instructions/arithmetic)
* [Data Comparison](/learn/tvm-instructions/instructions/data-comparison)
* [Cell Manipulation](/learn/tvm-instructions/instructions/cell-manipulation)
* [Continuation and Control Flow](/learn/tvm-instructions/instructions/control-flow)
* [Exception Generation and Handling](/learn/tvm-instructions/instructions/exception-gen-and-handling)
* [Dictionary Manipulation](/learn/tvm-instructions/instructions/dictionary-manipulation)
* [Application-specific Primitives](/learn/tvm-instructions/instructions/app-specific)
* [Miscellaneous](/learn/tvm-instructions/instructions/miscellaneous)

...
* [Exit From TVM Instruction Full Screen Mode](/learn/tvm-instructions/tvm-overview)


## See Also

- [TVM Overview](/learn/tvm-instructions/tvm-overview)
32 changes: 32 additions & 0 deletions src/pages/learn/tvm-instructions/instructions/arithmetic.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,22 @@ import { arithmeticOpcodes as opcodes } from '@site/src/data/opcodes';
]}
/>

### TVM Instructions Content List

* [Overview](/learn/tvm-instructions/instructions)
* [Stack Manipulation](/learn/tvm-instructions/instructions/stack-manipulation)
* [Tuple, List and Null](/learn/tvm-instructions/instructions/tuple-list-null)
* [Constants and Literals](/learn/tvm-instructions/instructions/constant)
* [Arithmetic Operations](/learn/tvm-instructions/instructions/arithmetic)
* [Data Comparison](/learn/tvm-instructions/instructions/data-comparison)
* [Cell Manipulation](/learn/tvm-instructions/instructions/cell-manipulation)
* [Continuation and Control Flow](/learn/tvm-instructions/instructions/control-flow)
* [Exception Generation and Handling](/learn/tvm-instructions/instructions/exception-gen-and-handling)
* [Dictionary Manipulation](/learn/tvm-instructions/instructions/dictionary-manipulation)
* [Application-specific Primitives](/learn/tvm-instructions/instructions/app-specific)
* [Miscellaneous](/learn/tvm-instructions/instructions/miscellaneous)

## Arithmetic primitives
### Addition, subtraction, multiplication

| xxxxxxx<br/>Opcode | xxxxxxxxxxxxxxxxxxxxxxxxxxxx<br/>Fift syntax | xxxxxxxxxxxxxxxxx<br/>Stack | xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx<br/>Description | xxxx<br/>Gas |
Expand Down Expand Up @@ -128,3 +144,19 @@ Quiet versions of integer comparison primitives are also available ([`QUIET SGN`
| **`B7B5cc`** | `[cc+1] QUFITS` | _`x - x`_ | Replaces `x` with a `NaN` if x is not a `cc+1`-bit unsigned integer, leaves it intact otherwise. | `34` |
| **`B7B600`** | `QFITSX` | _`x c - x`_ | Replaces `x` with a `NaN` if x is not a c-bit signed integer, leaves it intact otherwise. | `34` |
| **`B7B601`** | `QUFITSX` | _`x c - x`_ | Replaces `x` with a `NaN` if x is not a c-bit unsigned integer, leaves it intact otherwise. | `34` |


### TVM Instructions Content List

* [Overview](/learn/tvm-instructions/instructions)
* [Stack Manipulation](/learn/tvm-instructions/instructions/stack-manipulation)
* [Tuple, List and Null](/learn/tvm-instructions/instructions/tuple-list-null)
* [Constants and Literals](/learn/tvm-instructions/instructions/constant)
* [Arithmetic Operations](/learn/tvm-instructions/instructions/arithmetic)
* [Data Comparison](/learn/tvm-instructions/instructions/data-comparison)
* [Cell Manipulation](/learn/tvm-instructions/instructions/cell-manipulation)
* [Continuation and Control Flow](/learn/tvm-instructions/instructions/control-flow)
* [Exception Generation and Handling](/learn/tvm-instructions/instructions/exception-gen-and-handling)
* [Dictionary Manipulation](/learn/tvm-instructions/instructions/dictionary-manipulation)
* [Application-specific Primitives](/learn/tvm-instructions/instructions/app-specific)
* [Miscellaneous](/learn/tvm-instructions/instructions/miscellaneous)
Loading
Loading