Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

integration-tests: Use latest version of fudge-polkadot-v0.9.43 #1590

Merged
merged 18 commits into from
Nov 8, 2023
Merged
Show file tree
Hide file tree
Changes from 16 commits
Commits
Show all changes
18 commits
Select commit Hold shift + click to select a range
26acfaa
integration-tests: Use latest version of fudge-polkadot-v0.9.43 and a…
cdamian Oct 13, 2023
5f96a9d
integration-tests: Use fudge in development LP tests
cdamian Oct 27, 2023
d22adcc
integration-tests: Drop unnecessary envs and funcs from development t…
cdamian Oct 30, 2023
fce33f8
integration-tests: Add sibling to generic envs, fix LP tests
cdamian Oct 31, 2023
b260429
integration-tests: Adapt LP kusama tests to use the generic framework
cdamian Nov 6, 2023
c1bf32b
integration-tests: Adapt LP polkadot tests to use the generic framework
cdamian Nov 6, 2023
23f44d4
integration-tests: Don't evolve fudge env during creation
cdamian Nov 7, 2023
2b13734
development: Add max holds and max freezes to pallet-balances config.
cdamian Nov 7, 2023
4be8323
integration-tests: Remove unused imports
cdamian Nov 7, 2023
68698bc
integration-tests: Disable liquidity_rewards_runtime_api_works test
cdamian Nov 7, 2023
9612869
investments: Remove commented code
cdamian Nov 7, 2023
bd822d5
development: Remove MaxFreezes const
cdamian Nov 7, 2023
9fc45fb
integration-tests: Handle extrinsics errors, evolve fudge env on init
cdamian Nov 7, 2023
5a1eb05
integration-tests: Add missing LP foreign investment test
cdamian Nov 8, 2023
211bc35
integration-tests: Use correct sibling ID in convert_ausd for centrif…
cdamian Nov 8, 2023
834ef4d
integration-tests: Test LP restricted call on all runtimes
cdamian Nov 8, 2023
34035ab
integration-tests: Update total fee in LP tests
cdamian Nov 8, 2023
db90a0e
clippy: Obey
cdamian Nov 8, 2023
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
32 changes: 10 additions & 22 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 8 additions & 3 deletions runtime/integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,12 @@ repository = "https://github.com/centrifuge/centrifuge-chain"
[dependencies]
codec = { package = "parity-scale-codec", version = "3.0", default-features = false, features = ["derive"] }
fudge = { git = "https://github.com/centrifuge/fudge", branch = "polkadot-v0.9.43" }
fudge-core = { git = "https://github.com/centrifuge/fudge", branch = "polkadot-v0.9.43" }
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

why do we need core? Just out of interest?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

WE should re-export taht ^^

lazy_static = "1.4.0"
serde = { version = "1.0.119" }
tokio = { version = "1.15", features = ["macros"] }
tracing-subscriber = "0.2"
thiserror = "1.0.30"

# Substrate
## Substrate-Frame
Expand All @@ -22,9 +24,13 @@ frame-support = { git = "https://github.com/paritytech/substrate", branch = "pol
frame-system = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
pallet-aura = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "polkadot-v0.9.43" }
pallet-authorship = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-balances = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-beefy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-grandpa = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-collective = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-democracy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-im-online = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-message-queue = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-preimage = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
pallet-timestamp = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
Expand All @@ -39,6 +45,7 @@ fp-self-contained = { git = "https://github.com/moonbeam-foundation/frontier", b
sp-block-builder = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-consensus-aura = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-consensus-babe = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-consensus-beefy = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-consensus-slots = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-core = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
sp-inherents = { git = "https://github.com/paritytech/substrate", branch = "polkadot-v0.9.43" }
Expand Down Expand Up @@ -83,9 +90,6 @@ orml-tokens = { git = "https://github.com/open-web3-stack/open-runtime-module-li
orml-traits = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.43" }
orml-xtokens = { git = "https://github.com/open-web3-stack/open-runtime-module-library", branch = "polkadot-v0.9.43" }

# Misc
xcm-simulator = { git = "https://github.com/paritytech/polkadot", branch = "release-v0.9.43" }

# Local
altair-runtime = { path = "../altair" }
centrifuge-runtime = { path = "../centrifuge" }
Expand Down Expand Up @@ -167,6 +171,7 @@ std = [
"pallet-balances/std",
"pallet-collective/std",
"pallet-democracy/std",
"pallet-beefy/std",
"pallet-foreign-investments/std",
"pallet-investments/std",
"pallet-message-queue/std",
Expand Down
18 changes: 10 additions & 8 deletions runtime/integration-tests/src/generic/cases/example.rs
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ fn transfer_balance<T: Runtime>() {
)],
})
.storage(),
Genesis::<T>::default().storage(),
);

// Call an extrinsic that would be processed immediately
Expand All @@ -54,7 +55,7 @@ fn transfer_balance<T: Runtime>() {
.unwrap();

// Check the state
env.state(|| {
env.parachain_state(|| {
assert_eq!(
pallet_balances::Pallet::<T>::free_balance(Keyring::Alice.to_account_id()),
T::ExistentialDeposit::get() + FOR_FEES - fee,
Expand Down Expand Up @@ -83,6 +84,7 @@ fn fudge_transfer_balance<T: Runtime + FudgeSupport>() {
)],
})
.storage(),
Genesis::<T>::default().storage(),
);

env.submit_later(
Expand Down Expand Up @@ -116,7 +118,7 @@ fn fudge_transfer_balance<T: Runtime + FudgeSupport>() {
.unwrap();

// Check the state
env.state(|| {
env.parachain_state(|| {
assert_eq!(
pallet_balances::Pallet::<T>::free_balance(Keyring::Alice.to_account_id()),
T::ExistentialDeposit::get() + FOR_FEES - fee,
Expand All @@ -129,9 +131,9 @@ fn fudge_transfer_balance<T: Runtime + FudgeSupport>() {
}

fn call_api<T: Runtime>() {
let env = RuntimeEnv::<T>::from_storage(Default::default());
let env = RuntimeEnv::<T>::from_storage(Default::default(), Default::default());

env.state(|| {
env.parachain_state(|| {
// If imported the trait: sp_api::runtime_decl_for_core::CoreV4,
// you can easily do: T::Api::version()
assert_eq!(
Expand All @@ -142,7 +144,7 @@ fn call_api<T: Runtime>() {
}

fn fudge_call_api<T: Runtime + FudgeSupport>() {
let env = FudgeEnv::<T>::from_storage(Default::default());
let env = FudgeEnv::<T>::from_storage(Default::default(), Default::default());

// Exclusive from fudge environment.
// It uses a client to access the runtime api.
Expand All @@ -158,14 +160,14 @@ fn fudge_call_api<T: Runtime + FudgeSupport>() {
}

fn pass_time_one_block<T: Runtime>() {
let mut env = RuntimeEnv::<T>::from_storage(Default::default());
let mut env = RuntimeEnv::<T>::from_storage(Default::default(), Default::default());

let before = env.state(|| pallet_timestamp::Pallet::<T>::get());
let before = env.parachain_state(|| pallet_timestamp::Pallet::<T>::get());

// Not supported in fudge
env.pass(Blocks::JumpBySeconds(SECONDS_PER_YEAR));

let after = env.state(|| pallet_timestamp::Pallet::<T>::get());
let after = env.parachain_state(|| pallet_timestamp::Pallet::<T>::get());

assert_eq!((after - before).into_seconds(), SECONDS_PER_YEAR)
}
Expand Down
Loading
Loading