Skip to content

Commit e04aa40

Browse files
committed
Merge remote-tracking branch 'origin/main'
# Conflicts: # sidebars.js
2 parents c80bd98 + a47bd41 commit e04aa40

File tree

15 files changed

+764
-151
lines changed

15 files changed

+764
-151
lines changed

docs/develop/dapps/tutorials/simple-zk-on-ton.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ The verifier shows one of the pieces of paper to you (the prover) and asks you t
2727
Now if the verifier do this 10 times, and you can tell the difference every time, then the verifier will be convinced ~99.90234% (1 - (1/2)^10) that you can see colors.
2828
And if the verifier do this 30 times, then the verifier will be 99.99999990686774% (1 - (1/2)^30) convinced that you can see colors.
2929

30-
But this is an interactive solution, and we can't have a DAppthat ask user to send 30 transactions to prove some claim! So we need a non-interactive solution. And this is where Zk-SNARKs and STARKs come in.
30+
But this is an interactive solution, and we can't have a DApp that ask user to send 30 transactions to prove some claim! So we need a non-interactive solution. And this is where Zk-SNARKs and STARKs come in.
3131

3232
We will only cover Zk-SNARK in this tutorial, but you can read more about STARKs [here](https://starkware.co/stark/) and the comparison between Zk-SNARK and STARK [here](https://blog.pantherprotocol.io/zk-snarks-vs-zk-starks-differences-in-zero-knowledge-technologies/).
3333

docs/develop/func/overview.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ Here is a simple example method for sending money written in FunC:
1010
var msg = begin_cell()
1111
.store_uint(0x10, 6) ;; nobounce
1212
.store_slice(address)
13-
.store_grams(amount)
13+
.store_coins(amount)
1414
.end_cell();
1515
1616
send_raw_message(msg, 64);

docs/develop/func/stdlib.mdx

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ forall X -> (tuple, X) list_next(tuple list) asm( -> 1 0) "UNCONS";
4040
Extracts the head and tail of a lisp-style list. Can be used as a [(non-)modifying method](/develop/func/statements#methods-calls).
4141
```func
4242
() foo(tuple xs) {
43-
int x = xs.list_next(); ;; get the first element
43+
(_, int x) = xs.list_next(); ;; get the first element, `_` means do not use tail list
4444
int y = xs~list_next(); ;; pop the first element
4545
int z = xs~list_next(); ;; pop the second element
4646
}

docs/develop/howto/faq.md

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,6 @@ To protect message chains from being halted at non-existing contracts TON use "b
193193

194194
- [Deploying wallet via TonLib](https://ton.org/docs/develop/dapps/asset-processing/#deploying-wallet)
195195
- [Paying for processing queries and sending responses](https://ton.org/docs/develop/smart-contracts/guidelines/processing)
196-
- [Tips & Tricks: bounce TON back](https://ton.org/docs/develop/smart-contracts/guidelines/tips)
197196

198197
### Is it possible to re-deploy code to an existing address or does it have to be deployed as a new contract?
199198

docs/develop/network/adnl-tcp.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -112,7 +112,7 @@ Packet example in hex:
112112
ac2253594c86bd308ed631d57a63db4ab21279e9382e416128b58ee95897e164 -> sha256
113113
```
114114

115-
In response, we expect to receive [liteServer.masterchainInfo](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/lite_api.tl#L30), consisting of last:[ton.blockIdExt](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/tonlib_api.tl#L51) state_root_hash:int256 и init:[tonNode.zeroStateIdExt](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/ton_api.tl#L359).
115+
In response, we expect to receive [liteServer.masterchainInfo](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/lite_api.tl#L30), consisting of last:[ton.blockIdExt](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/tonlib_api.tl#L51) state_root_hash:int256 and init:[tonNode.zeroStateIdExt](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/ton_api.tl#L359).
116116

117117
The received packet is deserialized in the same way as the sent one - has same algorithm, but in the opposite direction, except that the response is wrapped only in [ADNLAnswer](https://github.com/ton-blockchain/ton/blob/ad736c6bc3c06ad54dc6e40d62acbaf5dae41584/tl/generate/scheme/lite_api.tl#L23).
118118

docs/develop/overview.mdx

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ Whether you're a seasoned developer or new to the space, this page provides an i
2323

2424
## Smart Contracts development
2525

26-
Smart contracts are the building blocks of decentralized applications (dApps) on TON Blockchain. If you're looking to develop your own dApps, it's essential to understand how smart contracts work.
26+
Smart contracts are the building blocks of decentralized applications (DApps) on TON Blockchain. If you're looking to develop your own dApps, it's essential to understand how smart contracts work.
2727

2828
<Button href="/develop/smart-contracts/sdk/javascript" colorType={'primary'} sizeType={'sm'}>Blueprint</Button>
2929
<Button href="/develop/smart-contracts/"
@@ -40,9 +40,9 @@ The following resources provide valuable information for TON smart contract deve
4040
* [Learn Smart Contracts by examples](/develop/smart-contracts/examples) (FunC, Fift)
4141

4242

43-
## DAppDevelopment
43+
## DApp Development
4444

45-
Decentralized applications (dApps) are applications that run on a peer-to-peer network of computers rather than a single computer (TON Blockchain). They are similar to traditional web applications, but they are built on top of a blockchain network. This means that dApps are decentralized, meaning that no single entity controls them.
45+
Decentralized applications (DApps) are applications that run on a peer-to-peer network of computers rather than a single computer (TON Blockchain). They are similar to traditional web applications, but they are built on top of a blockchain network. This means that DApps are decentralized, meaning that no single entity controls them.
4646

4747
### DeFi Development
4848

@@ -51,7 +51,7 @@ Decentralized applications (dApps) are applications that run on a peer-to-peer n
5151
* [TON Connect](/develop/dapps/ton-connect/) — integration and authentication for applications
5252
* [Fungible (FT) / Non-fungible (NFT) tokens](/develop/dapps/defi/tokens) — smart contracts, examples, tools
5353

54-
Take your first steps in dApps development with a comprehensive dApps building guide:
54+
Take your first steps in DApps development with a comprehensive DApps building guide:
5555

5656
- [TON Hello World: Step by step guide for building your first web client](https://ton-community.github.io/tutorials/03-client/)
5757
- [Telegram bot integration via TON Connect](/develop/dapps/ton-connect/tg-bot-integration)

docs/develop/smart-contracts/examples.md

Lines changed: 0 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -132,23 +132,6 @@ Make sure you have thoroughly tested contracts before using them in a production
132132
* [wallet.fif](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/wallet.fif)
133133
* [wallet-v3-code.fif](https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/wallet-v3-code.fif)
134134

135-
## Examples of Tests for Smart Contracts
136-
137-
* [liquid-staking-contract sandbox tests](https://github.com/ton-blockchain/liquid-staking-contract/tree/main/tests)
138-
* [governance_tests](https://github.com/Trinketer22/governance_tests/blob/master/config_tests/tests/)
139-
* [JettonWallet.spec.ts](https://github.com/EmelyanenkoK/modern_jetton/blob/master/tests/JettonWallet.spec.ts)
140-
* [governance_tests](https://github.com/Trinketer22/governance_tests/blob/master/elector_tests/tests/complaint-test.fc)
141-
* [MassSender.spec.ts](https://github.com/Gusarich/ton-mass-sender/blob/main/tests/MassSender.spec.ts)
142-
* [TonForwarder.spec.ts](https://github.com/TrueCarry/ton-contract-forwarder/blob/main/src/contracts/ton-forwarder/TonForwarder.spec.ts)
143-
* [ton-tvm-bus](https://github.com/ton-defi-org/ton-tvm-bus)
144-
* [wTON-contract tests](https://github.com/ton-community/wton-contract/tree/main/tests)
145-
* [getgems tests](https://github.com/ton-community/nft-sdk/tree/main/sandbox-examples/getgems)
146-
* [Distributor.spec.ts](https://github.com/ton-community/simple-distributor/blob/main/tests/Distributor.spec.ts)
147-
* [Migration.spec.ts](https://github.com/Gusarich/jetton-migration/blob/main/tests/Migration.spec.ts)
148-
* [SubdomainManager.spec.ts](https://github.com/Gusarich/simple-subdomain/blob/main/tests/SubdomainManager.spec.ts)
149-
* [Token.spec.ts](https://github.com/Gusarich/ton-single-token/blob/main/tests/Token.spec.ts)
150-
* [Scheduler.spec.ts](https://github.com/Gusarich/external-scheduler/blob/master/tests/Scheduler.spec.ts)
151-
152135
## FunC Libraries and Helpers
153136

154137
* https://github.com/ton-blockchain/ton/blob/master/crypto/smartcont/stdlib.fc

docs/develop/smart-contracts/guidelines/accept.md

Lines changed: 16 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,16 +4,27 @@
44

55
## External messages
66

7-
External messages are processed as follows: `gas_limit` is set to `gas_credit` (ConfigParam 20 and ConfigParam 21) equal to 10k gas. During the spending of those credits, a contract should call `accept_message` to `set_gas_limit` indicating that it is ready to pay fees for message processing. If `gas_credit` is reached or computation is finished, while `accept_message` is not called, this message will be completely discarded (like it never existed at all). Otherwise, a new gas limit equal to `contract_balance/gas_price` (in case of `accept_message`) or a custom number (in the case of `set_gas_limit`) will be set; after the transaction ends, full computation fees will be deducted from the contract balance (that way `gas_credit` is **credit** indeed, not free gas).
7+
External messages are processed as follows:
8+
- The `gas_limit` is set to `gas_credit` (ConfigParam 20 and ConfigParam 21), which is equal to 10k gas.
9+
- During the spending of those credits, a contract should call `accept_message` to `set_gas_limit`, indicating that it is ready to pay fees for message processing.
10+
- If `gas_credit` is reached or computation is finished, and `accept_message` is not called, the message will be completely discarded (as if it never existed at all).
11+
- Otherwise, a new gas limit, equal to `contract_balance/gas_price` (in the case of `accept_message`) or a custom number (in the case of `set_gas_limit`), will be set; after the transaction ends, full computation fees will be deducted from the contract balance (in this way, `gas_credit` is indeed **credit**, not free gas).
12+
13+
14+
Note that if, after `accept_message`, some error is thrown (either in ComputePhase or ActionPhase), the transaction will be written to the blockchain, and fees will be deducted from the contract balance. However, storage will not be updated, and actions will not be applied, as is the case in any transaction with an error exit code.
15+
16+
As a result, if the contract accepts an external message and then throws an exception due to an error in the message data or the sending of an incorrectly serialized message, it will pay for processing but will have no way of preventing message replay. **The same message will be accepted by the contract over and over until it consumes the entire balance.**
17+
818

9-
Note that if after `accept_message` some error is thrown (both in ComputePhase or ActionPhase) transaction will be written to the blockchain and fees will be deducted from the contract balance, but storage will not be updated and actions will not be applied as in any transaction with an error exit code. As a result, if the contract accepts an external message and then throws an exception due to an error in the message data or sending an incorrectly serialized message, it will pay for processing but have no way of preventing message replay. The same message will be accepted by contract over and over until it consumes the entire balance.
1019

1120
## Internal message
1221

13-
By default, when contract gets internal message gas limit is set to `message_balance/gas_price`, in other words, message pays for it's processing. By using `accept_message`/`set_gas_limit` contract may change gas limit during execution. Note that manual settings of gas limits do not interfere with bouncing behavior; messages will be bounced if sent in bounceable mode and contain enough money to pay for their processing and creation of bounce messages.
22+
By default, when a contract receives an internal message, the gas limit is set to `message_balance`/`gas_price`. In other words, the message pays for its processing. By using `accept_message`/`set_gas_limit`, the contract may change the gas limit during execution.
23+
24+
Note that manual settings of gas limits do not interfere with bouncing behavior; messages will be bounced if sent in bounceable mode and contain enough money to pay for their processing and the creation of bounce messages.
1425

1526
:::info example
16-
For instance, if you send a bounceable message with 0.1 TON in basechain that is accepted by a contract with 1 TON balance, computation costs 0.005 TON, and message fee 0.001 TON, then bounce message will contain `0.1 - 0.005 - 0.001 ` = `0.094` TON.
27+
For instance, if you send a bounceable message with 0.1 TON in the basechain that is accepted by a contract with a 1 TON balance, and the computation costs 0.005 TON, with a message fee of 0.001 TON, then the bounce message will contain `0.1 - 0.005 - 0.001` = `0.094` TON.
1728

18-
If in the same example, computation cost will be 0.5 (instead of 0.005), there will be no bounce (message balance should be `0.1 - 0.5 - 0.001 = -0.401`, thus no bounce) and contract balance will be `1 + 0.1 - 0.5` = `0.6` TON
29+
If in the same example, the computation cost is 0.5 (instead of 0.005), there will be no bounce (the message balance would be `0.1 - 0.5 - 0.001 = -0.401`, thus no bounce), and the contract balance will be `1 + 0.1 - 0.5` = `0.6` TON.
1930
:::

docs/develop/smart-contracts/guidelines/tips.md

Lines changed: 0 additions & 87 deletions
This file was deleted.

0 commit comments

Comments
 (0)