Skip to content

Commit

Permalink
Merge pull request #334 from tonlabs/1.6.3-rc
Browse files Browse the repository at this point in the history
Version 1.6.3
  • Loading branch information
d3p authored Feb 4, 2021
2 parents e870ada + 99ddbea commit 4d34e4d
Show file tree
Hide file tree
Showing 10 changed files with 73 additions and 8 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,10 @@
# Release Notes
All notable changes to this project will be documented in this file.

## 1.6.3 Feb 4, 2021
### Fixed
- Expired message wasn't retried if local execution succeeded.

## 1.6.2 Feb 3, 2021
### Added
- `ResponseHandler` type description into `modules.md`.
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.6.2"
version = "1.6.3"
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.6.2"
version = "1.6.3"
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.6.2"
version = "1.6.3"
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.6.2"
version = "1.6.3"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
edition = "2018"
license = "Apache-2.0"
Expand Down
6 changes: 5 additions & 1 deletion ton_client/src/processing/process_message.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ use crate::processing::{
send_message, wait_for_transaction, ErrorCode, ParamsOfSendMessage, ParamsOfWaitForTransaction,
ProcessingEvent, ResultOfProcessMessage,
};
use crate::tvm::StdContractError;
use std::sync::Arc;

#[derive(Serialize, Deserialize, ApiType, Debug)]
Expand Down Expand Up @@ -64,8 +65,11 @@ pub async fn process_message<F: futures::Future<Output = ()> + Send>(
return Ok(output);
}
Err(err) => {
let local_exit_code = &err.data["local_error"]["data"]["exit_code"];
let can_retry = err.code == ErrorCode::MessageExpired as u32
&& !err.data["local_error"].is_null()
&& (err.data["local_error"].is_null()
|| local_exit_code == StdContractError::ReplayProtection as i32
|| local_exit_code == StdContractError::ExtMessageExpired as i32)
&& can_retry_expired_message(&context, try_index);
if !can_retry {
// Waiting error is unrecoverable, return it
Expand Down
57 changes: 57 additions & 0 deletions ton_client/src/processing/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -457,3 +457,60 @@ async fn test_error_resolving() {
assert_eq!(result.data["local_error"]["data"]["exit_code"], 100)
}
}

#[tokio::test(core_threads = 10)]
async fn test_retries() {
let client = TestClient::new_with_config(json!({
"network": {
"server_address": TestClient::network_address(),
"message_retries_count": 10,
"out_of_sync_threshold": 2500,
},
"abi": {
"message_expiration_timeout": 5000,
}
}));
let client = std::sync::Arc::new(client);
let (abi, tvc) = TestClient::package(HELLO, Some(2));
let keys = client.generate_sign_keys();

let address = client
.deploy_with_giver_async(
ParamsOfEncodeMessage {
abi: abi.clone(),
deploy_set: DeploySet::some_with_tvc(tvc.clone()),
call_set: CallSet::some_with_function("constructor"),
signer: Signer::Keys { keys: keys.clone() },
processing_try_index: None,
address: None,
},
None,
)
.await;

let mut tasks = vec![];
for _ in 0..10 {
let address = Some(address.clone());
let abi = abi.clone();
let keys = keys.clone();
let client = client.clone();
tasks.push(tokio::spawn(async move {
client.net_process_message(ParamsOfProcessMessage {
message_encode_params: ParamsOfEncodeMessage {
abi,
address,
call_set: CallSet::some_with_function("touch"),
deploy_set: None,
processing_try_index: None,
signer: Signer::Keys { keys }
},
send_events: false,
},
TestClient::default_callback
).await
}));
}
for result in futures::future::join_all(tasks).await {
result.unwrap().unwrap();
}
}
2 changes: 1 addition & 1 deletion ton_sdk/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "ton_sdk"
version = "1.6.2"
version = "1.6.3"
edition = "2018"
license = "Apache-2.0"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
Expand Down
2 changes: 1 addition & 1 deletion toncli/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "toncli"
version = "1.6.2"
version = "1.6.3"
description = "TON CLient Command Line Tool"
authors = ["TON DEV SOLUTIONS LTD <[email protected]>"]
repository = "https://github.com/tonlabs/TON-SDK"
Expand Down
2 changes: 1 addition & 1 deletion tools/api.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"version": "1.6.2",
"version": "1.6.3",
"modules": [
{
"name": "client",
Expand Down

0 comments on commit 4d34e4d

Please sign in to comment.