Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
Show all changes
54 commits
Select commit Hold shift + click to select a range
e8a7ea6
use master branch
zqhxuyuan Jan 10, 2022
336a88a
transfer from self and sibling test
zqhxuyuan Jan 11, 2022
e3e7a49
transfer_to_sibling and test_asset_registry_module err
zqhxuyuan Jan 11, 2022
174cb01
templary fix transfer_to_sibling
zqhxuyuan Jan 12, 2022
56485d9
fix test_asset_registry_module error
zqhxuyuan Jan 12, 2022
a90e450
integration-test feature
zqhxuyuan Jan 13, 2022
e3cec97
asset registry update location works
zqhxuyuan Jan 18, 2022
c28bd79
merge master and update upstream master
zqhxuyuan Jan 24, 2022
b55c7db
Merge branch 'master' into new_reanchor
zqhxuyuan Jan 24, 2022
0130f08
update orml
zqhxuyuan Jan 24, 2022
9b7cc94
update stable-asset
zqhxuyuan Jan 24, 2022
ea65d9e
test serivice with cumulus test runtime works
zqhxuyuan Jan 24, 2022
3a5a5dd
update licence
zqhxuyuan Jan 24, 2022
a0c2abe
update test-service
zqhxuyuan Jan 24, 2022
342fc47
can not produce parachain block with mandala-runtime
zqhxuyuan Jan 24, 2022
9a39c28
fmt
zqhxuyuan Jan 24, 2022
813db74
restore stable-asset
zqhxuyuan Jan 24, 2022
4409862
simple balance works
zqhxuyuan Jan 26, 2022
2122717
test service standalone works
zqhxuyuan Jan 27, 2022
72b3d47
Merge branch 'master' into new_reanchor
zqhxuyuan Jan 27, 2022
a8f59c7
clean and refactor test-service
zqhxuyuan Jan 27, 2022
05aca8d
fix test of Default remove
zqhxuyuan Jan 27, 2022
67cf13e
CheckNonZeroSender
zqhxuyuan Jan 27, 2022
2e7ff7d
add karura native asset test
zqhxuyuan Jan 28, 2022
e7bdec2
apply canical location for manala and acala
zqhxuyuan Jan 28, 2022
102f117
add preimage pallet and migration
zqhxuyuan Jan 28, 2022
f36e29b
v0.9.16
zqhxuyuan Jan 28, 2022
e16462b
rm without_storage_info for some pallet
zqhxuyuan Jan 28, 2022
1033e23
update orml
zqhxuyuan Jan 29, 2022
351281d
review change
zqhxuyuan Jan 29, 2022
6595647
update stable-asset
zqhxuyuan Jan 30, 2022
90974d5
Merge branch 'master' into new_reanchor
xlc Jan 30, 2022
48ea7a3
update NoPreimagePostponement
xlc Jan 30, 2022
b4bedb2
some clippy fix
xlc Jan 30, 2022
312a4bb
update stable-asset
zqhxuyuan Jan 31, 2022
bdbbb1e
update mock
zqhxuyuan Jan 31, 2022
8d714e3
update
zqhxuyuan Jan 31, 2022
1eda19f
fix CI error
zqhxuyuan Feb 1, 2022
c5e6724
cargo test normal
zqhxuyuan Feb 1, 2022
be0d83c
update substrate and fix review
zqhxuyuan Feb 2, 2022
db96b25
Merge branch 'master' into new_reanchor
zqhxuyuan Feb 2, 2022
6834394
fix
zqhxuyuan Feb 2, 2022
bd5d6c5
update evm-tests
zqhxuyuan Feb 2, 2022
dfaec0f
update state_version to 0
zqhxuyuan Feb 3, 2022
91733da
Renamed the NFT trait to InspectExtended
Feb 3, 2022
61e6d43
Updated orml reference
Feb 3, 2022
315e66e
Update orml version
Feb 3, 2022
a29ea50
Merged from Master branch
Feb 3, 2022
8ce9aee
merge master
zqhxuyuan Feb 4, 2022
e9502a3
update polkadot-rc10
zqhxuyuan Feb 4, 2022
e2a734d
update polkadot-rc10
zqhxuyuan Feb 4, 2022
323e8df
merge nft PR #1841
zqhxuyuan Feb 4, 2022
9c795d6
change migration
xlc Feb 4, 2022
10f1ffa
fix Trader
zqhxuyuan Feb 6, 2022
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
review change
  • Loading branch information
zqhxuyuan committed Jan 29, 2022
commit 351281d0eeb491c14c27cb598f50931a1b84106a
2 changes: 0 additions & 2 deletions primitives/src/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -205,8 +205,6 @@ create_currency_id! {
PHA("Phala Native Token", 12) = 170,
KINT("Kintsugi Native Token", 12) = 171,
KBTC("Kintsugi Wrapped BTC", 8) = 172,
RMRK("Rmrk", 10) = 173,
RMRKV2("Rmrk V2", 10) = 174,
}
}

