benchmarking for evm bridge out added

Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
Uncle Stinky 2026-09-06 01:35:46 +03:00
parent f2544e3876
commit 3e6192cee7
Signed by: st1nky
GPG Key ID: 016064BD97603B40
2 changed files with 44 additions and 1 deletions

View File

@ -1,6 +1,6 @@
[package]
name = "ghost-exodus"
version = "0.0.5"
version = "0.0.6"
description = "Threshold signature generation with DKG included"
license.workspace = true
authors.workspace = true

View File

@ -802,6 +802,49 @@ mod benchmarks {
Ok(())
}
#[benchmark]
fn register_evm_bridge_out_exodus() -> Result<(), BenchmarkError> {
let caller: T::AccountId = frame_benchmarking::whitelisted_caller();
let (_, network_curve, _, _) = prepare_pallet::<T>(1usize);
let network_id = NetworkIdOf::<T>::default();
let amount: BalanceOf<T> = 10_000u32.into();
let bounty = Perbill::from_percent(5);
let receiver = EvmAddress::from([69u8; 20]);
QualificationDkgState::<T>::mutate(&network_curve, |state| {
loop {
if state.is_dkg_finalized() { break; }
state.next_phase();
}
});
let total_existential = T::Currency::minimum_balance();
let initial_balance = total_existential
.saturating_mul(5u32.into())
.saturating_add(amount);
let _ = T::Currency::make_free_balance_be(&caller, initial_balance);
let _ = T::NetworkDataHandler::register_incoming(&network_id, amount).unwrap();
let current_exodus_session = CurrentExodus::<T>::get();
#[extrinsic_call]
_(
RawOrigin::Signed(caller.clone()),
network_id,
amount,
bounty,
receiver,
);
assert!(ExodusRequests::<T>::contains_key(&network_curve, current_exodus_session));
assert_eq!(CurrentExodus::<T>::get(), current_exodus_session + 1);
assert_eq!(T::Currency::free_balance(&caller), initial_balance - amount);
Ok(())
}
impl_benchmark_test_suite!(
Pallet,
crate::mock::new_test_ext_benchmarks(),