@@ -112,18 +112,17 @@ decl_module! {
112112
113113 #[ weight = 10_000 ]
114114 pub fn grant_reputation( origin, cid: CommunityIdentifier , reputable: T :: AccountId ) -> DispatchResult {
115- debug :: RuntimeLogger :: init( ) ;
115+ log :: RuntimeLogger :: init( ) ;
116116 let sender = ensure_signed( origin) ?;
117117 ensure!( sender == <encointer_scheduler:: Module <T >>:: ceremony_master( ) , "only the CeremonyMaster can call this function" ) ;
118118 let cindex = <encointer_scheduler:: Module <T >>:: current_ceremony_index( ) ;
119119 <ParticipantReputation <T >>:: insert( & ( cid, cindex-1 ) , reputable, Reputation :: VerifiedUnlinked ) ;
120- debug :: info!( target: LOG , "granting reputation to {:?}" , sender) ;
120+ log :: info!( target: LOG , "granting reputation to {:?}" , sender) ;
121121 Ok ( ( ) )
122122 }
123123
124124 #[ weight = 10_000 ]
125125 pub fn register_participant( origin, cid: CommunityIdentifier , proof: Option <ProofOfAttendance <T :: Signature , T :: AccountId >>) -> DispatchResult {
126- debug:: RuntimeLogger :: init( ) ;
127126 let sender = ensure_signed( origin) ?;
128127 ensure!( <encointer_scheduler:: Module <T >>:: current_phase( ) == CeremonyPhaseType :: REGISTERING ,
129128 "registering participants can only be done during REGISTERING phase" ) ;
@@ -164,13 +163,12 @@ decl_module! {
164163 <ParticipantIndex <T >>:: insert( ( cid, cindex) , & sender, & new_count) ;
165164 <ParticipantCount >:: insert( ( cid, cindex) , new_count) ;
166165
167- debug :: debug!( target: LOG , "registered participant: {:?}" , sender) ;
166+ log :: debug!( target: LOG , "registered participant: {:?}" , sender) ;
168167 Ok ( ( ) )
169168 }
170169
171170 #[ weight = 10_000 ]
172171 pub fn register_attestations( origin, attestations: Vec <Attestation <T :: Signature , T :: AccountId , T :: Moment >>) -> DispatchResult {
173- debug:: RuntimeLogger :: init( ) ;
174172 let sender = ensure_signed( origin) ?;
175173 ensure!( <encointer_scheduler:: Module <T >>:: current_phase( ) == CeremonyPhaseType :: ATTESTING ,
176174 "registering attestations can only be done during ATTESTING phase" ) ;
@@ -193,57 +191,57 @@ decl_module! {
193191 { l } else { return Err ( <Error <T >>:: MeetupLocationNotFound . into( ) ) } ;
194192 let mtime = if let Some ( t) = Self :: get_meetup_time( & cid, meetup_index)
195193 { t } else { return Err ( <Error <T >>:: MeetupTimeCalculationError . into( ) ) } ;
196- debug :: debug!( target: LOG , "meetup {} at location {:?} should happen at {:?} for cid {:?}" ,
194+ log :: debug!( target: LOG , "meetup {} at location {:?} should happen at {:?} for cid {:?}" ,
197195 meetup_index, mlocation, mtime, cid) ;
198196 for attestation in attestations. iter( ) {
199197 let attestation_account = & attestation. public;
200198 if !meetup_participants. contains( attestation_account) {
201- debug :: warn!( target: LOG ,
199+ log :: warn!( target: LOG ,
202200 "ignoring attestation that isn't a meetup participant: {:?}" ,
203201 attestation_account) ;
204202 continue } ;
205203 if attestation. claim. ceremony_index != cindex {
206- debug :: warn!( target: LOG ,
204+ log :: warn!( target: LOG ,
207205 "ignoring claim with wrong ceremony index: {}" ,
208206 attestation. claim. ceremony_index) ;
209207 continue } ;
210208 if attestation. claim. community_identifier != cid {
211- debug :: warn!( target: LOG ,
209+ log :: warn!( target: LOG ,
212210 "ignoring claim with wrong community identifier: {:?}" ,
213211 attestation. claim. community_identifier) ;
214212 continue } ;
215213 if attestation. claim. meetup_index != meetup_index {
216- debug :: warn!( target: LOG ,
214+ log :: warn!( target: LOG ,
217215 "ignoring claim with wrong meetup index: {}" ,
218216 attestation. claim. meetup_index) ;
219217 continue } ;
220218 if !<encointer_communities:: Module <T >>:: is_valid_geolocation(
221219 & attestation. claim. location) {
222- debug :: warn!( target: LOG ,
220+ log :: warn!( target: LOG ,
223221 "ignoring claim with illegal geolocation: {:?}" ,
224222 attestation. claim. location) ;
225223 continue } ;
226224 if <encointer_communities:: Module <T >>:: haversine_distance(
227225 & mlocation, & attestation. claim. location) > Self :: location_tolerance( ) {
228- debug :: warn!( target: LOG ,
226+ log :: warn!( target: LOG ,
229227 "ignoring claim beyond location tolerance: {:?}" ,
230228 attestation. claim. location) ;
231229 continue } ;
232230 if let Some ( dt) = mtime. checked_sub( & attestation. claim. timestamp) {
233231 if dt > Self :: time_tolerance( ) {
234- debug :: warn!( target: LOG ,
232+ log :: warn!( target: LOG ,
235233 "ignoring claim beyond time tolerance (too early): {:?}" ,
236234 attestation. claim. timestamp) ;
237235 continue } ;
238236 } else if let Some ( dt) = attestation. claim. timestamp. checked_sub( & mtime) {
239237 if dt > Self :: time_tolerance( ) {
240- debug :: warn!( target: LOG ,
238+ log :: warn!( target: LOG ,
241239 "ignoring claim beyond time tolerance (too late): {:?}" ,
242240 attestation. claim. timestamp) ;
243241 continue } ;
244242 }
245243 if Self :: verify_attestation_signature( attestation. clone( ) ) . is_err( ) {
246- debug :: warn!( target: LOG , "ignoring attestation with bad signature for {:?}" , sender) ;
244+ log :: warn!( target: LOG , "ignoring attestation with bad signature for {:?}" , sender) ;
247245 continue } ;
248246 // attestation is legit. insert it!
249247 verified_attestation_accounts. insert( 0 , attestation_account. clone( ) ) ;
@@ -267,15 +265,14 @@ decl_module! {
267265 <AttestationRegistry <T >>:: insert( ( cid, cindex) , & idx, & verified_attestation_accounts) ;
268266 <AttestationIndex <T >>:: insert( ( cid, cindex) , & sender, & idx) ;
269267 <MeetupParticipantCountVote <T >>:: insert( ( cid, cindex) , & sender, & claim_n_participants) ;
270- debug :: debug!( target: LOG ,
268+ log :: debug!( target: LOG ,
271269 "sucessfully registered {} attestations for {:?}" ,
272270 verified_attestation_accounts. len( ) , sender) ;
273271 Ok ( ( ) )
274272 }
275273
276274 #[ weight = 10_000 ]
277275 pub fn endorse_newcomer( origin, cid: CommunityIdentifier , newbie: T :: AccountId ) -> DispatchResult {
278- debug:: RuntimeLogger :: init( ) ;
279276 let sender = ensure_signed( origin) ?;
280277
281278 ensure!( <encointer_communities:: Module <T >>:: community_identifiers( ) . contains( & cid) ,
@@ -295,7 +292,7 @@ decl_module! {
295292 "newbie is already endorsed" ) ;
296293
297294 <BurnedBootstrapperNewbieTickets <T >>:: mutate( & cid, sender, |b| * b += 1 ) ;
298- debug :: debug!( target: LOG , "endorsed newbie: {:?}" , newbie) ;
295+ log :: debug!( target: LOG , "endorsed newbie: {:?}" , newbie) ;
299296 <Endorsees <T >>:: insert( ( cid, cindex) , newbie, ( ) ) ;
300297 <EndorseesCount >:: mutate( ( cid, cindex) , |c| * c += 1 ) ;
301298 Ok ( ( ) )
@@ -340,7 +337,7 @@ impl<T: Config> Module<T> {
340337 <AttestationCount >:: insert ( ( cid, cindex) , 0 ) ;
341338 <MeetupParticipantCountVote < T > >:: remove_prefix ( ( cid, cindex) ) ;
342339 }
343- debug :: debug!( target: LOG , "purged registry for ceremony {}" , cindex) ;
340+ log :: debug!( target: LOG , "purged registry for ceremony {}" , cindex) ;
344341 }
345342
346343 /* this is for a more recent revision of substrate....
@@ -401,7 +398,7 @@ impl<T: Config> Module<T> {
401398 n += endorsees. len ( ) ;
402399
403400 if n < 3 {
404- debug :: debug!( target: LOG , "no meetups assigned for cid {:?}" , cid) ;
401+ log :: debug!( target: LOG , "no meetups assigned for cid {:?}" , cid) ;
405402 continue ;
406403 }
407404
@@ -410,7 +407,7 @@ impl<T: Config> Module<T> {
410407
411408 // capping the amount a participants prevents assigning more meetups than there are locations.
412409 if n > n_locations * 12 {
413- debug :: warn!( target: LOG , "Meetup Locations exhausted for cid: {:?}" , cid) ;
410+ log :: warn!( target: LOG , "Meetup Locations exhausted for cid: {:?}" , cid) ;
414411 n = n_locations * 12 ;
415412 }
416413
@@ -446,14 +443,14 @@ impl<T: Config> Module<T> {
446443 <MeetupRegistry < T > >:: insert ( ( cid, cindex) , & _idx, m. clone ( ) ) ;
447444 }
448445 } ;
449- debug :: debug!(
446+ log :: debug!(
450447 target: LOG ,
451448 "assigned {} meetups for cid {:?}" ,
452449 meetups. len( ) ,
453450 cid
454451 ) ;
455452 }
456- debug :: debug!( target: LOG , "meetup assignments done" ) ;
453+ log :: debug!( target: LOG , "meetup assignments done" ) ;
457454 }
458455
459456 fn verify_attestation_signature (
@@ -504,7 +501,7 @@ impl<T: Config> Module<T> {
504501 match Self :: ballot_meetup_n_votes ( cid, cindex, m) {
505502 Some ( nn) => nn,
506503 _ => {
507- debug :: warn!(
504+ log :: warn!(
508505 target: LOG ,
509506 "ignoring meetup {} because votes are not dependable" ,
510507 m
@@ -515,7 +512,7 @@ impl<T: Config> Module<T> {
515512 let meetup_participants = Self :: meetup_registry ( ( cid, cindex) , & m) ;
516513 for p in meetup_participants {
517514 if Self :: meetup_participant_count_vote ( ( cid, cindex) , & p) != n_confirmed {
518- debug :: debug!(
515+ log :: debug!(
519516 target: LOG ,
520517 "skipped participant because of wrong participant count vote: {:?}" ,
521518 p
@@ -529,7 +526,7 @@ impl<T: Config> Module<T> {
529526 if attestations. len ( ) < ( n_honest_participants - 1 ) as usize
530527 || attestations. is_empty ( )
531528 {
532- debug :: debug!(
529+ log :: debug!(
533530 target: LOG ,
534531 "skipped participant because of too few attestations ({}): {:?}" ,
535532 attestations. len( ) ,
@@ -548,14 +545,14 @@ impl<T: Config> Module<T> {
548545 }
549546 }
550547 if has_attested < ( n_honest_participants - 1 ) {
551- debug :: debug!(
548+ log :: debug!(
552549 target: LOG ,
553550 "skipped participant because didn't testify for honest peers: {:?}" ,
554551 p
555552 ) ;
556553 continue ;
557554 }
558- debug :: trace!( target: LOG , "participant merits reward: {:?}" , p) ;
555+ log :: trace!( target: LOG , "participant merits reward: {:?}" , p) ;
559556 if <encointer_balances:: Module < T > >:: issue ( * cid, & p, reward) . is_ok ( ) {
560557 <ParticipantReputation < T > >:: insert (
561558 ( cid, cindex) ,
@@ -566,7 +563,7 @@ impl<T: Config> Module<T> {
566563 }
567564 }
568565 }
569- debug :: info!( target: LOG , "issuing rewards completed" ) ;
566+ log :: info!( target: LOG , "issuing rewards completed" ) ;
570567 }
571568
572569 fn ballot_meetup_n_votes (
0 commit comments