mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-14 12:12:21 +00:00
Fix tests (#405)
* [tonlib] Update master configs and fix test-tonlib-offline * Fix test-bigint in release build Co-authored-by: ms <98183742+dungeon-master-666@users.noreply.github.com> Co-authored-by: dungeon-master-666 <dungeon666master@protonmail.com>
This commit is contained in:
parent
c00302ced4
commit
8537dd60e6
3 changed files with 124 additions and 155 deletions
|
@ -786,7 +786,9 @@ struct ModArray {
|
||||||
}
|
}
|
||||||
|
|
||||||
ModArray& operator/=(const ModArray& other) {
|
ModArray& operator/=(const ModArray& other) {
|
||||||
assert(try_divide(other) && "division by zero?");
|
if (!try_divide(other)) {
|
||||||
|
assert(false); // division by zero?
|
||||||
|
}
|
||||||
return *this;
|
return *this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1051,7 +1053,9 @@ void init_invm() {
|
||||||
for (int i = 0; i < mod_cnt; i++) {
|
for (int i = 0; i < mod_cnt; i++) {
|
||||||
assert(mod[i] > 0 && mod[i] <= (1 << 30));
|
assert(mod[i] > 0 && mod[i] <= (1 << 30));
|
||||||
for (int j = 0; j < i; j++) {
|
for (int j = 0; j < i; j++) {
|
||||||
assert(gcdx(mod[i], mod[j], invm[i][j], invm[j][i]) == 1);
|
if (gcdx(mod[i], mod[j], invm[i][j], invm[j][i]) != 1) {
|
||||||
|
assert(false);
|
||||||
|
}
|
||||||
if (invm[i][j] < 0) {
|
if (invm[i][j] < 0) {
|
||||||
invm[i][j] += mod[j];
|
invm[i][j] += mod[j];
|
||||||
}
|
}
|
||||||
|
|
|
@ -575,83 +575,92 @@ TEST(Tonlib, ConfigCache) {
|
||||||
nullptr, make_object<tonlib_api::keyStoreTypeDirectory>("testdir"))))
|
nullptr, make_object<tonlib_api::keyStoreTypeDirectory>("testdir"))))
|
||||||
.ensure();
|
.ensure();
|
||||||
|
|
||||||
|
auto mainnet = R"abc({
|
||||||
|
"liteservers": [
|
||||||
|
],
|
||||||
|
"validator": {
|
||||||
|
"@type": "validator.config.global",
|
||||||
|
"zero_state": {
|
||||||
|
"workchain": -1,
|
||||||
|
"shard": -9223372036854775808,
|
||||||
|
"seqno": 0,
|
||||||
|
"root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=",
|
||||||
|
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
|
||||||
|
},
|
||||||
|
"hardforks": [
|
||||||
|
{
|
||||||
|
"file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=",
|
||||||
|
"seqno": 8536841,
|
||||||
|
"root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=",
|
||||||
|
"workchain": -1,
|
||||||
|
"shard": -9223372036854775808
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
})abc";
|
||||||
auto testnet = R"abc({
|
auto testnet = R"abc({
|
||||||
"liteservers": [
|
"liteservers": [
|
||||||
],
|
],
|
||||||
"validator": {
|
"validator": {
|
||||||
"@type": "validator.config.global",
|
"@type": "validator.config.global",
|
||||||
"zero_state": {
|
"zero_state": {
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808,
|
"shard": -9223372036854775808,
|
||||||
"seqno": 0,
|
"seqno": 0,
|
||||||
"root_hash": "VCSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=",
|
"root_hash": "gj+B8wb/AmlPk1z1AhVI484rhrUpgSr2oSFIh56VoSg=",
|
||||||
"file_hash": "eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo="
|
"file_hash": "Z+IKwYS54DmmJmesw/nAD5DzWadnOCMzee+kdgSYDOg="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})abc";
|
||||||
})abc";
|
auto custom = R"abc({
|
||||||
auto testnet2 = R"abc({
|
"liteservers": [
|
||||||
"liteservers": [
|
],
|
||||||
],
|
"validator": {
|
||||||
"validator": {
|
"@type": "validator.config.global",
|
||||||
"@type": "validator.config.global",
|
"zero_state": {
|
||||||
"zero_state": {
|
"workchain": -1,
|
||||||
"workchain": -1,
|
"shard": -9223372036854775808,
|
||||||
"shard": -9223372036854775808,
|
"seqno": 0,
|
||||||
"seqno": 0,
|
"root_hash": "ZXSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=",
|
||||||
"root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=",
|
"file_hash": "eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo="
|
||||||
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
|
}
|
||||||
}
|
}
|
||||||
}
|
})abc";
|
||||||
})abc";
|
|
||||||
auto testnet3 = R"abc({
|
|
||||||
"liteservers": [
|
|
||||||
],
|
|
||||||
"validator": {
|
|
||||||
"@type": "validator.config.global",
|
|
||||||
"zero_state": {
|
|
||||||
"workchain": -1,
|
|
||||||
"shard": -9223372036854775808,
|
|
||||||
"seqno": 0,
|
|
||||||
"root_hash": "ZXSXxDHhTALFxReyTZRd8E4Ya3ySOmpOWAS4rBX9XBY=",
|
|
||||||
"file_hash": "eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo="
|
|
||||||
}
|
|
||||||
}
|
|
||||||
})abc";
|
|
||||||
auto bad = R"abc({
|
auto bad = R"abc({
|
||||||
"liteservers": [
|
"liteservers": [
|
||||||
],
|
],
|
||||||
"validator": {
|
"validator": {
|
||||||
"@type": "validator.config.global",
|
"@type": "validator.config.global",
|
||||||
"zero_state": {
|
"zero_state": {
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808,
|
"shard": -9223372036854775808,
|
||||||
"seqno": 0,
|
"seqno": 0,
|
||||||
"file_hash": "eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo="
|
"file_hash": "eh9yveSz1qMdJ7mOsO+I+H77jkLr9NpAuEkoJuseXBo="
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
})abc";
|
||||||
})abc";
|
|
||||||
sync_send(client,
|
sync_send(client,
|
||||||
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(bad, "", true, false)))
|
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(bad, "", true, false)))
|
||||||
.ensure_error();
|
.ensure_error();
|
||||||
|
|
||||||
|
sync_send(client,
|
||||||
|
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(mainnet, "", true, false)))
|
||||||
|
.ensure();
|
||||||
sync_send(client,
|
sync_send(client,
|
||||||
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(testnet, "", true, false)))
|
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(testnet, "", true, false)))
|
||||||
.ensure();
|
.ensure();
|
||||||
sync_send(client,
|
sync_send(client,
|
||||||
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(testnet2, "", true, false)))
|
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(custom, "", true, false)))
|
||||||
.ensure();
|
|
||||||
sync_send(client,
|
|
||||||
make_object<tonlib_api::options_validateConfig>(make_object<tonlib_api::config>(testnet3, "", true, false)))
|
|
||||||
.ensure();
|
.ensure();
|
||||||
|
|
||||||
sync_send(client, make_object<tonlib_api::options_validateConfig>(
|
sync_send(client, make_object<tonlib_api::options_validateConfig>(
|
||||||
make_object<tonlib_api::config>(testnet2, "testnet", true, false)))
|
make_object<tonlib_api::config>(mainnet, "testnet", true, false)))
|
||||||
.ensure_error();
|
.ensure_error();
|
||||||
|
|
||||||
sync_send(client, make_object<tonlib_api::options_setConfig>(
|
sync_send(client, make_object<tonlib_api::options_setConfig>(
|
||||||
make_object<tonlib_api::config>(testnet2, "testnet2", true, false)))
|
make_object<tonlib_api::config>(testnet, "testnet", true, false)))
|
||||||
.ensure();
|
.ensure();
|
||||||
sync_send(client, make_object<tonlib_api::options_setConfig>(
|
sync_send(client, make_object<tonlib_api::options_setConfig>(
|
||||||
make_object<tonlib_api::config>(testnet3, "testnet2", true, false)))
|
make_object<tonlib_api::config>(custom, "testnet", true, false)))
|
||||||
.ensure_error();
|
.ensure_error();
|
||||||
}
|
}
|
||||||
|
|
|
@ -1939,103 +1939,59 @@ class MasterConfig {
|
||||||
const MasterConfig& get_default_master_config() {
|
const MasterConfig& get_default_master_config() {
|
||||||
static MasterConfig config = [] {
|
static MasterConfig config = [] {
|
||||||
MasterConfig res;
|
MasterConfig res;
|
||||||
res.add_config("testnet", R"abc({
|
|
||||||
"liteservers": [
|
|
||||||
],
|
|
||||||
"validator": {
|
|
||||||
"@type": "validator.config.global",
|
|
||||||
"zero_state": {
|
|
||||||
"file_hash": "BzgfRpFgyNjHI7aR5KQhq4Wtr2wN+sXzLaW+rfHvP5A=",
|
|
||||||
"seqno": 0,
|
|
||||||
"root_hash": "WPsS1IiRjT0MSD6Xvys4QYQh7rrc9x0ybzXojwJ4gH0=",
|
|
||||||
"workchain": -1,
|
|
||||||
"shard": -9223372036854775808
|
|
||||||
},
|
|
||||||
"init_block":{
|
|
||||||
"file_hash":"CXvKA37GFugspx6U7sv4Sh7KIVqR1R+Pj4AmGx2Ezi0=",
|
|
||||||
"seqno":2908533,
|
|
||||||
"root_hash":"oFi1uMHmELXV/AfjuvTZREmRY7TtNgq608sFjnRJCAo=",
|
|
||||||
"workchain":-1,
|
|
||||||
"shard":-9223372036854775808
|
|
||||||
},
|
|
||||||
"hardforks":[
|
|
||||||
{
|
|
||||||
"file_hash":"x97xobbkPDggz7/u6KQzlT3pBmM5XfGE6vN7AiuTMU0=",
|
|
||||||
"seqno":1907338,
|
|
||||||
"root_hash":"BuZOCJvbg0ys2JBnfocqCf1T4rt0OzLLslOG3CjcSgU=",
|
|
||||||
"workchain":-1,
|
|
||||||
"shard":-9223372036854775808
|
|
||||||
},
|
|
||||||
{
|
|
||||||
"file_hash": "CXvKA37GFugspx6U7sv4Sh7KIVqR1R+Pj4AmGx2Ezi0=",
|
|
||||||
"seqno": 2908533,
|
|
||||||
"root_hash": "oFi1uMHmELXV/AfjuvTZREmRY7TtNgq608sFjnRJCAo=",
|
|
||||||
"workchain": -1,
|
|
||||||
"shard": -9223372036854775808
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})abc");
|
|
||||||
res.add_config("mainnet", R"abc({
|
res.add_config("mainnet", R"abc({
|
||||||
"liteservers": [
|
"liteservers": [
|
||||||
],
|
],
|
||||||
"validator": {
|
"validator": {
|
||||||
"@type": "validator.config.global",
|
"@type": "validator.config.global",
|
||||||
"zero_state": {
|
"zero_state": {
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808,
|
"shard": -9223372036854775808,
|
||||||
"seqno": 0,
|
"seqno": 0,
|
||||||
"root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=",
|
"root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=",
|
||||||
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
|
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
|
||||||
},
|
},
|
||||||
"init_block" : {
|
"init_block" : {
|
||||||
"root_hash": "irEt9whDfgaYwD+8AzBlYzrMZHhrkhSVp3PU1s4DOz4=",
|
"root_hash": "irEt9whDfgaYwD+8AzBlYzrMZHhrkhSVp3PU1s4DOz4=",
|
||||||
"seqno": 10171687,
|
"seqno": 10171687,
|
||||||
"file_hash": "lay/bUKUUFDJXU9S6gx9GACQFl+uK+zX8SqHWS9oLZc=",
|
"file_hash": "lay/bUKUUFDJXU9S6gx9GACQFl+uK+zX8SqHWS9oLZc=",
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808
|
"shard": -9223372036854775808
|
||||||
},
|
},
|
||||||
"hardforks": [
|
"hardforks": [
|
||||||
{
|
{
|
||||||
"file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=",
|
"file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=",
|
||||||
"seqno": 8536841,
|
"seqno": 8536841,
|
||||||
"root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=",
|
"root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=",
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808
|
"shard": -9223372036854775808
|
||||||
}
|
}
|
||||||
]
|
]
|
||||||
}
|
}
|
||||||
})abc");
|
})abc");
|
||||||
res.add_config("testnet2", R"abc({
|
res.add_config("testnet", R"abc({
|
||||||
"liteservers": [
|
"liteservers": [
|
||||||
],
|
],
|
||||||
"validator": {
|
"validator": {
|
||||||
"@type": "validator.config.global",
|
"@type": "validator.config.global",
|
||||||
"zero_state": {
|
"zero_state": {
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808,
|
"shard": -9223372036854775808,
|
||||||
"seqno": 0,
|
"seqno": 0,
|
||||||
"root_hash": "F6OpKZKqvqeFp6CQmFomXNMfMj2EnaUSOXN+Mh+wVWk=",
|
"root_hash": "gj+B8wb/AmlPk1z1AhVI484rhrUpgSr2oSFIh56VoSg=",
|
||||||
"file_hash": "XplPz01CXAps5qeSWUtxcyBfdAo5zVb1N979KLSKD24="
|
"file_hash": "Z+IKwYS54DmmJmesw/nAD5DzWadnOCMzee+kdgSYDOg="
|
||||||
},
|
},
|
||||||
"init_block" : {
|
"init_block" : {
|
||||||
"root_hash": "irEt9whDfgaYwD+8AzBlYzrMZHhrkhSVp3PU1s4DOz4=",
|
"root_hash": "gj+B8wb/AmlPk1z1AhVI484rhrUpgSr2oSFIh56VoSg=",
|
||||||
"seqno": 10171687,
|
"seqno": 0,
|
||||||
"file_hash": "lay/bUKUUFDJXU9S6gx9GACQFl+uK+zX8SqHWS9oLZc=",
|
"file_hash": "Z+IKwYS54DmmJmesw/nAD5DzWadnOCMzee+kdgSYDOg=",
|
||||||
"workchain": -1,
|
"workchain": -1,
|
||||||
"shard": -9223372036854775808
|
"shard": -9223372036854775808
|
||||||
},
|
},
|
||||||
"hardforks": [
|
"hardforks": [
|
||||||
{
|
]
|
||||||
"file_hash": "t/9VBPODF7Zdh4nsnA49dprO69nQNMqYL+zk5bCjV/8=",
|
}
|
||||||
"seqno": 8536841,
|
})abc");
|
||||||
"root_hash": "08Kpc9XxrMKC6BF/FeNHPS3MEL1/Vi/fQU/C9ELUrkc=",
|
|
||||||
"workchain": -1,
|
|
||||||
"shard": -9223372036854775808
|
|
||||||
}
|
|
||||||
]
|
|
||||||
}
|
|
||||||
})abc");
|
|
||||||
return res;
|
return res;
|
||||||
}();
|
}();
|
||||||
return config;
|
return config;
|
||||||
|
|
Loading…
Reference in a new issue