diff --git a/Cargo.lock b/Cargo.lock index 4c534e8e..d07e38b7 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -2047,7 +2047,7 @@ dependencies = [ [[package]] name = "cess-node-runtime" -version = "0.10.0" +version = "0.10.1" dependencies = [ "ces-pallet-mq", "ces-pallet-mq-runtime-api", diff --git a/pallets/storage-handler/src/lib.rs b/pallets/storage-handler/src/lib.rs index c8e40f88..1391bd51 100644 --- a/pallets/storage-handler/src/lib.rs +++ b/pallets/storage-handler/src/lib.rs @@ -521,6 +521,7 @@ pub mod pallet { .ok_or(Error::::Overflow)? .checked_mul(&gib_count.saturated_into()) .ok_or(Error::::Overflow)?; + ensure!( ::Currency::can_slash(&sender, price.clone()), Error::::InsufficientBalance @@ -979,6 +980,18 @@ pub mod pallet { Ok(()) } + + #[pallet::call_index(10)] + #[pallet::weight(Weight::zero())] + pub fn fix_territory_space_for_reactivate(origin: OriginFor, acc: AccountOf, tname: TerrName) -> DispatchResult { + let _ = ensure_root(origin)?; + + let mut territory = >::try_get(&acc, &tname).map_err(|_| Error::::NotHaveTerritory)?; + territory.remaining_space = territory.total_space; + >::insert(&acc, &tname, territory); + + Ok(()) + } } } @@ -1122,7 +1135,7 @@ impl Pallet { let now = >::block_number(); t.state = TerritoryState::Active; - t.remaining_space = 0; + t.remaining_space = t.total_space; t.locked_space = 0; t.used_space = 0; t.start = now; diff --git a/standalone/chain/runtime/Cargo.toml b/standalone/chain/runtime/Cargo.toml index 7dcb9475..62e79bc4 100644 --- a/standalone/chain/runtime/Cargo.toml +++ b/standalone/chain/runtime/Cargo.toml @@ -4,7 +4,7 @@ edition = "2021" license = "Unlicense" name = "cess-node-runtime" repository = "https://github.com/CESSProject/cess" -version = "0.10.0" +version = "0.10.1" [package.metadata.docs.rs] targets = ["x86_64-unknown-linux-gnu"] diff --git a/standalone/chain/runtime/src/lib.rs b/standalone/chain/runtime/src/lib.rs index 81e555ee..549a04b6 100644 --- a/standalone/chain/runtime/src/lib.rs +++ b/standalone/chain/runtime/src/lib.rs @@ -155,7 +155,7 @@ pub const VERSION: RuntimeVersion = RuntimeVersion { // and set impl_version to 0. If only runtime // implementation changes and behavior does not, then leave spec_version as // is and increment impl_version. - spec_version: 129, + spec_version: 130, impl_version: 0, apis: RUNTIME_API_VERSIONS, transaction_version: 1,