Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
2 changes: 1 addition & 1 deletion .github/workflows/tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -379,6 +379,6 @@ jobs:

# Run specific tests doing XCM between hydradx and other parachains
yarn install
yarn test --no-file-parallelism packages/hydration/tests/xcm.test.ts packages/hydration/tests/dca.test.ts
yarn test --no-file-parallelism packages/hydration/tests/xcm.test.ts
env:
HYDRADX_RUNTIME_WASM_PATH: ${{ env.HYDRADX_RUNTIME_WASM_PATH }}
63 changes: 8 additions & 55 deletions Cargo.lock

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

2 changes: 0 additions & 2 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ members = [
'node/cerebro-core/hydration',
'runtime/hydradx',
'pallets/omnipool',
'pallets/dca',
'primitives',
'utils/build-script-utils',
'integration-tests',
Expand Down Expand Up @@ -151,7 +150,6 @@ pallet-collator-rewards = { path = "pallets/collator-rewards", default-features
pallet-collator-rotation = { path = "pallets/collator-rotation", default-features = false }
pallet-currencies = { path = "pallets/currencies", default-features = false }
pallet-currencies-rpc-runtime-api = { path = "pallets/currencies/rpc/runtime-api", default-features = false }
pallet-dca = { path = "pallets/dca", default-features = false }
pallet-dispatcher = { path = "pallets/dispatcher", default-features = false }
pallet-duster = { path = "pallets/duster", default-features = false }
pallet-duster-rpc-runtime-api = { path = "pallets/duster/rpc/runtime-api", default-features = false }
Expand Down
3 changes: 1 addition & 2 deletions integration-tests/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "runtime-integration-tests"
version = "1.128.4"
version = "1.129.0"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down Expand Up @@ -39,7 +39,6 @@ pallet-otc = { workspace = true }
pallet-otc-settlements = { workspace = true }
pallet-relaychain-info = { workspace = true }
pallet-route-executor = { workspace = true }
pallet-dca = { workspace = true }
pallet-dynamic-fees = { workspace = true }
pallet-dynamic-evm-fee = { workspace = true }
pallet-staking = { workspace = true }
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ This produces `integration-tests/<pallet>-snapshot/SNAPSHOT_<block_number>`.

### 4. Write a test that loads the snapshot

Use `hydra_live_ext` to spin up the runtime against the snapshot. Canonical example: `src/dca.rs:4872`.
Use `hydra_live_ext` to spin up the runtime against the snapshot. Canonical example: `src/aave_simulator.rs:27`.

```rust
const PATH_TO_SNAPSHOT: &str = "<pallet>-snapshot/SNAPSHOT_<block_number>";
Expand Down
Binary file removed integration-tests/dca-snapshot/SNAPSHOT_12309734
Binary file not shown.
Binary file removed integration-tests/dca-snapshot/SNAPSHOT_13260776
Binary file not shown.
44 changes: 1 addition & 43 deletions integration-tests/src/aave_router.rs
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
#![cfg(test)]

use crate::dca::create_schedule;
use crate::dca::schedule_fake_with_sell_order;
use crate::liquidation::{borrow, supply};
use crate::polkadot_test_net::*;
use crate::utils::accounts::*;
Expand All @@ -10,7 +8,7 @@ use frame_support::assert_ok;
use frame_support::pallet_prelude::DispatchError::Other;
use frame_support::pallet_prelude::ValidateUnsigned;
use frame_support::storage::with_transaction;
use frame_support::traits::{ExistenceRequirement, OnInitialize};
use frame_support::traits::ExistenceRequirement;
use frame_support::{assert_noop, BoundedVec};
use hex_literal::hex;
use hydradx_runtime::evm::aave_trade_executor::AaveTradeExecutor;
Expand Down Expand Up @@ -779,46 +777,6 @@ fn router_should_set_on_chain_route() {
})
}

#[test]
fn dca_schedule_buying_atokens_should_be_created() {
with_aave(|| {
create_schedule(
ALICE,
schedule_fake_with_sell_order(ALICE, Aave, 10 * ONE, DOT, ADOT, ONE),
);
})
}

#[test]
fn dca_schedule_selling_atokens_should_be_created() {
with_aave(|| {
assert_ok!(hydradx_runtime::MultiTransactionPayment::add_currency(
hydradx_runtime::RuntimeOrigin::root(),
ADOT,
FixedU128::from_rational(1, 100000),
));
hydradx_runtime::MultiTransactionPayment::on_initialize(0);
assert_ok!(Router::buy(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
DOT,
ADOT,
1000 * ONE,
1000 * ONE + 2,
vec![Trade {
pool: Aave,
asset_in: DOT,
asset_out: ADOT,
}]
.try_into()
.unwrap()
));
create_schedule(
ALICE,
schedule_fake_with_sell_order(ALICE, Aave, 10 * ONE, ADOT, DOT, ONE),
);
})
}

#[test]
fn buy_adot_from_stablepool() {
with_stablepool(|pool| {
Expand Down
8 changes: 6 additions & 2 deletions integration-tests/src/cerebro_diff.rs
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ use cerebro_core::model::StateDelta;
use cerebro_core::value::Usd6;
use cerebro_core::BlockHash;
use cerebro_hydration::balance::call_output;
use cerebro_hydration::decode::map_records;
use cerebro_hydration::decode::{map_records, Record};
use cerebro_hydration::guard::{
self, candidate_of, is_candidate, read_oracle, read_point, with_state, Accumulators, GuardCtx, InconclusiveReason,
Judgement, Thresholds, Verdict, POST, PRE,
Expand Down Expand Up @@ -167,7 +167,11 @@ fn guarded(signer: Option<[u8; 32]>, call: impl FnOnce()) -> Guarded {
.filter(|k| before.get(*k) != after.get(*k))
.map(|k| (k.clone(), (before.get(k).cloned(), after.get(k).cloned())))
.collect();
let records = ext.execute_with(System::events);
let records: Vec<_> = ext
.execute_with(System::events)
.into_iter()
.map(Record::Runtime)
.collect();

let t = ExtTransport(RefCell::new(&mut ext));
let protocol = accounts::fetch(&t, H256(POST)).expect("protocol accounts read");
Expand Down
Loading
Loading