tx · HpTrwcrNgEG3TbjNBu9ut76Lfh6aQeJhexhBUNQ8Povb

3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh:  -0.01000000 Waves

2023.04.18 11:57 [2539780] smart account 3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh > SELF 0.00000000 Waves

{ "type": 13, "id": "HpTrwcrNgEG3TbjNBu9ut76Lfh6aQeJhexhBUNQ8Povb", "fee": 1000000, "feeAssetId": null, "timestamp": 1681808277037, "version": 2, "chainId": 84, "sender": "3N4ziXSMRverXyxHDUKKMR9MHXnB3TyU3Yh", "senderPublicKey": "EU9obW1yVhR8qug3EmXPeew3DMagvJFQzY5Ku8bmcsU7", "proofs": [ "2vi8SDZP6jQ4zNdTW1zecnXAZkF8d8vd1ZDvHYckdpERFVjFSd2igK2buQD4b1GBdmX8D8S9WVjzTpsBcnRxc9Kj" ], "script": "base64:BgIECAISABAAA1NFUAICX18AEGNvbnRyYWN0RmlsZW5hbWUCCXRlc3QucmlkZQEQa2V5UHVibGljS2V5TGlzdAAJALkJAgkAzAgCAgIlcwkAzAgCAhVtdWx0aXNpZ1B1YmxpY0tleUxpc3QFA25pbAUDU0VQAQh0aHJvd0VycgEBcwkAAgEJAKwCAgkArAICBRBjb250cmFjdEZpbGVuYW1lAgI6IAUBcwETcHViS2V5U3RyaW5nVG9CeXRlcwIGcmVzdWx0DHB1YktleVN0cmluZwkAzQgCBQZyZXN1bHQJANkEAQUMcHViS2V5U3RyaW5nARZnZXRNdWx0aXNpZ1B1YktleXNMaXN0AAQScmF3TXVsdGlzaWdQdWJLZXlzCQELdmFsdWVPckVsc2UCCQCdCAIFBHRoaXMJARBrZXlQdWJsaWNLZXlMaXN0AAIACQC1CQIFEnJhd011bHRpc2lnUHViS2V5cwUDU0VQAR5nZXRQdXRibGljS2V5c0FzQnl0ZVZlY3Rvckxpc3QABA5yYXdQdWJLZXlzTGlzdAkBFmdldE11bHRpc2lnUHViS2V5c0xpc3QACgACJGwFDnJhd1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uRz22Yy3oADxDj7YEfp5Pxh4ZnwGZGmfJQ1Ri2 Diff:
OldNewDifferences
1111 func throwErr (s) = throw(((contractFilename + ": ") + s))
1212
1313
14-func getMultisigPubKeysListOrUnit () = {
14+func pubKeyStringToBytes (result,pubKeyString) = (result :+ fromBase58String(pubKeyString))
15+
16+
17+func getMultisigPubKeysList () = {
1518 let rawMultisigPubKeys = valueOrElse(getString(this, keyPublicKeyList()), "")
1619 split(rawMultisigPubKeys, SEP)
1720 }
1821
1922
20-func validateProof (publicKey,proof,bodyBytes) = if ((publicKey == proof))
23+func getPutblicKeysAsByteVectorList () = {
24+ let rawPubKeysList = getMultisigPubKeysList()
25+ let $l = rawPubKeysList
26+ let $s = size($l)
27+ let $acc0 = nil
28+ func $f0_1 ($a,$i) = if (($i >= $s))
29+ then $a
30+ else pubKeyStringToBytes($a, $l[$i])
31+
32+ func $f0_2 ($a,$i) = if (($i >= $s))
33+ then $a
34+ else throw("List size exceeds 3")
35+
36+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
37+ }
38+
39+
40+func validateProof (publicKey,proof,bodyBytes) = if (sigVerify(bodyBytes, proof, publicKey))
2141 then 1
2242 else 0
2343
2444
2545 func compareHelper (lst,proof) = {
26- let $t0646687 = lst
27- let results = $t0646687._1
28- let publicKey = $t0646687._2
29- let bodyBytes = $t0646687._3
46+ let $t0927968 = lst
47+ let results = $t0927968._1
48+ let publicKey = $t0927968._2
49+ let bodyBytes = $t0927968._3
3050 $Tuple3((results :+ validateProof(publicKey, proof, bodyBytes)), publicKey, bodyBytes)
3151 }
3252
4161
4262 func $f0_2 ($a,$i) = if (($i >= $s))
4363 then $a
44- else throw("List size exceeds 10")
64+ else throw("List size exceeds 3")
4565
46- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
66+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
4767 }
4868
4969
6080
6181 func $f0_2 ($a,$i) = if (($i >= $s))
6282 then $a
63- else throw("List size exceeds 10")
83+ else throw("List size exceeds 3")
6484
65- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
85+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
6686 }
6787
6888
6989 func compareListHelper (proofs,publicKey) = {
70- let $t011511196 = proofs
71- let results = $t011511196._1
72- let proofsList = $t011511196._2
73- let bodyBytes = $t011511196._3
90+ let $t014301475 = proofs
91+ let results = $t014301475._1
92+ let proofsList = $t014301475._2
93+ let bodyBytes = $t014301475._3
7494 let compareList = compare(proofsList, publicKey, bodyBytes)._1
7595 let sum = sumList(compareList)
7696 $Tuple3((results :+ sum), proofsList, bodyBytes)
90110
91111 func $f0_2 ($a,$i) = if (($i >= $s))
92112 then $a
93- else throw("List size exceeds 10")
113+ else throw("List size exceeds 3")
94114
95- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
115+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
96116 }
97117
98118
107127
108128 func $f0_2 ($a,$i) = if (($i >= $s))
109129 then $a
110- else throw("List size exceeds 10")
130+ else throw("List size exceeds 3")
111131
112- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
132+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
113133 }
114134 let norm = normilize(rawList._1)
115- norm
135+ sumList(norm)
116136 }
117137
118138
119-func test () = {
120- let proofsList = [base58'AAA', base58'AAAA']
121- let publicKeysList = [base58'AAA', base58'AAAAAA', base58'AAAAA', base58'AAAA', base58'AAAAAAA']
122- let bodyBytes = base58'AAAA'
123- let b = validProofCount(publicKeysList, proofsList, bodyBytes)
124- $Tuple2(sumList(b), b)
125- }
139+@Callable(i)
140+func test () = nil
126141
127142
143+@Verifier(tx)
144+func verify () = match tx {
145+ case s: SetScriptTransaction =>
146+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
147+ case _ =>
148+ let proofsList = tx.proofs
149+ let publicKeysList = getPutblicKeysAsByteVectorList()
150+ (validProofCount(publicKeysList, proofsList, tx.bodyBytes) > 0)
151+}
128152
Full:
OldNewDifferences
11 {-# STDLIB_VERSION 6 #-}
22 {-# SCRIPT_TYPE ACCOUNT #-}
33 {-# CONTENT_TYPE DAPP #-}
44 let SEP = "__"
55
66 let contractFilename = "test.ride"
77
88 func keyPublicKeyList () = makeString(["%s", "multisigPublicKeyList"], SEP)
99
1010
1111 func throwErr (s) = throw(((contractFilename + ": ") + s))
1212
1313
14-func getMultisigPubKeysListOrUnit () = {
14+func pubKeyStringToBytes (result,pubKeyString) = (result :+ fromBase58String(pubKeyString))
15+
16+
17+func getMultisigPubKeysList () = {
1518 let rawMultisigPubKeys = valueOrElse(getString(this, keyPublicKeyList()), "")
1619 split(rawMultisigPubKeys, SEP)
1720 }
1821
1922
20-func validateProof (publicKey,proof,bodyBytes) = if ((publicKey == proof))
23+func getPutblicKeysAsByteVectorList () = {
24+ let rawPubKeysList = getMultisigPubKeysList()
25+ let $l = rawPubKeysList
26+ let $s = size($l)
27+ let $acc0 = nil
28+ func $f0_1 ($a,$i) = if (($i >= $s))
29+ then $a
30+ else pubKeyStringToBytes($a, $l[$i])
31+
32+ func $f0_2 ($a,$i) = if (($i >= $s))
33+ then $a
34+ else throw("List size exceeds 3")
35+
36+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
37+ }
38+
39+
40+func validateProof (publicKey,proof,bodyBytes) = if (sigVerify(bodyBytes, proof, publicKey))
2141 then 1
2242 else 0
2343
2444
2545 func compareHelper (lst,proof) = {
26- let $t0646687 = lst
27- let results = $t0646687._1
28- let publicKey = $t0646687._2
29- let bodyBytes = $t0646687._3
46+ let $t0927968 = lst
47+ let results = $t0927968._1
48+ let publicKey = $t0927968._2
49+ let bodyBytes = $t0927968._3
3050 $Tuple3((results :+ validateProof(publicKey, proof, bodyBytes)), publicKey, bodyBytes)
3151 }
3252
3353
3454 func compare (proofsList,publicKey,bodyBytes) = {
3555 let $l = proofsList
3656 let $s = size($l)
3757 let $acc0 = $Tuple3(nil, publicKey, bodyBytes)
3858 func $f0_1 ($a,$i) = if (($i >= $s))
3959 then $a
4060 else compareHelper($a, $l[$i])
4161
4262 func $f0_2 ($a,$i) = if (($i >= $s))
4363 then $a
44- else throw("List size exceeds 10")
64+ else throw("List size exceeds 3")
4565
46- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
66+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
4767 }
4868
4969
5070 func accum (sum,val) = (sum + val)
5171
5272
5373 func sumList (list) = {
5474 let $l = list
5575 let $s = size($l)
5676 let $acc0 = 0
5777 func $f0_1 ($a,$i) = if (($i >= $s))
5878 then $a
5979 else accum($a, $l[$i])
6080
6181 func $f0_2 ($a,$i) = if (($i >= $s))
6282 then $a
63- else throw("List size exceeds 10")
83+ else throw("List size exceeds 3")
6484
65- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
85+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
6686 }
6787
6888
6989 func compareListHelper (proofs,publicKey) = {
70- let $t011511196 = proofs
71- let results = $t011511196._1
72- let proofsList = $t011511196._2
73- let bodyBytes = $t011511196._3
90+ let $t014301475 = proofs
91+ let results = $t014301475._1
92+ let proofsList = $t014301475._2
93+ let bodyBytes = $t014301475._3
7494 let compareList = compare(proofsList, publicKey, bodyBytes)._1
7595 let sum = sumList(compareList)
7696 $Tuple3((results :+ sum), proofsList, bodyBytes)
7797 }
7898
7999
80100 func normilizeHelper (results,next) = (results :+ min([1, next]))
81101
82102
83103 func normilize (results) = {
84104 let $l = results
85105 let $s = size($l)
86106 let $acc0 = nil
87107 func $f0_1 ($a,$i) = if (($i >= $s))
88108 then $a
89109 else normilizeHelper($a, $l[$i])
90110
91111 func $f0_2 ($a,$i) = if (($i >= $s))
92112 then $a
93- else throw("List size exceeds 10")
113+ else throw("List size exceeds 3")
94114
95- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
115+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
96116 }
97117
98118
99119 func validProofCount (publicKeysList,proofsList,bodyBytes) = {
100120 let rawList = {
101121 let $l = publicKeysList
102122 let $s = size($l)
103123 let $acc0 = $Tuple3(nil, proofsList, bodyBytes)
104124 func $f0_1 ($a,$i) = if (($i >= $s))
105125 then $a
106126 else compareListHelper($a, $l[$i])
107127
108128 func $f0_2 ($a,$i) = if (($i >= $s))
109129 then $a
110- else throw("List size exceeds 10")
130+ else throw("List size exceeds 3")
111131
112- $f0_2($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3), 4), 5), 6), 7), 8), 9), 10)
132+ $f0_2($f0_1($f0_1($f0_1($acc0, 0), 1), 2), 3)
113133 }
114134 let norm = normilize(rawList._1)
115- norm
135+ sumList(norm)
116136 }
117137
118138
119-func test () = {
120- let proofsList = [base58'AAA', base58'AAAA']
121- let publicKeysList = [base58'AAA', base58'AAAAAA', base58'AAAAA', base58'AAAA', base58'AAAAAAA']
122- let bodyBytes = base58'AAAA'
123- let b = validProofCount(publicKeysList, proofsList, bodyBytes)
124- $Tuple2(sumList(b), b)
125- }
139+@Callable(i)
140+func test () = nil
126141
127142
143+@Verifier(tx)
144+func verify () = match tx {
145+ case s: SetScriptTransaction =>
146+ sigVerify(tx.bodyBytes, tx.proofs[0], tx.senderPublicKey)
147+ case _ =>
148+ let proofsList = tx.proofs
149+ let publicKeysList = getPutblicKeysAsByteVectorList()
150+ (validProofCount(publicKeysList, proofsList, tx.bodyBytes) > 0)
151+}
128152

github/deemru/w8io/026f985 
33.30 ms