Expand Down
9 changes: 4 additions & 5 deletions runtime/acala/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -769,8 +769,6 @@ parameter_type_with_key! {
TokenSymbol::KBTC |
TokenSymbol::KINT |
TokenSymbol::TAI |
TokenSymbol::RMRK |
TokenSymbol::RMRKV2 |
TokenSymbol::CASH => Balance::max_value() // unsupported
},
CurrencyId::DexShare(dex_share_0, _) => {
Expand Down Expand Up @@ -927,8 +925,8 @@ impl orml_vesting::Config for Runtime {
parameter_types! {
pub MaximumSchedulerWeight: Weight = Perbill::from_percent(10) * RuntimeBlockWeights::get().max_block;
pub const MaxScheduledPerBlock: u32 = 10;
// Retry a scheduled item every 10 blocks (1 minute) until the preimage exists.
pub const NoPreimagePostponement: Option<u32> = Some(10);
// Retry a scheduled item every 25 blocks (5 minute) until the preimage exists.
pub const NoPreimagePostponement: Option<u32> = Some(25);
}

impl pallet_scheduler::Config for Runtime {
Expand Down Expand Up @@ -1972,7 +1970,8 @@ pub type Executive = frame_executive::Executive<
pub struct SchedulerMigrationV3;
impl frame_support::traits::OnRuntimeUpgrade for SchedulerMigrationV3 {
fn on_runtime_upgrade() -> frame_support::weights::Weight {
Scheduler::migrate_v2_to_v3()
Scheduler::migrate_v1_to_v3();
<Runtime as frame_system::Config>::BlockWeights::get().max_block
}

#[cfg(feature = "try-runtime")]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ use crate::relaychain::kusama_test_net::*;
use crate::setup::*;

use frame_support::assert_ok;
use sp_runtime::traits::{AccountIdConversion, TrailingZeroInput};
use sp_runtime::traits::AccountIdConversion;
use xcm_builder::ParentIsDefault;

use karura_runtime::parachains::bifrost::BNC_KEY;
Expand Down Expand Up @@ -87,74 +87,6 @@ fn transfer_to_relay_chain() {
});
}

#[test]
fn transfer_self_chain_asset() {
TestNet::reset();

fn sibling_reserve_account() -> AccountId {
polkadot_parachain::primitives::Sibling::from(2001).into_account()
}

Karura::execute_with(|| {
let _ = Balances::deposit_creating(&AccountId::from(ALICE), 100_000_000_000_000);

assert_ok!(XTokens::transfer(
Origin::signed(ALICE.into()),
KAR,
10_000_000_000_000,
Box::new(
MultiLocation::new(
1,
X2(
Parachain(2001),
Junction::AccountId32 {
network: NetworkId::Any,
id: BOB.into(),
}
)
)
.into()
),
1_000_000_000_000,
));

assert_eq!(90_000_000_000_000, Balances::free_balance(&AccountId::from(ALICE)));
assert_eq!(10_000_000_000_000, Balances::free_balance(&sibling_reserve_account()));
});

Sibling::execute_with(|| {
assert_eq!(0, Tokens::free_balance(KAR, &AccountId::from(BOB)));
assert_eq!(9_993_600_000_000, Balances::free_balance(&AccountId::from(BOB)));

assert_ok!(XTokens::transfer(
Origin::signed(BOB.into()),
KAR,
1_000_000_000_000,
Box::new(
MultiLocation::new(
1,
X2(
Parachain(2000),
Junction::AccountId32 {
network: NetworkId::Any,
id: ALICE.into(),
}
)
)
.into()
),
1_000_000_000,
));

assert_eq!(8_993_600_000_000, Balances::free_balance(&AccountId::from(BOB)));
});

Karura::execute_with(|| {
assert_eq!(90_993_600_000_000, Balances::free_balance(&AccountId::from(ALICE)));
assert_eq!(9_000_000_000_000, Balances::free_balance(&sibling_reserve_account()));
});
}

#[test]
fn transfer_sibling_chain_asset() {
TestNet::reset();
Expand Down Expand Up @@ -576,123 +508,6 @@ fn test_asset_registry_module() {
});
}

#[test]
fn asset_registry_location_update_prefix_works() {
TestNet::reset();

fn karura_reserve_account() -> AccountId {
polkadot_parachain::primitives::Sibling::from(2000).into_account()
}

Karura::execute_with(|| {
// register foreign asset
assert_ok!(AssetRegistry::register_foreign_asset(
Origin::root(),
// we use parachain 20001 mock as statemine
Box::new(MultiLocation::new(1, X2(Parachain(2001), GeneralIndex(8))).into()),
Box::new(AssetMetadata {
name: b"Statemine Asset".to_vec(),
symbol: b"RMRK".to_vec(),
decimals: 12,
minimal_balance: Balances::minimum_balance() / 10, // 10%
})
));
});

Sibling::execute_with(|| {
// the native asset of Sibling is KAR, so RMRK is consider as Token
assert_ok!(Tokens::deposit(RMRK, &AccountId::from(BOB), 100_000_000_000_000));

// Sibling will convert RMRK to location: (1, 2001, 8)
assert_ok!(XTokens::transfer(
Origin::signed(BOB.into()),
RMRK,
5_000_000_000_000,
Box::new(
MultiLocation::new(
1,
X2(
Parachain(2000),
Junction::AccountId32 {
network: NetworkId::Any,
id: ALICE.into(),
}
)
)
.into()
),
1_000_000_000,
));

assert_eq!(Tokens::free_balance(RMRK, &karura_reserve_account()), 5_000_000_000_000);
assert_eq!(Tokens::free_balance(RMRK, &AccountId::from(BOB)), 95_000_000_000_000);
});

Karura::execute_with(|| {
// Karura received (1, 2001, 8) and regard it as ForeignAsset(0)
assert_eq!(
Tokens::free_balance(CurrencyId::ForeignAsset(0), &AccountId::from(ALICE)),
4_999_360_000_000
);

// update foreign asset location with PalletInstance prefix before asset
assert_ok!(AssetRegistry::update_foreign_asset(
Origin::root(),
0,
Box::new(MultiLocation::new(1, X3(Parachain(2001), PalletInstance(53), GeneralIndex(8))).into()),
Box::new(AssetMetadata {
name: b"Statemine Token".to_vec(),
symbol: b"RMRK".to_vec(),
decimals: 12,
minimal_balance: Balances::minimum_balance() / 10, // 10%
})
));
});

Sibling::execute_with(|| {
// Sibling will convert RMRKV2 to location: (1, 2001, 53, 8)
assert_ok!(XTokens::transfer(
Origin::signed(BOB.into()),
RMRKV2,
5_000_000_000_000,
Box::new(
MultiLocation::new(
1,
X2(
Parachain(2000),
Junction::AccountId32 {
network: NetworkId::Any,
id: ALICE.into(),
}
)
)
.into()
),
1_000_000_000,
));

assert_eq!(
10_000_000_000_000,
Tokens::free_balance(RMRK, &karura_reserve_account())
);
assert_eq!(90_000_000_000_000, Tokens::free_balance(RMRK, &AccountId::from(BOB)));
});

Karura::execute_with(|| {
// Karura received (1, 2001, 53, 8) and also regard it as ForeignAsset(0)
assert_eq!(
Tokens::free_balance(CurrencyId::ForeignAsset(0), &AccountId::from(ALICE)),
4_999_360_000_000 * 2
);

// ToTreasury
assert_eq!(
Tokens::free_balance(CurrencyId::ForeignAsset(0), &TreasuryAccount::get()),
640_000_000 * 2
);
});
}

#[test]
fn unspent_xcm_fee_is_returned_correctly() {
let mut parachain_account: AccountId = AccountId::new([0u8; 32]);
Expand Down
47 changes: 47 additions & 0 deletions runtime/karura/src/integration_tests_config.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
// This file is part of Acala.

// Copyright (C) 2020-2022 Acala Foundation.
// SPDX-License-Identifier: GPL-3.0-or-later WITH Classpath-exception-2.0

// This program is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with this program. If not, see <https://www.gnu.org/licenses/>.

use super::*;

parameter_types! {
pub const ParachainIdForTest: u32 = 2000;
pub KarPerSecondOfCanonicalLocation: (AssetId, u128) = (
MultiLocation::new(
0,
X1(GeneralKey(KAR.encode())),
).into(),
kar_per_second()
);
pub BncPerSecondOfCanonicalLocation: (AssetId, u128) = (
MultiLocation::new(
0,
X1(GeneralKey(parachains::bifrost::BNC_KEY.to_vec())),
).into(),
ksm_per_second() * 80
);
}

pub type Trader = (
TransactionFeePoolTrader<Runtime, CurrencyIdConvert, KarPerSecondAsBased, ToTreasury>,
FixedRateOfFungible<KsmPerSecond, ToTreasury>,
FixedRateOfFungible<KarPerSecond, ToTreasury>,
FixedRateOfFungible<KarPerSecondOfCanonicalLocation, ToTreasury>,
FixedRateOfFungible<BncPerSecond, ToTreasury>,
FixedRateOfFungible<BncPerSecondOfCanonicalLocation, ToTreasury>,
FixedRateOfForeignAsset<Runtime, ForeignAssetUnitsPerSecond, ToTreasury>,
);
Loading