@@ -8,7 +8,7 @@ use crate::ouroboros::{
88} ;
99use acropolis_common:: {
1010 crypto:: keyhash_224,
11- protocol_params:: { Nonce , PraosParams } ,
11+ protocol_params:: Nonce ,
1212 rational_number:: RationalNumber ,
1313 validation:: { VrfValidation , VrfValidationError } ,
1414 BlockInfo , GenesisDelegates , PoolId , VrfKeyHash ,
@@ -23,14 +23,12 @@ pub fn validate_vrf_tpraos<'a>(
2323 header : & ' a MultiEraHeader ,
2424 epoch_nonce : & ' a Nonce ,
2525 genesis_delegs : & ' a GenesisDelegates ,
26- praos_params : & ' a PraosParams ,
26+ active_slots_coeff : RationalNumber ,
27+ decentralisation_param : RationalNumber ,
2728 active_spos : & ' a HashMap < PoolId , VrfKeyHash > ,
2829 active_spdd : & ' a HashMap < PoolId , u64 > ,
2930 total_active_stake : u64 ,
30- decentralisation_param : RationalNumber ,
3131) -> Result < Vec < VrfValidation < ' a > > , Box < VrfValidationError > > {
32- let active_slots_coeff = praos_params. active_slots_coeff ;
33-
3432 // first look up for overlay slot
3533 let obft_slot = overlay_schedule:: lookup_in_overlay_schedule (
3634 block_info. epoch_slot ,
@@ -189,7 +187,6 @@ mod tests {
189187 #[ test]
190188 fn test_4490511_block_produced_by_genesis_key ( ) {
191189 let genesis_value = GenesisValues :: mainnet ( ) ;
192- let praos_params = PraosParams :: mainnet ( ) ;
193190 let epoch_nonce = Nonce :: from (
194191 NonceHash :: try_from (
195192 hex:: decode ( "1a3be38bcbb7911969283716ad7aa550250226b76a61fc51cc9a9a35d9276d81" )
@@ -198,6 +195,7 @@ mod tests {
198195 )
199196 . unwrap ( ) ,
200197 ) ;
198+ let active_slots_coeff = RationalNumber :: new ( 1 , 20 ) ;
201199 let decentralisation_param = RationalNumber :: from ( 1 ) ;
202200
203201 let block_header_4490511: Vec < u8 > =
@@ -226,11 +224,11 @@ mod tests {
226224 & block_header,
227225 & epoch_nonce,
228226 & genesis_value. genesis_delegs ,
229- & praos_params,
227+ active_slots_coeff,
228+ decentralisation_param,
230229 & active_spos,
231230 & active_spdd,
232231 1 ,
233- decentralisation_param,
234232 )
235233 . and_then ( |vrf_validations| {
236234 vrf_validations. iter ( ) . try_for_each ( |assert| assert ( ) . map_err ( Box :: new) )
@@ -241,7 +239,6 @@ mod tests {
241239 #[ test]
242240 fn test_4556956_block ( ) {
243241 let genesis_value = GenesisValues :: mainnet ( ) ;
244- let praos_params = PraosParams :: mainnet ( ) ;
245242 let epoch_nonce = Nonce :: from (
246243 NonceHash :: try_from (
247244 hex:: decode ( "3fac34ac3d7d1ac6c976ba68b1509b1ee3aafdbf6de96e10789e488e13e16bd7" )
@@ -250,6 +247,7 @@ mod tests {
250247 )
251248 . unwrap ( ) ,
252249 ) ;
250+ let active_slots_coeff = RationalNumber :: new ( 1 , 20 ) ;
253251 let decentralisation_param = RationalNumber :: new ( 9 , 10 ) ;
254252
255253 let block_header_4556956: Vec < u8 > =
@@ -284,11 +282,11 @@ mod tests {
284282 & block_header,
285283 & epoch_nonce,
286284 & genesis_value. genesis_delegs ,
287- & praos_params,
285+ active_slots_coeff,
286+ decentralisation_param,
288287 & active_spos,
289288 & active_spdd,
290289 10177811974823000 ,
291- decentralisation_param,
292290 )
293291 . and_then ( |vrf_validations| {
294292 vrf_validations. iter ( ) . try_for_each ( |assert| assert ( ) . map_err ( Box :: new) )
@@ -299,7 +297,6 @@ mod tests {
299297 #[ test]
300298 fn test_4576496_block ( ) {
301299 let genesis_value = GenesisValues :: mainnet ( ) ;
302- let praos_params = PraosParams :: mainnet ( ) ;
303300 let epoch_nonce = Nonce :: from (
304301 NonceHash :: try_from (
305302 hex:: decode ( "3fac34ac3d7d1ac6c976ba68b1509b1ee3aafdbf6de96e10789e488e13e16bd7" )
@@ -308,6 +305,7 @@ mod tests {
308305 )
309306 . unwrap ( ) ,
310307 ) ;
308+ let active_slots_coeff = RationalNumber :: new ( 1 , 20 ) ;
311309 let decentralisation_param = RationalNumber :: new ( 9 , 10 ) ;
312310
313311 let block_header_4576496: Vec < u8 > =
@@ -342,11 +340,11 @@ mod tests {
342340 & block_header,
343341 & epoch_nonce,
344342 & genesis_value. genesis_delegs ,
345- & praos_params,
343+ active_slots_coeff,
344+ decentralisation_param,
346345 & active_spos,
347346 & active_spdd,
348347 10177811974823000 ,
349- decentralisation_param,
350348 )
351349 . and_then ( |vrf_validations| {
352350 vrf_validations. iter ( ) . try_for_each ( |assert| assert ( ) . map_err ( Box :: new) )
@@ -357,7 +355,6 @@ mod tests {
357355 #[ test]
358356 fn test_4576496_block_as_unknown_pool ( ) {
359357 let genesis_value = GenesisValues :: mainnet ( ) ;
360- let praos_params = PraosParams :: mainnet ( ) ;
361358 let epoch_nonce = Nonce :: from (
362359 NonceHash :: try_from (
363360 hex:: decode ( "3fac34ac3d7d1ac6c976ba68b1509b1ee3aafdbf6de96e10789e488e13e16bd7" )
@@ -366,6 +363,7 @@ mod tests {
366363 )
367364 . unwrap ( ) ,
368365 ) ;
366+ let active_slots_coeff = RationalNumber :: new ( 1 , 20 ) ;
369367 let decentralisation_param = RationalNumber :: new ( 9 , 10 ) ;
370368
371369 let block_header_4576496: Vec < u8 > =
@@ -397,11 +395,11 @@ mod tests {
397395 & block_header,
398396 & epoch_nonce,
399397 & genesis_value. genesis_delegs ,
400- & praos_params,
398+ active_slots_coeff,
399+ decentralisation_param,
401400 & active_spos,
402401 & active_spdd,
403402 10177811974823000 ,
404- decentralisation_param,
405403 )
406404 . and_then ( |vrf_validations| {
407405 vrf_validations. iter ( ) . try_for_each ( |assert| assert ( ) . map_err ( Box :: new) )
@@ -416,7 +414,6 @@ mod tests {
416414 #[ test]
417415 fn test_4576496_block_as_wrong_leader_vrf_key ( ) {
418416 let genesis_value = GenesisValues :: mainnet ( ) ;
419- let praos_params = PraosParams :: mainnet ( ) ;
420417 let epoch_nonce = Nonce :: from (
421418 NonceHash :: try_from (
422419 hex:: decode ( "3fac34ac3d7d1ac6c976ba68b1509b1ee3aafdbf6de96e10789e488e13e16bd7" )
@@ -425,6 +422,7 @@ mod tests {
425422 )
426423 . unwrap ( ) ,
427424 ) ;
425+ let active_slots_coeff = RationalNumber :: new ( 1 , 20 ) ;
428426 let decentralisation_param = RationalNumber :: new ( 9 , 10 ) ;
429427
430428 let block_header_4576496: Vec < u8 > =
@@ -457,11 +455,11 @@ mod tests {
457455 & block_header,
458456 & epoch_nonce,
459457 & genesis_value. genesis_delegs ,
460- & praos_params,
458+ active_slots_coeff,
459+ decentralisation_param,
461460 & active_spos,
462461 & active_spdd,
463462 10177811974823000 ,
464- decentralisation_param,
465463 )
466464 . and_then ( |vrf_validations| {
467465 vrf_validations. iter ( ) . try_for_each ( |assert| assert ( ) . map_err ( Box :: new) )
@@ -484,7 +482,6 @@ mod tests {
484482 #[ test]
485483 fn test_4576496_block_with_small_active_stake ( ) {
486484 let genesis_value = GenesisValues :: mainnet ( ) ;
487- let praos_params = PraosParams :: mainnet ( ) ;
488485 let epoch_nonce = Nonce :: from (
489486 NonceHash :: try_from (
490487 hex:: decode ( "3fac34ac3d7d1ac6c976ba68b1509b1ee3aafdbf6de96e10789e488e13e16bd7" )
@@ -493,6 +490,7 @@ mod tests {
493490 )
494491 . unwrap ( ) ,
495492 ) ;
493+ let active_slots_coeff = RationalNumber :: new ( 1 , 20 ) ;
496494 let decentralisation_param = RationalNumber :: new ( 9 , 10 ) ;
497495
498496 let block_header_4576496: Vec < u8 > =
@@ -528,11 +526,11 @@ mod tests {
528526 & block_header,
529527 & epoch_nonce,
530528 & genesis_value. genesis_delegs ,
531- & praos_params,
529+ active_slots_coeff,
530+ decentralisation_param,
532531 & active_spos,
533532 & active_spdd,
534533 10177811974823000 ,
535- decentralisation_param,
536534 )
537535 . and_then ( |vrf_validations| {
538536 vrf_validations. iter ( ) . try_for_each ( |assert| assert ( ) . map_err ( Box :: new) )
0 commit comments