mirror of
https://github.com/ton-blockchain/ton
synced 2025-02-13 03:32:22 +00:00
30 lines
1.2 KiB
Text
30 lines
1.2 KiB
Text
|
#!/usr/bin/fift -s
|
||
|
"TonUtil.fif" include
|
||
|
"GetOpt.fif" include
|
||
|
|
||
|
"validator-to-sign.req" =: savefile
|
||
|
|
||
|
{ ."usage: " @' $0 type ." <validator-idx> <elect-id> <complaint-hash> [<savefile>]" cr
|
||
|
."Creates an unsigned request to vote for complaint <complaint-hash> (decimal; prefix with '0x' if needed) of past validator set <elect-id> on behalf of validator with zero-based index <validator-idx> in current validator set (as stored in configuration parameter 34)." cr
|
||
|
."The result is saved into <savefile> (" savefile type ." by default) and output in hexadecimal form, to be signed later by the validator public key" cr 1 halt
|
||
|
} : usage
|
||
|
|
||
|
$# dup 3 < swap 4 > or ' usage if
|
||
|
4 :$1..n
|
||
|
|
||
|
$1 parse-int dup =: val-idx
|
||
|
16 ufits not abort"validator index out of range"
|
||
|
$2 parse-int dup =: elect-id
|
||
|
32 ufits not abort"invalid election id"
|
||
|
$3 parse-int dup =: compl-hash
|
||
|
256 ufits not abort"invalid complaint hash"
|
||
|
$4 savefile replace-if-null =: savefile
|
||
|
|
||
|
."Creating a request to vote for complaint 0x" compl-hash 64x. ."of past validator set " elect-id .
|
||
|
."on behalf of current validator with index " val-idx . cr
|
||
|
|
||
|
B{56744350} val-idx 16 u>B B+ elect-id 32 u>B B+ compl-hash 256 u>B B+
|
||
|
dup Bx. cr
|
||
|
dup B>base64url type cr
|
||
|
savefile tuck B>file ."Saved to file " type cr
|