Skip to content
This repository has been archived by the owner on Sep 5, 2022. It is now read-only.

Slashing idle validators #13

Open
tolya-yanot opened this issue Feb 15, 2021 · 3 comments
Open

Slashing idle validators #13

tolya-yanot opened this issue Feb 15, 2021 · 3 comments
Assignees

Comments

@tolya-yanot
Copy link
Member

Complete slashing of idle validators.

Initially mytonctrl will act as a panisher.

@tolya-yanot
Copy link
Member Author

tolya-yanot commented Feb 26, 2021

Summary

After the end of the validation period, each validator checks other validators for the number of blocks they have processed in this last validation period. If the number of blocks is not enough and no one has sent a complaint about this idle validator yet, the validator creates a complaint. The validator also checks the submitted complaints and if they are valid and he has not yet voted for the fine of this idle validator during this validation period, he votes for the complaint.

Since most of the network validators use mytonctrl, the functionality of creating a complaints (to fine idle validator) and voting for complaints was implemented in mytonctrl.

The author of the algorithm and implementation is a igroman787.

In the process of work mytonctrl does:

Implementation of detecting idle validators and checking complaints made in the lite-client, mytonctrl just calls these methods.

Testing Period

At the beginning, the fine is reduced to 101 coins. This is done in order not to scare away validators during testing.

The validator can be fined only once during the validation period.

So in order to participate in the slashing process now, you need to use the last code from https://github.com/newton-blockchain/ton/

In the future, the fine will be returned to significant values.

Detailed description of the algorithm

0. Time to check, create and vote a complaint

We can create a complaint only at a certain period of time, when the elector has frozen the validators' stakes. We will take the time intervals from network config 15:

lite-client> getconfig 15

ConfigParam(15) = ( validators_elected_for:65536 elections_start_before:32768 elections_end_before:8192 stake_held_for:32768)
x{00010000000080000000200000008000}

Here we are interested in the stake_held_for parameter, which is equal to 32768 seconds. This means that within 32768 seconds after the end of the validator's validation cycle, we can check, create and vote for the complaint.

We also need the utime_until parameter, which will be the beginning of the time interval:

lite-client> getconfig 32

