Skip to content

Commit dfc2c68

Browse files
tests: Various minor fixups
1 parent 725941c commit dfc2c68

File tree

1 file changed

+9
-18
lines changed

1 file changed

+9
-18
lines changed

reference/tests.py

+9-18
Original file line numberDiff line numberDiff line change
@@ -36,13 +36,13 @@ def simulate_simplpedpop(seeds, t) -> List[Tuple[simplpedpop.DKGOutput, bytes]]:
3636
pmsgs = [ret[1] for ret in prets]
3737

3838
cmsg, cout, ceq = simplpedpop.coordinator_step(pmsgs, t, n)
39-
pre_finalize_outputs = [(cout, ceq)]
39+
pre_finalize_rets = [(cout, ceq)]
4040
for i in range(n):
4141
shares_sum = Scalar.sum(*([pret[2][i] for pret in prets]))
42-
pre_finalize_outputs += [
42+
pre_finalize_rets += [
4343
simplpedpop.participant_pre_finalize(prets[i][0], cmsg, shares_sum)
4444
]
45-
return pre_finalize_outputs
45+
return pre_finalize_rets
4646

4747

4848
def encpedpop_keys(seed: bytes) -> Tuple[bytes, bytes]:
@@ -67,12 +67,12 @@ def simulate_encpedpop(seeds, t) -> List[Tuple[simplpedpop.DKGOutput, bytes]]:
6767
pstates = [pstate for (pstate, _) in enc_prets1]
6868

6969
cmsg, cout, ceq, enc_shares_sums = encpedpop.coordinator_step(pmsgs, t, enckeys)
70-
pre_finalize_outputs = [(cout, ceq)]
70+
pre_finalize_rets = [(cout, ceq)]
7171
for i in range(n):
72-
pre_finalize_outputs += [
72+
pre_finalize_rets += [
7373
encpedpop.participant_pre_finalize(pstates[i], cmsg, enc_shares_sums[i])
7474
]
75-
return pre_finalize_outputs
75+
return pre_finalize_rets
7676

7777

7878
def simulate_chilldkg(
@@ -91,13 +91,13 @@ def simulate_chilldkg(
9191
for i in range(n):
9292
prets1 += [chilldkg.participant_step1(seeds[i], params)]
9393

94-
pstate1s = [pret[0] for pret in prets1]
94+
pstates1 = [pret[0] for pret in prets1]
9595
pmsgs = [pret[1] for pret in prets1]
9696
cstate, cmsg = chilldkg.coordinator_step(pmsgs, params)
9797

9898
prets2 = []
9999
for i in range(n):
100-
prets2 += [chilldkg.participant_step2(seeds[i], pstate1s[i], cmsg)]
100+
prets2 += [chilldkg.participant_step2(seeds[i], pstates1[i], cmsg)]
101101

102102
cmsg2, cout, crec = chilldkg.coordinator_finalize(
103103
cstate, [pret[1] for pret in prets2]
@@ -136,15 +136,7 @@ async def main():
136136
return await asyncio.gather(*coroutines)
137137

138138
outputs = asyncio.run(main())
139-
140-
# Check coordinator output
141-
return [
142-
(
143-
simplpedpop.DKGOutput(out[0][0], out[0][1], out[0][2]),
144-
chilldkg.RecoveryData(out[1]),
145-
)
146-
for out in outputs
147-
]
139+
return outputs
148140

149141

150142
def derive_interpolating_value(L, x_i):
@@ -197,7 +189,6 @@ def test_correctness_dkg_output(t, n, dkg_outputs: List[simplpedpop.DKGOutput]):
197189
assert secshares[0] is None
198190

199191
# Check that each secshare matches the corresponding pubshare
200-
# (secshares[1:])
201192
for i in range(1, n + 1):
202193
assert secshares[i] * G == pubshares[0][i - 1]
203194

0 commit comments

Comments
 (0)