1
0
Fork 0
mirror of https://github.com/ton-blockchain/ton synced 2025-03-09 15:40:10 +00:00

added support for config change proposals

- added some fift scripts for the config change proposal voting
- added validator-engine-console support for the config change proposal voting
- additional sanity checks in catchain
- unsafe slow catchain resync method
This commit is contained in:
ton 2020-03-30 17:20:45 +04:00
parent a31f8d4424
commit 4dd5eea11f
35 changed files with 753 additions and 144 deletions

View file

@ -657,6 +657,27 @@ td::Status CreateElectionBidQuery::receive(td::BufferSlice data) {
return td::Status::OK();
}
td::Status CreateProposalVoteQuery::run() {
TRY_RESULT_ASSIGN(data_, tokenizer_.get_token<std::string>());
TRY_RESULT_ASSIGN(fname_, tokenizer_.get_token<std::string>());
TRY_STATUS(tokenizer_.check_endl());
return td::Status::OK();
}
td::Status CreateProposalVoteQuery::send() {
auto b = ton::create_serialize_tl_object<ton::ton_api::engine_validator_createProposalVote>(td::BufferSlice(data_));
td::actor::send_closure(console_, &ValidatorEngineConsole::envelope_send_query, std::move(b), create_promise());
return td::Status::OK();
}
td::Status CreateProposalVoteQuery::receive(td::BufferSlice data) {
TRY_RESULT_PREFIX(f, ton::fetch_tl_object<ton::ton_api::engine_validator_proposalVote>(data.as_slice(), true),
"received incorrect answer: ");
td::TerminalIO::out() << "success: permkey=" << f->perm_key_.to_hex() << "\n";
TRY_STATUS(td::write_file(fname_, f->to_send_.as_slice()));
return td::Status::OK();
}
td::Status CheckDhtServersQuery::run() {
TRY_RESULT_ASSIGN(id_, tokenizer_.get_token<ton::PublicKeyHash>());
return td::Status::OK();

View file

@ -835,6 +835,29 @@ class CreateElectionBidQuery : public Query {
std::string fname_;
};
class CreateProposalVoteQuery : public Query {
public:
CreateProposalVoteQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)
: Query(console, std::move(tokenizer)) {
}
td::Status run() override;
td::Status send() override;
td::Status receive(td::BufferSlice data) override;
static std::string get_name() {
return "createproposalvote";
}
static std::string get_help() {
return "createproposalvote <data> <fname>\tcreate proposal vote";
}
std::string name() const override {
return get_name();
}
private:
std::string data_;
std::string fname_;
};
class CheckDhtServersQuery : public Query {
public:
CheckDhtServersQuery(td::actor::ActorId<ValidatorEngineConsole> console, Tokenizer tokenizer)

View file

@ -130,6 +130,7 @@ void ValidatorEngineConsole::run() {
add_query_runner(std::make_unique<QueryRunnerImpl<AddNetworkAddressQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<AddNetworkProxyAddressQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CreateElectionBidQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CreateProposalVoteQuery>>());
add_query_runner(std::make_unique<QueryRunnerImpl<CheckDhtServersQuery>>());
}