Skip to content

Commit b817e2d

Browse files
committed
Warm up pallet-revive storage deposit account before tests
1 parent a55b1c1 commit b817e2d

File tree

2 files changed

+25
-2
lines changed

2 files changed

+25
-2
lines changed

integration-tests/contracts/xcm/Cargo.lock

Lines changed: 0 additions & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

integration-tests/src/lib.rs

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,15 @@
22

33
use std::path::Path;
44

5-
use frame_support::{assert_ok, weights::Weight};
5+
use frame_support::{
6+
assert_ok,
7+
traits::{
8+
Currency,
9+
fungible::Mutate,
10+
fungibles::Inspect,
11+
},
12+
weights::Weight,
13+
};
614
use ink_parachain_runtime::{
715
AccountId, Assets, Balance, Balances, Revive, Runtime, RuntimeOrigin, System, UNIT,
816
};
@@ -23,6 +31,21 @@ const STORAGE_DEPOSIT_LIMIT: DepositLimit<Balance> = DepositLimit::Balance(Balan
2331

2432
type AssetId = u32;
2533

34+
/// `pallet-revive` recently introduced a dedicated "pallet" account for
35+
/// tracking storage deposits. This static account is returned by the
36+
/// `pallet_revive::Pallet::account_id()` function.
37+
///
38+
/// This function here funds the account with the existential deposit
39+
/// (i.e. minimum balance).
40+
///
41+
fn warm_up() {
42+
let deposit_account = Revive::account_id();
43+
let existential_deposit = Balances::minimum_balance();
44+
Balances::mint_into(&deposit_account, existential_deposit).unwrap_or_else(|_| {
45+
panic!("Failed to mint existential balance into `pallet-revive` account")
46+
});
47+
}
48+
2649
// Get the last event from `pallet-revive`.
2750
fn last_contract_event(address: &H160) -> Vec<u8> {
2851
let events = System::read_events_for_pallet::<pallet_revive::Event<Runtime>>();
@@ -70,6 +93,7 @@ fn instantiate(
7093
data: Vec<u8>,
7194
salt: Option<[u8; 32]>,
7295
) -> H160 {
96+
warm_up();
7397
let binary = std::fs::read(contract).expect("could not read .polkavm file");
7498

7599
let result = Revive::bare_instantiate(

0 commit comments

Comments
 (0)