Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
wip: migrate pallets and runtimes
  • Loading branch information
wischli committed Sep 6, 2022
commit 71607799d31f26367010025b1ae053167b2e1cda
6 changes: 3 additions & 3 deletions pallets/attestation/src/access_control.rs
Original file line number Diff line number Diff line change
Expand Up @@ -94,12 +94,12 @@ where
Default::default()
}
fn can_attest_weight(&self) -> Weight {
0
Weight::zero()
}
fn can_revoke_weight(&self) -> Weight {
0
Weight::zero()
}
fn can_remove_weight(&self) -> Weight {
0
Weight::zero()
}
}
64 changes: 32 additions & 32 deletions pallets/attestation/src/default_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,59 +56,59 @@ pub trait WeightInfo {
pub struct SubstrateWeight<T>(PhantomData<T>);
impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
fn add() -> Weight {
(74_496_000_u64)
.saturating_add(T::DbWeight::get().reads(6_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
Weight::from_ref_time(74_496_000 as u64)
.saturating_add(T::DbWeight::get().reads(6 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
fn revoke() -> Weight {
(37_029_000_u64)
Weight::from_ref_time(37_029_000 as u64)
// Standard Error: 44_000
.saturating_add(6_325_000_u64)
.saturating_add(T::DbWeight::get().reads(2_u64))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(1_u64))
.saturating_add(Weight::from_ref_time(6_325_000 as u64))
.saturating_add(T::DbWeight::get().reads(2 as u64))
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(1 as u64))
}
fn remove() -> Weight {
(64_058_000_u64)
Weight::from_ref_time(64_058_000 as u64)
// Standard Error: 44_000
.saturating_add(6_317_000_u64)
.saturating_add(T::DbWeight::get().reads(4_u64))
.saturating_add(T::DbWeight::get().reads(1_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
.saturating_add(Weight::from_ref_time(6_317_000 as u64))
.saturating_add(T::DbWeight::get().reads(4 as u64))
.saturating_add(T::DbWeight::get().reads(1 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
fn reclaim_deposit() -> Weight {
(56_873_000_u64)
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
Weight::from_ref_time(56_873_000 as u64)
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn add() -> Weight {
(74_496_000_u64)
.saturating_add(RocksDbWeight::get().reads(6_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
Weight::from_ref_time(74_496_000 as u64)
.saturating_add(RocksDbWeight::get().reads(6 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
fn revoke() -> Weight {
(37_029_000_u64)
Weight::from_ref_time(37_029_000 as u64)
// Standard Error: 44_000
.saturating_add(6_325_000_u64)
.saturating_add(RocksDbWeight::get().reads(2_u64))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(1_u64))
.saturating_add(Weight::from_ref_time(6_325_000 as u64))
.saturating_add(RocksDbWeight::get().reads(2 as u64))
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(1 as u64))
}
fn remove() -> Weight {
(64_058_000_u64)
Weight::from_ref_time(64_058_000 as u64)
// Standard Error: 44_000
.saturating_add(6_317_000_u64)
.saturating_add(RocksDbWeight::get().reads(4_u64))
.saturating_add(RocksDbWeight::get().reads(1_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
.saturating_add(Weight::from_ref_time(6_317_000 as u64))
.saturating_add(RocksDbWeight::get().reads(4 as u64))
.saturating_add(RocksDbWeight::get().reads(1 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
fn reclaim_deposit() -> Weight {
(56_873_000_u64)
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
Weight::from_ref_time(56_873_000 as u64)
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
}
6 changes: 3 additions & 3 deletions pallets/attestation/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ pub mod pallet {
/// # </weight>
#[pallet::weight(
<T as pallet::Config>::WeightInfo::add()
.saturating_add(authorization.as_ref().map(|ac| ac.can_attest_weight()).unwrap_or(0))
.saturating_add(authorization.as_ref().map(|ac| ac.can_attest_weight()).unwrap_or(Weight::zero()))
)]
pub fn add(
origin: OriginFor<T>,
Expand Down Expand Up @@ -315,7 +315,7 @@ pub mod pallet {
/// # </weight>
#[pallet::weight(
<T as pallet::Config>::WeightInfo::revoke()
.saturating_add(authorization.as_ref().map(|ac| ac.can_revoke_weight()).unwrap_or(0))
.saturating_add(authorization.as_ref().map(|ac| ac.can_revoke_weight()).unwrap_or(Weight::zero()))
)]
pub fn revoke(
origin: OriginFor<T>,
Expand Down Expand Up @@ -374,7 +374,7 @@ pub mod pallet {
/// # </weight>
#[pallet::weight(
<T as pallet::Config>::WeightInfo::remove()
.saturating_add(authorization.as_ref().map(|ac| ac.can_remove_weight()).unwrap_or(0))
.saturating_add(authorization.as_ref().map(|ac| ac.can_remove_weight()).unwrap_or(Weight::zero()))
)]
pub fn remove(
origin: OriginFor<T>,
Expand Down
12 changes: 6 additions & 6 deletions pallets/attestation/src/mock.rs
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ where
_claim: &ClaimHashOf<T>,
) -> Result<Weight, DispatchError> {
if who == &self.0 {
Ok(0)
Ok(Weight::zero())
} else {
Err(DispatchError::Other("Unauthorized"))
}
Expand All @@ -105,7 +105,7 @@ where
authorization_id: &T::AuthorizationId,
) -> Result<Weight, DispatchError> {
if authorization_id == who {
Ok(0)
Ok(Weight::zero())
} else {
Err(DispatchError::Other("Unauthorized"))
}
Expand All @@ -119,7 +119,7 @@ where
authorization_id: &T::AuthorizationId,
) -> Result<Weight, DispatchError> {
if authorization_id == who {
Ok(0)
Ok(Weight::zero())
} else {
Err(DispatchError::Other("Unauthorized"))
}
Expand All @@ -130,13 +130,13 @@ where
}

fn can_attest_weight(&self) -> Weight {
0
Weight::zero()
}
fn can_revoke_weight(&self) -> Weight {
0
Weight::zero()
}
fn can_remove_weight(&self) -> Weight {
0
Weight::zero()
}
}

Expand Down
16 changes: 8 additions & 8 deletions pallets/ctype/src/default_weights.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,21 +56,21 @@ impl<T: frame_system::Config> WeightInfo for SubstrateWeight<T> {
// Storage: System Account (r:2 w:2)
// Storage: Ctype Ctypes (r:1 w:1)
fn add(l: u32, ) -> Weight {
(5_346_000_u64)
Weight::from_ref_time(5_346_000 as u64)
// Standard Error: 0
.saturating_add((2_000_u64).saturating_mul(l as Weight))
.saturating_add(T::DbWeight::get().reads(3_u64))
.saturating_add(T::DbWeight::get().writes(3_u64))
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(l as u64))
.saturating_add(T::DbWeight::get().reads(3 as u64))
.saturating_add(T::DbWeight::get().writes(3 as u64))
}
}

// For backwards compatibility and tests
impl WeightInfo for () {
fn add(l: u32, ) -> Weight {
(5_346_000_u64)
Weight::from_ref_time(5_346_000 as u64)
// Standard Error: 0
.saturating_add((2_000_u64).saturating_mul(l as Weight))
.saturating_add(RocksDbWeight::get().reads(3_u64))
.saturating_add(RocksDbWeight::get().writes(3_u64))
.saturating_add(Weight::from_ref_time(2_000 as u64).saturating_mul(l as u64))
.saturating_add(RocksDbWeight::get().reads(3 as u64))
.saturating_add(RocksDbWeight::get().writes(3 as u64))
}
}
Loading