Skip to content

Commit

Permalink
0.7.0 patch 1 (#227)
Browse files Browse the repository at this point in the history
* fix: fix the issue of multiple challenge generation events reported

* refactor: oss authorize update return ok(()) when existed
  • Loading branch information
ytqaljn authored Sep 4, 2023
1 parent 6d240f3 commit 40c7e2b
Show file tree
Hide file tree
Showing 5 changed files with 11 additions and 10 deletions.
10 changes: 6 additions & 4 deletions c-pallets/audit/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -291,6 +291,8 @@ pub mod pallet {
BloomFilterError,

Submitted,

Challenging,
}

//Relevant time nodes for storage challenges
Expand Down Expand Up @@ -415,12 +417,13 @@ pub mod pallet {
let limit = count
.checked_mul(2).ok_or(Error::<T>::Overflow)?
.checked_div(3).ok_or(Error::<T>::Overflow)?;

let now = <frame_system::Pallet<T>>::block_number();

if ChallengeProposal::<T>::contains_key(&hash) {
let proposal = ChallengeProposal::<T>::get(&hash).unwrap();
if proposal.0 + 1 >= limit {
let cur_blcok = <ChallengeDuration<T>>::get();
let now = <frame_system::Pallet<T>>::block_number();

if now > cur_blcok {
let duration = now.checked_add(&proposal.1.net_snap_shot.life).ok_or(Error::<T>::Overflow)?;
<ChallengeDuration<T>>::put(duration);
Expand All @@ -435,9 +438,8 @@ pub mod pallet {
<VerifyDuration<T>>::put(v_duration);
<ChallengeSnapShot<T>>::put(proposal.1);
let _ = ChallengeProposal::<T>::clear(ChallengeProposal::<T>::count(), None);
Self::deposit_event(Event::<T>::GenerateChallenge);
}

Self::deposit_event(Event::<T>::GenerateChallenge);
}
} else {
if ChallengeProposal::<T>::count() > count {
Expand Down
5 changes: 3 additions & 2 deletions c-pallets/oss/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ pub mod pallet {
let sender = ensure_signed(origin)?;

AuthorityList::<T>::try_mutate(&sender, |authority_list| -> DispatchResult {
ensure!(!authority_list.contains(&operator), Error::<T>::Existed);
authority_list.try_push(operator.clone()).map_err(|_| Error::<T>::BoundedVecError)?;
if !authority_list.contains(&operator) {
authority_list.try_push(operator.clone()).map_err(|_| Error::<T>::BoundedVecError)?;
}

Ok(())
})?;
Expand Down
2 changes: 1 addition & 1 deletion c-pallets/staking/src/pallet/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1040,7 +1040,7 @@ pub mod pallet {

// Note: in case there is no current era it is fine to bond one era more.
let era = Self::current_era().unwrap_or(0) + T::BondingDuration::get();
if let Some(mut chunk) =
if let Some(chunk) =
ledger.unlocking.last_mut().filter(|chunk| chunk.era == era)
{
// To keep the chunk count down, we only keep one chunk per era. Since
Expand Down
2 changes: 0 additions & 2 deletions primitives/enclave-verify/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,7 @@ use rsa::{
PublicKey,
Pkcs1v15Sign,
pkcs1::DecodeRsaPublicKey,
pkcs8::DecodePrivateKey,
};
use sp_core::bounded::BoundedVec;
use ic_verify_bls_signature::{
Signature as BLSSignature,
PublicKey as BLSPubilc,
Expand Down
2 changes: 1 addition & 1 deletion runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -172,7 +172,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion {
// `spec_version`, and `authoring_version` are the same between Wasm and native.
// This value is set to 100 to notify Polkadot-JS App (https://polkadot.js.org/apps) to use
// the compatible custom types.
spec_version: 100,
spec_version: 101,
impl_version: 1,
apis: RUNTIME_API_VERSIONS,
transaction_version: 1,
Expand Down

0 comments on commit 40c7e2b

Please sign in to comment.