Skip to content

Commit ffd2676

Browse files
committed
Fix outdated test_intraction after rebase
1 parent dc3514b commit ffd2676

File tree

1 file changed

+16
-6
lines changed

1 file changed

+16
-6
lines changed

tests/test_infraction.py

Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
import ape
55
import pytest
66

7+
from tests.conftest import generate_transcript
8+
79
TIMEOUT = 1000
810
MAX_DKG_SIZE = 31
911
FEE_RATE = 42
@@ -83,10 +85,12 @@ def coordinator(project, deployer, application, oz_dependency):
8385
admin = deployer
8486
contract = project.Coordinator.deploy(
8587
application.address,
88+
TIMEOUT,
89+
0,
8690
sender=deployer,
8791
)
8892

89-
encoded_initializer_function = contract.initialize.encode_input(TIMEOUT, MAX_DKG_SIZE, admin)
93+
encoded_initializer_function = contract.initialize.encode_input(MAX_DKG_SIZE, admin)
9094
proxy = oz_dependency.TransparentUpgradeableProxy.deploy(
9195
contract.address,
9296
deployer,
@@ -108,7 +112,7 @@ def fee_model(project, deployer, coordinator, erc20, treasury):
108112
contract = project.FlatRateFeeModel.deploy(
109113
coordinator.address, erc20.address, FEE_RATE, sender=deployer
110114
)
111-
coordinator.grantRole(coordinator.TREASURY_ROLE(), treasury, sender=deployer)
115+
coordinator.grantRole(coordinator.FEE_MODEL_MANAGER_ROLE(), treasury, sender=deployer)
112116
coordinator.approveFeeModel(contract.address, sender=treasury)
113117
return contract
114118

@@ -130,9 +134,13 @@ def test_no_infractions(
130134
coordinator.initiateRitual(
131135
fee_model, nodes, initiator, DURATION, global_allow_list.address, sender=initiator
132136
)
133-
transcript = os.urandom(transcript_size(len(nodes), len(nodes)))
137+
138+
size = len(nodes)
139+
threshold = coordinator.getThresholdForRitualSize(size)
140+
transcript = generate_transcript(size, threshold)
141+
134142
for node in nodes:
135-
coordinator.postTranscript(0, transcript, sender=node)
143+
coordinator.publishTranscript(0, transcript, sender=node)
136144

137145
with ape.reverts("Ritual must have failed"):
138146
infraction_collector.reportMissingTranscript(0, nodes, sender=initiator)
@@ -149,10 +157,12 @@ def test_partial_infractions(
149157
coordinator.initiateRitual(
150158
fee_model, nodes, initiator, DURATION, global_allow_list.address, sender=initiator
151159
)
152-
transcript = os.urandom(transcript_size(len(nodes), len(nodes)))
153160
# post transcript for half of nodes
161+
size = len(nodes)
162+
threshold = coordinator.getThresholdForRitualSize(size)
163+
transcript = generate_transcript(size, threshold)
154164
for node in nodes[: len(nodes) // 2]:
155-
coordinator.postTranscript(RITUAL_ID, transcript, sender=node)
165+
coordinator.publishTranscript(RITUAL_ID, transcript, sender=node)
156166
chain.pending_timestamp += TIMEOUT * 2
157167
infraction_collector.reportMissingTranscript(
158168
RITUAL_ID, nodes[len(nodes) // 2 :], sender=initiator

0 commit comments

Comments
 (0)