Skip to content

Commit

Permalink
Fix compilation issues
Browse files Browse the repository at this point in the history
  • Loading branch information
MRamanenkau committed Dec 5, 2023
1 parent 6a91f74 commit 65806be
Show file tree
Hide file tree
Showing 8 changed files with 199 additions and 165 deletions.
324 changes: 162 additions & 162 deletions Cargo.lock

Large diffs are not rendered by default.

5 changes: 5 additions & 0 deletions pallets/ddc-clusters/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -191,6 +191,7 @@ pub mod pallet {
where
T::AccountId: UncheckedFrom<T::Hash> + AsRef<[u8]>,
{
#[pallet::call_index(0)]
#[pallet::weight(<T as pallet::Config>::WeightInfo::create_cluster())]
pub fn create_cluster(
origin: OriginFor<T>,
Expand All @@ -210,6 +211,7 @@ pub mod pallet {
)
}

#[pallet::call_index(1)]
#[pallet::weight(<T as pallet::Config>::WeightInfo::add_node())]
pub fn add_node(
origin: OriginFor<T>,
Expand Down Expand Up @@ -259,6 +261,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(2)]
#[pallet::weight(<T as pallet::Config>::WeightInfo::remove_node())]
pub fn remove_node(
origin: OriginFor<T>,
Expand All @@ -280,6 +283,7 @@ pub mod pallet {
}

// Sets Governance non-sensetive parameters only
#[pallet::call_index(3)]
#[pallet::weight(<T as pallet::Config>::WeightInfo::set_cluster_params())]
pub fn set_cluster_params(
origin: OriginFor<T>,
Expand All @@ -298,6 +302,7 @@ pub mod pallet {
}

// Requires Governance approval
#[pallet::call_index(4)]
#[pallet::weight(<T as pallet::Config>::WeightInfo::set_cluster_gov_params())]
pub fn set_cluster_gov_params(
origin: OriginFor<T>,
Expand Down
4 changes: 3 additions & 1 deletion pallets/ddc-clusters/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use ddc_primitives::{ClusterId, NodePubKey};
use ddc_traits::staking::{StakerCreator, StakingVisitor, StakingVisitorError};
use frame_support::{
construct_runtime, parameter_types,
traits::{ConstU32, ConstU64, Everything, Nothing},
traits::{ConstBool, ConstU32, ConstU64, Everything, Nothing},
weights::constants::RocksDbWeight,
};
use frame_system::mocking::{MockBlock, MockUncheckedExtrinsic};
Expand Down Expand Up @@ -93,6 +93,8 @@ impl contracts::Config for Test {
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
type MaxCodeLen = ConstU32<{ 128 * 1024 }>;
type MaxStorageKeyLen = ConstU32<128>;
type UnsafeUnstableInterface = ConstBool<false>;
type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
}

use frame_system::offchain::{
Expand Down
5 changes: 5 additions & 0 deletions pallets/ddc-customers/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -289,6 +289,7 @@ pub mod pallet {
/// Create new bucket with specified cluster id
///
/// Anyone can create a bucket
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::create_bucket())]
pub fn create_bucket(origin: OriginFor<T>, cluster_id: ClusterId) -> DispatchResult {
let bucket_owner = ensure_signed(origin)?;
Expand Down Expand Up @@ -316,6 +317,7 @@ pub mod pallet {
/// The dispatch origin for this call must be _Signed_ by the owner account.
///
/// Emits `Deposited`.
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::deposit())]
pub fn deposit(
origin: OriginFor<T>,
Expand Down Expand Up @@ -353,6 +355,7 @@ pub mod pallet {
/// The dispatch origin for this call must be _Signed_ by the owner.
///
/// Emits `Deposited`.
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::deposit_extra())]
pub fn deposit_extra(
origin: OriginFor<T>,
Expand Down Expand Up @@ -398,6 +401,7 @@ pub mod pallet {
/// Emits `InitialDepositUnlock`.
///
/// See also [`Call::withdraw_unlocked_deposit`].
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::unlock_deposit())]
pub fn unlock_deposit(
origin: OriginFor<T>,
Expand Down Expand Up @@ -459,6 +463,7 @@ pub mod pallet {
/// Emits `Withdrawn`.
///
/// See also [`Call::unlock_deposit`].
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::withdraw_unlocked_deposit_kill())]
pub fn withdraw_unlocked_deposit(origin: OriginFor<T>) -> DispatchResultWithPostInfo {
let owner = ensure_signed(origin)?;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ use std::cell::RefCell;

use frame_support::{
parameter_types,
traits::{ConstU32, Currency, Everything, Get, Nothing},
traits::{ConstBool, ConstU32, Currency, Everything, Get, Nothing},
weights::Weight,
};
use sp_core::H256;
Expand Down Expand Up @@ -155,6 +155,8 @@ impl contracts::Config for Test {
type AddressGenerator = pallet_contracts::DefaultAddressGenerator;
type MaxCodeLen = ConstU32<{ 128 * 1024 }>;
type MaxStorageKeyLen = ConstU32<128>;
type UnsafeUnstableInterface = ConstBool<false>;
type MaxDebugBufferLen = ConstU32<{ 2 * 1024 * 1024 }>;
}

parameter_types! {
Expand Down
4 changes: 3 additions & 1 deletion pallets/ddc-nodes/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,8 +94,8 @@ pub mod pallet {

#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::weight(T::WeightInfo::create_node())]
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::create_node())]
pub fn create_node(
origin: OriginFor<T>,
node_pub_key: NodePubKey,
Expand All @@ -109,6 +109,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::delete_node())]
pub fn delete_node(origin: OriginFor<T>, node_pub_key: NodePubKey) -> DispatchResult {
let caller_id = ensure_signed(origin)?;
Expand All @@ -122,6 +123,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::set_node_params())]
pub fn set_node_params(
origin: OriginFor<T>,
Expand Down
9 changes: 9 additions & 0 deletions pallets/ddc-payouts/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -265,6 +265,7 @@ pub mod pallet {

#[pallet::call]
impl<T: Config> Pallet<T> {
#[pallet::call_index(0)]
#[pallet::weight(10_000)]
pub fn set_authorised_caller(
origin: OriginFor<T>,
Expand All @@ -279,6 +280,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(1)]
#[pallet::weight(10_000)]
pub fn begin_billing_report(
origin: OriginFor<T>,
Expand Down Expand Up @@ -307,6 +309,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(2)]
#[pallet::weight(10_000)]
pub fn begin_charging_customers(
origin: OriginFor<T>,
Expand All @@ -333,6 +336,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(3)]
#[pallet::weight(10_000)]
pub fn send_charging_customers_batch(
origin: OriginFor<T>,
Expand Down Expand Up @@ -453,6 +457,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(4)]
#[pallet::weight(10_000)]
pub fn end_charging_customers(
origin: OriginFor<T>,
Expand Down Expand Up @@ -542,6 +547,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(5)]
#[pallet::weight(10_000)]
pub fn begin_rewarding_providers(
origin: OriginFor<T>,
Expand Down Expand Up @@ -573,6 +579,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(6)]
#[pallet::weight(10_000)]
pub fn send_rewarding_providers_batch(
origin: OriginFor<T>,
Expand Down Expand Up @@ -650,6 +657,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(7)]
#[pallet::weight(10_000)]
pub fn end_rewarding_providers(
origin: OriginFor<T>,
Expand Down Expand Up @@ -680,6 +688,7 @@ pub mod pallet {
Ok(())
}

#[pallet::call_index(8)]
#[pallet::weight(10_000)]
pub fn end_billing_report(
origin: OriginFor<T>,
Expand Down
9 changes: 9 additions & 0 deletions pallets/ddc-staking/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -365,6 +365,7 @@ pub mod pallet {
/// The dispatch origin for this call must be _Signed_ by the stash account.
///
/// Emits `Bonded`.
#[pallet::call_index(0)]
#[pallet::weight(T::WeightInfo::bond())]
pub fn bond(
origin: OriginFor<T>,
Expand Down Expand Up @@ -439,6 +440,7 @@ pub mod pallet {
/// Emits `Unbonded`.
///
/// See also [`Call::withdraw_unbonded`].
#[pallet::call_index(1)]
#[pallet::weight(T::WeightInfo::unbond())]
pub fn unbond(
origin: OriginFor<T>,
Expand Down Expand Up @@ -559,6 +561,7 @@ pub mod pallet {
/// Emits `Withdrawn`.
///
/// See also [`Call::unbond`].
#[pallet::call_index(2)]
#[pallet::weight(T::WeightInfo::withdraw_unbonded())]
pub fn withdraw_unbonded(origin: OriginFor<T>) -> DispatchResult {
let controller = ensure_signed(origin)?;
Expand Down Expand Up @@ -614,6 +617,7 @@ pub mod pallet {
///
/// The dispatch origin for this call must be _Signed_ by the controller, not the stash. The
/// bond size must be greater than or equal to the `CDNBondSize`.
#[pallet::call_index(3)]
#[pallet::weight(T::WeightInfo::serve())]
pub fn serve(origin: OriginFor<T>, cluster_id: ClusterId) -> DispatchResult {
let controller = ensure_signed(origin)?;
Expand Down Expand Up @@ -667,6 +671,7 @@ pub mod pallet {
///
/// The dispatch origin for this call must be _Signed_ by the controller, not the stash. The
/// bond size must be greater than or equal to the `StorageBondSize`.
#[pallet::call_index(4)]
#[pallet::weight(T::WeightInfo::store())]
pub fn store(origin: OriginFor<T>, cluster_id: ClusterId) -> DispatchResult {
let controller = ensure_signed(origin)?;
Expand Down Expand Up @@ -728,6 +733,7 @@ pub mod pallet {
/// The dispatch origin for this call must be _Signed_ by the controller, not the stash.
///
/// Emits `ChillSoon`, `Chill`.
#[pallet::call_index(5)]
#[pallet::weight(T::WeightInfo::chill())]
pub fn chill(origin: OriginFor<T>) -> DispatchResult {
let controller = ensure_signed(origin)?;
Expand Down Expand Up @@ -782,6 +788,7 @@ pub mod pallet {
/// Effects will be felt at the beginning of the next block.
///
/// The dispatch origin for this call must be _Signed_ by the stash, not the controller.
#[pallet::call_index(6)]
#[pallet::weight(T::WeightInfo::set_controller())]
pub fn set_controller(
origin: OriginFor<T>,
Expand All @@ -805,6 +812,7 @@ pub mod pallet {
/// (Re-)set the DDC node of a node operator stash account. Requires to chill first.
///
/// The dispatch origin for this call must be _Signed_ by the stash, not the controller.
#[pallet::call_index(7)]
#[pallet::weight(T::WeightInfo::set_node())]
pub fn set_node(origin: OriginFor<T>, new_node: NodePubKey) -> DispatchResult {
let stash = ensure_signed(origin)?;
Expand Down Expand Up @@ -838,6 +846,7 @@ pub mod pallet {
/// Allow cluster node candidate to chill in the next block.
///
/// The dispatch origin for this call must be _Signed_ by the controller.
#[pallet::call_index(8)]
#[pallet::weight(10_000)]
pub fn fast_chill(origin: OriginFor<T>) -> DispatchResult {
let controller = ensure_signed(origin)?;
Expand Down

0 comments on commit 65806be

Please sign in to comment.