-
Notifications
You must be signed in to change notification settings - Fork 350
Update documentation according to the TVM Update 02.2025 #1192
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
Merged
Merged
Changes from 4 commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
7eac435
Update documentation according to the TVM Update 02.2025
fakela d949692
tvm-upd-2025-02
aigerimu 5a9161d
order
aigerimu b58ff77
added link to ton status and date of roll up
fakela c45b014
Updates based on reviewer comments
fakela 92dfd09
fix typo
fakela File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
65 changes: 65 additions & 0 deletions
65
docs/v3/documentation/tvm/changelog/tvm-upgrade-2025-02.md
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
import Feedback from '@site/src/components/Feedback'; | ||
|
||
# TVM upgrade Feb 2025 | ||
|
||
|
||
:::tip | ||
This upgrade is active on the Mainnet since **March 11, 2025**. See details in the [here](https://t.me/tonstatus/155). | ||
::: | ||
|
||
## c7 tuple extension | ||
|
||
The `c7` tuple parameter number **13** (previous blocks info tuple) now has a third element, containing IDs of the last 16 masterchain blocks with seqno divisible by 100. | ||
|
||
Example: if the last masterchain block seqno is `19071`, the list contains block IDs with seqnos `19000, 18900, ..., 17500`. | ||
|
||
|
||
## New TVM instructions - cryptographic and continuation operations | ||
|
||
| Fift syntax | Stack | Description | | ||
| :--------------------------------- | :---------------------------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `SECP256K1_XONLY_PUBKEY_TWEAK_ADD` | *`key tweak - 0 or f x y -1`* | Performs `secp256k1_xonly_pubkey_tweak_add`. Inputs are two 256-bit unsigned integers (`key`, `tweak`). Returns a 65-byte public key as `uint8 f`, `uint256 x`, `uint256 y` (similar to `ECRECOVER`). Gas cost: 1276. | | ||
| `mask SETCONTCTRMANY` | *`cont - cont'`* | For each bit set in `mask` (range 0..255), applies `c[i] PUSHCTR SWAP c[i] SETCONTCNR` to the continuation. Efficiently updates multiple continuations. | | ||
| `SETCONTCTRMANYX` | *`cont mask - cont'`* | Same as `SETCONTCTRMANY`, but reads `mask` from the stack. | | ||
| `PREVMCBLOCKS_100` | *`- list`* | Returns the new third element in `c7[13]`: a list of 16 recent masterchain block IDs (where seqno is divisible by 100). | | ||
|
||
## Execution and gas logic improvements | ||
|
||
* When the `RAWRESERVE` action uses flag 4, the original balance is calculated as `balance - msg_balance_remaining`. | ||
fakela marked this conversation as resolved.
Show resolved
Hide resolved
|
||
* The gas cost for continuation jumps deeper than 8 levels is increased by one additional gas unit per extra level. | ||
* Jumps to continuations with non-null control data now execute without error. | ||
* The `RESERVE` action in mode +2 supports reserving extra currencies in addition to TON. | ||
* Executing contract code from a library cell does not consume additional gas. | ||
* Accounts with previously locked highload-v2 wallets are assigned higher gas limits to enable unlocking and improved operation. | ||
|
||
## Error handling improvements | ||
|
||
If these instructions encounter multiple error conditions, the TVM prioritizes `stk_und` (stack underflow) over other errors. | ||
|
||
| Fift syntax | Stack | Description | | ||
| --------------------- | ------------------------------------ | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | ||
| `GETGASFEE` | *`gas_used is_mc - price`* | Calculates the computation cost in nanotons for a transaction that consumes `gas_used` gas. | | ||
| `GETSTORAGEFEE` | *`cells bits seconds is_mc - price`* | Calculates the storage fees in nanotons for the contract based on current storage prices. `cells` and `bits` represent the size of the [`AccountState`](https://github.com/ton-blockchain/ton/blob/8a9ff339927b22b72819c5125428b70c406da631/crypto/block/block.tlb#L247) with deduplication, including the root cell. | | ||
| `GETFORWARDFEE` | *`cells bits is_mc - price`* | Calculates forward fees in nanotons for an outgoing message. `is_mc` is true if the source or the destination is in the MasterChain and false if both are in the basechain. | | ||
| `GETORIGINALFWDFEE` | *`fwd_fee is_mc - orig_fwd_fee`* | Calculates `fwd_fee * 2^16 / first_frac`. Used to derive the original forwarding fee. | | ||
| `GETGASFEESIMPLE` | *`gas_used is_mc - price`* | Computes simplified gas cost using `(gas_used * price) / 2^16`. | | ||
| `GETFORWARDFEESIMPLE` | *`cells bits is_mc - price`* | Computes simplified forwarding fee using `(bits * bit_price + cells * cell_price) / 2^16`. | | ||
| `HASHEXT` | *`cell i - hash`* | Computes an extended hash of a cell at the given index. | | ||
| `PFXDICTSET` | *`x k D n – D0 −1 or D 0`* | Sets a value in a prefix code dictionary. Fails if prefix constraints are violated. | | ||
| `PFXDICTREPLACE` | *`x k D n – D0 −1 or D 0`* | Replaces a value in a prefix code dictionary if constraints are satisfied. | | ||
| `PFXDICTADD` | *`x k D n – D0 −1 or D 0`* | Adds an entry to a prefix code dictionary. Fails if entry already exists. | | ||
| `PFXDICTDEL` | *`k D n – D0 −1 or D 0`* | Deletes an entry from a prefix code dictionary. | ||
## Emulator and validator improvements | ||
|
||
Validator nodes now perform more reliable IP discovery by retrying DHT queries, making it easier to locate updated peers during upgrades or restarts. The validator console also displays dashed names and shard formats in a more readable format, helping operators better monitor network activity. | ||
|
||
In the emulator, handling of library cells and extra currency operations has been improved to provide more accurate behavior during local testing. Support for extra currencies has been refined across both `rungetmethod` and reserve modes, ensuring compatibility for contracts that rely on multi-currency interactions. | ||
|
||
## TL-B schema fixes | ||
|
||
* Corrected CRC computations ensuring accurate validation of TL-B schema data. | ||
* Fixed incorrect tags in Merkle proofs, improving proof reliability. | ||
* Improved handling of `advance_ext` for better spec alignment. | ||
* Fixed `NatWidth` print function to properly display natural width representations. | ||
|
||
<Feedback /> |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.