Skip to content

Commit d5c796d

Browse files
gabriele-0201rphmeier
authored andcommitted
fix benchmarks
1 parent cf73600 commit d5c796d

File tree

3 files changed

+10
-31
lines changed

3 files changed

+10
-31
lines changed

sugondat-chain/pallets/blobs/src/benchmarking.rs

Lines changed: 10 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ use codec::Encode;
77
use frame_benchmarking::__private::traits::Hooks;
88
#[allow(unused)]
99
use frame_benchmarking::v2::{benchmarks, impl_benchmark_test_suite, whitelisted_caller};
10-
use frame_support::{traits::Get, BoundedVec};
10+
use frame_support::traits::Get;
1111
use frame_system::RawOrigin;
1212
use sp_std::vec;
1313

@@ -30,12 +30,8 @@ mod benchmarks {
3030
sp_io::storage::set(b":extrinsic_index", &(ext_index).encode());
3131
Blobs::<T>::submit_blob(
3232
RawOrigin::Signed(caller.clone()).into(),
33-
ext_index,
34-
ext_index
35-
.to_le_bytes()
36-
.to_vec()
37-
.try_into()
38-
.expect("Impossible convert blob into BoundedVec"),
33+
(ext_index as u128).into(),
34+
ext_index.to_le_bytes().to_vec(),
3935
)
4036
.expect("Preparation Extrinsic failed");
4137
}
@@ -56,20 +52,16 @@ mod benchmarks {
5652
sp_io::storage::set(b":extrinsic_index", &(x).encode());
5753

5854
// Create a random blob that needs to be hashed on chain
59-
let blob: BoundedVec<u8, T::MaxBlobSize> = vec![23u8]
60-
.repeat(y as usize)
61-
.try_into()
62-
.expect("Impossible convert blob into BoundedVec");
63-
55+
let blob = vec![23u8; y as usize];
6456
#[extrinsic_call]
65-
_(RawOrigin::Signed(caller), 0, blob);
57+
_(RawOrigin::Signed(caller), 0.into(), blob);
6658

6759
// Check that an item is inserted in the BlobList and
6860
// the new value stored in TotalBlobs are correct
6961
assert_eq!(BlobList::<T>::get().len(), x as usize + 1);
7062
assert_eq!(TotalBlobs::<T>::get(), x as u32 + 1);
7163
// the blob size of all the previus sumbitted blob si 4 bytes (u32.to_le_bytes())
72-
assert_eq!(TotalBlobsSize::<T>::get(), (x * 4) + y);
64+
assert_eq!(TotalBlobSize::<T>::get(), (x * 4) + y);
7365
}
7466

7567
#[benchmark]
@@ -84,9 +76,10 @@ mod benchmarks {
8476
Blobs::<T>::on_finalize(15u32.into());
8577
}
8678

87-
assert_eq!(BlobList::<T>::get().len(), x as usize);
88-
assert_eq!(TotalBlobs::<T>::get(), x as u32);
89-
assert_eq!(TotalBlobsSize::<T>::get(), x * 4);
79+
// Every storage Item should be killed
80+
assert_eq!(BlobList::<T>::get().len(), 0);
81+
assert_eq!(TotalBlobs::<T>::get(), 0);
82+
assert_eq!(TotalBlobSize::<T>::get(), 0);
9083
}
9184

9285
impl_benchmark_test_suite!(Blobs, crate::mock::new_test_ext(), crate::mock::Test);

sugondat-chain/runtimes/sugondat-kusama/src/xcm_config.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -188,11 +188,6 @@ pub type TrustedTeleporters = ();
188188
/// The parent relay chain is the accepted reserve for the native asset.
189189
pub type TrustedReserve = ParentRelayChainAndAsset;
190190

191-
#[cfg(feature = "runtime-benchmarks")]
192-
parameter_types! {
193-
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
194-
}
195-
196191
impl pallet_xcm::Config for Runtime {
197192
type RuntimeEvent = RuntimeEvent;
198193
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
@@ -219,8 +214,6 @@ impl pallet_xcm::Config for Runtime {
219214
type MaxLockers = ConstU32<8>;
220215
// TODO: needs benchmarked weights
221216
type WeightInfo = pallet_xcm::TestWeightInfo;
222-
#[cfg(feature = "runtime-benchmarks")]
223-
type ReachableDest = ReachableDest;
224217
type AdminOrigin = EnsureRoot<AccountId>;
225218
type MaxRemoteLockConsumers = ConstU32<0>;
226219
type RemoteLockConsumerIdentifier = ();

sugondat-chain/runtimes/test/src/xcm_config.rs

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -150,11 +150,6 @@ pub type XcmRouter = WithUniqueTopic<(
150150
XcmpQueue,
151151
)>;
152152

153-
#[cfg(feature = "runtime-benchmarks")]
154-
parameter_types! {
155-
pub ReachableDest: Option<MultiLocation> = Some(Parent.into());
156-
}
157-
158153
impl pallet_xcm::Config for Runtime {
159154
type RuntimeEvent = RuntimeEvent;
160155
type SendXcmOrigin = EnsureXcmOrigin<RuntimeOrigin, LocalOriginToLocation>;
@@ -180,8 +175,6 @@ impl pallet_xcm::Config for Runtime {
180175
type SovereignAccountOf = LocationToAccountId;
181176
type MaxLockers = ConstU32<8>;
182177
type WeightInfo = pallet_xcm::TestWeightInfo;
183-
#[cfg(feature = "runtime-benchmarks")]
184-
type ReachableDest = ReachableDest;
185178
type AdminOrigin = EnsureRoot<AccountId>;
186179
type MaxRemoteLockConsumers = ConstU32<0>;
187180
type RemoteLockConsumerIdentifier = ();

0 commit comments

Comments
 (0)