diff --git a/Cargo.lock b/Cargo.lock
index bcaf7c1..2ca8b91 100644
--- a/Cargo.lock
+++ b/Cargo.lock
@@ -727,7 +727,6 @@ dependencies = [
"hex-literal",
"log",
"orml-benchmarking",
- "orml-traits",
"orml-vesting",
"pallet-ajuna-affiliates",
"pallet-ajuna-awesome-avatars",
@@ -5974,41 +5973,6 @@ dependencies = [
"sp-storage",
]
-[[package]]
-name = "orml-traits"
-version = "0.7.0"
-source = "git+https://github.com/ajuna-network/open-runtime-module-library.git?branch=remove-nested-workspace#b80c07673265f6f3872ed10a1b2f9b1804206343"
-dependencies = [
- "frame-support",
- "impl-trait-for-tuples",
- "num-traits",
- "orml-utilities",
- "parity-scale-codec",
- "paste",
- "scale-info",
- "serde",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
- "staging-xcm",
-]
-
-[[package]]
-name = "orml-utilities"
-version = "0.7.0"
-source = "git+https://github.com/ajuna-network/open-runtime-module-library.git?branch=remove-nested-workspace#b80c07673265f6f3872ed10a1b2f9b1804206343"
-dependencies = [
- "frame-support",
- "parity-scale-codec",
- "scale-info",
- "serde",
- "sp-core",
- "sp-io",
- "sp-runtime",
- "sp-std",
-]
-
[[package]]
name = "orml-vesting"
version = "0.7.0"
diff --git a/Cargo.toml b/Cargo.toml
index 69b9912..37c4ff3 100644
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -149,7 +149,6 @@ staging-parachain-info = { version = "0.8.0", default-features
# ORML
orml-vesting = { git = "https://github.com/ajuna-network/open-runtime-module-library.git", branch = "remove-nested-workspace", default-features = false }
orml-benchmarking = { git = "https://github.com/ajuna-network/open-runtime-module-library.git", branch = "remove-nested-workspace", default-features = false }
-orml-traits = { git = "https://github.com/ajuna-network/open-runtime-module-library.git", branch = "remove-nested-workspace", default-features = false }
# Runtime
bajun-runtime = { path = "runtime/bajun" }
diff --git a/runtime/bajun/Cargo.toml b/runtime/bajun/Cargo.toml
index 09c8a56..2fd3750 100644
--- a/runtime/bajun/Cargo.toml
+++ b/runtime/bajun/Cargo.toml
@@ -89,7 +89,6 @@ staging-parachain-info = { workspace = true }
# ORML
orml-vesting = { workspace = true }
orml-benchmarking = { workspace = true, optional = true }
-orml-traits = { workspace = true, optional = true }
# Ajuna Pallets
pallet-ajuna-affiliates = { workspace = true }
@@ -119,7 +118,6 @@ std = [
"orml-vesting/std",
"pallet-ajuna-affiliates/std",
"orml-benchmarking?/std",
- "orml-traits?/std",
"pallet-ajuna-awesome-avatars/std",
"pallet-ajuna-awesome-avatars-benchmarking?/std",
"pallet-ajuna-nft-transfer/std",
@@ -176,7 +174,6 @@ runtime-benchmarks = [
"frame-system/runtime-benchmarks",
"orml-vesting/runtime-benchmarks",
"orml-benchmarking",
- "orml-traits",
"pallet-balances/runtime-benchmarks",
"pallet-collator-selection/runtime-benchmarks",
"pallet-collective/runtime-benchmarks",
diff --git a/runtime/bajun/src/benchmarking/mod.rs b/runtime/bajun/src/benchmarking/mod.rs
new file mode 100644
index 0000000..70779bf
--- /dev/null
+++ b/runtime/bajun/src/benchmarking/mod.rs
@@ -0,0 +1,4 @@
+mod utils;
+
+// module benchmarking
+mod orml_vesting;
diff --git a/runtime/bajun/src/benchmarks/orml_vesting.rs b/runtime/bajun/src/benchmarking/orml_vesting.rs
similarity index 80%
rename from runtime/bajun/src/benchmarks/orml_vesting.rs
rename to runtime/bajun/src/benchmarking/orml_vesting.rs
index 56fd47e..d0cf347 100644
--- a/runtime/bajun/src/benchmarks/orml_vesting.rs
+++ b/runtime/bajun/src/benchmarking/orml_vesting.rs
@@ -16,20 +16,14 @@
// You should have received a copy of the GNU General Public License
// along with this program. If not, see .
-use super::{
- get_vesting_account,
- utils::{lookup_of_account, set_balance, NATIVE},
-};
-use crate::{dollar, AccountId, Balance, BlockNumber, Currencies, Runtime, System, Vesting};
-
-use sp_std::prelude::*;
-
+use super::utils::{get_vesting_account, lookup_of_account, set_balance};
+use crate::{AccountId, Balance, Balances, BlockNumber, Runtime, System, Vesting, BAJUN};
use frame_benchmarking::{account, whitelisted_caller};
-use frame_support::traits::Get;
+use frame_support::traits::{fungible::Inspect, Get};
use frame_system::RawOrigin;
+use sp_std::prelude::*;
use orml_benchmarking::runtime_benchmarks;
-use orml_traits::MultiCurrency;
use orml_vesting::VestingSchedule;
pub type Schedule = VestingSchedule;
@@ -47,16 +41,14 @@ runtime_benchmarks! {
per_period: ::MinVestedTransfer::get(),
};
- // extra 1 dollar to pay fees
let from: AccountId = get_vesting_account();
- set_balance(NATIVE, &from, schedule.total_amount().unwrap() + dollar(NATIVE));
+ set_balance(from.clone(), schedule.total_amount().unwrap() + BAJUN);
let to: AccountId = account("to", 0, SEED);
let to_lookup = lookup_of_account(to.clone());
}: _(RawOrigin::Signed(from), to_lookup, schedule.clone())
verify {
- assert_eq!(
- >::total_balance(NATIVE, &to),
+ assert_eq!(Balances::total_balance(&to),
schedule.total_amount().unwrap()
);
}
@@ -72,9 +64,7 @@ runtime_benchmarks! {
};
let from: AccountId = get_vesting_account();
- // extra 1 dollar to pay fees
- set_balance(NATIVE, &from, schedule.total_amount().unwrap() * i as u128 + dollar(NATIVE));
-
+ set_balance(from.clone(), schedule.total_amount().unwrap() + BAJUN);
let to: AccountId = whitelisted_caller();
let to_lookup = lookup_of_account(to.clone());
@@ -86,7 +76,7 @@ runtime_benchmarks! {
}: _(RawOrigin::Signed(to.clone()))
verify {
assert_eq!(
- >::free_balance(NATIVE, &to),
+ Balances::free_balance(&to),
schedule.total_amount().unwrap() * i as u128,
);
}
@@ -102,7 +92,7 @@ runtime_benchmarks! {
};
let to: AccountId = account("to", 0, SEED);
- set_balance(NATIVE, &to, schedule.total_amount().unwrap() * i as u128);
+ set_balance(to.clone(),schedule.total_amount().unwrap() * i as u128);
let to_lookup = lookup_of_account(to.clone());
let mut schedules = vec![];
@@ -113,7 +103,7 @@ runtime_benchmarks! {
}: _(RawOrigin::Root, to_lookup, schedules)
verify {
assert_eq!(
- >::free_balance(NATIVE, &to),
+ Balances::free_balance(&to),
schedule.total_amount().unwrap() * i as u128
);
}
diff --git a/runtime/bajun/src/benchmarking/utils.rs b/runtime/bajun/src/benchmarking/utils.rs
new file mode 100644
index 0000000..6133b96
--- /dev/null
+++ b/runtime/bajun/src/benchmarking/utils.rs
@@ -0,0 +1,30 @@
+pub use crate::{AccountId, Balances, Runtime, BAJUN};
+use frame_support::dispatch::RawOrigin;
+pub use parity_scale_codec::Encode;
+use sp_runtime::traits::{AccountIdConversion, StaticLookup};
+
+pub fn get_vesting_account() -> AccountId {
+ crate::TreasuryPalletId::get().into_account_truncating()
+}
+
+pub fn lookup_of_account(
+ who: AccountId,
+) -> <::Lookup as StaticLookup>::Source {
+ ::Lookup::unlookup(who)
+}
+
+pub fn set_balance(account: AccountId, schedule_amount: u128) {
+ Balances::force_set_balance(RawOrigin::Root.into(), account.into(), schedule_amount).unwrap();
+}
+
+#[cfg(test)]
+pub mod tests {
+ use sp_runtime::BuildStorage;
+
+ pub fn new_test_ext() -> sp_io::TestExternalities {
+ frame_system::GenesisConfig::::default()
+ .build_storage()
+ .unwrap()
+ .into()
+ }
+}
diff --git a/runtime/bajun/src/benchmarks/mod.rs b/runtime/bajun/src/benchmarks/mod.rs
deleted file mode 100644
index b57ca3a..0000000
--- a/runtime/bajun/src/benchmarks/mod.rs
+++ /dev/null
@@ -1 +0,0 @@
-mod orml_vesting;
diff --git a/runtime/bajun/src/lib.rs b/runtime/bajun/src/lib.rs
index 7e520dc..8a151c7 100644
--- a/runtime/bajun/src/lib.rs
+++ b/runtime/bajun/src/lib.rs
@@ -23,7 +23,7 @@
include!(concat!(env!("OUT_DIR"), "/wasm_binary.rs"));
#[cfg(feature = "runtime-benchmarks")]
-mod benchmarks;
+mod benchmarking;
mod gov;
mod proxy_type;
mod weights;
@@ -928,35 +928,33 @@ extern crate frame_benchmarking;
#[cfg(feature = "runtime-benchmarks")]
mod benches {
- define_benchmarks!(
- [cumulus_pallet_parachain_system, ParachainSystem]
- [cumulus_pallet_xcmp_queue, XcmpQueue]
- [frame_system, SystemBench::]
- [pallet_balances, Balances]
- [pallet_collator_selection, CollatorSelection]
- [pallet_collective, Council]
- // [pallet_collective, TechnicalCommittee] // writes to the same file
- [pallet_democracy, Democracy]
- [pallet_identity, Identity]
- [pallet_membership, CouncilMembership]
- // [pallet_membership, TechnicalCommitteeMembership] // writes to the same file
- [pallet_message_queue, MessageQueue]
- [pallet_multisig, Multisig]
- [pallet_preimage, Preimage]
- [pallet_proxy, Proxy]
- [pallet_scheduler, Scheduler]
- [pallet_session, SessionBench::]
- [pallet_sudo, Sudo]
- [pallet_timestamp, Timestamp]
- // [pallet_treasury, Treasury] // treasury config is broken, needs fixes
- [pallet_utility, Utility]
- [pallet_ajuna_awesome_avatars, AwesomeAvatarsBench::]
- [pallet_nfts, Nft]
- );
- // Use this section if you want to benchmark individual pallets
// define_benchmarks!(
- // [orml_vesting, Vesting]
- // )
+ // [cumulus_pallet_parachain_system, ParachainSystem]
+ // [cumulus_pallet_xcmp_queue, XcmpQueue]
+ // [frame_system, SystemBench::]
+ // [pallet_balances, Balances]
+ // [pallet_collator_selection, CollatorSelection]
+ // [pallet_collective, Council]
+ // // [pallet_collective, TechnicalCommittee] // writes to the same file
+ // [pallet_democracy, Democracy]
+ // [pallet_identity, Identity]
+ // [pallet_membership, CouncilMembership]
+ // // [pallet_membership, TechnicalCommitteeMembership] // writes to the same file
+ // [pallet_message_queue, MessageQueue]
+ // [pallet_multisig, Multisig]
+ // [pallet_preimage, Preimage]
+ // [pallet_proxy, Proxy]
+ // [pallet_scheduler, Scheduler]
+ // [pallet_session, SessionBench::]
+ // [pallet_sudo, Sudo]
+ // [pallet_timestamp, Timestamp]
+ // // [pallet_treasury, Treasury] // treasury config is broken, needs fixes
+ // [pallet_utility, Utility]
+ // [pallet_ajuna_awesome_avatars, AwesomeAvatarsBench::]
+ // [pallet_nfts, Nft]
+ // );
+ // Use this section if you want to benchmark individual pallets
+ define_benchmarks!([orml_vesting, benchmarking::vesting]);
}
#[cfg(feature = "runtime-benchmarks")]
@@ -1126,7 +1124,7 @@ impl_runtime_apis! {
}
}
- #[cfg(feature = "runtime-benchmarks")]
+ #[cfg(feature = "runtime-benchmarking")]
impl frame_benchmarking::Benchmark for Runtime {
fn benchmark_metadata(extra: bool) -> (
Vec,