@@ -40,15 +40,15 @@ fn solution_with_size<T: Config>(
4040 size : SolutionOrSnapshotSize ,
4141 active_voters_count : u32 ,
4242 desired_targets : u32 ,
43- ) -> Result < RawSolution < CompactOf < T > > , & ' static str > {
43+ ) -> Result < RawSolution < SolutionOf < T > > , & ' static str > {
4444 ensure ! ( size. targets >= desired_targets, "must have enough targets" ) ;
4545 ensure ! (
46- size. targets >= ( <CompactOf <T >>:: LIMIT * 2 ) as u32 ,
46+ size. targets >= ( <SolutionOf <T >>:: LIMIT * 2 ) as u32 ,
4747 "must have enough targets for unique votes."
4848 ) ;
4949 ensure ! ( size. voters >= active_voters_count, "must have enough voters" ) ;
5050 ensure ! (
51- ( <CompactOf <T >>:: LIMIT as u32 ) < desired_targets,
51+ ( <SolutionOf <T >>:: LIMIT as u32 ) < desired_targets,
5252 "must have enough winners to give them votes."
5353 ) ;
5454
@@ -75,7 +75,7 @@ fn solution_with_size<T: Config>(
7575 // chose a random subset of winners.
7676 let winner_votes = winners
7777 . as_slice ( )
78- . choose_multiple ( & mut rng, <CompactOf < T > >:: LIMIT )
78+ . choose_multiple ( & mut rng, <SolutionOf < T > >:: LIMIT )
7979 . cloned ( )
8080 . collect :: < Vec < _ > > ( ) ;
8181 let voter = frame_benchmarking:: account :: < T :: AccountId > ( "Voter" , i, SEED ) ;
@@ -92,7 +92,7 @@ fn solution_with_size<T: Config>(
9292 let rest_voters = ( active_voters_count..size. voters )
9393 . map ( |i| {
9494 let votes = ( & non_winners)
95- . choose_multiple ( & mut rng, <CompactOf < T > >:: LIMIT )
95+ . choose_multiple ( & mut rng, <SolutionOf < T > >:: LIMIT )
9696 . cloned ( )
9797 . collect :: < Vec < T :: AccountId > > ( ) ;
9898 let voter = frame_benchmarking:: account :: < T :: AccountId > ( "Voter" , i, SEED ) ;
@@ -129,25 +129,25 @@ fn solution_with_size<T: Config>(
129129 let assignments = active_voters
130130 . iter ( )
131131 . map ( |( voter, _stake, votes) | {
132- let percent_per_edge: InnerOf < CompactAccuracyOf < T > > =
132+ let percent_per_edge: InnerOf < SolutionAccuracyOf < T > > =
133133 ( 100 / votes. len ( ) ) . try_into ( ) . unwrap_or_else ( |_| panic ! ( "failed to convert" ) ) ;
134134 crate :: unsigned:: Assignment :: < T > {
135135 who : voter. clone ( ) ,
136136 distribution : votes
137137 . iter ( )
138- . map ( |t| ( t. clone ( ) , <CompactAccuracyOf < T > >:: from_percent ( percent_per_edge) ) )
138+ . map ( |t| ( t. clone ( ) , <SolutionAccuracyOf < T > >:: from_percent ( percent_per_edge) ) )
139139 . collect :: < Vec < _ > > ( ) ,
140140 }
141141 } )
142142 . collect :: < Vec < _ > > ( ) ;
143143
144- let compact =
145- <CompactOf < T > >:: from_assignment ( & assignments, & voter_index, & target_index) . unwrap ( ) ;
146- let score = compact . clone ( ) . score ( & winners, stake_of, voter_at, target_at) . unwrap ( ) ;
144+ let solution =
145+ <SolutionOf < T > >:: from_assignment ( & assignments, & voter_index, & target_index) . unwrap ( ) ;
146+ let score = solution . clone ( ) . score ( & winners, stake_of, voter_at, target_at) . unwrap ( ) ;
147147 let round = <MultiPhase < T > >:: round ( ) ;
148148
149149 assert ! ( score[ 0 ] > 0 , "score is zero, this probably means that the stakes are not set." ) ;
150- Ok ( RawSolution { compact , score, round } )
150+ Ok ( RawSolution { solution , score, round } )
151151}
152152
153153fn set_up_data_provider < T : Config > ( v : u32 , t : u32 ) {
@@ -265,7 +265,7 @@ frame_benchmarking::benchmarks! {
265265 let v in ( T :: BenchmarkingConfig :: VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: VOTERS [ 1 ] ;
266266 // number of targets in snapshot.
267267 let t in ( T :: BenchmarkingConfig :: TARGETS [ 0 ] ) .. T :: BenchmarkingConfig :: TARGETS [ 1 ] ;
268- // number of assignments, i.e. compact .len(). This means the active nominators, thus must be
268+ // number of assignments, i.e. solution .len(). This means the active nominators, thus must be
269269 // a subset of `v` component.
270270 let a in ( T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 1 ] ;
271271 // number of desired targets. Must be a subset of `t` component.
@@ -308,11 +308,11 @@ frame_benchmarking::benchmarks! {
308308
309309 let mut signed_submissions = SignedSubmissions :: <T >:: get( ) ;
310310 for i in 0 ..c {
311- let solution = RawSolution {
311+ let raw_solution = RawSolution {
312312 score: [ ( 10_000_000 + i) . into( ) , 0 , 0 ] ,
313313 ..Default :: default ( )
314314 } ;
315- let signed_submission = SignedSubmission { solution , ..Default :: default ( ) } ;
315+ let signed_submission = SignedSubmission { raw_solution , ..Default :: default ( ) } ;
316316 signed_submissions. insert( signed_submission) ;
317317 }
318318 signed_submissions. put( ) ;
@@ -330,7 +330,7 @@ frame_benchmarking::benchmarks! {
330330 let v in ( T :: BenchmarkingConfig :: VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: VOTERS [ 1 ] ;
331331 // number of targets in snapshot.
332332 let t in ( T :: BenchmarkingConfig :: TARGETS [ 0 ] ) .. T :: BenchmarkingConfig :: TARGETS [ 1 ] ;
333- // number of assignments, i.e. compact .len(). This means the active nominators, thus must be
333+ // number of assignments, i.e. solution .len(). This means the active nominators, thus must be
334334 // a subset of `v` component.
335335 let a in
336336 ( T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 1 ] ;
@@ -369,7 +369,7 @@ frame_benchmarking::benchmarks! {
369369 let v in ( T :: BenchmarkingConfig :: VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: VOTERS [ 1 ] ;
370370 // number of targets in snapshot.
371371 let t in ( T :: BenchmarkingConfig :: TARGETS [ 0 ] ) .. T :: BenchmarkingConfig :: TARGETS [ 1 ] ;
372- // number of assignments, i.e. compact .len(). This means the active nominators, thus must be
372+ // number of assignments, i.e. solution .len(). This means the active nominators, thus must be
373373 // a subset of `v` component.
374374 let a in ( T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 1 ] ;
375375 // number of desired targets. Must be a subset of `t` component.
@@ -378,8 +378,8 @@ frame_benchmarking::benchmarks! {
378378 let size = SolutionOrSnapshotSize { voters: v, targets: t } ;
379379 let raw_solution = solution_with_size:: <T >( size, a, d) ?;
380380
381- assert_eq!( raw_solution. compact . voter_count( ) as u32 , a) ;
382- assert_eq!( raw_solution. compact . unique_targets( ) . len( ) as u32 , d) ;
381+ assert_eq!( raw_solution. solution . voter_count( ) as u32 , a) ;
382+ assert_eq!( raw_solution. solution . unique_targets( ) . len( ) as u32 , d) ;
383383
384384 // encode the most significant storage item that needs to be decoded in the dispatch.
385385 let encoded_snapshot = <MultiPhase <T >>:: snapshot( ) . unwrap( ) . encode( ) ;
@@ -447,7 +447,7 @@ frame_benchmarking::benchmarks! {
447447 let v in ( T :: BenchmarkingConfig :: VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: VOTERS [ 1 ] ;
448448 // number of targets in snapshot.
449449 let t in ( T :: BenchmarkingConfig :: TARGETS [ 0 ] ) .. T :: BenchmarkingConfig :: TARGETS [ 1 ] ;
450- // number of assignments, i.e. compact .len(). This means the active nominators, thus must be
450+ // number of assignments, i.e. solution .len(). This means the active nominators, thus must be
451451 // a subset of `v` component.
452452 let a in
453453 ( T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 0 ] ) .. T :: BenchmarkingConfig :: ACTIVE_VOTERS [ 1 ] ;
@@ -461,11 +461,11 @@ frame_benchmarking::benchmarks! {
461461 // Compute a random solution, then work backwards to get the lists of voters, targets, and
462462 // assignments
463463 let witness = SolutionOrSnapshotSize { voters: v, targets: t } ;
464- let RawSolution { compact , .. } = solution_with_size:: <T >( witness, a, d) ?;
464+ let RawSolution { solution , .. } = solution_with_size:: <T >( witness, a, d) ?;
465465 let RoundSnapshot { voters, targets } = MultiPhase :: <T >:: snapshot( ) . unwrap( ) ;
466466 let voter_at = helpers:: voter_at_fn:: <T >( & voters) ;
467467 let target_at = helpers:: target_at_fn:: <T >( & targets) ;
468- let mut assignments = compact . into_assignment( voter_at, target_at) . unwrap( ) ;
468+ let mut assignments = solution . into_assignment( voter_at, target_at) . unwrap( ) ;
469469
470470 // make a voter cache and some helper functions for access
471471 let cache = helpers:: generate_voter_cache:: <T >( & voters) ;
@@ -488,7 +488,7 @@ frame_benchmarking::benchmarks! {
488488 . unwrap( ) ;
489489
490490 let encoded_size_of = |assignments: & [ IndexAssignmentOf <T >] | {
491- CompactOf :: <T >:: try_from( assignments) . map( |compact| compact . encoded_size( ) )
491+ SolutionOf :: <T >:: try_from( assignments) . map( |solution| solution . encoded_size( ) )
492492 } ;
493493
494494 let desired_size = Percent :: from_percent( 100 - f. saturated_into:: <u8 >( ) )
@@ -501,8 +501,8 @@ frame_benchmarking::benchmarks! {
501501 & encoded_size_of,
502502 ) . unwrap( ) ;
503503 } verify {
504- let compact = CompactOf :: <T >:: try_from( index_assignments. as_slice( ) ) . unwrap( ) ;
505- let encoding = compact . encode( ) ;
504+ let solution = SolutionOf :: <T >:: try_from( index_assignments. as_slice( ) ) . unwrap( ) ;
505+ let encoding = solution . encode( ) ;
506506 log!(
507507 trace,
508508 "encoded size prediction = {}" ,
0 commit comments