Skip to content

Commit

Permalink
Merge pull request #351 from tonlabs/1.9.0-rc
Browse files Browse the repository at this point in the history
Version 1.9.0
  • Loading branch information
d3p authored Feb 25, 2021
2 parents 26a2cc4 + 49aa7c2 commit 7873392
Show file tree
Hide file tree
Showing 36 changed files with 626 additions and 165 deletions.
17 changes: 16 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,13 +2,28 @@

All notable changes to this project will be documented in this file.

## 1.9.0 Feb 19, 2021

### New

- `tuple_list_as_array` parameter in `tvm.run_get` function which controls lists representation.
Default is stack-like based on nested tuples. If set to `true` then returned lists are encoded as plain arrays. Use this option if you receive this error on Web: "Runtime error. Unreachable code should not be executed..."
This reduces stack size requirements for long lists.
- `function_name` field of `CallSet` structure can be the name or **id (as string in hex starting with 0x)** of the called function.
- Fields `config_servers`, `query_url`, `account_address`, `gas_used` added into specific errors' `ClientError.data` object.

### Fixed

- Binaries download links are now under https protocol
- If you receive this error on Web: "Runtime error. Unreachable code should not be executed..." in `run_get`, use the new parameter `tuple_list_as_array = true`. [See the documentation](docs/mod_tvm.md#run_get). This may happen, for example, when elector contract contains too many participants

## 1.8.0 Feb 11, 2021

### New

- **Debot Module**:
- Added new built-in interface `Msg` which allows to send external message to blockchain and sign it with supplied keypair.

### Fixed

- `crypto.hdkey_public_from_xprv` used compressed 33-byte form instead of normal 32-byte.
Expand Down
14 changes: 7 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -182,15 +182,15 @@ TON Labs SDK Binaries Store.

Platform | Major | Download links
-------- | ----- | --------------
Win32 | 0 | [`ton_client.lib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_win32_lib.gz), [`ton_client.dll`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_win32_dll.gz)
  | 1 | [`ton_client.lib`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_win32_lib.gz), [`ton_client.dll`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_win32_dll.gz)
macOS | 0 | [`libton_client.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_darwin.gz)
  | 1 | [`libton_client.dylib`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_darwin.gz)
Linux | 0 | [`libton_client.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_0_linux.gz)
  | 1 | [`libton_client.so`](http://sdkbinaries-ws.tonlabs.io/tonclient_1_linux.gz)
Win32 | 0 | [`ton_client.lib`](https://binaries.tonlabs.io/tonclient_0_win32_lib.gz), [`ton_client.dll`](https://binaries.tonlabs.io/tonclient_0_win32_dll.gz)
  | 1 | [`ton_client.lib`](https://binaries.tonlabs.io/tonclient_1_win32_lib.gz), [`ton_client.dll`](https://binaries.tonlabs.io/tonclient_1_win32_dll.gz)
macOS | 0 | [`libton_client.dylib`](https://binaries.tonlabs.io/tonclient_0_darwin.gz)
  | 1 | [`libton_client.dylib`](https://binaries.tonlabs.io/tonclient_1_darwin.gz)
Linux | 0 | [`libton_client.so`](https://binaries.tonlabs.io/tonclient_0_linux.gz)
  | 1 | [`libton_client.so`](https://binaries.tonlabs.io/tonclient_1_linux.gz)

If you want an older version of library (e.g. `0.25.0` for macOS), you need to choose a link to your platform from the list above and replace `0` with a version:
[http://sdkbinaries.tonlabs.io/tonclient_<b>0_25_0</b>_darwin.gz](http://sdkbinaries.tonlabs.io/tonclient_0_25_0_darwin.gz)
[https://binaries.tonlabs.io/tonclient_<b>0_25_0</b>_darwin.gz](http://sdkbinaries.tonlabs.io/tonclient_0_25_0_darwin.gz)

_Downloaded archive is gzipped file_

2 changes: 1 addition & 1 deletion api/derive/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api_derive"
version = "1.8.0"
version = "1.9.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion api/info/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api_info"
version = "1.8.0"
version = "1.9.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"

Expand Down
2 changes: 1 addition & 1 deletion api/test/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "api_test"
version = "1.8.0"
version = "1.9.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"

Expand Down
10 changes: 6 additions & 4 deletions docs/mod_abi.md
Original file line number Diff line number Diff line change
Expand Up @@ -433,7 +433,7 @@ function encode_account(
- `last_trans_lt`?: _bigint_ – Initial value for the `last_trans_lt`.
- `last_paid`?: _number_ – Initial value for the `last_paid`.
- `boc_cache`?: _[BocCacheType](mod_boc.md#BocCacheType)_ – Cache type to put the result.
<br>The BOC intself returned if no cache type provided
<br>The BOC itself returned if no cache type provided


### Result
Expand All @@ -456,7 +456,8 @@ enum AbiErrorCode {
InvalidTvcImage = 308,
RequiredPublicKeyMissingForFunctionHeader = 309,
InvalidSigner = 310,
InvalidAbi = 311
InvalidAbi = 311,
InvalidFunctionId = 312
}
```
One of the following value:
Expand All @@ -472,6 +473,7 @@ One of the following value:
- `RequiredPublicKeyMissingForFunctionHeader = 309`
- `InvalidSigner = 310`
- `InvalidAbi = 311`
- `InvalidFunctionId = 312`


## Abi
Expand Down Expand Up @@ -550,7 +552,7 @@ type CallSet = {
input?: any
}
```
- `function_name`: _string_ – Function name that is being called.
- `function_name`: _string_ – Function name that is being called. Or function id encoded as string in hex (starting with 0x).
- `header`?: _[FunctionHeader](mod_abi.md#FunctionHeader)_ – Function header.
<br>If an application omits some header parameters required by the<br>contract's ABI, the library will set the default values for<br>them.
- `input`?: _any_ – Function input parameters according to ABI.
Expand Down Expand Up @@ -1021,7 +1023,7 @@ type ParamsOfEncodeAccount = {
- `last_trans_lt`?: _bigint_ – Initial value for the `last_trans_lt`.
- `last_paid`?: _number_ – Initial value for the `last_paid`.
- `boc_cache`?: _[BocCacheType](mod_boc.md#BocCacheType)_ – Cache type to put the result.
<br>The BOC intself returned if no cache type provided
<br>The BOC itself returned if no cache type provided
## ResultOfEncodeAccount
Expand Down
6 changes: 3 additions & 3 deletions docs/mod_crypto.md
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ Crypto functions.

[nacl_box](#nacl_box) – Public key authenticated encryption

[nacl_box_open](#nacl_box_open) – Decrypt and verify the cipher text using the recievers secret key, the senders public key, and the nonce.
[nacl_box_open](#nacl_box_open) – Decrypt and verify the cipher text using the receivers secret key, the senders public key, and the nonce.

[nacl_secret_box](#nacl_secret_box) – Encrypt and authenticate message using nonce and secret key.

Expand Down Expand Up @@ -733,7 +733,7 @@ function nacl_box_keypair_from_secret_key(

Public key authenticated encryption

Encrypt and authenticate a message using the senders secret key, the recievers public
Encrypt and authenticate a message using the senders secret key, the receivers public
key, and a nonce.

```ts
Expand Down Expand Up @@ -766,7 +766,7 @@ function nacl_box(

## nacl_box_open

Decrypt and verify the cipher text using the recievers secret key, the senders public key, and the nonce.
Decrypt and verify the cipher text using the receivers secret key, the senders public key, and the nonce.

```ts
type ParamsOfNaclBoxOpen = {
Expand Down
4 changes: 2 additions & 2 deletions docs/mod_debot.md
Original file line number Diff line number Diff line change
Expand Up @@ -201,7 +201,7 @@ enum DebotErrorCode {
DebotInvalidAbi = 807,
DebotGetMethodFailed = 808,
DebotInvalidMsg = 809,
DebotExternaCallFailed = 810
DebotExternalCallFailed = 810
}
```
One of the following value:
Expand All @@ -215,7 +215,7 @@ One of the following value:
- `DebotInvalidAbi = 807`
- `DebotGetMethodFailed = 808`
- `DebotInvalidMsg = 809`
- `DebotExternaCallFailed = 810`
- `DebotExternalCallFailed = 810`


## DebotHandle
Expand Down
66 changes: 36 additions & 30 deletions docs/mod_tvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
## Functions
[run_executor](#run_executor) – Emulates all the phases of contract execution locally

[run_tvm](#run_tvm) – Executes get methods of ABI-compatible contracts
[run_tvm](#run_tvm) – Executes get-methods of ABI-compatible contracts

[run_get](#run_get) – Executes a getmethod of FIFT contract
[run_get](#run_get) – Executes a get-method of FIFT contract

## Types
[TvmErrorCode](#TvmErrorCode)
Expand Down Expand Up @@ -38,19 +38,19 @@ Emulates all the phases of contract execution locally
Performs all the phases of contract execution on Transaction Executor -
the same component that is used on Validator Nodes.

Can be used for contract debug, to find out the reason of message unsuccessful
delivery - as Validators just throw away failed transactions, here you can catch it.
Can be used for contract debugginh, to find out the reason why message was not delivered successfully
- because Validators just throw away the failed external inbound messages, here you can catch them.

Another use case is to estimate fees for message execution. Set `AccountForExecutor::Account.unlimited_balance`
to `true` so that emulation will not depend on the actual balance.

One more use case - you can procude the sequence of operations,
One more use case - you can produce the sequence of operations,
thus emulating the multiple contract calls locally.
And so on.

To get the account boc (bag of cells) - use `net.query` method to download it from graphql api
(field `boc` of `account`) or generate it with `abi.encode_account method`.
To get the message boc - use `abi.encode_message` or prepare it any other way, for instance, with Fift script.
To get the account BOC (bag of cells) - use `net.query` method to download it from GraphQL API
(field `boc` of `account`) or generate it with `abi.encode_account` method.
To get the message BOC - use `abi.encode_message` or prepare it any other way, for instance, with FIFT script.

If you need this emulation to be as precise as possible then specify `ParamsOfRunExecutor` parameter.
If you need to see the aborted transaction as a result, not as an error, set `skip_transaction_check` to `true`.
Expand Down Expand Up @@ -86,7 +86,7 @@ function run_executor(
- `abi`?: _[Abi](mod_abi.md#Abi)_ – Contract ABI for decoding output messages
- `skip_transaction_check`?: _boolean_ – Skip transaction check flag
- `boc_cache`?: _[BocCacheType](mod_boc.md#BocCacheType)_ – Cache type to put the result.
<br>The BOC intself returned if no cache type provided
<br>The BOC itself returned if no cache type provided
- `return_updated_account`?: _boolean_ – Return updated account flag.
<br>Empty string is returned if the flag is `false`

Expand All @@ -105,20 +105,20 @@ function run_executor(

## run_tvm

Executes get methods of ABI-compatible contracts
Executes get-methods of ABI-compatible contracts

Performs only a part of compute phase of transaction execution
that is used to run get-methods of ABI-compatible contracts.

If you try to run get methods with `run_executor` you will get an error, because it checks ACCEPT and exits
if there is none, which is actually true for get methods.
If you try to run get-methods with `run_executor` you will get an error, because it checks ACCEPT and exits
if there is none, which is actually true for get-methods.

To get the account boc (bag of cells) - use `net.query` method to download it from graphql api
To get the account BOC (bag of cells) - use `net.query` method to download it from GraphQL API
(field `boc` of `account`) or generate it with `abi.encode_account method`.
To get the message boc - use `abi.encode_message` or prepare it any other way, for instance, with Fift script.
To get the message BOC - use `abi.encode_message` or prepare it any other way, for instance, with FIFT script.

Attention! Updated account state is produces as well, but only
`account_state.storage.state.data` part of the boc is updated.
`account_state.storage.state.data` part of the BOC is updated.

```ts
type ParamsOfRunTvm = {
Expand Down Expand Up @@ -146,9 +146,9 @@ function run_tvm(
- `account`: _string_ – Account BOC.
<br>Must be encoded as base64.
- `execution_options`?: _[ExecutionOptions](mod_tvm.md#ExecutionOptions)_ – Execution options.
- `abi`?: _[Abi](mod_abi.md#Abi)_ – Contract ABI for dedcoding output messages
- `abi`?: _[Abi](mod_abi.md#Abi)_ – Contract ABI for decoding output messages
- `boc_cache`?: _[BocCacheType](mod_boc.md#BocCacheType)_ – Cache type to put the result.
<br>The BOC intself returned if no cache type provided
<br>The BOC itself returned if no cache type provided
- `return_updated_account`?: _boolean_ – Return updated account flag.
<br>Empty string is returned if the flag is `false`

Expand All @@ -159,22 +159,23 @@ function run_tvm(
<br>Encoded as `base64`
- `decoded`?: _[DecodedOutput](mod_processing.md#DecodedOutput)_ – Optional decoded message bodies according to the optional `abi` parameter.
- `account`: _string_ – Updated account state BOC.
<br>Encoded as `base64`. Attention! Only `account_state.storage.state.data` part of the boc is updated.
<br>Encoded as `base64`. Attention! Only `account_state.storage.state.data` part of the BOC is updated.


## run_get

Executes a getmethod of FIFT contract
Executes a get-method of FIFT contract

Executes a getmethod of FIFT contract that fulfills the smc-guidelines https://test.ton.org/smc-guidelines.txt
Executes a get-method of FIFT contract that fulfills the smc-guidelines https://test.ton.org/smc-guidelines.txt
and returns the result data from TVM's stack

```ts
type ParamsOfRunGet = {
account: string,
function_name: string,
input?: any,
execution_options?: ExecutionOptions
execution_options?: ExecutionOptions,
tuple_list_as_array?: boolean
}

type ResultOfRunGet = {
Expand All @@ -189,12 +190,14 @@ function run_get(
- `account`: _string_ – Account BOC in `base64`
- `function_name`: _string_ – Function name
- `input`?: _any_ – Input parameters
- `execution_options`?: _[ExecutionOptions](mod_tvm.md#ExecutionOptions)_
- `execution_options`?: _[ExecutionOptions](mod_tvm.md#ExecutionOptions)_ – Execution options
- `tuple_list_as_array`?: _boolean_ – Convert lists based on nested tuples in the **result** into plain arrays.
<br>Default is `false`. Input parameters may use any of lists representations<br>If you receive this error on Web: "Runtime error. Unreachable code should not be executed...",<br>set this flag to true.<br>This may happen, for example, when elector contract contains too many participants


### Result

- `output`: _any_ – Values returned by getmethod on stack
- `output`: _any_ – Values returned by get-method on stack


# Types
Expand Down Expand Up @@ -323,7 +326,7 @@ type ParamsOfRunExecutor = {
- `abi`?: _[Abi](mod_abi.md#Abi)_ – Contract ABI for decoding output messages
- `skip_transaction_check`?: _boolean_ – Skip transaction check flag
- `boc_cache`?: _[BocCacheType](mod_boc.md#BocCacheType)_ – Cache type to put the result.
<br>The BOC intself returned if no cache type provided
<br>The BOC itself returned if no cache type provided
- `return_updated_account`?: _boolean_ – Return updated account flag.
<br>Empty string is returned if the flag is `false`
Expand Down Expand Up @@ -364,9 +367,9 @@ type ParamsOfRunTvm = {
- `account`: _string_ – Account BOC.
<br>Must be encoded as base64.
- `execution_options`?: _[ExecutionOptions](mod_tvm.md#ExecutionOptions)_ – Execution options.
- `abi`?: _[Abi](mod_abi.md#Abi)_ – Contract ABI for dedcoding output messages
- `abi`?: _[Abi](mod_abi.md#Abi)_ – Contract ABI for decoding output messages
- `boc_cache`?: _[BocCacheType](mod_boc.md#BocCacheType)_ – Cache type to put the result.
<br>The BOC intself returned if no cache type provided
<br>The BOC itself returned if no cache type provided
- `return_updated_account`?: _boolean_ – Return updated account flag.
<br>Empty string is returned if the flag is `false`
Expand All @@ -383,7 +386,7 @@ type ResultOfRunTvm = {
<br>Encoded as `base64`
- `decoded`?: _[DecodedOutput](mod_processing.md#DecodedOutput)_ – Optional decoded message bodies according to the optional `abi` parameter.
- `account`: _string_ – Updated account state BOC.
<br>Encoded as `base64`. Attention! Only `account_state.storage.state.data` part of the boc is updated.
<br>Encoded as `base64`. Attention! Only `account_state.storage.state.data` part of the BOC is updated.
## ParamsOfRunGet
Expand All @@ -392,13 +395,16 @@ type ParamsOfRunGet = {
account: string,
function_name: string,
input?: any,
execution_options?: ExecutionOptions
execution_options?: ExecutionOptions,
tuple_list_as_array?: boolean
}
```
- `account`: _string_ – Account BOC in `base64`
- `function_name`: _string_ – Function name
- `input`?: _any_ – Input parameters
- `execution_options`?: _[ExecutionOptions](mod_tvm.md#ExecutionOptions)_
- `execution_options`?: _[ExecutionOptions](mod_tvm.md#ExecutionOptions)_ – Execution options
- `tuple_list_as_array`?: _boolean_ – Convert lists based on nested tuples in the **result** into plain arrays.
<br>Default is `false`. Input parameters may use any of lists representations<br>If you receive this error on Web: "Runtime error. Unreachable code should not be executed...",<br>set this flag to true.<br>This may happen, for example, when elector contract contains too many participants
## ResultOfRunGet
Expand All @@ -407,6 +413,6 @@ type ResultOfRunGet = {
output: any
}
```
- `output`: _any_ – Values returned by getmethod on stack
- `output`: _any_ – Values returned by get-method on stack
6 changes: 3 additions & 3 deletions docs/modules.md
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ Where:

[nacl_box](mod_crypto.md#nacl_box) – Public key authenticated encryption

[nacl_box_open](mod_crypto.md#nacl_box_open) – Decrypt and verify the cipher text using the recievers secret key, the senders public key, and the nonce.
[nacl_box_open](mod_crypto.md#nacl_box_open) – Decrypt and verify the cipher text using the receivers secret key, the senders public key, and the nonce.

[nacl_secret_box](mod_crypto.md#nacl_secret_box) – Encrypt and authenticate message using nonce and secret key.

Expand Down Expand Up @@ -157,9 +157,9 @@ Where:

[run_executor](mod_tvm.md#run_executor) – Emulates all the phases of contract execution locally

[run_tvm](mod_tvm.md#run_tvm) – Executes get methods of ABI-compatible contracts
[run_tvm](mod_tvm.md#run_tvm) – Executes get-methods of ABI-compatible contracts

[run_get](mod_tvm.md#run_get) – Executes a getmethod of FIFT contract
[run_get](mod_tvm.md#run_get) – Executes a get-method of FIFT contract

## [net](mod_net.md) – Network access.

Expand Down
2 changes: 1 addition & 1 deletion ton_client/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ton_client"
version = "1.8.0"
version = "1.9.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
2 changes: 1 addition & 1 deletion ton_client/src/abi/encode_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ pub struct ParamsOfEncodeAccount {
pub last_trans_lt: Option<u64>,
/// Initial value for the `last_paid`.
pub last_paid: Option<u32>,
/// Cache type to put the result. The BOC intself returned if no cache type provided
/// Cache type to put the result. The BOC itself returned if no cache type provided
pub boc_cache: Option<BocCacheType>,
}

Expand Down
Loading

0 comments on commit 7873392

Please sign in to comment.