mirror of
https://github.com/ton-blockchain/ton
synced 2025-03-09 15:40:10 +00:00
pow-testgiver support
This commit is contained in:
parent
dbde9c1c40
commit
f064b1047a
257 changed files with 6665 additions and 2608 deletions
|
@ -30,7 +30,7 @@
|
|||
#include "auto/tl/ton_api_json.h"
|
||||
#include "dht/dht.h"
|
||||
#include "overlay/overlays.h"
|
||||
#include "td/utils/OptionsParser.h"
|
||||
#include "td/utils/OptionParser.h"
|
||||
#include "td/utils/Time.h"
|
||||
#include "td/utils/filesystem.h"
|
||||
#include "td/utils/format.h"
|
||||
|
@ -347,7 +347,7 @@ int main(int argc, char *argv[]) {
|
|||
|
||||
td::actor::ActorOwn<TestNode> x;
|
||||
|
||||
td::OptionsParser p;
|
||||
td::OptionParser p;
|
||||
p.set_description("test collate block");
|
||||
p.add_option('h', "help", "prints_help", [&]() {
|
||||
char b[10240];
|
||||
|
@ -355,39 +355,26 @@ int main(int argc, char *argv[]) {
|
|||
sb << p;
|
||||
std::cout << sb.as_cslice().c_str();
|
||||
std::exit(2);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('Z', "zero-root-hash", "zero state root hash (base64url-encoded)", [&](td::Slice fname) {
|
||||
td::actor::send_closure(x, &TestNode::set_zero_root_hash, get_uint256(fname).move_as_ok());
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('F', "zero-file-hash", "zero state file hash (base64url-encoded)", [&](td::Slice fname) {
|
||||
td::actor::send_closure(x, &TestNode::set_zero_file_hash, get_uint256(fname).move_as_ok());
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('z', "zero-state-file", "zero state file", [&](td::Slice fname) {
|
||||
td::actor::send_closure(x, &TestNode::set_zero_file, fname.str());
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('D', "db", "root for dbs", [&](td::Slice fname) {
|
||||
td::actor::send_closure(x, &TestNode::set_db_root, fname.str());
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('m', "ext-message", "binary file with serialized inbound external message", [&](td::Slice fname) {
|
||||
td::actor::send_closure(x, &TestNode::load_ext_message, fname.str());
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('z', "zero-state-file", "zero state file",
|
||||
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::set_zero_file, fname.str()); });
|
||||
p.add_option('D', "db", "root for dbs",
|
||||
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::set_db_root, fname.str()); });
|
||||
p.add_option('m', "ext-message", "binary file with serialized inbound external message",
|
||||
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::load_ext_message, fname.str()); });
|
||||
p.add_option('M', "top-shard-message", "binary file with serialized shard top block description",
|
||||
[&](td::Slice fname) {
|
||||
td::actor::send_closure(x, &TestNode::load_shard_block_message, fname.str());
|
||||
return td::Status::OK();
|
||||
});
|
||||
[&](td::Slice fname) { td::actor::send_closure(x, &TestNode::load_shard_block_message, fname.str()); });
|
||||
p.add_option('v', "verbosity", "set verbosity level", [&](td::Slice arg) {
|
||||
int v = VERBOSITY_NAME(FATAL) + (verbosity = td::to_integer<int>(arg));
|
||||
SET_VERBOSITY_LEVEL(v);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('w', "workchain", "<workchain>[:<shard>]\tcollate block in this workchain", [&](td::Slice arg) {
|
||||
p.add_checked_option('w', "workchain", "<workchain>[:<shard>]\tcollate block in this workchain", [&](td::Slice arg) {
|
||||
ton::ShardId shard = 0;
|
||||
auto pos = std::min(arg.find(':'), arg.size());
|
||||
TRY_RESULT(workchain, td::to_integer_safe<int>(arg.substr(0, pos)));
|
||||
|
@ -403,31 +390,24 @@ int main(int argc, char *argv[]) {
|
|||
td::actor::send_closure(x, &TestNode::set_shard, ton::ShardIdFull{workchain, shard ? shard : ton::shardIdAll});
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('S', "want-split", "forces setting want_split in the header of new shard block", [&]() {
|
||||
td::actor::send_closure(x, &TestNode::set_collator_flags, 1);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('G', "want-merge", "forces setting want_merge in the header of new shard block", [&]() {
|
||||
td::actor::send_closure(x, &TestNode::set_collator_flags, 2);
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('S', "want-split", "forces setting want_split in the header of new shard block",
|
||||
[&]() { td::actor::send_closure(x, &TestNode::set_collator_flags, 1); });
|
||||
p.add_option('G', "want-merge", "forces setting want_merge in the header of new shard block",
|
||||
[&]() { td::actor::send_closure(x, &TestNode::set_collator_flags, 2); });
|
||||
p.add_option('s', "save-top-descr", "saves generated shard top block description into files with specified prefix",
|
||||
[&](td::Slice arg) {
|
||||
td::actor::send_closure(x, &TestNode::set_top_descr_prefix, arg.str());
|
||||
return td::Status::OK();
|
||||
});
|
||||
p.add_option('T', "top-block", "BlockIdExt of top block (new block will be generated atop of it)",
|
||||
[&](td::Slice arg) {
|
||||
ton::BlockIdExt block_id;
|
||||
if (block::parse_block_id_ext(arg, block_id)) {
|
||||
LOG(INFO) << "setting previous block to " << block_id.to_str();
|
||||
td::actor::send_closure(x, &TestNode::set_shard_top_block, block_id);
|
||||
[&](td::Slice arg) { td::actor::send_closure(x, &TestNode::set_top_descr_prefix, arg.str()); });
|
||||
p.add_checked_option('T', "top-block", "BlockIdExt of top block (new block will be generated atop of it)",
|
||||
[&](td::Slice arg) {
|
||||
ton::BlockIdExt block_id;
|
||||
if (block::parse_block_id_ext(arg, block_id)) {
|
||||
LOG(INFO) << "setting previous block to " << block_id.to_str();
|
||||
td::actor::send_closure(x, &TestNode::set_shard_top_block, block_id);
|
||||
|
||||
return td::Status::OK();
|
||||
} else {
|
||||
return td::Status::Error("cannot parse BlockIdExt");
|
||||
}
|
||||
});
|
||||
return td::Status::OK();
|
||||
} else {
|
||||
return td::Status::Error("cannot parse BlockIdExt");
|
||||
}
|
||||
});
|
||||
p.add_option('d', "daemonize", "set SIGHUP", [&]() {
|
||||
td::set_signal_handler(td::SignalType::HangUp, [](int sig) {
|
||||
#if TD_DARWIN || TD_LINUX
|
||||
|
@ -435,7 +415,6 @@ int main(int argc, char *argv[]) {
|
|||
setsid();
|
||||
#endif
|
||||
}).ensure();
|
||||
return td::Status::OK();
|
||||
});
|
||||
|
||||
td::actor::Scheduler scheduler({7});
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue