File tree Expand file tree Collapse file tree 3 files changed +179
-33
lines changed Expand file tree Collapse file tree 3 files changed +179
-33
lines changed Original file line number Diff line number Diff line change 1+ #!/usr/bin/fift -s
2+ "TonUtil.fif" include
3+
4+ { ."usage: " @' $0 type ." <complaint-boc> <file-base>" cr
5+ ."Removes proof cells from complaint." cr cr
6+
7+ ."<complaint-boc> is a filename of the serialized TL-B ValidatorComplaint boc." cr
8+ ."Saves the result boc into `<file-base>.boc`." cr 1 halt
9+ } : usage
10+ $# 2 = { cr } { usage } cond
11+
12+ $1 =: filename
13+ $2 =: file-base
14+
15+ filename file>B dup
16+ 8 B| drop B>$ "b5ee9c72" $= { B>$ x>B? drop } if
17+ B>boc =: complaint
18+
19+ ."got: " cr
20+ complaint <s csr. cr
21+
22+
23+ // replaces 2 refs with empty cells
24+ // c - c
25+ {
26+ <b // s, c, b
27+ swap // s, b, c
28+ <s // s, b, s
29+ ref@+ drop
30+ ref@+ drop
31+ s, // s, b
32+ <b b> ref,
33+ <b b> ref,
34+ b> // s, c
35+ } : clear_producer_info
36+
37+ { // c
38+ <s // s
39+ ref@+ // s, c
40+
41+ clear_producer_info // s, c
42+
43+ <b // s, c, b
44+ swap ref, // s, b
45+ swap s, // b
46+ b> // c
47+ } : clean_descr
48+
49+ { // c
50+ <s // s
51+
52+ ref@+ clear_producer_info // s, c1
53+ swap // c1, s
54+ ref@+ clear_producer_info // c1, s, c2
55+
56+ <b // c1, s, c2, b
57+ 3 roll ref, // s, c2, b
58+ swap ref, // s, b
59+ swap s, // b
60+ b> // c
61+ } : clean_descr_with_diff
62+
63+
64+ // prod_info#34 utime:uint32 mc_blk_ref:ExtBlkRef state_proof:^(MERKLE_PROOF Block)
65+ // prod_proof:^(MERKLE_PROOF ShardState) = ProducerInfo;
66+ //
67+ // no_blk_gen#450e8bd9 from_utime:uint32 prod_info:^ProducerInfo = ComplaintDescr;
68+ // no_blk_gen_diff#c737b0ca prod_info_old:^ProducerInfo prod_info_new:^ProducerInfo = ComplaintDescr;
69+ //
70+ // validator_complaint#bc validator_pubkey:bits256 description:^ComplaintDescr created_at:uint32 severity:uint8 reward_addr:uint256 paid:Grams suggested_fine:Grams suggested_fine_part:uint32 = ValidatorComplaint;
71+
72+ complaint <s
73+ ref@+ =: descr
74+ =: comlaint_no_ref
75+
76+ <b comlaint_no_ref s,
77+ descr dup <s
78+ 32 u@ 0x450e8bd9 =
79+ { clean_descr }
80+ { clean_descr_with_diff }
81+ cond
82+ ref,
83+ b> =: result_cell
84+
85+ "result: " type cr
86+ result_cell <s csr.
87+
88+ result_cell 2 boc+>B
89+ file-base +".boc" B>file
90+
Original file line number Diff line number Diff line change @@ -504,13 +504,11 @@ def Complaints(local, ton):
504504 # Voting for complaints
505505 config32 = ton .GetConfig32 ()
506506 electionId = config32 .get ("startWorkTime" )
507- complaintsHashes = ton .SaveComplaints (electionId )
508- complaints = ton .GetComplaints (electionId )
509- for key , item in complaints .items ():
510- complaintHash = item .get ("hash" )
511- complaintHash_hex = Dec2HexAddr (complaintHash )
512- if complaintHash_hex in complaintsHashes :
513- ton .VoteComplaint (electionId , complaintHash )
507+ complaints = ton .GetComplaints (electionId ) # get complaints from Elector
508+ for c in complaints .values ():
509+ complaint_hash = c .get ("hash" )
510+ if ton .complaint_is_valid (c ):
511+ ton .VoteComplaint (electionId , complaint_hash )
514512# end define
515513
516514
You can’t perform that action at this time.
0 commit comments