Skip to content

Commit

Permalink
create_agent benchmark fix
Browse files Browse the repository at this point in the history
  • Loading branch information
bkontur committed Mar 25, 2024
1 parent 86dff7a commit 897d272
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 8 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,10 @@ impl snowbridge_pallet_system::Config for Runtime {

#[cfg(feature = "runtime-benchmarks")]
pub mod benchmark_helpers {
use crate::{
bridge_to_ethereum_config::EthereumGatewayAddress, EthereumBeaconClient, Runtime,
RuntimeOrigin,
};
use super::{EthereumGatewayAddress, Runtime, TreasuryAccount};
use crate::{Balances, EthereumBeaconClient, ExistentialDeposit, RuntimeOrigin};
use codec::Encode;
use frame_support::traits::fungible;
use hex_literal::hex;
use snowbridge_beacon_primitives::CompactExecutionHeader;
use snowbridge_pallet_inbound_queue::BenchmarkHelper;
Expand Down Expand Up @@ -201,6 +200,12 @@ pub mod benchmark_helpers {

impl snowbridge_pallet_system::BenchmarkHelper<RuntimeOrigin> for () {
fn make_xcm_origin(location: Location) -> RuntimeOrigin {
// Drip ED to the `TreasuryAccount`
<Balances as fungible::Mutate<_>>::set_balance(
&TreasuryAccount::get(),
ExistentialDeposit::get(),
);

RuntimeOrigin::from(pallet_xcm::Origin::Xcm(location))
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -165,11 +165,10 @@ impl snowbridge_pallet_system::Config for Runtime {

#[cfg(feature = "runtime-benchmarks")]
pub mod benchmark_helpers {
use crate::{
bridge_to_ethereum_config::EthereumGatewayAddress, EthereumBeaconClient, Runtime,
RuntimeOrigin,
};
use super::{EthereumGatewayAddress, Runtime, TreasuryAccount};
use crate::{Balances, EthereumBeaconClient, ExistentialDeposit, RuntimeOrigin};
use codec::Encode;
use frame_support::traits::fungible;
use hex_literal::hex;
use snowbridge_beacon_primitives::CompactExecutionHeader;
use snowbridge_pallet_inbound_queue::BenchmarkHelper;
Expand Down Expand Up @@ -201,6 +200,12 @@ pub mod benchmark_helpers {

impl snowbridge_pallet_system::BenchmarkHelper<RuntimeOrigin> for () {
fn make_xcm_origin(location: Location) -> RuntimeOrigin {
// Drip ED to the `TreasuryAccount`
<Balances as fungible::Mutate<_>>::set_balance(
&TreasuryAccount::get(),
ExistentialDeposit::get(),
);

RuntimeOrigin::from(pallet_xcm::Origin::Xcm(location))
}
}
Expand Down

0 comments on commit 897d272

Please sign in to comment.