@@ -87,8 +87,8 @@ mod service_tests {
8787 cp
8888 }
8989
90- fn set_root_peer_id ( trust_graph : & mut ServiceInterface , peer_id : PeerId , weight_factor : u32 ) {
91- let result = trust_graph. set_root ( peer_id. to_base58 ( ) , weight_factor ) ;
90+ fn set_root_peer_id ( trust_graph : & mut ServiceInterface , peer_id : PeerId , max_chain_len : u32 ) {
91+ let result = trust_graph. set_root ( peer_id. to_base58 ( ) , max_chain_len ) ;
9292 assert ! ( result. success, "{}" , result. error) ;
9393 }
9494
@@ -97,9 +97,9 @@ mod service_tests {
9797 issuer_kp : & KeyPair ,
9898 issued_at_sec : u64 ,
9999 expires_at_sec : u64 ,
100- weight_factor : u32 ,
100+ max_chain_len : u32 ,
101101 ) -> Trust {
102- let result = trust_graph. set_root ( issuer_kp. get_peer_id ( ) . to_base58 ( ) , weight_factor ) ;
102+ let result = trust_graph. set_root ( issuer_kp. get_peer_id ( ) . to_base58 ( ) , max_chain_len ) ;
103103 assert ! ( result. success, "{}" , result. error) ;
104104 add_trust (
105105 trust_graph,
@@ -408,7 +408,7 @@ mod service_tests {
408408 & root_kp,
409409 cur_time,
410410 root_expired_time - 1 ,
411- 4 ,
411+ 10 ,
412412 ) ;
413413
414414 let trust_kp = KeyPair :: generate_ed25519 ( ) ;
@@ -447,7 +447,7 @@ mod service_tests {
447447
448448 let peerA_kp = KeyPair :: generate_ed25519 ( ) ;
449449 let mut cur_time = 100u64 ;
450- add_root_with_trust ( & mut trust_graph, & peerA_kp, cur_time, cur_time + 9999 , 4u32 ) ;
450+ add_root_with_trust ( & mut trust_graph, & peerA_kp, cur_time, cur_time + 9999 , 10 ) ;
451451
452452 let peerB_kp = KeyPair :: generate_ed25519 ( ) ;
453453 add_trust (
@@ -490,7 +490,7 @@ mod service_tests {
490490 let mut cur_time = current_time ( ) ;
491491
492492 let root_peer_id = key_pairs[ 0 ] . get_peer_id ( ) ;
493- set_root_peer_id ( & mut trust_graph, root_peer_id, 2 ) ;
493+ set_root_peer_id ( & mut trust_graph, root_peer_id, 10 ) ;
494494 add_trusts ( & mut trust_graph, & trusts, cur_time) ;
495495
496496 let target_peer_id = key_pairs[ 4 ] . get_peer_id ( ) ;
@@ -536,7 +536,7 @@ mod service_tests {
536536 let cur_time = current_time ( ) ;
537537
538538 let root_peer_id = key_pairs[ 0 ] . get_peer_id ( ) ;
539- set_root_peer_id ( & mut trust_graph, root_peer_id, 2 ) ;
539+ set_root_peer_id ( & mut trust_graph, root_peer_id, 10 ) ;
540540 add_trusts ( & mut trust_graph, & trusts, cur_time) ;
541541
542542 let issued_by = key_pairs. last ( ) . unwrap ( ) . get_peer_id ( ) ;
@@ -577,7 +577,7 @@ mod service_tests {
577577 let cur_time = current_time ( ) ;
578578
579579 let root1_peer_id = key_pairs[ 0 ] . get_peer_id ( ) ;
580- set_root_peer_id ( & mut trust_graph, root1_peer_id, 2 ) ;
580+ set_root_peer_id ( & mut trust_graph, root1_peer_id, 10 ) ;
581581 add_trusts ( & mut trust_graph, & trusts, cur_time) ;
582582
583583 let issued_by = key_pairs. last ( ) . unwrap ( ) . get_peer_id ( ) ;
@@ -620,7 +620,7 @@ mod service_tests {
620620
621621 let cur_time = current_time ( ) ;
622622 let root_peer_id = key_pairs[ 0 ] . get_peer_id ( ) ;
623- set_root_peer_id ( & mut trust_graph, root_peer_id, 1 ) ;
623+ set_root_peer_id ( & mut trust_graph, root_peer_id, 10 ) ;
624624
625625 for auth in trusts. iter ( ) {
626626 add_trust_checked ( & mut trust_graph, auth. trust . clone ( ) , auth. issuer , cur_time) ;
@@ -649,9 +649,9 @@ mod service_tests {
649649 let far_future = cur_time + 9999 ;
650650
651651 // add first and last trusts as roots
652- set_root_peer_id ( & mut trust_graph, kps[ 0 ] . get_peer_id ( ) , 0 ) ;
652+ set_root_peer_id ( & mut trust_graph, kps[ 0 ] . get_peer_id ( ) , 10 ) ;
653653 add_trusts ( & mut trust_graph, & trusts, cur_time) ;
654- add_root_with_trust ( & mut trust_graph, & kps[ 5 ] , cur_time, far_future, 0 ) ;
654+ add_root_with_trust ( & mut trust_graph, & kps[ 5 ] , cur_time, far_future, 10 ) ;
655655
656656 let certs = get_all_certs ( & mut trust_graph, kps[ 5 ] . get_peer_id ( ) , cur_time) ;
657657 // first with self-signed last trust, second - without
@@ -667,7 +667,7 @@ mod service_tests {
667667
668668 let root_kp = KeyPair :: generate_ed25519 ( ) ;
669669 let cur_time = 100u64 ;
670- add_root_with_trust ( & mut trust_graph, & root_kp, cur_time, cur_time + 999 , 4u32 ) ;
670+ add_root_with_trust ( & mut trust_graph, & root_kp, cur_time, cur_time + 999 , 10 ) ;
671671
672672 let trust_kp = KeyPair :: generate_ed25519 ( ) ;
673673 add_trust (
@@ -712,7 +712,7 @@ mod service_tests {
712712
713713 let root_kp = KeyPair :: generate_ed25519 ( ) ;
714714 let mut cur_time = 100u64 ;
715- add_root_with_trust ( & mut trust_graph, & root_kp, cur_time, cur_time + 999 , 4u32 ) ;
715+ add_root_with_trust ( & mut trust_graph, & root_kp, cur_time, cur_time + 999 , 10 ) ;
716716
717717 let trust_kp = KeyPair :: generate_ed25519 ( ) ;
718718 let expires_at_sec = cur_time + 10 ;
@@ -752,10 +752,10 @@ mod service_tests {
752752 let root2_kp = KeyPair :: generate_ed25519 ( ) ;
753753 let cur_time = 100 ;
754754 let far_future = cur_time + 99999 ;
755- // root with bigger weight (smaller weight factor )
756- add_root_with_trust ( & mut trust_graph, & root1_kp, cur_time, far_future, 0u32 ) ;
755+ // root with bigger weight (bigger max_chain_len )
756+ add_root_with_trust ( & mut trust_graph, & root1_kp, cur_time, far_future, 10 ) ;
757757 // opposite
758- add_root_with_trust ( & mut trust_graph, & root2_kp, cur_time, far_future, 5u32 ) ;
758+ add_root_with_trust ( & mut trust_graph, & root2_kp, cur_time, far_future, 5 ) ;
759759
760760 // issue trust from root2 to any other peer_id
761761 let issued_by_root2_peer_id = KeyPair :: generate_ed25519 ( ) . get_peer_id ( ) ;
@@ -832,7 +832,7 @@ mod service_tests {
832832
833833 let cur_time = current_time ( ) ;
834834 let root_peer_id = key_pairs[ 0 ] . get_peer_id ( ) ;
835- set_root_peer_id ( & mut trust_graph, root_peer_id, 1 ) ;
835+ set_root_peer_id ( & mut trust_graph, root_peer_id, 10 ) ;
836836
837837 for auth in trusts. iter ( ) {
838838 add_trust_checked ( & mut trust_graph, auth. trust . clone ( ) , auth. issuer , cur_time) ;
@@ -862,7 +862,7 @@ mod service_tests {
862862
863863 let cur_time = current_time ( ) ;
864864 let root_peer_id = key_pairs[ 0 ] . get_peer_id ( ) ;
865- set_root_peer_id ( & mut trust_graph, root_peer_id, 1 ) ;
865+ set_root_peer_id ( & mut trust_graph, root_peer_id, 10 ) ;
866866
867867 for auth in trusts. iter ( ) {
868868 add_trust_checked ( & mut trust_graph, auth. trust . clone ( ) , auth. issuer , cur_time) ;
0 commit comments