Skip to content

Commit 83ddcbb

Browse files
committed
feat: support mocking new algopy.op functions falcon_verify, mimc, online_stake, sumhash512 and VoterParamsGet
1 parent 90d857d commit 83ddcbb

File tree

3 files changed

+43
-0
lines changed

3 files changed

+43
-0
lines changed

src/_algopy_testing/op/__init__.py

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,16 +3,20 @@
33
EC,
44
ECDSA,
55
EllipticCurve,
6+
MiMCConfigurations,
67
VrfVerify,
78
ecdsa_pk_decompress,
89
ecdsa_pk_recover,
910
ecdsa_verify,
1011
ed25519verify,
1112
ed25519verify_bare,
13+
falcon_verify,
1214
keccak256,
15+
mimc,
1316
sha3_256,
1417
sha256,
1518
sha512_256,
19+
sumhash512,
1620
vrf_verify,
1721
)
1822
from _algopy_testing.op.global_values import Global
@@ -26,6 +30,7 @@
2630
AssetParamsGet,
2731
Box,
2832
Scratch,
33+
VoterParamsGet,
2934
app_opted_in,
3035
arg,
3136
balance,
@@ -35,6 +40,7 @@
3540
gload_bytes,
3641
gload_uint64,
3742
min_balance,
43+
online_stake,
3844
)
3945
from _algopy_testing.op.pure import (
4046
Base64,
@@ -90,8 +96,10 @@
9096
"ITxn",
9197
"ITxnCreate",
9298
"JsonRef",
99+
"MiMCConfigurations",
93100
"Scratch",
94101
"Txn",
102+
"VoterParamsGet",
95103
"VrfVerify",
96104
"addw",
97105
"arg",
@@ -118,6 +126,7 @@
118126
"extract_uint16",
119127
"extract_uint32",
120128
"extract_uint64",
129+
"falcon_verify",
121130
"gaid",
122131
"getbit",
123132
"getbyte",
@@ -126,7 +135,9 @@
126135
"itob",
127136
"keccak256",
128137
"min_balance",
138+
"mimc",
129139
"mulw",
140+
"online_stake",
130141
"replace",
131142
"select_bytes",
132143
"select_uint64",
@@ -140,5 +151,6 @@
140151
"shr",
141152
"sqrt",
142153
"substring",
154+
"sumhash512",
143155
"vrf_verify",
144156
]

src/_algopy_testing/op/crypto.py

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,10 @@ def sha3_256(a: Bytes | bytes, /) -> Bytes:
4242
return Bytes(hashlib.sha3_256(input_value).digest())
4343

4444

45+
def sumhash512(_a: Bytes | bytes, /) -> Bytes:
46+
raise_mocked_function_error("sumhash512")
47+
48+
4549
def keccak256(a: Bytes | bytes, /) -> Bytes:
4650
input_value = as_bytes(a)
4751
hashed_value = keccak.new(data=input_value, digest_bits=256)
@@ -167,6 +171,10 @@ def ecdsa_pk_decompress(v: ECDSA, a: Bytes | bytes, /) -> tuple[Bytes, Bytes]:
167171
)
168172

169173

174+
def falcon_verify(_a: Bytes | bytes, _b: Bytes | bytes, _c: Bytes | bytes, /) -> bool:
175+
raise_mocked_function_error("falcon_verify")
176+
177+
170178
def vrf_verify(
171179
_s: VrfVerify,
172180
_a: Bytes | bytes,
@@ -202,3 +210,12 @@ class EllipticCurve:
202210
scalar_mul = _MockedMember()
203211
scalar_mul_multi = _MockedMember()
204212
subgroup_check = _MockedMember()
213+
214+
215+
class MiMCConfigurations(enum.StrEnum):
216+
BN254Mp110 = enum.auto()
217+
BLS12_381Mp111 = enum.auto()
218+
219+
220+
def mimc(_c: MiMCConfigurations, _a: Bytes | bytes, /) -> Bytes:
221+
raise_mocked_function_error("mimc")

src/_algopy_testing/op/misc.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -638,3 +638,17 @@ def splice(
638638

639639
# Update the box with the new content
640640
lazy_context.ledger.set_box(app_id, key, new_content)
641+
642+
643+
def online_stake() -> UInt64:
644+
raise_mocked_function_error("online_stake")
645+
646+
647+
class VoterParamsGet:
648+
@staticmethod
649+
def voter_balance(_a: Account | UInt64 | int, /) -> tuple[UInt64, bool]:
650+
raise_mocked_function_error("VoterParamsGet.voter_balance")
651+
652+
@staticmethod
653+
def voter_incentive_eligible(_a: Account | UInt64 | int, /) -> tuple[bool, bool]:
654+
raise_mocked_function_error("VoterParamsGet.voter_balance")

0 commit comments

Comments
 (0)