Skip to content

Commit

Permalink
fix: 💚 round of ci fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
ignazio-bovo committed Apr 2, 2024
1 parent 19409c9 commit 210773e
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 13 deletions.
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
"start": "./start.sh",
"test": "./tests/network-tests/run-tests.sh",
"cargo-checks": "./scripts/cargo-checks.sh",
"cargo-checks-with-benchmarking": "./scripts/cargo-checks-with-benchmarking.sh",
"cargo-build": "./scripts/cargo-build.sh",
"lint": "./scripts/lint-typescript.sh",
"update-chain-metadata": "./scripts/fetch-chain-metadata.sh | tee chain-metadata.json query-node/chain-metadata/$(./scripts/fetch-chain-spec-version.sh).json >/dev/null",
Expand Down
15 changes: 9 additions & 6 deletions runtime-modules/working-group/src/benchmarking.rs
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ use crate::types::StakeParameters;
use crate::Module as WorkingGroup;
use balances::Pallet as Balances;
use membership::Module as Membership;
use vesting::Config as VestingConfig;

const SEED: u32 = 0;
const MAX_KILOBYTES_METADATA: u32 = 100;
Expand Down Expand Up @@ -255,7 +256,7 @@ pub fn complete_opening<T: Config<I> + membership::Config, I: Instance>(

benchmarks_instance! {
where_clause {
where T: membership::Config
where T: membership::Config + Config<I>
}

on_initialize_leaving {
Expand Down Expand Up @@ -796,21 +797,23 @@ benchmarks_instance! {
}

vested_spend_from_budget {
use core::ops::Div;

let (lead_id, _) = insert_a_worker::<T, I>(
OpeningType::Leader,
0,
None
);

let raw_amount_vesting = 10_000u32;
let amount_vesting = VestingBalanceOf::<T>::from(raw_amount_vesting);
let budget = BalanceOf::<T>::from(raw_amount_vesting * 10);
let amount = core::cmp::max(<T as VestingConfig>::MinVestedTransfer::get(), VestingBalanceOf::<T>::from(10_000u32));
let amount_balance = <T as Config<I>>::VestingBalanceToBalance::convert(amount);
let budget = amount_balance.saturating_mul(10u32.into());
let current_block = <T as frame_system::Config>::BlockNumber::from(1u32);
let vested = VestingInfoOf::<T>::new(amount_vesting, amount_vesting, current_block);
let vested = VestingInfoOf::<T>::new(amount, amount.div(10u32.into()), current_block);
WorkingGroup::<T, _>::set_budget(RawOrigin::Root.into(), budget).unwrap();
}: _ (RawOrigin::Signed(lead_id.clone()), lead_id.clone(), vested, None)
verify {
assert_eq!(WorkingGroup::<T, I>::budget(), BalanceOf::<T>::from(90_000u32), "Budget not updated");
assert_eq!(WorkingGroup::<T, I>::budget(), budget.saturating_sub(amount_balance), "Budget not updated");
assert_last_event::<T, I>(RawEvent::VestedBudgetSpending(lead_id, vested, None).into());
}

Expand Down
7 changes: 0 additions & 7 deletions runtime/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1780,18 +1780,11 @@ impl bounty::Config for Runtime {
type CreatorStateBloatBondAmount = CreatorStateBloatBondAmount;
}

#[cfg(not(feature = "runtime-benchmarks"))]
parameter_types! {
pub const MinVestedTransfer: Balance = dollars!(1);
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::empty();
}

#[cfg(feature = "runtime-benchmarks")]
parameter_types! {
pub MinVestedTransfer: Balance = ExistentialDeposit::get();
pub UnvestedFundsAllowedWithdrawReasons: WithdrawReasons = WithdrawReasons::empty();
}

impl pallet_vesting::Config for Runtime {
type RuntimeEvent = RuntimeEvent;
type Currency = Balances;
Expand Down

0 comments on commit 210773e

Please sign in to comment.