@@ -80,18 +80,7 @@ pub fn select_indexers<'s, R: Rng>(
8080 continue ;
8181 }
8282 masks. push ( mask) ;
83- let score = meta_indexer. score ( params) ;
84- if tracing:: enabled!( tracing:: Level :: TRACE ) {
85- tracing:: trace!(
86- indexers = ?meta_indexer. 0 . iter( ) . map( |f| f. indexing. indexer) . collect:: <V <_>>( ) ,
87- score,
88- ) ;
89- } else if rng. gen_bool ( 0.001 ) {
90- tracing:: debug!(
91- indexers = ?meta_indexer. 0 . iter( ) . map( |f| f. indexing. indexer) . collect:: <V <_>>( ) ,
92- score,
93- ) ;
94- }
83+ let score = meta_indexer. score ( params, rng) ;
9584 if score > selections. 1 {
9685 selections = ( meta_indexer. 0 , score) ;
9786 }
@@ -123,7 +112,7 @@ impl MetaIndexer<'_> {
123112 mask
124113 }
125114
126- fn score ( & self , params : & UtilityParameters ) -> f64 {
115+ fn score < R : Rng > ( & self , params : & UtilityParameters , rng : & mut R ) -> f64 {
127116 if self . 0 . is_empty ( ) {
128117 return 0.0 ;
129118 }
@@ -195,7 +184,7 @@ impl MetaIndexer<'_> {
195184 let p_success = ps. iter ( ) . sum :: < f64 > ( ) ;
196185 debug_assert ! ( ( 0.0 ..=1.0 ) . contains( & p_success) ) ;
197186
198- weighted_product_model ( [
187+ let factors = [
199188 reliability_utility ( p_success) . mul_weight ( exploration) ,
200189 performance_utility ( params. performance , perf_success as u32 )
201190 . mul_weight ( exploration * p_success) ,
@@ -204,7 +193,24 @@ impl MetaIndexer<'_> {
204193 params. economic_security . concave_utility ( slashable_usd) ,
205194 data_freshness_utility ( params. data_freshness , & params. requirements , blocks_behind) ,
206195 fee_utility ( params. fee_weight , & self . fee ( ) , & params. budget ) ,
207- ] )
196+ ] ;
197+ let score = weighted_product_model ( factors) ;
198+
199+ if tracing:: enabled!( tracing:: Level :: TRACE ) {
200+ tracing:: trace!(
201+ indexers = ?self . 0 . iter( ) . map( |f| f. indexing. indexer) . collect:: <V <_>>( ) ,
202+ score,
203+ ?factors,
204+ ) ;
205+ } else if rng. gen_bool ( 0.001 ) {
206+ tracing:: debug!(
207+ indexers = ?self . 0 . iter( ) . map( |f| f. indexing. indexer) . collect:: <V <_>>( ) ,
208+ score,
209+ ?factors,
210+ ) ;
211+ }
212+
213+ score
208214 }
209215}
210216
0 commit comments