ConfigParam(32) = (
  prev_validators:(validators_ext utime_since:1617526392 utime_until:1617591928 total:92 main:92 total_weight:1152921504606846933
    list:(hme_root
      root:(hm_edge
      ...
      ...
      ...

So in our example, we can check the work of the validator, create a complaint and vote for it from 05.04.21 03:05:28 to 05.04.21 12:11:36 (UTC).

1.1. Checking the work quality of the validators

We will check the work of the validators with the checkloadall {utime_since} {utime_until-60} {file_prefix} lite-client command. We do not take into account the last 60 seconds of the validator's work, since this is a borderline interval and can cause us problems:

lite-client> checkloadall 1617526392 1617591868 cla

total: (10827834,166255817) -> (10845039,166275828)
val #0: created (0,0) ; was (0,0)
val #1: created (204,321) ; was (0,0)
val #2: created (189,379) ; was (0,0)
val #3: created (231,397) ; was (0,0)
val #4: created (211,359) ; was (0,0)
val #5: created (194,318) ; was (0,0)
val #6: created (173,353) ; was (0,0)
val #7: created (175,281) ; was (0,0)
val #8: created (172,277) ; was (0,0)
val #9: created (127,171) ; was (0,0)
val #10: created (207,386) ; was (0,0)
val #11: created (206,305) ; was (0,0)
val #12: created (186,330) ; was (0,0)
val #13: created (187,283) ; was (0,0)
val #14: created (201,263) ; was (0,0)
val #15: created (202,256) ; was (0,0)
val #16: created (200,274) ; was (0,0)
val #17: created (197,262) ; was (0,0)
val #18: created (192,256) ; was (0,0)
val #19: created (198,339) ; was (0,0)
val #20: created (193,257) ; was (0,0)
val #21: created (166,238) ; was (0,0)
val #22: created (173,261) ; was (0,0)
val #23: created (192,257) ; was (0,0)
val #24: created (197,269) ; was (0,0)
val #25: created (207,200) ; was (0,0)
val #26: created (212,218) ; was (0,0)
val #27: created (204,224) ; was (0,0)
val #28: created (196,235) ; was (0,0)
val #29: created (192,225) ; was (0,0)
val #30: created (176,230) ; was (0,0)
val #31: created (203,192) ; was (0,0)
val #32: created (114,153) ; was (0,0)
val #33: created (201,201) ; was (0,0)
val #34: created (214,220) ; was (0,0)
val #35: created (199,196) ; was (0,0)
val #36: created (155,208) ; was (0,0)
val #37: created (125,189) ; was (0,0)
val #38: created (136,153) ; was (0,0)
val #39: created (130,168) ; was (0,0)
val #40: created (181,232) ; was (0,0)
val #41: created (196,199) ; was (0,0)
val #42: created (204,164) ; was (0,0)
val #43: created (209,207) ; was (0,0)
val #44: created (188,182) ; was (0,0)
val #45: created (222,227) ; was (0,0)
val #46: created (203,211) ; was (0,0)
val #47: created (178,173) ; was (0,0)
val #48: created (196,244) ; was (0,0)
val #49: created (200,173) ; was (0,0)
val #50: created (192,219) ; was (0,0)
val #51: created (187,230) ; was (0,0)
val #52: created (178,184) ; was (0,0)
val #53: created (181,162) ; was (0,0)
val #54: created (202,173) ; was (0,0)
val #55: created (192,246) ; was (0,0)
val #56: created (202,220) ; was (0,0)
val #57: created (200,169) ; was (0,0)
val #58: created (198,215) ; was (0,0)
val #59: created (201,186) ; was (0,0)
val #60: created (203,227) ; was (0,0)
val #61: created (202,227) ; was (0,0)
val #62: created (191,203) ; was (0,0)
val #63: created (201,210) ; was (0,0)
val #64: created (204,187) ; was (0,0)
val #65: created (195,203) ; was (0,0)
val #66: created (201,181) ; was (0,0)
val #67: created (185,150) ; was (0,0)
val #68: created (198,229) ; was (0,0)
val #69: created (202,176) ; was (0,0)
val #70: created (198,175) ; was (0,0)
val #71: created (197,172) ; was (0,0)
val #72: created (183,193) ; was (0,0)
val #73: created (200,232) ; was (0,0)
val #74: created (188,218) ; was (0,0)
val #75: created (195,210) ; was (0,0)
val #76: created (192,198) ; was (0,0)
val #77: created (211,177) ; was (0,0)
val #78: created (191,168) ; was (0,0)
val #79: created (190,204) ; was (0,0)
val #80: created (194,217) ; was (0,0)
val #81: created (203,189) ; was (0,0)
val #82: created (4,88) ; was (0,0)
val #83: created (190,171) ; was (0,0)
val #84: created (211,189) ; was (0,0)
val #85: created (211,143) ; was (0,0)
val #86: created (202,164) ; was (0,0)
val #87: created (201,142) ; was (0,0)
val #88: created (182,152) ; was (0,0)
val #89: created (178,195) ; was (0,0)
val #90: created (199,148) ; was (0,0)
val #91: created (156,153) ; was (0,0)
total: (17205,20011)
val #0: pubkey FE8467473CAE2CA03358968670C58671F36A1D1C612BDA5D91AF6176DC678D1C, blocks created (0,0), expected (187.010870,346.023715), probabilities 0.000000 and 0.000000
[ 1][t 1][1617622687.748080730][lite-client.cpp:3645][!testnode]	validator #0 with pubkey FE8467473CAE2CA03358968670C58671F36A1D1C612BDA5D91AF6176DC678D1C : serious misbehavior detected: created less than 90% of the expected amount of blocks with probability 99.999% : created (0,0), expected (187.010870,346.023715) masterchain/shardchain blocks
[ 3][t 1][1617622687.748100996][lite-client.cpp:3719][!testnode]	creating proof file cla-1.boc
saved validator misbehavior proof into file `cla-1.boc` (4777 bytes written)
COMPLAINT_SAVED	7E04265C54643BCC2B596802369D8B7BF2B93A366D5A5981F093E7FEAA7C809C	401F0CD8081410B0839160F092808F21CC2C4CC53EA660327328B7EA8F48848D	cla-1.boc
val #1: pubkey AD97A6BD93AEFC7B42D96C4841819B8F003FAA05E248C2AA98388F32ED4541E4, blocks created (204,321), expected (187.010870,346.072585), probabilities 0.500000 and 0.500000
val #2: pubkey E504197DF258636FE977F67BBC150AED2133E8550039B2163580477C90CB3D46, blocks created (189,379), expected (187.010870,346.026468), probabilities 0.500000 and 0.500000
val #3: pubkey F0F285F4AEA720D1CDD89A1B9B262C060B3E1836E2D265772628D0405AFE6F1C, blocks created (231,397), expected (187.010870,346.119767), probabilities 0.500000 and 0.500000
val #4: pubkey A394087F1A3397501E2471BE01FAE1D9F39DFFDAF7CD5C471D1116EF3D97CB8E, blocks created (211,359), expected (187.010870,346.238528), probabilities 0.500000 and 0.500000
val #5: pubkey B709ACFAC6A1007877F061F1C4843A478192864E30CE421D08F0F0BEF71A922B, blocks created (194,318), expected (187.010870,345.957652), probabilities 0.500000 and 0.500000
val #6: pubkey 16A23BBD1C03F939C11EEEB945D1181057171D2711A60F99D680E7F6DB56233D, blocks created (173,353), expected (187.010870,317.966526), probabilities 0.500000 and 0.500000
val #7: pubkey 2ACCC69F182B5A97971A2C6EE5C0171D6FE3B82F0337F13D5621F907B05F46A2, blocks created (175,281), expected (187.010870,315.874482), probabilities 0.500000 and 0.479579
val #8: pubkey 37A3C07EF97DA206D6E9CE79F0120309CEDD0EA0BC3D1CC12F014DD1E9CFD50C, blocks created (172,277), expected (187.010870,315.828087), probabilities 0.500000 and 0.455061
val #9: pubkey 9AC19F8BA2E4267C0BB69FFAB47C04AE3DB3F034F25CED2DDB725891C4B35909, blocks created (127,171), expected (187.010870,315.888684), probabilities 0.000726 and 0.038775
[ 1][t 1][1617622687.753309011][lite-client.cpp:3658][!testnode]	validator #9 with pubkey 9AC19F8BA2E4267C0BB69FFAB47C04AE3DB3F034F25CED2DDB725891C4B35909 : moderate misbehavior detected: created less than 90% of the expected amount of blocks with probability 99.9% : created (127,171), expected (187.010870,315.888684) masterchain/shardchain blocks
[ 3][t 1][1617622687.753344536][lite-client.cpp:3719][!testnode]	creating proof file cla-2.boc
saved validator misbehavior proof into file `cla-2.boc` (4936 bytes written)
COMPLAINT_SAVED	7E04265C54643BCC2B596802369D8B7BF2B93A366D5A5981F093E7FEAA7C809C	B0A3ACFA589B7757EEEC408342C93B45F4F189CE9118C6448C86C589B5C43BA4	cla-2.boc
val #10: pubkey 664BAF44168730B67EFC9A3DFF91A838EF19421B17A8B7E67D112D0972311F84, blocks created (207,386), expected (187.010870,315.939957), probabilities 0.500000 and 0.500000
val #11: pubkey 87E88A12622B8A85110EF73ED4613B973821810F9CE9E39799A8C5ACD9453A15, blocks created (206,305), expected (187.010870,315.590433), probabilities 0.500000 and 0.500000
val #12: pubkey 18130E06F03207B93FC0CDDEDD7717FD2948980DEC3816085813CC407AD45A70, blocks created (186,330), expected (187.010870,273.174584), probabilities 0.500000 and 0.500000
val #13: pubkey AA6E85955FF8045889DBA0AAC6898CD3A203AD9B306F72546FB5822537FBCBE6, blocks created (187,283), expected (187.010870,273.278129), probabilities 0.500000 and 0.500000
val #14: pubkey FD6833ECD8A7B91BD31678767E87399B79AB522DB65EE416C47B039769F597F0, blocks created (201,263), expected (187.010870,273.277404), probabilities 0.500000 and 0.500000
val #15: pubkey C420EDD73E0F1DDE3B4C6B5BECC55EF9FE656A3DDA10190BB9FD057435E2E4F5, blocks created (202,256), expected (187.010870,273.259793), probabilities 0.500000 and 0.500000
val #16: pubkey 8BB84A2F6AE07B69884020851A05F20B3F526C8DE4061ECC54E26771737067A2, blocks created (200,274), expected (187.010870,272.583205), probabilities 0.500000 and 0.500000
val #17: pubkey 37E7FBD167D11AFB5C59973D9AF72A2165AB5AF480E27EE7F56715D47032BD79, blocks created (197,262), expected (187.010870,272.327329), probabilities 0.500000 and 0.500000
val #18: pubkey 836A25688007C7DB589469958B8436123998E8313F9AB57E9C92F265A53403C1, blocks created (192,256), expected (187.010870,272.501584), probabilities 0.500000 and 0.500000
val #19: pubkey F8EB47DD59D65FC472BB6A3DB7EA62699F1E72BE9B77E11A2D6F26EF3357267F, blocks created (198,339), expected (187.010870,272.571210), probabilities 0.500000 and 0.500000
val #20: pubkey 8ED1779CDB090740C01AD5E8AC351AA88DED9E75080A54D131AE0C15744A356A, blocks created (193,257), expected (187.010870,272.367077), probabilities 0.500000 and 0.500000
val #21: pubkey 5E2EDF11EE2A5E5B77F12C219454CE9C6A8A0ED8F8BF7DCE74E00374AE209D69, blocks created (166,238), expected (187.010870,270.453446), probabilities 0.429346 and 0.463725
val #22: pubkey 5410D37A1BC7116974D501DE1EC8ABB24C20FFF53A6AF4A51458990F98D9B997, blocks created (173,261), expected (187.010870,270.491834), probabilities 0.500000 and 0.500000
val #23: pubkey 1C706E0D846ECCF3B1480074294B53170FAA0D96443BAC5A6263C36AE241D36D, blocks created (192,257), expected (187.010870,222.731950), probabilities 0.500000 and 0.500000
val #24: pubkey 6C0DF0282873CD26366934BDB8A6F6256869DA298F3444752372B2BE004B598D, blocks created (197,269), expected (187.010870,218.076135), probabilities 0.500000 and 0.500000
val #25: pubkey 871E10E53D484E50150257733C6BCA6FC0B51C6FE3FE205AF110D16EA5E5C1C7, blocks created (207,200), expected (187.010870,215.400517), probabilities 0.500000 and 0.500000
val #26: pubkey 77E3C8F07D7D111A61117E54EE05B2AC62805002C61B43D9B025AE45A4DB6427, blocks created (212,218), expected (187.010870,209.558880), probabilities 0.500000 and 0.500000
val #27: pubkey CA970DB1EEF460E1D672618F53C4A646C0CD347FC99494953BB0B34A985375B8, blocks created (204,224), expected (187.010870,209.317237), probabilities 0.500000 and 0.500000
val #28: pubkey 57BCF9B206A24F7FE85D3B3F8A0E6F2B20337B3094F4FB7690C39D791B0004B9, blocks created (196,235), expected (187.010870,206.075581), probabilities 0.500000 and 0.500000
val #29: pubkey EFC36BC477BF7952B03526C51950551260ADDBABE9B0A1B6FD29527AE6576F2E, blocks created (192,225), expected (187.010870,205.810574), probabilities 0.500000 and 0.500000
val #30: pubkey A857F2EBD2109FA4F4EF8ECF503B6268C51ADF881671D7B80DB0045E2A3EAD62, blocks created (176,230), expected (187.010870,203.783556), probabilities 0.500000 and 0.500000
val #31: pubkey 161C3FB9921CEE324A47AD647468188FB39D5428D9507EFB7BF4FA860895ED96, blocks created (203,192), expected (187.010870,201.992454), probabilities 0.500000 and 0.500000
val #32: pubkey C736D556EE3E3EFB08B9A2C7C3DFEF5D359E98FF64E0BF53F86D7C52A053764D, blocks created (114,153), expected (187.010870,202.015391), probabilities 0.000014 and 0.287289
[ 1][t 1][1617622687.757979393][lite-client.cpp:3658][!testnode]	validator #32 with pubkey C736D556EE3E3EFB08B9A2C7C3DFEF5D359E98FF64E0BF53F86D7C52A053764D : moderate misbehavior detected: created less than 90% of the expected amount of blocks with probability 99.9% : created (114,153), expected (187.010870,202.015391) masterchain/shardchain blocks
[ 3][t 1][1617622687.758003473][lite-client.cpp:3719][!testnode]	creating proof file cla-3.boc
saved validator misbehavior proof into file `cla-3.boc` (5174 bytes written)
COMPLAINT_SAVED	7E04265C54643BCC2B596802369D8B7BF2B93A366D5A5981F093E7FEAA7C809C	8FB8E25B583E62D1569E680D8232EC8210A130477A4092275869055BB3441500	cla-3.boc
val #33: pubkey 3C738D1BE47861E7FBAC9852DE6F51DAA571CDECFE8875CCD278B8FC5E2AD28C, blocks created (201,201), expected (187.010870,201.924229), probabilities 0.500000 and 0.500000
val #34: pubkey 45FBB4BE53DB125FBF5F24E0245E019848710B4ABA502BFD958C655A88101B55, blocks created (214,220), expected (187.010870,201.404934), probabilities 0.500000 and 0.500000
val #35: pubkey 93553B972427D13C2613DF853CF1A4EA7581EE92B7759D268D4821AF2BEDE412, blocks created (199,196), expected (187.010870,201.297039), probabilities 0.500000 and 0.500000
val #36: pubkey A364FCCD4A8E9EDE76B1674E3A7E0283D7622519F7228F69A3D53687C4CEB316, blocks created (155,208), expected (187.010870,200.939520), probabilities 0.152463 and 0.500000
val #37: pubkey 79FA3AEDDD4548D3C14AB383587CA30D39E58B017906F82D0A4CFC500FA3895D, blocks created (125,189), expected (187.010870,200.554990), probabilities 0.000421 and 0.500000
[ 1][t 1][1617622687.762533188][lite-client.cpp:3658][!testnode]	validator #37 with pubkey 79FA3AEDDD4548D3C14AB383587CA30D39E58B017906F82D0A4CFC500FA3895D : moderate misbehavior detected: created less than 90% of the expected amount of blocks with probability 99.9% : created (125,189), expected (187.010870,200.554990) masterchain/shardchain blocks
[ 3][t 1][1617622687.762566328][lite-client.cpp:3719][!testnode]	creating proof file cla-4.boc
saved validator misbehavior proof into file `cla-4.boc` (4845 bytes written)
COMPLAINT_SAVED	7E04265C54643BCC2B596802369D8B7BF2B93A366D5A5981F093E7FEAA7C809C	75835C81FDB8972827748C5D4AD038CF2E825FA8093469E561DFB9634AEDE8F4	cla-4.boc
val #38: pubkey B2032CBD9EC7BE3951F2682610B186944582AABEBDBF58AB670302314CF6ACC6, blocks created (136,153), expected (187.010870,199.840642), probabilities 0.006379 and 0.299433
val #39: pubkey 7E5C21221F531C87350D0441217373C6249AEEE245AE914DE8396FED30C18479, blocks created (130,168), expected (187.010870,198.868044), probabilities 0.001574 and 0.414645
val #40: pubkey FFF6CD576D88970DC853358CE32FB652E5BD56A8DE1816ABC4894996EEE00F73, blocks created (181,232), expected (187.010870,198.095079), probabilities 0.500000 and 0.500000
val #41: pubkey 287D134B8796148F096222920177B824E027A952CAB9970C57AB56460BF8AD4C, blocks created (196,199), expected (187.010870,195.556687), probabilities 0.500000 and 0.500000
val #42: pubkey C4CF8470803648AFEE4C5BE7C122456A898BAC593E70A74565AE27E643E5EE06, blocks created (204,164), expected (187.010870,194.208166), probabilities 0.500000 and 0.415145
val #43: pubkey D398CC425A1CACFA8AB8B6F96389CB3E575934EBB905BCE23348F1FE9D61B792, blocks created (209,207), expected (187.010870,193.134649), probabilities 0.500000 and 0.500000
val #44: pubkey D78D3ADAFF7CBB27A39FF2B4233845FE41B4A17DE98D1294A6852F1FD85CAA9A, blocks created (188,182), expected (187.010870,192.808657), probabilities 0.500000 and 0.500000
val #45: pubkey 2A23CD32DFCA14D4FEB65CCE54A9B92228ECEA45059CD8CD85D3795FE5FE4D9A, blocks created (222,227), expected (187.010870,192.242485), probabilities 0.500000 and 0.500000
val #46: pubkey 794E45D082D235923721E48D75CDEBE6C6EB19D7C43B387429B0AC8773C827E9, blocks created (203,211), expected (187.010870,191.881420), probabilities 0.500000 and 0.500000
val #47: pubkey 739DA354A5AB5194EFAE08657E39563BB1CF71D53BD904DBD18E9655237033D0, blocks created (178,173), expected (187.010870,190.800275), probabilities 0.500000 and 0.500000
val #48: pubkey 5C100415537AC058DACA39CDED18841AFEDE9D598A5A29BC4BB3775B5C9490CB, blocks created (196,244), expected (187.010870,190.670122), probabilities 0.500000 and 0.500000
val #49: pubkey 5D68501CDBF086C71C5B9DEB33DB503FC8263BB470DA83B964D47FC4BEDBC9DB, blocks created (200,173), expected (187.010870,190.512029), probabilities 0.500000 and 0.500000
val #50: pubkey 57AC72786CFFAC95AE08FE9E057866E8F2B9B6497A34B31069F18DA487A1BAB6, blocks created (192,219), expected (187.010870,190.508949), probabilities 0.500000 and 0.500000
val #51: pubkey 13C6B14A24C8EC166AE56B0DD716D9D068D6BE5B5C614B68AA6E6EBB06D132B9, blocks created (187,230), expected (187.010870,189.875113), probabilities 0.500000 and 0.500000
val #52: pubkey 2FB732F66310EAAFDB930490FEC44D193E2BBC484D921C469704F63EEA35B429, blocks created (178,184), expected (187.010870,189.742385), probabilities 0.500000 and 0.500000
val #53: pubkey 65287DF947F6BE36E0E77CD1D15E2B0C9B1A593B470D351A9D27BB3339702845, blocks created (181,162), expected (187.010870,189.235861), probabilities 0.500000 and 0.433563
val #54: pubkey 05E489195322C3D67BBC517087076D4A3BCAC58047C3941C870937A170CAA96F, blocks created (202,173), expected (187.010870,189.155173), probabilities 0.500000 and 0.500000
val #55: pubkey 34F4169283F0D15E271EC2646463A3AA986A166AA098336EDD0330114D9C7648, blocks created (192,246), expected (187.010870,189.046017), probabilities 0.500000 and 0.500000
val #56: pubkey B8F6EFC3F26D26A988BDE2FB5E77459554131972FA3AC089ECA506101BDC9C68, blocks created (202,220), expected (187.010870,188.558192), probabilities 0.500000 and 0.500000
val #57: pubkey 6D94DFEA4AA3DEEAA48A4DB0716164BB247DE2EF7A86A543757B5BF937417C77, blocks created (200,169), expected (187.010870,187.450227), probabilities 0.500000 and 0.500000
val #58: pubkey 1BDB69C9C3A34BDDAEFCB3C1BF036FE8D47523DD7459B2DFAC4276B68959A120, blocks created (198,215), expected (187.010870,187.320616), probabilities 0.500000 and 0.500000
val #59: pubkey AD7A92F367D93B52EFB9B3BAEC1E387D686DE7DC5493DEE5BB1F3810A5A3938A, blocks created (201,186), expected (187.010870,187.372558), probabilities 0.500000 and 0.500000
val #60: pubkey 4280EBF6A5A881ADD81F6602C693731615BC4FF76855F5DB76976EB82BF71EA7, blocks created (203,227), expected (187.010870,187.373488), probabilities 0.500000 and 0.500000
val #61: pubkey 8EA201BAF9E9B84B54EE3996F133F60C75AF132E32C3D42ED8CDB00DBFE9F849, blocks created (202,227), expected (187.010870,186.459851), probabilities 0.500000 and 0.500000
val #62: pubkey C6E6957039D2922336573DCA3F20BA7C066E738A6D1123FECDCE5CFCA2A28953, blocks created (191,203), expected (187.010870,186.484089), probabilities 0.500000 and 0.500000
val #63: pubkey 5EFB445FBC3609D79E5B9879E5C8052D9A5E84C7908AAAB9F764D3B3726641A5, blocks created (201,210), expected (187.010870,186.451361), probabilities 0.500000 and 0.500000
val #64: pubkey 63452AD5A198A3214C53989B5459C83904B3FE8B5D60FDB301D0736236CABFB6, blocks created (204,187), expected (187.010870,186.423142), probabilities 0.500000 and 0.500000
val #65: pubkey 058AE9962F073D38CBF82EAACF5AE57BC212630833CA1A8F312460BDE87CF9F3, blocks created (195,203), expected (187.010870,184.799900), probabilities 0.500000 and 0.500000
val #66: pubkey DFB4BB59D2C816B7B5F25CFA3F61DCDB8D3FA272981646AE1D0D47A93BCC3DCE, blocks created (201,181), expected (187.010870,184.664814), probabilities 0.500000 and 0.500000
val #67: pubkey 2C334871B477B59A837FC1CB1BAC57214282F7401E1E11E6F289F254A702F48A, blocks created (185,150), expected (187.010870,184.508744), probabilities 0.500000 and 0.371710
val #68: pubkey 565F5F2B9FB5E066545127C32E76D4BE8C16346F4519783B339001DA0EEC6B8D, blocks created (198,229), expected (187.010870,184.188982), probabilities 0.500000 and 0.500000
val #69: pubkey 5932FFDD3C2EB2BAA14FA3BCE11656661E3C10DB761B88400068A9622AE543B6, blocks created (202,176), expected (187.010870,184.143102), probabilities 0.500000 and 0.500000
val #70: pubkey 688F0027DC0CF8A2B42CB04777FCA4C9652EDBAAA527265F5F84C42680F35139, blocks created (198,175), expected (187.010870,183.394526), probabilities 0.500000 and 0.500000
val #71: pubkey 9C7D053E110DE10A9D828BA9A2EC8F57101D1BD3A81DB41BC337FC4E5D6716D0, blocks created (197,172), expected (187.010870,183.186774), probabilities 0.500000 and 0.500000
val #72: pubkey 15E5CDF4968908252178FF3DAC7EA4374A46FA8E6DAE28D9EF3D90CB9EC65CA4, blocks created (183,193), expected (187.010870,183.066869), probabilities 0.500000 and 0.500000
val #73: pubkey 7ED4B3194054620DED7C0780265D12D9108B1BE2B26A7CC2328175E3AD219222, blocks created (200,232), expected (187.010870,182.831612), probabilities 0.500000 and 0.500000
val #74: pubkey 34B546F1992B705F90057AEFC26D4EB19BFA305EA2D179D446526BAE2360367E, blocks created (188,218), expected (187.010870,182.785701), probabilities 0.500000 and 0.500000
val #75: pubkey DC50E27F303DA189826DA05495E924FF7E1356D30F85020CEA614A57526FBDAB, blocks created (195,210), expected (187.010870,182.894771), probabilities 0.500000 and 0.500000
val #76: pubkey 853B6736B8A373EAF1F1581ECA2CA34022821F4466093DB4B18DDA0C715F74F2, blocks created (192,198), expected (187.010870,182.924000), probabilities 0.500000 and 0.500000
val #77: pubkey 7CC809BA1AFC73DD8554F9D1D64FB3991537766D452F9FB5375E7A0B1FEF3259, blocks created (211,177), expected (187.010870,182.815200), probabilities 0.500000 and 0.500000
val #78: pubkey EA9F0A17A50CEFDC1D2FFEE38415B7ED1A6DE8AFC1F0C5A0557F51AF0E733BAA, blocks created (191,168), expected (187.010870,182.853258), probabilities 0.500000 and 0.500000
val #79: pubkey 9F1FC8A736500629C1A44E9D48632765C7853E19A17F185FC45562AFAB2FB5CB, blocks created (190,204), expected (187.010870,182.812343), probabilities 0.500000 and 0.500000
val #80: pubkey 1CCAE7C776ED496EE91990C3A836E27EADCF805DF3CE2EFE19C4B5915EE5809B, blocks created (194,217), expected (187.010870,182.800016), probabilities 0.500000 and 0.500000
val #81: pubkey 21CA7BA57D99467F252750FFDE960FB4920AC0B6AA2A6874793F7FD487FC0BDB, blocks created (203,189), expected (187.010870,180.542211), probabilities 0.500000 and 0.500000
val #82: pubkey 8B4349BEA9E270246B0995D2C4B2AA285CAE8B5456D729E254048180456ABAA3, blocks created (4,88), expected (187.010870,148.339644), probabilities 0.000000 and 0.150446
[ 1][t 1][1617622687.767342091][lite-client.cpp:3645][!testnode]	validator #82 with pubkey 8B4349BEA9E270246B0995D2C4B2AA285CAE8B5456D729E254048180456ABAA3 : serious misbehavior detected: created less than 90% of the expected amount of blocks with probability 99.999% : created (4,88), expected (187.010870,148.339644) masterchain/shardchain blocks
[ 3][t 1][1617622687.767372847][lite-client.cpp:3719][!testnode]	creating proof file cla-5.boc
saved validator misbehavior proof into file `cla-5.boc` (4873 bytes written)
COMPLAINT_SAVED	7E04265C54643BCC2B596802369D8B7BF2B93A366D5A5981F093E7FEAA7C809C	BDCA4EDD31F9684E90991F93B0CA1B7441EA290824D59D3DC7DA2CFF8E9A504C	cla-5.boc
val #83: pubkey DF65538FB594086FC7B46D38F6017EB52E48296EF53D59B4ADF730C5728B73D5, blocks created (190,171), expected (187.010870,177.484555), probabilities 0.500000 and 0.500000
val #84: pubkey AAD08DDD0070CAC646861FCA31D234DA5B0F9A9E63C72CC7FE51836028DE6BE0, blocks created (211,189), expected (187.010870,176.330974), probabilities 0.500000 and 0.500000
val #85: pubkey 974519D3FD0F2789848A1D189F05426519E688537D9BA264D6B5B2451FD6C78F, blocks created (211,143), expected (187.010870,175.270549), probabilities 0.500000 and 0.378907
val #86: pubkey D313D0C2867DBDCD53F585E65F77BC85F71347106F89752B605D0A27208246A9, blocks created (202,164), expected (187.010870,175.147348), probabilities 0.500000 and 0.500000
val #87: pubkey 813B5351B85F91C907AE3A2B2CBD7DC945A914761A7B8B418EAF4AC8DE6DE844, blocks created (201,142), expected (187.010870,172.195214), probabilities 0.500000 and 0.392122
val #88: pubkey 99B00F1B2F30F63CF0C9B828AE06D2E66D908F607C3CF2ED7D30E0E5BC8F8A99, blocks created (182,152), expected (187.010870,172.128894), probabilities 0.500000 and 0.475464
val #89: pubkey C8D80FDFA3A508F7BA8B23F4A4243F960B319E9626F828617F04C0150F166C5B, blocks created (178,195), expected (187.010870,165.434327), probabilities 0.500000 and 0.500000
val #90: pubkey 089A19223C19D5ACB61626CE367E7296C66800BF10F8A48CF5E3B6B63E088FF3, blocks created (199,148), expected (187.010870,164.349738), probabilities 0.500000 and 0.500000
val #91: pubkey F4A1C05437676203EB3CD8DF4D619D8C0492C8F113E281B6E3740AC390A57A05, blocks created (156,153), expected (187.010870,148.335191), probabilities 0.171349 and 0.500000
[ 3][t 1][1617622687.771440268][lite-client.cpp:3673][!testnode]	5 out of 5 proofs written to cla-*.boc

Here we can see that 5 validators were found that worked poorly. 5 log files were created for these validators. We will need them in the next paragraph to create a complaint.

1.2. Checking that the complaint does not exist yet

Before creating a complaint, we need to check that this complaint does not exist yet in network. Otherwise, our complaint will not make sense and we will waste our coins. We will check by calling the elector method runmethod {fullElectorAddr} list_complaints {utime_since}:

lite-client> runmethod -1:3333333333333333333333333333333333333333333333333333333333333333 list_complaints 1617526392

arguments:  [ 1617526392 70210 ] 
result:  [ ([44535041052591608287425708264402274110695802669646080627861555422994582284968 [[115121400153120730833320993286736585940903350885659302592540374821205589855516 C{ED0DDECA45225E9385EC4C55BF3E7DAC44387D28AD6472E049E63B06DCD28835} 1617592348 2 39762719560905642917067435359170698335393452962810080979680725755343774988354 72569540096 101000000000 0] (14 15 21 22 23 24 25 27 28 30 32 33 34 35 36 38 44 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 75 77 78 79 80 81 82 83 84 85 86 87 90 92) 48323609452558152022454392089533618385184703843320787540057429868550099191013 173419920912838882]] [53328431306450471796630390041015823217657001818941552051295307488843028466843 [[69998281307581425271049711898212026236197018432476057373403229623089236236553 C{0938500FD2D05CC527A0DCC60D76DF70D826E239D62B4C91907AEFCCC42BD8CF} 1617592356 1 39762719560905642917067435359170698335393452962810080979680725755343774988354 72704596096 101000000000 0] (14 15 21 22 23 24 25 27 28 30 32 33 34 35 36 38 44 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 75 77 78 79 80 81 82 83 84 85 86 87 90 92) 48323609452558152022454392089533618385184703843320787540057429868550099191013 173419920912838882]] [59051848885702016526384307683187461740897293021115141836634331164245829815033 [[90107139025185255748811060466736240843649638686898690942962952244454063568461 C{CA6114B18249E44AE81DFB7857D62C4993DE15E0303EBE2698790C4CD6EC3AFF} 1617592365 1 39762719560905642917067435359170698335393452962810080979680725755343774988354 72891044533 101000000000 0] (14 15 21 22 23 24 25 27 28 30 32 33 34 35 36 38 44 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 75 77 78 79 80 81 82 83 84 85 86 87 90 92) 48323609452558152022454392089533618385184703843320787540057429868550099191013 173419920912838882]] [71485797668742897194006029515302646335813109913345940019931399591884605297201 [[55171973158867821484081433374360782549734660877957102077163765206654258481501 C{00475BDC7693DD8962C801D2FFAFADB54978B96C4A443EF96E4CC0A4E3C0208D} 1617592372 1 39762719560905642917067435359170698335393452962810080979680725755343774988354 72679634320 101000000000 0] (14 15 21 22 23 24 25 27 28 30 32 33 34 35 36 38 44 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 75 77 78 79 80 81 82 83 84 85 86 87 90 92) 48323609452558152022454392089533618385184703843320787540057429868550099191013 173419920912838882]]) ]

We can transform the received data into a more readable form. The conversion code in python3 can be viewed here (https://github.com/igroman787/mytonctrl/blob/6873aef03cefdf9ef54f204ffe20a1e0ad617d38/mytoncore.py#L1723).

Another option would be to convert the validator pubkey to a number (hex2dec):

FE8467473CAE2CA03358968670C58671F36A1D1C612BDA5D91AF6176DC678D1C --> 115121400153120730833320993286736585940903350885659302592540374821205589855516
9AC19F8BA2E4267C0BB69FFAB47C04AE3DB3F034F25CED2DDB725891C4B35909 --> 69998281307581425271049711898212026236197018432476057373403229623089236236553
C736D556EE3E3EFB08B9A2C7C3DFEF5D359E98FF64E0BF53F86D7C52A053764D --> 90107139025185255748811060466736240843649638686898690942962952244454063568461
79FA3AEDDD4548D3C14AB383587CA30D39E58B017906F82D0A4CFC500FA3895D --> 55171973158867821484081433374360782549734660877957102077163765206654258481501
8B4349BEA9E270246B0995D2C4B2AA285CAE8B5456D729E254048180456ABAA3 --> 62990373674178290708888165547318754923543790940400476463313520546781172775587

We see that a complaint has not yet been created for the last idle validator. For this last validator we will create a complaint.

1.3. Creating a complaint

To create a complaint, we will use the fift script envelope-complaint.fif {utime_since} {complaint_boc} {output_filename}. It is assumed that you have already completed the previous tutorials on working with fift (https://ton.org/HOWTO.txt).

> fift -s envelope-complaint.fif 1617526392 cla-5.boc ecf-5.boc

Loading complaint from file `cla-5.boc`...
Query id is 6947638327042933901 
resulting internal message body:...
(a total of 33984 data bits, 162 cell references -> 4793 BoC data bytes)
(Saved to file ecf-5.boc)

Here we got the ecf-5.boc file that we will use in the next paragraph. Do the same for the each other validator.

1.4. Signing a complaint by a wallet

We sign the file with the complaint fift -s wallet.fif {wallet_path} {fullElectorAddr} {seqno} {amount} -B {boc_filename} {result_filename}:

> fift -s wallet.fif validator_wallet_001 -1:3333333333333333333333333333333333333333333333333333333333333333 3815 100 -B msb.boc result

Source wallet address = .............................................. (address is hidden)
kf9Af7EYeqoU3MMYiCP3mzsA6t3LC75gtXj5uQ9x7AOGgYjG
Loading private key from file /home/user/.local/share/mytoncore/wallets/validator_wallet_001.pk
Transferring GR$100 to account kf8zMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzMzM_BP = -1:3333333333333333333333333333333333333333333333333333333333333333 seqno=0xee7 bounce=-1 
Body of transfer message is x{56744370606B5CAE915D2AA8744F96F8199CBECDFB208FA3C4EB6546B3DDF7DF30C2FD1E018D335376A3791CA9D92A52027B27EB3E3C09DFC9DAA578579A82A41A6928E67806457AE371070256744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8}

StateInit is x{4_}

signing message: x{00000EE703}
 x{627F9999999999999999999999999999999999999999999999999999999999999999A2CB41780000000000000000000000000001}
  x{56744370606B5CAE915D2AA8744F96F8199CBECDFB208FA3C4EB6546B3DDF7DF30C2FD1E018D335376A3791CA9D92A52027B27EB3E3C09DFC9DAA578579A82A41A6928E67806457AE371070256744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8}

resulting external message: x{89FE80FF6230F55429B986311047EF367601D5BB96177CC16AF1F3721EE3D8070D02059711D6D8F233504773C8BFB9F0AD3A0EC1314F4053F162EAD3FF58BB41D187DBCAB19636E2927939B04653B0D4B8409323665A67B26346E96EC9ACF3D99B1070000077381C_}
 x{627F9999999999999999999999999999999999999999999999999999999999999999A2CB41780000000000000000000000000001}
  x{56744370606B5CAE915D2AA8744F96F8199CBECDFB208FA3C4EB6546B3DDF7DF30C2FD1E018D335376A3791CA9D92A52027B27EB3E3C09DFC9DAA578579A82A41A6928E67806457AE371070256744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8}

B5EE9C724102030100011A0001CF89FE80FF6230F55429B986311047EF367601D5BB96177CC16AF1F3721EE3D8070D02059711D6D8F233504773C8BFB9F0AD3A0EC1314F4053F162EAD3FF58BB41D187DBCAB19636E2927939B04653B0D4B8409323665A67B26346E96EC9ACF3D99B1070000077381C010168627F9999999999999999999999999999999999999999999999999999999999999999A2CB417800000000000000000000000000010200EC56744370606B5CAE915D2AA8744F96F8199CBECDFB208FA3C4EB6546B3DDF7DF30C2FD1E018D335376A3791CA9D92A52027B27EB3E3C09DFC9DAA578579A82A41A6928E67806457AE371070256744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA863BC1DA6
(Saved to file result.boc)

Where 3815 is seqno, you can get it by running the command lite-client> runmethod {addr} seqno;
100 - the number of coins to be signed. Calculated with lite-client> complaintprice <expires-in> <complaint-boc>

1.5. Submitting a complaint to the network

lite-client> sendfile result.boc

2.1. Checking an existing complaint

To punish an idle validator, we need to collect 2/3 of the votes of all validators.
However, before voting for a complaint, it must be checked - whether the complaint is indeed correct. To do this, we first download these complaints from the net with the savecomplaints {utime_since} {file_prefix} lite-client command:

lite-client> savecomplaints 1617526392 scp_

arguments:  [ 1617526392 86500 ] 
result:  [ C{EF0E6698BCF8C37C4F57255FDE3202E67293BB63C6D2256F7BEFFA7C4F5C6DE5} ] 
remote result (not to be trusted):  [ C{EF0E6698BCF8C37C4F57255FDE3202E67293BB63C6D2256F7BEFFA7C4F5C6DE5} ] 
SAVE_COMPLAINT	1617526392	6275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8	FE8467473CAE2CA03358968670C58671F36A1D1C612BDA5D91AF6176DC678D1C	1617592348	scp_6275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8.boc
SAVE_COMPLAINT	1617526392	75E6D28E157F8919D38919F6C87CD715073792CC305552F617ED4B48EB378C9B	9AC19F8BA2E4267C0BB69FFAB47C04AE3DB3F034F25CED2DDB725891C4B35909	1617592356	scp_75E6D28E157F8919D38919F6C87CD715073792CC305552F617ED4B48EB378C9B.boc
SAVE_COMPLAINT	1617526392	828E297AF68DC491398AD1458F4ADB0C52FA82875E74C8AC4461812F38270AF9	C736D556EE3E3EFB08B9A2C7C3DFEF5D359E98FF64E0BF53F86D7C52A053764D	1617592365	scp_828E297AF68DC491398AD1458F4ADB0C52FA82875E74C8AC4461812F38270AF9.boc
SAVE_COMPLAINT	1617526392	9E0B8713FF39DFA57E1DDA1617F508E52C5BC9C457ACFBFA4C66F55D0B931231	79FA3AEDDD4548D3C14AB383587CA30D39E58B017906F82D0A4CFC500FA3895D	1617592372	scp_9E0B8713FF39DFA57E1DDA1617F508E52C5BC9C457ACFBFA4C66F55D0B931231.boc
SAVE_COMPLAINT	1617526392	BB5AA5F3B3FF0A874814DE89B800C78142342040BF0D38E5BC39200A8C25156B	8B4349BEA9E270246B0995D2C4B2AA285CAE8B5456D729E254048180456ABAA3	1617592379	scp_BB5AA5F3B3FF0A874814DE89B800C78142342040BF0D38E5BC39200A8C25156B.boc

Here we got the complaint files for each validator. Let's check them with the loadproofcheck {filename} lite-client command:

lite-client> loadproofcheck scp_6275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8.boc

total: (10827834,166255817) -> (10845039,166275828)
total: (17205,20011)
val #0: pubkey FE8467473CAE2CA03358968670C58671F36A1D1C612BDA5D91AF6176DC678D1C, blocks created (0,0), expected (187.010870,346.040003), probabilities 0.000000 and 0.000000
[ 1][t 2][1617625894.181727648][lite-client.cpp:4031][!testnode]	validator #0 with pubkey FE8467473CAE2CA03358968670C58671F36A1D1C612BDA5D91AF6176DC678D1C : serious misbehavior detected: created less than 90% of the expected amount of blocks with probability 99.999% : created (0,0), expected (187.010870,346.040003) masterchain/shardchain blocks
COMPLAINT_VOTE_FOR	6275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8	YES

Here lite-client advises us to vote on the complaint. Let's check other complaints in the same way.

We also need to check that we have not already voted on any complaint for this validator (identified by the public key) during this given validation period. We must do this check so as not to fine the validator more than once during the validation period.

2.2. Vote on complaint

After checking the complaint, we must vote for it. Create a file for voting with the command complaint-vote-req.fif {validator_index} {utime_since} {complaint_hash} {filename}, where validator_index is the ordinal number in the list of validators (can be counted in getconfig 34, the count starts from zero). In our example, our validator index will be 25. complaint_hash is the hash of the complaint in decimal (hex2dec, 6275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8 --> 44535041052591608287425708264402274110695802669646080627861555422994582284968):

> fift -s complaint-vote-req.fif 25 1617526392 44535041052591608287425708264402274110695802669646080627861555422994582284968 cvr.boc

Creating a request to vote for complaint 0x6275f0a1ef13d0026ab9326e18c34d58637a381e4fed6a8705da3600915d2aa8 of past validator set 1617526392 on behalf of current validator with index 25 
56744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8
VnRDUAAZYGl-eGJ18KHvE9ACarkybhjDTVhjejgeT-1qhwXaNgCRXSqo
Saved to file cvr.boc

Here we are interested in the field 56744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8. We will need it further.

2.3. Getting a validator key

For the next point, we need a validator key, we will take it from the validator configuration file (/var/ton-work/db/config.json). We are interested in the validators section:

  "validators": [
    {
      "@type": "engine.validator",
      "id": "SF5w6nzqguTIbcj1kZKmnAeTppRbeKxJ8U++wZY8dWo=",
      "temp_keys": [
        {
          "@type": "engine.validatorTempKey",
          "key": "SF5w6nzqguTIbcj1kZKmnAeTppRbeKxJ8U++wZY8dWo=",
          "expire_at": 1617657764
        }
      ],
      "adnl_addrs": [
        {
          "@type": "engine.validatorAdnlAddress",
          "id": "6t0DjIuTG/yALmcl1XWBVwYwxVrvcYHIdIxKj3kHzfc=",
          "expire_at": 1617657764
        }
      ],
      "election_date": 1617591928,
      "expire_at": 1617657764
    },
    {
      "@type": "engine.validator",
      "id": "nVC3UCMyiXL+XjDGoiuH3GOmYwexIwxmLoRWVo6Ds+o=",
      "temp_keys": [
        {
          "@type": "engine.validatorTempKey",
          "key": "nVC3UCMyiXL+XjDGoiuH3GOmYwexIwxmLoRWVo6Ds+o=",
          "expire_at": 1617723300
        }
      ],
      "adnl_addrs": [
        {
          "@type": "engine.validatorAdnlAddress",
          "id": "6t0DjIuTG/yALmcl1XWBVwYwxVrvcYHIdIxKj3kHzfc=",
          "expire_at": 1617723300
        }
      ],
      "election_date": 1617657464,
      "expire_at": 1617723300
    }
  ],

Here we see two sections. We need to select the one that is currently relevant. For example now unixtimestamp = 1617644084. So we need the first section (1617591928 < 1617644084 < 1617657764).
Take the key and convert it to hex (base64 to hex): SF5w6nzqguTIbcj1kZKmnAeTppRbeKxJ8U++wZY8dWo= --> 485e70ea7cea82e4c86dc8f59192a69c0793a6945b78ac49f14fbec1963c756a. So we got the validator_key.

2.4. Getting the signature of the validator

Next, we need to get the signature of the validator with the sign {validator_key} {data} command:

validator-engine-console> sign 485e70ea7cea82e4c86dc8f59192a69c0793a6945b78ac49f14fbec1963c756a 56744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8

got signature dE+W+Bmcvs37II+jxOtlRrPd998wwv0eAY0zU3ajeRyp2SpSAnsn6z48Cd/J2qV4V5qCpBppKOZ4BkV643EHAg==

2.5. Getting the public key of the validator

For the next point, we need validator_pubkey. We will get it with the exportpub {validator_key} command:

validator-engine-console> exportpub 485e70ea7cea82e4c86dc8f59192a69c0793a6945b78ac49f14fbec1963c756a

got public key: xrQTSC95c8r0XJhPN+O5Hzfip7t5f83BuVNU4FD3cv/U5+ie

2.6. Adding a validator signature to your vote

The next step is to add the validator signature to the message with our vote with the complaint-vote-signed command.fif {validator_index} {utime_since} {complaint_hash} {validator_pubkey} {validator_signature} {fileName}:

> fift -s complaint-vote-signed.fif 25 1617526392 44535041052591608287425708264402274110695802669646080627861555422994582284968 xrQTSC95c8r0XJhPN+O5Hzfip7t5f83BuVNU4FD3cv/U5+ie dE+W+Bmcvs37II+jxOtlRrPd998wwv0eAY0zU3ajeRyp2SpSAnsn6z48Cd/J2qV4V5qCpBppKOZ4BkV643EHAg== msb.boc

Creating the body of an internal message to be sent to the elections smart contract
containing a signed request to vote for complaint 0x6275f0a1ef13d0026ab9326e18c34d58637a381e4fed6a8705da3600915d2aa8 of past validator set 1617526392 on behalf of current validator with index 25 2F7973CAF45C984F37E3B91F37E2A7BB797FCDC1B95354E050F772FFD4E7E89E
String to sign is 56744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8
Provided a valid Ed25519 signature 744F96F8199CBECDFB208FA3C4EB6546B3DDF7DF30C2FD1E018D335376A3791CA9D92A52027B27EB3E3C09DFC9DAA578579A82A41A6928E67806457AE3710702 with validator public key 2F7973CAF45C984F37E3B91F37E2A7BB797FCDC1B95354E050F772FFD4E7E89E
Internal message body is x{56744370606B5CAE915D2AA8744F96F8199CBECDFB208FA3C4EB6546B3DDF7DF30C2FD1E018D335376A3791CA9D92A52027B27EB3E3C09DFC9DAA578579A82A41A6928E67806457AE371070256744350001960697E786275F0A1EF13D0026AB9326E18C34D58637A381E4FED6A8705DA3600915D2AA8}
Saved to file msb.boc

2.7. Signing vote by wallet

We sign the file with our vote with the fift -s wallet.fif {wallet_path} {fullElectorAddr} {seqno} {amount} -B {boc_filename} {result_filename}:

> fift -s wallet.fif validator_wallet_001 -1:3333333333333333333333333333333333333333333333333333333333333333 3816 1.5 -B msb.boc result.boc

2.8. Sending vote to the network

lite-client> sendfile result.boc

@tolya-yanot
Copy link
Member Author

tolya-yanot commented Apr 6, 2021

Validators who do not use mytonctrl need to create their own scripts that implement the algorithm for voting for complaints

Since 2/3 votes are needed to accept a complaint, it is necessary that all validators vote and vote according to the same rules.

The process of creating a complaint can be left to validators who use mytonctrl.

Validators who do not use mytonctrl need to create their own scripts that implement the algorithm for voting for complaints as detailed in #13 (comment):

After end of validation period while the stakes are still holding (paragraph 0):

  • Every N minutes invoke savecomplaints (2.1) (for example mytonctrl does this every 10 minutes)
  • For each complaint invoke loadproofcheck (2.1)
  • For each complaint check that you have not already voted for this validator during this validation period (2.1) (for example you can save previous votes locally; the validator is identified by the public key, the validation period is identified by the time range)
  • For each valid complaint create vote, sign vote and send it (2.2-2.8)

You need to use the last code from https://github.com/newton-blockchain/ton/ so that the amount of the fine does not differ.

@tolya-yanot
Copy link
Member Author

tolya-yanot commented Jun 6, 2021

https://github.com/newton-blockchain/punisher/ - script for those validators that do not use mytonctrl for some reason.

This script implements receiving complaints about idle or cheating validators, checking complaints and voting for complaints to fine such validators.

If you are using mytonctrl (recommended) you do not need to use this script, as the complete slashing process is already built into mytonctrl.

Note that identifying idle or cheating validators and submitting a complaint for such validators is not implemented in the script and it is assumed that this is done by validators using mytonctrl

This single file script has no dependencies and can be easily reviewed.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

3 participants