Commit 40c7e2b 1 parent 6d240f3 commit 40c7e2b Copy full SHA for 40c7e2b
File tree 5 files changed +11
-10
lines changed
primitives/enclave-verify/src
5 files changed +11
-10
lines changed Original file line number Diff line number Diff line change @@ -291,6 +291,8 @@ pub mod pallet {
291
291
BloomFilterError ,
292
292
293
293
Submitted ,
294
+
295
+ Challenging ,
294
296
}
295
297
296
298
//Relevant time nodes for storage challenges
@@ -415,12 +417,13 @@ pub mod pallet {
415
417
let limit = count
416
418
. checked_mul ( 2 ) . ok_or ( Error :: < T > :: Overflow ) ?
417
419
. checked_div ( 3 ) . ok_or ( Error :: < T > :: Overflow ) ?;
418
-
420
+ let now = <frame_system:: Pallet < T > >:: block_number ( ) ;
421
+
419
422
if ChallengeProposal :: < T > :: contains_key ( & hash) {
420
423
let proposal = ChallengeProposal :: < T > :: get ( & hash) . unwrap ( ) ;
421
424
if proposal. 0 + 1 >= limit {
422
425
let cur_blcok = <ChallengeDuration < T > >:: get ( ) ;
423
- let now = <frame_system :: Pallet < T > > :: block_number ( ) ;
426
+
424
427
if now > cur_blcok {
425
428
let duration = now. checked_add ( & proposal. 1 . net_snap_shot . life ) . ok_or ( Error :: < T > :: Overflow ) ?;
426
429
<ChallengeDuration < T > >:: put ( duration) ;
@@ -435,9 +438,8 @@ pub mod pallet {
435
438
<VerifyDuration < T > >:: put ( v_duration) ;
436
439
<ChallengeSnapShot < T > >:: put ( proposal. 1 ) ;
437
440
let _ = ChallengeProposal :: < T > :: clear ( ChallengeProposal :: < T > :: count ( ) , None ) ;
441
+ Self :: deposit_event ( Event :: < T > :: GenerateChallenge ) ;
438
442
}
439
-
440
- Self :: deposit_event ( Event :: < T > :: GenerateChallenge ) ;
441
443
}
442
444
} else {
443
445
if ChallengeProposal :: < T > :: count ( ) > count {
Original file line number Diff line number Diff line change @@ -93,8 +93,9 @@ pub mod pallet {
93
93
let sender = ensure_signed ( origin) ?;
94
94
95
95
AuthorityList :: < T > :: try_mutate ( & sender, |authority_list| -> DispatchResult {
96
- ensure ! ( !authority_list. contains( & operator) , Error :: <T >:: Existed ) ;
97
- authority_list. try_push ( operator. clone ( ) ) . map_err ( |_| Error :: < T > :: BoundedVecError ) ?;
96
+ if !authority_list. contains ( & operator) {
97
+ authority_list. try_push ( operator. clone ( ) ) . map_err ( |_| Error :: < T > :: BoundedVecError ) ?;
98
+ }
98
99
99
100
Ok ( ( ) )
100
101
} ) ?;
Original file line number Diff line number Diff line change @@ -1040,7 +1040,7 @@ pub mod pallet {
1040
1040
1041
1041
// Note: in case there is no current era it is fine to bond one era more.
1042
1042
let era = Self :: current_era ( ) . unwrap_or ( 0 ) + T :: BondingDuration :: get ( ) ;
1043
- if let Some ( mut chunk) =
1043
+ if let Some ( chunk) =
1044
1044
ledger. unlocking . last_mut ( ) . filter ( |chunk| chunk. era == era)
1045
1045
{
1046
1046
// To keep the chunk count down, we only keep one chunk per era. Since
Original file line number Diff line number Diff line change @@ -16,9 +16,7 @@ use rsa::{
16
16
PublicKey ,
17
17
Pkcs1v15Sign ,
18
18
pkcs1:: DecodeRsaPublicKey ,
19
- pkcs8:: DecodePrivateKey ,
20
19
} ;
21
- use sp_core:: bounded:: BoundedVec ;
22
20
use ic_verify_bls_signature:: {
23
21
Signature as BLSSignature ,
24
22
PublicKey as BLSPubilc ,
Original file line number Diff line number Diff line change @@ -172,7 +172,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
172
172
// `spec_version`, and `authoring_version` are the same between Wasm and native.
173
173
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
174
174
// the compatible custom types.
175
- spec_version : 100 ,
175
+ spec_version : 101 ,
176
176
impl_version : 1 ,
177
177
apis : RUNTIME_API_VERSIONS ,
178
178
transaction_version : 1 ,
You can’t perform that action at this time.
0 commit comments