Skip to content

Commit

Permalink
Merge pull request #343 from tonlabs/1.8.0-rc
Browse files Browse the repository at this point in the history
Version 1.8.0
  • Loading branch information
d3p authored Feb 12, 2021
2 parents ef19c55 + bccaef5 commit 26a2cc4
Show file tree
Hide file tree
Showing 52 changed files with 566 additions and 195 deletions.
24 changes: 19 additions & 5 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,14 +1,28 @@
# Release Notes

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

## 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.

## 1.7.0 Feb 9, 2021

### New

- BOC cache management functions were introduced:
- `boc.cache_set`,
- `boc.cache_get`
- `boc.cache_unpin`
- Now functions that take boc as a parameter can also take a reference to boc cash instead so that it deсreases the number of boc serialization
and deserializations which drastically improves performance of `run_tvm` and `run_executor` expecially in case of numerous calls on the same data.
- `boc.cache_set`,
- `boc.cache_get`
- `boc.cache_unpin`
- Now functions that take boc as a parameter can also take a reference to boc cash instead so that it deсreases the number of boc serialization
and deserializations which drastically improves performance of `run_tvm` and `run_executor` expecially in case of numerous calls on the same data.
- `boc_cache` parameter in `tvm.run_tvm` and `tvm.run_executor` functions to save resulting messages and account BOCs into cache.
- `return_updated_account` flag parameter introduced in `tvm.run_tvm` and `tvm.run_executor` functions to return updated account state. Important: by default this flag is `false` and account data is not returned.
- `abi.encode_internal_message` function to encode an internal ABI-compatible message.
Expand Down
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.7.0"
version = "1.8.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.7.0"
version = "1.8.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.7.0"
version = "1.8.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"

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.7.0"
version = "1.8.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
4 changes: 2 additions & 2 deletions ton_client/src/abi/decode_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ impl DecodedMessageBody {

//---------------------------------------------------------------------------------- decode_message

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ParamsOfDecodeMessage {
/// contract ABI
pub abi: Abi,
Expand All @@ -89,7 +89,7 @@ pub async fn decode_message(

//----------------------------------------------------------------------------- decode_message_body

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ParamsOfDecodeMessageBody {
/// Contract ABI used to decode.
pub abi: Abi,
Expand Down
16 changes: 13 additions & 3 deletions ton_client/src/abi/encode_account.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ use ton_sdk::ContractImage;

//--------------------------------------------------------------------------------- encode_account

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct StateInitParams {
abi: Abi,
value: Value,
Expand Down Expand Up @@ -45,7 +45,17 @@ pub enum StateInitSource {
},
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
impl Default for StateInitSource {
fn default() -> Self {
StateInitSource::Tvc {
tvc: Default::default(),
public_key: Default::default(),
init_params: Default::default(),
}
}
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct ParamsOfEncodeAccount {
/// Source of the account state init.
pub state_init: StateInitSource,
Expand All @@ -59,7 +69,7 @@ pub struct ParamsOfEncodeAccount {
pub boc_cache: Option<BocCacheType>,
}

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ResultOfEncodeAccount {
/// Account BOC encoded in `base64`.
pub account: String,
Expand Down
20 changes: 10 additions & 10 deletions ton_client/src/abi/encode_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ impl CallSet {
}
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct ParamsOfEncodeMessage {
/// Contract ABI.
pub abi: Abi,
Expand Down Expand Up @@ -216,7 +216,7 @@ pub struct ParamsOfEncodeMessage {
pub processing_try_index: Option<u8>,
}

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ResultOfEncodeMessage {
/// Message BOC encoded with `base64`.
pub message: String,
Expand Down Expand Up @@ -459,7 +459,7 @@ pub async fn encode_message(

//------------------------------------------------------------------------ encode_internal_message

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct ParamsOfEncodeInternalMessage {
/// Contract ABI.
pub abi: Abi,
Expand Down Expand Up @@ -492,7 +492,7 @@ pub struct ParamsOfEncodeInternalMessage {
pub enable_ihr: Option<bool>,
}

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ResultOfEncodeInternalMessage {
/// Message BOC encoded with `base64`.
pub message: String,
Expand Down Expand Up @@ -591,7 +591,7 @@ pub async fn encode_internal_message(

//---------------------------------------------------------------------------- encode_message_body

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct ParamsOfEncodeMessageBody {
/// Contract ABI.
pub abi: Abi,
Expand Down Expand Up @@ -622,7 +622,7 @@ pub struct ParamsOfEncodeMessageBody {
pub processing_try_index: Option<u8>,
}

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ResultOfEncodeMessageBody {
/// Message body BOC encoded with `base64`.
pub body: String,
Expand Down Expand Up @@ -717,7 +717,7 @@ pub async fn encode_message_body(

//------------------------------------------------------------------------------- attach_signature

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ParamsOfAttachSignature {
/// Contract ABI
pub abi: Abi,
Expand All @@ -732,7 +732,7 @@ pub struct ParamsOfAttachSignature {
pub signature: String,
}

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ResultOfAttachSignature {
/// Signed message BOC
pub message: String,
Expand Down Expand Up @@ -762,7 +762,7 @@ pub async fn attach_signature(

//---------------------------------------------------------------- attach_signature_to_message_body

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ParamsOfAttachSignatureToMessageBody {
/// Contract ABI
pub abi: Abi,
Expand All @@ -777,7 +777,7 @@ pub struct ParamsOfAttachSignatureToMessageBody {
pub signature: String,
}

#[derive(Serialize, Deserialize, ApiType)]
#[derive(Serialize, Deserialize, ApiType, Default)]
pub struct ResultOfAttachSignatureToMessageBody {
pub body: String,
}
Expand Down
6 changes: 6 additions & 0 deletions ton_client/src/abi/signing.rs
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,12 @@ pub enum Signer {
SigningBox { handle: SigningBoxHandle },
}

impl Default for Signer {
fn default() -> Self {
Signer::None
}
}

impl Signer {
pub(crate) fn is_external(&self) -> bool {
if let Signer::External { .. } = self {
Expand Down
16 changes: 11 additions & 5 deletions ton_client/src/abi/types.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,12 @@ pub enum Abi {
Serialized(AbiContract),
}

impl Default for Abi {
fn default() -> Self {
Abi::Json(Default::default())
}
}

impl Abi {
pub(crate) fn json_string(&self) -> ClientResult<String> {
match self {
Expand All @@ -31,7 +37,7 @@ impl Abi {
}
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct AbiContract {
#[serde(rename = "ABI version", default = "default_abi_version")]
pub obsolete_abi_version: u32,
Expand All @@ -51,7 +57,7 @@ fn default_abi_version() -> u32 {
2
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct AbiFunction {
pub name: String,
pub inputs: Vec<AbiParam>,
Expand All @@ -60,15 +66,15 @@ pub struct AbiFunction {
pub id: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct AbiEvent {
pub name: String,
pub inputs: Vec<AbiParam>,
#[serde(default)]
pub id: Option<String>,
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct AbiData {
pub key: u64,
pub name: String,
Expand All @@ -78,7 +84,7 @@ pub struct AbiData {
pub components: Vec<AbiParam>,
}

#[derive(Serialize, Deserialize, Clone, Debug, ApiType)]
#[derive(Serialize, Deserialize, Clone, Debug, ApiType, Default)]
pub struct AbiParam {
pub name: String,
#[serde(rename = "type")]
Expand Down
4 changes: 2 additions & 2 deletions ton_client/src/boc/blockchain_config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ use crate::error::ClientResult;
use ton_block::Serializable;
use super::internal::deserialize_object_from_boc;

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfGetBlockchainConfig {
/// Key block BOC encoded as base64
pub block_boc: String,
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ResultOfGetBlockchainConfig {
/// Blockchain config BOC encoded as base64
pub config_boc: String,
Expand Down
16 changes: 11 additions & 5 deletions ton_client/src/boc/cache.rs
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,12 @@ pub enum BocCacheType {
Unpinned
}

impl Default for BocCacheType {
fn default() -> Self {
BocCacheType::Unpinned
}
}

pub struct PinnedBoc {
pins: HashSet<String>,
cell: Cell,
Expand Down Expand Up @@ -231,15 +237,15 @@ fn parse_boc_ref(boc_ref: &str) -> ClientResult<UInt256> {
))
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfBocCacheSet {
/// BOC encoded as base64 or BOC reference
pub boc: String,
/// Cache type
pub cache_type: BocCacheType,
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ResultOfBocCacheSet {
/// Reference to the cached BOC
pub boc_ref: String,
Expand All @@ -261,13 +267,13 @@ pub async fn cache_set(
.map(|hash| ResultOfBocCacheSet { boc_ref: format!("*{}", hash.to_hex_string()) })
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfBocCacheGet {
/// Reference to the cached BOC
pub boc_ref: String,
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ResultOfBocCacheGet {
/// BOC encoded as base64.
pub boc: Option<String>
Expand All @@ -290,7 +296,7 @@ pub async fn cache_get(
Ok( ResultOfBocCacheGet { boc })
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfBocCacheUnpin {
/// Pinned name
pub pin: String,
Expand Down
4 changes: 2 additions & 2 deletions ton_client/src/boc/hash.rs
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,13 @@ use crate::boc::internal::deserialize_cell_from_boc;
use crate::client::ClientContext;
use crate::error::ClientResult;

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfGetBocHash {
/// BOC encoded as base64
pub boc: String,
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ResultOfGetBocHash {
/// BOC root hash encoded with hex
pub hash: String,
Expand Down
6 changes: 3 additions & 3 deletions ton_client/src/boc/parse.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,13 +17,13 @@ use crate::client::ClientContext;
use crate::error::ClientResult;
use serde_json::Value;

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfParse {
/// BOC encoded as base64
pub boc: String,
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ParamsOfParseShardstate {
/// BOC encoded as base64
pub boc: String,
Expand All @@ -33,7 +33,7 @@ pub struct ParamsOfParseShardstate {
pub workchain_id: i32,
}

#[derive(Serialize, Deserialize, Clone, ApiType)]
#[derive(Serialize, Deserialize, Clone, ApiType, Default)]
pub struct ResultOfParse {
/// JSON containing parsed BOC
pub parsed: serde_json::Value,
Expand Down
Loading

0 comments on commit 26a2cc4

Please sign in to comment.