Skip to content

Commit 40c7e2b

Browse files
authored
0.7.0 patch 1 (#227)
* fix: fix the issue of multiple challenge generation events reported * refactor: oss authorize update return ok(()) when existed
1 parent 6d240f3 commit 40c7e2b

File tree

5 files changed

+11
-10
lines changed

5 files changed

+11
-10
lines changed

c-pallets/audit/src/lib.rs

+6-4
Original file line numberDiff line numberDiff line change
@@ -291,6 +291,8 @@ pub mod pallet {
291291
BloomFilterError,
292292

293293
Submitted,
294+
295+
Challenging,
294296
}
295297

296298
//Relevant time nodes for storage challenges
@@ -415,12 +417,13 @@ pub mod pallet {
415417
let limit = count
416418
.checked_mul(2).ok_or(Error::<T>::Overflow)?
417419
.checked_div(3).ok_or(Error::<T>::Overflow)?;
418-
420+
let now = <frame_system::Pallet<T>>::block_number();
421+
419422
if ChallengeProposal::<T>::contains_key(&hash) {
420423
let proposal = ChallengeProposal::<T>::get(&hash).unwrap();
421424
if proposal.0 + 1 >= limit {
422425
let cur_blcok = <ChallengeDuration<T>>::get();
423-
let now = <frame_system::Pallet<T>>::block_number();
426+
424427
if now > cur_blcok {
425428
let duration = now.checked_add(&proposal.1.net_snap_shot.life).ok_or(Error::<T>::Overflow)?;
426429
<ChallengeDuration<T>>::put(duration);
@@ -435,9 +438,8 @@ pub mod pallet {
435438
<VerifyDuration<T>>::put(v_duration);
436439
<ChallengeSnapShot<T>>::put(proposal.1);
437440
let _ = ChallengeProposal::<T>::clear(ChallengeProposal::<T>::count(), None);
441+
Self::deposit_event(Event::<T>::GenerateChallenge);
438442
}
439-
440-
Self::deposit_event(Event::<T>::GenerateChallenge);
441443
}
442444
} else {
443445
if ChallengeProposal::<T>::count() > count {

c-pallets/oss/src/lib.rs

+3-2
Original file line numberDiff line numberDiff line change
@@ -93,8 +93,9 @@ pub mod pallet {
9393
let sender = ensure_signed(origin)?;
9494

9595
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+
}
9899

99100
Ok(())
100101
})?;

c-pallets/staking/src/pallet/mod.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -1040,7 +1040,7 @@ pub mod pallet {
10401040

10411041
// Note: in case there is no current era it is fine to bond one era more.
10421042
let era = Self::current_era().unwrap_or(0) + T::BondingDuration::get();
1043-
if let Some(mut chunk) =
1043+
if let Some(chunk) =
10441044
ledger.unlocking.last_mut().filter(|chunk| chunk.era == era)
10451045
{
10461046
// To keep the chunk count down, we only keep one chunk per era. Since

primitives/enclave-verify/src/lib.rs

-2
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,7 @@ use rsa::{
1616
PublicKey,
1717
Pkcs1v15Sign,
1818
pkcs1::DecodeRsaPublicKey,
19-
pkcs8::DecodePrivateKey,
2019
};
21-
use sp_core::bounded::BoundedVec;
2220
use ic_verify_bls_signature::{
2321
Signature as BLSSignature,
2422
PublicKey as BLSPubilc,

runtime/src/lib.rs

+1-1
Original file line numberDiff line numberDiff line change
@@ -172,7 +172,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
172172
// `spec_version`, and `authoring_version` are the same between Wasm and native.
173173
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
174174
// the compatible custom types.
175-
spec_version: 100,
175+
spec_version: 101,
176176
impl_version: 1,
177177
apis: RUNTIME_API_VERSIONS,
178178
transaction_version: 1,

0 commit comments

Comments
 (0)