@@ -541,15 +541,17 @@ mod tests {
541541 } ) ;
542542
543543 // Some POD IDs
544- let attestation_pod_id = PodId ( Hash ( array:: from_fn ( |i| GoldilocksField ( i as u64 ) ) ) ) ;
545- let other_pod_id = PodId ( Hash ( array:: from_fn ( |i| GoldilocksField ( ( i * i) as u64 ) ) ) ) ;
544+ let pod_id1 = PodId ( Hash ( array:: from_fn ( |i| GoldilocksField ( i as u64 ) ) ) ) ;
545+ let pod_id2 = PodId ( Hash ( array:: from_fn ( |i| GoldilocksField ( ( i * i) as u64 ) ) ) ) ;
546+ let pod_id3 = PodId ( Hash ( array:: from_fn ( |i| GoldilocksField ( ( 2 * i) as u64 ) ) ) ) ;
547+ let pod_id4 = PodId ( Hash ( array:: from_fn ( |i| GoldilocksField ( ( 2 * i) as u64 ) ) ) ) ;
546548
547549 // Example statement
548550 let ethdos_example = Statement :: Custom (
549551 CustomPredicateRef ( eth_dos_distance_batch. clone ( ) , 2 ) ,
550552 vec ! [
551- AnchoredKey ( SELF , "Alice" . into( ) ) ,
552- AnchoredKey ( SELF , "Bob" . into( ) ) ,
553+ AnchoredKey ( pod_id1 , "Alice" . into( ) ) ,
554+ AnchoredKey ( pod_id2 , "Bob" . into( ) ) ,
553555 AnchoredKey ( SELF , "Seven" . into( ) ) ,
554556 ] ,
555557 ) ;
@@ -561,8 +563,8 @@ mod tests {
561563 let ethdos_ind_example = Statement :: Custom (
562564 CustomPredicateRef ( eth_dos_distance_batch. clone ( ) , 1 ) ,
563565 vec ! [
564- AnchoredKey ( SELF , "Alice" . into( ) ) ,
565- AnchoredKey ( SELF , "Bob" . into( ) ) ,
566+ AnchoredKey ( pod_id1 , "Alice" . into( ) ) ,
567+ AnchoredKey ( pod_id2 , "Bob" . into( ) ) ,
566568 AnchoredKey ( SELF , "Seven" . into( ) ) ,
567569 ] ,
568570 ) ;
@@ -573,6 +575,39 @@ mod tests {
573575 )
574576 . check( & ethdos_example) ?) ;
575577
578+ // And the inductive step would arise as follows: Say the
579+ // ETHDoS distance from Alice to Charlie is 6, which is one
580+ // less than 7, and Charlie is ETH-friends with Bob.
581+ let ethdos_facts = vec ! [
582+ Statement :: Custom (
583+ CustomPredicateRef ( eth_dos_distance_batch. clone( ) , 2 ) ,
584+ vec![
585+ AnchoredKey ( pod_id1, "Alice" . into( ) ) ,
586+ AnchoredKey ( pod_id3, "Charlie" . into( ) ) ,
587+ AnchoredKey ( pod_id4, "Six" . into( ) ) ,
588+ ] ,
589+ ) ,
590+ Statement :: ValueOf ( AnchoredKey ( SELF , "One" . into( ) ) , 1 . into( ) ) ,
591+ Statement :: SumOf (
592+ AnchoredKey ( SELF , "Seven" . into( ) ) ,
593+ AnchoredKey ( pod_id4, "Six" . into( ) ) ,
594+ AnchoredKey ( SELF , "One" . into( ) ) ,
595+ ) ,
596+ Statement :: Custom (
597+ CustomPredicateRef ( eth_friend_batch. clone( ) , 0 ) ,
598+ vec![
599+ AnchoredKey ( pod_id3, "Charlie" . into( ) ) ,
600+ AnchoredKey ( pod_id2, "Bob" . into( ) ) ,
601+ ] ,
602+ ) ,
603+ ] ;
604+
605+ assert ! ( Operation :: Custom (
606+ CustomPredicateRef ( eth_dos_distance_batch. clone( ) , 1 ) ,
607+ ethdos_facts
608+ )
609+ . check( & ethdos_ind_example) ?) ;
610+
576611 Ok ( ( ) )
577612 }
578613}
0 commit comments