@@ -76,9 +76,9 @@ def init_alerts():
7676 ),
7777 "zero_block_created" : Alert (
7878 "critical" ,
79- f"Validator has not created any blocks in the { int (VALIDATION_PERIOD // 3 // 3600 )} hours" ,
80- "Validator has not created any blocks in the last {hours} hours." ,
81- VALIDATION_PERIOD // 3
79+ f"Validator has not created any blocks in the { int (VALIDATION_PERIOD // 6 // 3600 )} hours" ,
80+ "Validator has not created any blocks in the last <b> {hours} hours</b> ." ,
81+ VALIDATION_PERIOD // 6
8282 ),
8383 "validator_slashed" : Alert (
8484 "high" ,
@@ -95,13 +95,13 @@ def init_alerts():
9595 "stake_accepted" : Alert (
9696 "info" ,
9797 "Validator's stake has been accepted (info alert with no sound)" ,
98- "Validator's stake {stake} TON has been accepted" ,
98+ "Validator's stake <b> {stake} TON</b> has been accepted" ,
9999 ELECTIONS_START_BEFORE
100100 ),
101101 "stake_returned" : Alert (
102102 "info" ,
103103 "Validator's stake has been returned (info alert with no sound)" ,
104- "Validator's stake {stake} TON has been returned on address <code>{address}</code>. The reward amount is {reward} TON." ,
104+ "Validator's stake <b> {stake} TON</b> has been returned on address <code>{address}</code>. The reward amount is <b> {reward} TON</b> ." ,
105105 60
106106 ),
107107 "stake_not_returned" : Alert (
@@ -158,6 +158,11 @@ def send_alert(self, alert_name: str, *args, **kwargs):
158158 if alert is None :
159159 raise Exception (f"Alert { alert_name } not found" )
160160 alert_name_readable = alert_name .replace ('_' , ' ' ).title ()
161+
162+ for key , value in kwargs .items ():
163+ if isinstance (value , (int , float )):
164+ kwargs [key ] = f'{ value :,} ' .replace (',' , ' ' ) # make space separator for thousands
165+
161166 text = '🆘' if alert .severity != 'info' else ''
162167 text += f''' <b>Node { self .hostname } : { alert_name_readable } </b>
163168
@@ -341,7 +346,7 @@ def check_zero_blocks_created(self):
341346 if not self .ton .using_validator ():
342347 return
343348 ts = get_timestamp ()
344- period = VALIDATION_PERIOD // 3 # 6h for mainnet, 40m for testnet
349+ period = VALIDATION_PERIOD // 6 # 3h for mainnet, 40m for testnet
345350 start , end = ts - period , ts - 60
346351 config34 = self .ton .GetConfig34 ()
347352 if start < config34 .startWorkTime : # round started recently
@@ -394,7 +399,7 @@ def check_stake_sent(self):
394399 if res is False :
395400 self .send_alert ("stake_not_accepted" )
396401 return
397- self .send_alert ("stake_accepted" , stake = round (res .get ('stake' ), 2 ))
402+ self .send_alert ("stake_accepted" , stake = round (res .get ('stake' )))
398403
399404 def check_stake_returned (self ):
400405 if not self .ton .using_validator ():
@@ -409,7 +414,7 @@ def check_stake_returned(self):
409414
410415 for tr in trs :
411416 if tr .time >= config ['endWorkTime' ] + FREEZE_PERIOD and tr .srcAddr == '3333333333333333333333333333333333333333333333333333333333333333' and tr .body .startswith ('F96F7324' ): # Elector Recover Stake Response
412- self .send_alert ("stake_returned" , stake = round (tr .value , 2 ), address = res ["walletAddr" ], reward = round (tr .value - res .get ('stake' , 0 ), 2 ))
417+ self .send_alert ("stake_returned" , stake = round (tr .value ), address = res ["walletAddr" ], reward = round (tr .value - res .get ('stake' , 0 ), 2 ))
413418 return
414419 self .send_alert ("stake_not_returned" , address = res ["walletAddr" ])
415420
0 commit comments