forked from ghostchain/ghost-node
benchmarking for evm bridge out added
Signed-off-by: Uncle Stinky <uncle.stinky@ghostchain.io>
This commit is contained in:
parent
f2544e3876
commit
3e6192cee7
@ -1,6 +1,6 @@
|
|||||||
[package]
|
[package]
|
||||||
name = "ghost-exodus"
|
name = "ghost-exodus"
|
||||||
version = "0.0.5"
|
version = "0.0.6"
|
||||||
description = "Threshold signature generation with DKG included"
|
description = "Threshold signature generation with DKG included"
|
||||||
license.workspace = true
|
license.workspace = true
|
||||||
authors.workspace = true
|
authors.workspace = true
|
||||||
|
|||||||
@ -802,6 +802,49 @@ mod benchmarks {
|
|||||||
Ok(())
|
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!(
|
impl_benchmark_test_suite!(
|
||||||
Pallet,
|
Pallet,
|
||||||
crate::mock::new_test_ext_benchmarks(),
|
crate::mock::new_test_ext_benchmarks(),
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user