@@ -41,8 +41,7 @@ use sp_std::convert::{
4141use frame_system:: {
4242 self as system,
4343 ensure_signed,
44- ensure_root,
45- offchain
44+ ensure_root
4645} ;
4746use codec:: { Encode , Decode } ;
4847use sp_core:: {
@@ -240,16 +239,16 @@ impl HashPayload for RootHashPayload {
240239 fn hash ( & self ) -> H256 {
241240 self . using_encoded ( |dirtybits|{
242241 native:: info!( "Root Hash Dirty Payload [{:#?}]: {:x?}" , dirtybits. len( ) , dirtybits) ;
243- let mut dirtycopy = dirtybits. to_vec ( ) ;
242+ let dirtycopy = dirtybits. to_vec ( ) ;
244243 let mut x = 2 ;
245244 let mut bits : Vec < u8 > = Vec :: new ( ) ;
246245 bits. push ( * dirtycopy. get ( 0 ) . expect ( "" ) ) ;
247246 loop {
248247 let pt1 = dirtycopy. get ( x+0 ..x+32 ) . expect ( "" ) ;
249- let mut pt2: & mut [ u8 ; 8 ] = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
248+ let pt2: & mut [ u8 ; 8 ] = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
250249 pt2. copy_from_slice ( dirtycopy. get ( x+32 ..x+40 ) . expect ( "" ) ) ;
251250 pt2. reverse ( ) ;
252- let mut pt3: & mut [ u8 ; 8 ] = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
251+ let pt3: & mut [ u8 ; 8 ] = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
253252 pt3. copy_from_slice ( dirtycopy. get ( x+40 ..x+48 ) . expect ( "" ) ) ;
254253 pt3. reverse ( ) ;
255254 let mut newbits = [
@@ -273,10 +272,10 @@ impl HashPayload for ParentHashPayload {
273272 fn hash ( & self ) -> H256 {
274273 self . using_encoded ( |b|{
275274 native:: info!( "Parent Hash Payload Dirty [{:x?}]: {:x?}" , b. len( ) , b) ;
276- let mut dirtycopy = b. to_vec ( ) ;
275+ let dirtycopy = b. to_vec ( ) ;
277276 let mut cleanbits: Vec < u8 > = Vec :: new ( ) ;
278- let mut hash_type = dirtycopy. get ( 0 ..1 ) . expect ( "" ) ;
279- let mut total_length = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
277+ let hash_type = dirtycopy. get ( 0 ..1 ) . expect ( "" ) ;
278+ let total_length = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
280279 total_length. copy_from_slice ( dirtycopy. get ( 1 ..9 ) . expect ( "" ) ) ;
281280 total_length. reverse ( ) ;
282281
@@ -292,10 +291,10 @@ impl HashPayload for ChunkHashPayload {
292291 fn hash ( & self ) -> H256 {
293292 self . using_encoded ( |b|{
294293 native:: info!( "Chunk Hash Payload: {:x?}" , b) ;
295- let mut dirtycopy = b. to_vec ( ) ;
294+ let dirtycopy = b. to_vec ( ) ;
296295 let mut cleanbits: Vec < u8 > = Vec :: new ( ) ;
297- let mut hash_type = dirtycopy. get ( 0 ..1 ) . expect ( "" ) ;
298- let mut total_length = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
296+ let hash_type = dirtycopy. get ( 0 ..1 ) . expect ( "" ) ;
297+ let total_length = & mut [ 0 , 0 , 0 , 0 , 0 , 0 , 0 , 0 ] ;
299298 total_length. copy_from_slice ( dirtycopy. get ( 1 ..9 ) . expect ( "" ) ) ;
300299 total_length. reverse ( ) ;
301300
@@ -437,13 +436,13 @@ decl_module!{
437436 //gutted temporarily to demonstrate datdot flow.
438437 //we should manually verify proof from raw bits.
439438 #[ weight = ( 10000 , Operational ) ] //todo weight
440- fn submit_proof( origin, challenge_index: u64 , proof : Vec <u8 >) {
439+ fn submit_proof( origin, challenge_index: u64 , _proof : Vec <u8 >) {
441440 let account = ensure_signed( origin) ?;
442441 // TODO - verify proof!
443442
444443
445444 native:: info!( "submitProof; challengeIndex: {:#?}" , challenge_index) ;
446- let mut challenge_attestors = Self :: get_attestors_for( challenge_index) ;
445+ let challenge_attestors = Self :: get_attestors_for( challenge_index) ;
447446 native:: info!( "submitProof; challengeAttestors: {:#?}" , challenge_attestors) ;
448447 <ChallengeAttestors >:: insert( & challenge_index, & challenge_attestors) ;
449448 Self :: deposit_event( RawEvent :: AttestPhase ( challenge_index, challenge_attestors) ) ;
@@ -574,7 +573,7 @@ decl_module!{
574573 fn submit_attestation( origin, challenge_index: u64 , attestation: Attestation ) {
575574 let attestor = ensure_signed( origin) ?;
576575 let mut challenge : ChallengeAttestations = <ChallengeAttestors >:: get( challenge_index) ;
577- let mut attestor_index;
576+ let attestor_index;
578577 for ( user_index, user_account) in <Attestors <T >>:: iter( ) {
579578 if user_account == attestor {
580579 attestor_index = user_index;
@@ -608,7 +607,7 @@ decl_module!{
608607 match user_indexes. binary_search( & user_index) {
609608 Ok ( i) => {
610609 user_indexes. remove( i) ;
611- <ActiveAttestors >:: mutate( |mut att_vec|{
610+ <ActiveAttestors >:: mutate( |att_vec|{
612611 match att_vec. binary_search( & user_index) {
613612 Ok ( e) => {
614613 att_vec. remove( e) ;
@@ -658,7 +657,7 @@ decl_module!{
658657 <DatHosters <T >>:: insert( & dat_pubkey, & dat_hosters) ;
659658 <UsersStorage <T >>:: insert( & account, & current_user_dats) ;
660659 let user_index;
661- if ( current_user_dats. len( ) == 1 ) {
660+ if current_user_dats. len( ) == 1 {
662661 let user_index_option = <UsersCount >:: get( ) . pop( ) ;
663662 let current_user_index = match user_index_option {
664663 Some ( x) => {
@@ -724,7 +723,7 @@ decl_module!{
724723
725724
726725 #[ weight = ( 10000 , Operational ) ] //todo weight
727- fn submit_challenge( origin , selected_user: u64 , dat_id: u64 ) {
726+ fn submit_challenge( _origin , selected_user: u64 , dat_id: u64 ) {
728727 let challenge_index = <ChallengeIndex >:: get( ) ;
729728 let nonce = Self :: unique_nonce( ) ;
730729 let new_random = ( T :: Randomness :: random( b"dat_verify_init" ) , nonce)
@@ -796,7 +795,7 @@ decl_module!{
796795 native:: info!( "OnFinalize; Dat: {:#?}" , dat) ;
797796 let deadline = challenge. 2 ;
798797 let attesting = Self :: is_attestation_complete( challenge_index) ;
799- if ( n >= deadline) {
798+ if n >= deadline {
800799 match attesting {
801800 Some ( true ) => {
802801 <SelectedChallenges <T >>:: remove( challenge_index) ;
@@ -905,7 +904,7 @@ impl<T: Trait> Module<T> {
905904 }
906905
907906
908- fn reward_seeder ( rewarded : T :: AccountId ) {
907+ fn reward_seeder ( _rewarded : T :: AccountId ) {
909908 //todo
910909 }
911910
0 commit comments