Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/polkadot-v1.7.2' into wf/polkado…
Browse files Browse the repository at this point in the history
…t-v1.7.2-client
  • Loading branch information
wischli committed May 27, 2024
2 parents e10f5e5 + ed5b888 commit 69b73a1
Show file tree
Hide file tree
Showing 9 changed files with 576 additions and 270 deletions.
739 changes: 534 additions & 205 deletions Cargo.lock

Large diffs are not rendered by default.

10 changes: 4 additions & 6 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ members = [
"runtime/centrifuge",
"runtime/development",
"runtime/common",
#"runtime/integration-tests",
"runtime/integration-tests",
"runtime/integration-tests/procedural",
]

Expand Down Expand Up @@ -113,9 +113,7 @@ pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-featu
staging-xcm = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
staging-xcm-builder = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
staging-xcm-executor = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
rococo-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
staging-kusama-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
polkadot-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
polkadot-test-runtime = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
polkadot-runtime-common = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
polkadot-runtime-parachains = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
polkadot-parachain-primitives = { git = "https://github.com/paritytech/polkadot-sdk", default-features = false, branch = "release-polkadot-v1.7.2" }
Expand Down Expand Up @@ -270,8 +268,8 @@ orml-xcm-support = { git = "https://github.com/moonbeam-foundation/open-runtime-
orml-xtokens = { git = "https://github.com/moonbeam-foundation/open-runtime-module-library", default-features = false, branch = "moonbeam-polkadot-v1.7.2" }

# Centrifuge organization
#fudge = { git = "https://github.com/centrifuge/fudge", branch = "polkadot-v1.7.2" }
#fudge-core = { git = "https://github.com/centrifuge/fudge", branch = "polkadot-v1.7.2" }
fudge = { git = "https://github.com/centrifuge/fudge", branch = "polkadot-v1.7.2" }
fudge-core = { git = "https://github.com/centrifuge/fudge", branch = "polkadot-v1.7.2" }
chainbridge = { git = "https://github.com/centrifuge/chainbridge-substrate.git", default-features = false, branch = "polkadot-v1.7.2" }

# Foss3
Expand Down
5 changes: 1 addition & 4 deletions runtime/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -54,11 +54,9 @@ polkadot-core-primitives = { workspace = true, features = ["std"] }
polkadot-node-primitives = { workspace = true }
polkadot-parachain-primitives = { workspace = true, features = ["std"] }
polkadot-primitives = { workspace = true, features = ["std"] }
polkadot-runtime = { workspace = true, features = ["std"] }
polkadot-test-runtime = { workspace = true, features = ["std"] }
polkadot-runtime-common = { workspace = true, features = ["std"] }
polkadot-runtime-parachains = { workspace = true, features = ["std"] }
rococo-runtime = { workspace = true, features = ["std"] }
staging-kusama-runtime = { workspace = true, features = ["std"] }

pallet-babe = { workspace = true, features = ["std"] }
pallet-grandpa = { workspace = true, features = ["std"] }
Expand Down Expand Up @@ -87,7 +85,6 @@ runtime-integration-tests-proc-macro = { workspace = true }
axelar-gateway-precompile = { workspace = true, features = ["std"] }
chainbridge = { workspace = true, features = ["std"] }
cumulus-pallet-aura-ext = { workspace = true, features = ["std"] }
cumulus-pallet-dmp-queue = { workspace = true, features = ["std"] }
cumulus-pallet-parachain-system = { workspace = true, features = ["std"] }
cumulus-pallet-xcm = { workspace = true, features = ["std"] }
cumulus-pallet-xcmp-queue = { workspace = true, features = ["std"] }
Expand Down
6 changes: 3 additions & 3 deletions runtime/integration-tests/src/generic/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use cfg_types::{
domain_address::Domain,
fixed_point::{Quantity, Rate, Ratio},
investments::InvestmentPortfolio,
locations::Location,
locations::RestrictedTransferLocation,
oracles::OracleKey,
permissions::{PermissionScope, Role},
tokens::{AssetStringLimit, CurrencyId, CustomMetadata, FilterCurrency, TrancheCurrency},
Expand Down Expand Up @@ -92,7 +92,7 @@ pub trait Runtime:
Quantity = Quantity,
PriceId = OracleKey,
> + orml_tokens::Config<CurrencyId = CurrencyId, Balance = Balance>
+ orml_asset_registry::Config<
+ orml_asset_registry::module::Config<
AssetId = CurrencyId,
CustomMetadata = CustomMetadata,
Balance = Balance,
Expand Down Expand Up @@ -122,7 +122,7 @@ pub trait Runtime:
+ pallet_proxy::Config<RuntimeCall = Self::RuntimeCallExt>
+ pallet_restricted_tokens::Config<Balance = Balance, CurrencyId = CurrencyId>
+ pallet_restricted_xtokens::Config
+ pallet_transfer_allowlist::Config<CurrencyId = FilterCurrency, Location = Location>
+ pallet_transfer_allowlist::Config<CurrencyId = FilterCurrency, Location = RestrictedTransferLocation>
+ pallet_liquidity_pools::Config<
CurrencyId = CurrencyId,
Balance = Balance,
Expand Down
26 changes: 18 additions & 8 deletions runtime/integration-tests/src/generic/envs/fudge_env/handle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ use sp_consensus_aura::{sr25519::AuthorityId, AuraApi};
use sp_consensus_babe::BabeApi;
use sp_consensus_slots::SlotDuration;
use sp_core::{crypto::AccountId32, ByteArray, H256};
use sp_runtime::{traits::AccountIdLookup, BuildStorage, Storage};
use sp_runtime::{BuildStorage, Storage};
use sp_transaction_pool::runtime_api::TaggedTransactionQueue;
use tokio::runtime::Handle;

Expand Down Expand Up @@ -78,7 +78,7 @@ pub type RelayClient<ConstructApi> = TFullClient<RelayBlock, ConstructApi, TWasm
pub type ParachainClient<Block, ConstructApi> = TFullClient<Block, ConstructApi, TWasmExecutor>;

pub trait FudgeHandle<T: Runtime> {
type RelayRuntime: frame_system::Config<AccountId = AccountId32, Lookup = AccountIdLookup<AccountId32, ()>>
type RelayRuntime: frame_system::Config<AccountId = AccountId32>
+ polkadot_runtime_parachains::paras::Config
+ polkadot_runtime_parachains::session_info::Config
+ polkadot_runtime_parachains::initializer::Config
Expand Down Expand Up @@ -185,7 +185,6 @@ pub trait FudgeHandle<T: Runtime> {
state
.insert_storage(
frame_system::GenesisConfig::<T> {
code: code.to_vec(),
_config: Default::default(),
}
.build_storage()
Expand Down Expand Up @@ -250,8 +249,14 @@ pub trait FudgeHandle<T: Runtime> {
Ok(digest)
});

RelaychainBuilder::new(init, |client| (cidp(client), dp))
.expect("ESSENTIAL: Relaychain Builder can be created.")
let mut runtime = RelaychainBuilder::new(init, |client| (cidp(client), dp))
.expect("ESSENTIAL: Relaychain Builder can be created.");

runtime.with_mut_state(|| {
frame_system::Pallet::<T>::update_code_in_storage(code);
}).unwrap();

runtime
}

fn new_parachain_builder(
Expand All @@ -269,7 +274,6 @@ pub trait FudgeHandle<T: Runtime> {
state
.insert_storage(
frame_system::GenesisConfig::<T> {
code: code.to_vec(),
_config: Default::default(),
}
.build_storage()
Expand Down Expand Up @@ -345,7 +349,13 @@ pub trait FudgeHandle<T: Runtime> {
})
};

ParachainBuilder::new(para_id, init, |client| (cidp, dp(client)))
.expect("ESSENTIAL: Parachain Builder can be created.")
let mut runtime = ParachainBuilder::new(para_id, init, |client| (cidp, dp(client)))
.expect("ESSENTIAL: Parachain Builder can be created.");

runtime.with_mut_state(|| {
frame_system::Pallet::<T>::update_code_in_storage(code);
}).unwrap();

runtime
}
}
52 changes: 11 additions & 41 deletions runtime/integration-tests/src/generic/impls.rs
Original file line number Diff line number Diff line change
Expand Up @@ -179,65 +179,35 @@ macro_rules! impl_fudge_support {

impl_fudge_support!(
FudgeDevelopment,
rococo_runtime,
default_rococo_session_keys(),
development_runtime,
polkadot_test_runtime,
default_relay_session_keys(),
development_runtime,
2000,
2001
);

impl_fudge_support!(
FudgeAltair,
staging_kusama_runtime,
default_kusama_session_keys(),
altair_runtime,
polkadot_test_runtime,
default_relay_session_keys(),
altair_runtime,
2088,
2089
);

impl_fudge_support!(
FudgeCentrifuge,
polkadot_runtime,
default_polkadot_session_keys(),
centrifuge_runtime,
polkadot_test_runtime,
default_relay_session_keys(),
centrifuge_runtime,
2031,
2032
);

pub fn default_rococo_session_keys() -> rococo_runtime::SessionKeys {
rococo_runtime::SessionKeys {
pub fn default_relay_session_keys() -> polkadot_test_runtime::SessionKeys {
polkadot_test_runtime::SessionKeys {
grandpa: pallet_grandpa::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
babe: pallet_babe::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
im_online: pallet_im_online::sr25519::AuthorityId::from_slice([0u8; 32].as_slice())
.unwrap(),
para_validator: ValidatorId::from_slice([0u8; 32].as_slice()).unwrap(),
para_assignment: AssignmentId::from_slice([0u8; 32].as_slice()).unwrap(),
authority_discovery: AuthorityDiscoveryId::from_slice([0u8; 32].as_slice()).unwrap(),
beefy: sp_consensus_beefy::ecdsa_crypto::AuthorityId::from_slice([0u8; 33].as_slice())
.unwrap(),
}
}

pub fn default_kusama_session_keys() -> staging_kusama_runtime::SessionKeys {
staging_kusama_runtime::SessionKeys {
grandpa: pallet_grandpa::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
babe: pallet_babe::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
im_online: pallet_im_online::sr25519::AuthorityId::from_slice([0u8; 32].as_slice())
.unwrap(),
para_validator: ValidatorId::from_slice([0u8; 32].as_slice()).unwrap(),
para_assignment: AssignmentId::from_slice([0u8; 32].as_slice()).unwrap(),
authority_discovery: AuthorityDiscoveryId::from_slice([0u8; 32].as_slice()).unwrap(),
beefy: sp_consensus_beefy::ecdsa_crypto::AuthorityId::from_slice([0u8; 33].as_slice())
.unwrap(),
}
}

pub fn default_polkadot_session_keys() -> polkadot_runtime::SessionKeys {
polkadot_runtime::SessionKeys {
grandpa: pallet_grandpa::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
babe: pallet_babe::AuthorityId::from_slice([0u8; 32].as_slice()).unwrap(),
im_online: pallet_im_online::sr25519::AuthorityId::from_slice([0u8; 32].as_slice())
.unwrap(),
para_validator: ValidatorId::from_slice([0u8; 32].as_slice()).unwrap(),
para_assignment: AssignmentId::from_slice([0u8; 32].as_slice()).unwrap(),
authority_discovery: AuthorityDiscoveryId::from_slice([0u8; 32].as_slice()).unwrap(),
Expand Down
2 changes: 2 additions & 0 deletions runtime/integration-tests/src/generic/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ mod impls;
pub mod utils;

// Test cases
/*
mod cases {
mod account_derivation;
mod block_rewards;
Expand All @@ -21,6 +22,7 @@ mod cases {
mod proxy;
mod restricted_transfers;
}
*/

/// Generate tests for the specified runtimes or all runtimes.
/// Usage
Expand Down
4 changes: 2 additions & 2 deletions runtime/integration-tests/src/generic/utils/currency.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ pub trait CurrencyInfo {
&self.symbol()
}

fn location(&self) -> Option<staging_xcm::VersionedMultiLocation> {
fn location(&self) -> Option<staging_xcm::VersionedLocation> {
None
}

Expand Down Expand Up @@ -153,7 +153,7 @@ pub fn register_currency<T: Runtime>(
) {
let mut meta = currency.metadata();
adaptor(&mut meta);
assert_ok!(orml_asset_registry::Pallet::<T>::register_asset(
assert_ok!(orml_asset_registry::module::Pallet::<T>::register_asset(
<T as frame_system::Config>::RuntimeOrigin::root(),
meta,
Some(currency.id())
Expand Down
2 changes: 1 addition & 1 deletion runtime/integration-tests/src/generic/utils/genesis.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ pub fn tokens<T: Runtime>(values: Vec<(CurrencyId, Balance)>) -> impl BuildStora
}

pub fn assets<T: Runtime>(currency_ids: Vec<Box<dyn CurrencyInfo>>) -> impl BuildStorage {
orml_asset_registry::GenesisConfig::<T> {
orml_asset_registry::module::GenesisConfig::<T> {
assets: currency_ids
.into_iter()
.map(|currency_id| (currency_id.id(), currency_id.metadata().encode()))
Expand Down

0 comments on commit 69b73a1

Please sign in to comment.