@@ -405,18 +405,14 @@ decl_storage! {
405
405
/// Mapping between a topic (represented by T::Hash) and a vector of indexes
406
406
/// of events in the `<Events<T>>` list.
407
407
///
408
- /// The first key serves no purpose. This field is declared as double_map just
409
- /// for convenience of using `remove_prefix`.
410
- ///
411
408
/// All topic vectors have deterministic storage locations depending on the topic. This
412
409
/// allows light-clients to leverage the changes trie storage tracking mechanism and
413
410
/// in case of changes fetch the list of events of interest.
414
411
///
415
412
/// The value has the type `(T::BlockNumber, EventIndex)` because if we used only just
416
413
/// the `EventIndex` then in case if the topic has the same contents on the next block
417
414
/// no notification will be triggered thus the event might be lost.
418
- EventTopics get( fn event_topics) : double_map hasher( blake2_256) ( ) , blake2_256( T :: Hash )
419
- => Vec <( T :: BlockNumber , EventIndex ) >;
415
+ EventTopics get( fn event_topics) : map T :: Hash => Vec <( T :: BlockNumber , EventIndex ) >;
420
416
}
421
417
add_extra_genesis {
422
418
config( changes_trie_config) : Option <ChangesTrieConfiguration >;
@@ -583,7 +579,7 @@ impl<T: Trait> Module<T> {
583
579
let block_no = Self :: block_number ( ) ;
584
580
for topic in topics {
585
581
// The same applies here.
586
- if <EventTopics < T > >:: append ( & ( ) , topic, & [ ( block_no, event_idx) ] ) . is_err ( ) {
582
+ if <EventTopics < T > >:: append ( topic, & [ ( block_no, event_idx) ] ) . is_err ( ) {
587
583
return ;
588
584
}
589
585
}
@@ -647,7 +643,7 @@ impl<T: Trait> Module<T> {
647
643
<ExtrinsicsRoot < T > >:: put ( txs_root) ;
648
644
<Events < T > >:: kill ( ) ;
649
645
EventCount :: kill ( ) ;
650
- <EventTopics < T > >:: remove_prefix ( & ( ) ) ;
646
+ <EventTopics < T > >:: remove_all ( ) ;
651
647
}
652
648
653
649
/// Remove temporary "environment" entries in storage.
@@ -1302,15 +1298,15 @@ mod tests {
1302
1298
// Check that the topic-events mapping reflects the deposited topics.
1303
1299
// Note that these are indexes of the events.
1304
1300
assert_eq ! (
1305
- System :: event_topics( & ( ) , & topics[ 0 ] ) ,
1301
+ System :: event_topics( & topics[ 0 ] ) ,
1306
1302
vec![ ( BLOCK_NUMBER , 0 ) , ( BLOCK_NUMBER , 1 ) ] ,
1307
1303
) ;
1308
1304
assert_eq ! (
1309
- System :: event_topics( & ( ) , & topics[ 1 ] ) ,
1305
+ System :: event_topics( & topics[ 1 ] ) ,
1310
1306
vec![ ( BLOCK_NUMBER , 0 ) , ( BLOCK_NUMBER , 2 ) ] ,
1311
1307
) ;
1312
1308
assert_eq ! (
1313
- System :: event_topics( & ( ) , & topics[ 2 ] ) ,
1309
+ System :: event_topics( & topics[ 2 ] ) ,
1314
1310
vec![ ( BLOCK_NUMBER , 0 ) ] ,
1315
1311
) ;
1316
1312
} ) ;
0 commit comments