@@ -75,21 +75,36 @@ spec = describe "POOL" $ do
75
75
submitFailingTx tx [injectFailure $ PoolMedataHashTooBig kh (fromIntegral tooBigSize)]
76
76
77
77
it " register a new pool with an already registered VRF" $ do
78
+ pv <- getsPParams ppProtocolVersionL
78
79
(kh, vrf) <- registerNewPool
79
80
khNew <- freshKeyHash
80
- registerPoolTx <$> poolParams khNew vrf >>= submitTx_
81
- expectPool khNew (Just vrf)
81
+ registerPoolTx <$> poolParams khNew vrf >>= \ tx ->
82
+ if pvMajor pv < natVersion @ 11
83
+ then do
84
+ submitTx_ tx
85
+ expectPool khNew (Just vrf)
86
+ else do
87
+ submitFailingTx tx [injectFailure $ VRFKeyHashAlreadyRegistered khNew vrf]
88
+ expectPool khNew Nothing
82
89
expectPool kh (Just vrf)
83
90
84
91
it " re-register a pool with an already registered VRF" $ do
92
+ pv <- getsPParams ppProtocolVersionL
85
93
(kh1, vrf1) <- registerNewPool
86
94
(kh2, vrf2) <- registerNewPool
87
- registerPoolTx <$> poolParams kh1 vrf2 >>= submitTx_
88
- expectPool kh1 (Just vrf1)
89
- expectFuturePool kh1 (Just vrf2)
90
- passEpoch
91
- expectPool kh1 (Just vrf2)
92
- expectPool kh2 (Just vrf2)
95
+ registerPoolTx <$> poolParams kh1 vrf2 >>= \ tx ->
96
+ if pvMajor pv < natVersion @ 11
97
+ then do
98
+ submitTx_ tx
99
+ expectPool kh1 (Just vrf1)
100
+ expectFuturePool kh1 (Just vrf2)
101
+ passEpoch
102
+ expectPool kh1 (Just vrf2)
103
+ expectPool kh2 (Just vrf2)
104
+ else do
105
+ submitFailingTx tx [injectFailure $ VRFKeyHashAlreadyRegistered kh1 vrf2]
106
+ expectPool kh1 (Just vrf1)
107
+ expectFuturePool kh1 Nothing
93
108
94
109
it " re-register a pool with its own VRF" $ do
95
110
(kh, vrf) <- registerNewPool
@@ -148,14 +163,22 @@ spec = describe "POOL" $ do
148
163
expectRetiring False kh
149
164
150
165
it " re-register a retiring pool with an already registered vrf" $ do
166
+ pv <- getsPParams ppProtocolVersionL
151
167
(kh1, _) <- registerNewPool
152
168
(_, vrf2) <- registerNewPool
153
169
retirePoolTx kh1 (EpochInterval 10 ) >>= submitTx_
154
- registerPoolTx <$> poolParams kh1 vrf2 >>= submitTx_
155
- expectRetiring False kh1
156
- expectFuturePool kh1 (Just vrf2)
157
- passEpoch
158
- expectPool kh1 (Just vrf2)
170
+ registerPoolTx <$> poolParams kh1 vrf2 >>= \ tx ->
171
+ if pvMajor pv < natVersion @ 11
172
+ then do
173
+ submitTx_ tx
174
+ expectRetiring False kh1
175
+ expectFuturePool kh1 (Just vrf2)
176
+ passEpoch
177
+ expectPool kh1 (Just vrf2)
178
+ else do
179
+ submitFailingTx tx [injectFailure $ VRFKeyHashAlreadyRegistered kh1 vrf2]
180
+ expectRetiring True kh1
181
+ expectFuturePool kh1 Nothing
159
182
160
183
it " re-register retiring pool with its own VRF" $ do
161
184
(kh, vrf) <- registerNewPool
@@ -176,15 +199,21 @@ spec = describe "POOL" $ do
176
199
expectPool kh (Just vrfNew)
177
200
178
201
it " register a pool with the VRF of a retiring pool" $ do
202
+ pv <- getsPParams ppProtocolVersionL
179
203
(kh, vrf) <- registerNewPool
180
204
let retirement = 1
181
205
retirePoolTx kh (EpochInterval retirement) >>= submitTx_
182
206
khNew <- freshKeyHash
183
- registerPoolTx <$> poolParams khNew vrf >>= submitTx_
184
- expectPool khNew (Just vrf)
207
+ registerPoolTx <$> poolParams khNew vrf >>= \ tx ->
208
+ if pvMajor pv < natVersion @ 11
209
+ then do
210
+ submitTx_ tx
211
+ expectPool khNew (Just vrf)
212
+ else do
213
+ submitFailingTx tx [injectFailure $ VRFKeyHashAlreadyRegistered khNew vrf]
214
+ expectPool khNew Nothing
185
215
expectRetiring True kh
186
216
passNEpochs (fromIntegral retirement)
187
- expectPool khNew (Just vrf)
188
217
expectRetiring False khNew
189
218
expectPool kh Nothing
190
219
@@ -197,6 +226,7 @@ spec = describe "POOL" $ do
197
226
expectPool kh Nothing
198
227
registerPoolTx <$> poolParams kh vrf >>= submitTx_
199
228
expectPool kh (Just vrf)
229
+ expectVRFs [vrf]
200
230
201
231
it " register a pool with the VRF of a retired pool" $ do
202
232
(kh, vrf) <- registerNewPool
@@ -209,6 +239,7 @@ spec = describe "POOL" $ do
209
239
registerPoolTx <$> poolParams khNew vrf >>= submitTx_
210
240
expectPool khNew (Just vrf)
211
241
expectRetiring False khNew
242
+ expectVRFs [vrf]
212
243
where
213
244
registerNewPool = do
214
245
(kh, vrf) <- (,) <$> freshKeyHash <*> freshKeyHashVRF
@@ -235,6 +266,8 @@ spec = describe "POOL" $ do
235
266
assertBool
236
267
(" Expected 'retiring' status of: " <> show poolKh <> " to be: " <> show isRetiring)
237
268
$ Map. member poolKh retiring == isRetiring
269
+ expectVRFs vrfs = do
270
+ (^. psVRFKeyHashesL) <$> getPState `shouldReturn` vrfs
238
271
poolParams kh vrf = do
239
272
pps <- registerRewardAccount >>= freshPoolParams kh
240
273
pure $ pps & ppVrfL .~ vrf
0 commit comments