Skip to content

Commit 07c7a6a

Browse files
authored
Merge pull request #376 from yungwine/revert-374-master-complaints
Revert "update complaints validation and warnings"
2 parents e005612 + 4a45167 commit 07c7a6a

File tree

3 files changed

+9
-27
lines changed

3 files changed

+9
-27
lines changed

mytoncore/mytoncore.py

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -2310,7 +2310,6 @@ def get_valid_complaints(self, complaints: dict, election_id: int):
23102310
continue
23112311

23122312
exists = False
2313-
vload = None
23142313
for item in validators_load.values():
23152314
if 'fileName' not in item:
23162315
continue
@@ -2320,14 +2319,14 @@ def get_valid_complaints(self, complaints: dict, election_id: int):
23202319
pseudohash = pubkey + str(election_id)
23212320
if pseudohash == complaint['pseudohash']:
23222321
exists = True
2323-
vload = item
2322+
vid = item['id']
23242323
break
23252324

23262325
if not exists:
23272326
self.local.add_log(f"complaint {complaint['hash_hex']} declined: complaint info was not found, probably it's wrong", "info")
23282327
continue
23292328

2330-
if vload["id"] >= config32['mainValidators']:
2329+
if vid >= config32['mainValidators']:
23312330
self.local.add_log(f"complaint {complaint['hash_hex']} declined: complaint created for non masterchain validator", "info")
23322331
continue
23332332

@@ -2336,13 +2335,8 @@ def get_valid_complaints(self, complaints: dict, election_id: int):
23362335
self.local.add_log(f"complaint {complaint['hash_hex']} declined: complaint fine value is {complaint['suggestedFine']} ton", "info")
23372336
continue
23382337
if complaint['suggestedFinePart'] != 0: # https://github.com/ton-blockchain/ton/blob/5847897b3758bc9ea85af38e7be8fc867e4c133a/lite-client/lite-client.cpp#L3709
2339-
if vload["id"] < config32['mainValidators'] and vload["masterBlocksCreated"] + vload["workBlocksCreated"] == 0: # masterchain validator that created 0 blocks
2340-
if complaint['suggestedFinePart'] != 42949672: # (1LL << 32) / 100
2341-
self.local.add_log(f"complaint {complaint['hash_hex']} declined: complaint fine part value is {complaint['suggestedFinePart']} ton", "info")
2342-
continue
2343-
else:
2344-
self.local.add_log(f"complaint {complaint['hash_hex']} declined: complaint fine part value is {complaint['suggestedFinePart']} ton", "info")
2345-
continue
2338+
self.local.add_log(f"complaint {complaint['hash_hex']} declined: complaint fine part value is {complaint['suggestedFinePart']} ton", "info")
2339+
continue
23462340

23472341
result[complaint['pseudohash']] = complaint
23482342
return result
@@ -2492,7 +2486,6 @@ def GetValidatorsList(self, past=False, fast=False):
24922486
validator["efficiency"] = round(validator["wr"] * 100, 2)
24932487
if saveElectionEntries and adnlAddr in saveElectionEntries:
24942488
validator["walletAddr"] = saveElectionEntries[adnlAddr]["walletAddr"]
2495-
validator["stake"] = saveElectionEntries[adnlAddr].get("stake")
24962489
#end for
24972490

24982491
# Set buffer

mytonctrl/mytonctrl.py

Lines changed: 2 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -483,22 +483,11 @@ def check_slashed(local, ton):
483483
config32 = ton.GetConfig32()
484484
save_complaints = ton.GetSaveComplaints()
485485
complaints = save_complaints.get(str(config32['startWorkTime']))
486-
from modules.validator import ValidatorModule
487-
module = ValidatorModule(ton, local)
488-
vl = ton.GetValidatorsList(past=True)
489-
me = module.find_myself(vl)
490-
if not me: # we were not a validator in the previous round
491-
return
492486
if not complaints:
493487
return
494488
for c in complaints.values():
495-
if c["adnl"] == me["adnlAddr"] and c["isPassed"]:
496-
if me.get("stake"):
497-
fine = f"""{round(c['suggestedFine'] + me["stake"] * (c['suggestedFinePart'] / (1<<32)))} TON"""
498-
else: # unknown stake amount so just print percents
499-
fine = f"""{round(c['suggestedFine'])} TON + {(c['suggestedFinePart'] / (1<<32)) * 100} % of stake"""
500-
warning = local.translate("slashed_warning").format(fine)
501-
print_warning(local, warning)
489+
if c["adnl"] == ton.GetAdnlAddr() and c["isPassed"]:
490+
print_warning(local, "slashed_warning")
502491
#end define
503492

504493
def check_adnl(local, ton):

mytonctrl/resources/translate.json

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -445,9 +445,9 @@
445445
"zh_TW": "{red}錯誤 - 驗證器的 UDP 端口無法從外部訪問.{endc}"
446446
},
447447
"slashed_warning": {
448-
"en": "{red}You were fined by {0} for low efficiency in the previous round.{endc}",
449-
"ru": "{red}Вы были оштрафованы на {0} за низкую эффективность в предыдущем раунде.{endc}",
450-
"zh_TW": "{red}您因上一輪效率低而被罰款 {0}。{endc}"
448+
"en": "{red}You were fined by 101 TON for low efficiency in the previous round.{endc}",
449+
"ru": "{red}Вы были оштрафованы на 101 TON за низкую эффективность в предыдущем раунде.{endc}",
450+
"zh_TW": "{red}您因上一輪效率低而被罰款 101 TON。{endc}"
451451
},
452452
"add_custom_overlay_cmd": {
453453
"en": "Add custom overlay",

0 commit comments

Comments
 (0)