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

bugfix in validator

This commit is contained in:
ton 2020-04-03 18:47:22 +04:00
parent 54b40df4aa
commit c300b4ff30
5 changed files with 93 additions and 44 deletions

View file

@ -596,6 +596,36 @@ bool MsgProcessedUptoCollection::for_each_mcseqno(std::function<bool(ton::BlockS
return true;
}
std::ostream& MsgProcessedUpto::print(std::ostream& os) const {
return os << "[" << ton::shard_to_str(shard) << "," << mc_seqno << "," << last_inmsg_lt << ","
<< last_inmsg_hash.to_hex() << "]";
}
std::ostream& MsgProcessedUptoCollection::print(std::ostream& os) const {
os << "MsgProcessedUptoCollection of " << owner.to_str() << " = {";
int i = 0;
for (const auto& entry : list) {
if (i++) {
os << ", ";
}
os << entry;
}
os << "}";
return os;
}
std::string MsgProcessedUpto::to_str() const {
std::ostringstream os;
print(os);
return os.str();
}
std::string MsgProcessedUptoCollection::to_str() const {
std::ostringstream os;
print(os);
return os.str();
}
// unpacks some fields from EnqueuedMsg
bool EnqueuedMsgDescr::unpack(vm::CellSlice& cs) {
block::gen::EnqueuedMsg::Record enq;

View file

@ -174,8 +174,14 @@ struct MsgProcessedUpto {
bool can_check_processed() const {
return (bool)compute_shard_end_lt;
}
std::ostream& print(std::ostream& os) const;
std::string to_str() const;
};
static inline std::ostream& operator<<(std::ostream& os, const MsgProcessedUpto& proc) {
return proc.print(os);
}
struct MsgProcessedUptoCollection {
ton::ShardIdFull owner;
bool valid{false};
@ -202,8 +208,14 @@ struct MsgProcessedUptoCollection {
bool already_processed(const EnqueuedMsgDescr& msg) const;
bool can_check_processed() const;
bool for_each_mcseqno(std::function<bool(ton::BlockSeqno)>) const;
std::ostream& print(std::ostream& os) const;
std::string to_str() const;
};
static inline std::ostream& operator<<(std::ostream& os, const MsgProcessedUptoCollection& proc_coll) {
return proc_coll.print(os);
}
struct ParamLimits {
enum { limits_cnt = 4 };
enum { cl_underload = 0, cl_normal = 1, cl_soft = 2, cl_medium = 3, cl_hard = 4 };

View file

@ -2,20 +2,23 @@
"TonUtil.fif" include
"Asm.fif" include
{ ."usage: " @' $0 type ." <workchain-id> <dest-addr> [<filename-base>]" cr
{ ."usage: " $0 type ." <workchain-id> <dest-addr> [<filename-base>]" cr
."Creates a new pinger in specified workchain, with destination address <dest-addr>. " cr
."Resulting initialization query is saved into <filename-base>-query.boc ('new-pinger-query.boc' by default)" cr 1 halt
} : usage
def? $# { @' $# dup 1 < swap 3 > or ' usage if } if
$# dup 1 < swap 3 > or ' usage if
3 :$1..n
Basechain 256 1<<1- 3 15 */ 2constant dest-addr
Basechain constant wc // create a wallet in workchain 0 (basechain)
def? $1 { @' $1 parse-workchain-id =: wc } if // set workchain id from command line argument
def? $2 { @' $2 false parse-load-address drop 2=: dest-addr } if
def? $3 { @' $3 } { "new-pinger" } cond constant file-base
$1 parse-workchain-id =: wc // set workchain id from command line argument
$2 dup null? { drop } { false parse-load-address drop 2=: dest-addr } cond
$3 "new-pinger" replace-if-null constant file-base
."Creating new pinger in workchain " wc . cr
."Address to ping is " dest-addr 2dup .addr ." = " 6 .Addr cr
// Create new simple pinger
<{ SETCP0 DUP INC 1 RSHIFT# 32 THROWIF // fail unless recv_internal or recv_external