Skip to content
Closed
Show file tree
Hide file tree
Changes from 65 commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
234f87e
Cleanup Gov v1 from chain spec and launch configs
cl0w5 Feb 25, 2025
6a084a2
remove unneeded gov v1 pallets
cl0w5 Feb 25, 2025
4d8874e
add migrations for removing Gov v1
cl0w5 Feb 25, 2025
5642002
bump versions
cl0w5 Feb 25, 2025
413dc2c
fmt
cl0w5 Feb 25, 2025
f25556c
Cleanup gov v1 from integration tests
cl0w5 Feb 25, 2025
6340c86
bump runtime-integration-tests
cl0w5 Feb 25, 2025
3c57049
Add pallet_config
cl0w5 Jun 8, 2025
51eb4a5
rename to pallet_configuration
cl0w5 Jun 8, 2025
0ba7062
use once_cell
cl0w5 Jun 8, 2025
2d74000
Add unit tests
cl0w5 Jun 9, 2025
a7d2e2f
runtime integration tests
cl0w5 Jun 9, 2025
0d9b952
dont use once_cell
cl0w5 Jun 11, 2025
8cbaec9
use 2 static lists for TRACK_DATA
cl0w5 Jun 11, 2025
06511c9
fmt
cl0w5 Jun 11, 2025
c8b8910
versions
cl0w5 Jun 11, 2025
c379229
set Configuration.IsTestnet on zombienet fork
cl0w5 Jun 11, 2025
135ae1b
Merge branch 'master' into fast_enact_testnet
cl0w5 Jun 11, 2025
c3bc02c
adjust other testnet tracks
cl0w5 Jun 11, 2025
7953cc4
review comments
cl0w5 Jun 13, 2025
8ccde97
Merge branch 'master' into fast_enact_testnet
cl0w5 Jun 13, 2025
994824b
version
cl0w5 Jun 13, 2025
ae9ae99
update frontier and evm dependencies
enthusiastmartin Jun 16, 2025
252254c
update versions- again
enthusiastmartin Jun 27, 2025
b47d1a3
tests fixed
mrq1911 Jun 30, 2025
e224cae
scraper - load from bytes
enthusiastmartin Jul 1, 2025
31486e4
reduce accepted diff in stableswap integration test
enthusiastmartin Jul 1, 2025
3e7c3ca
feat: improve stableswap invariant checks after each operation
enthusiastmartin Jul 1, 2025
3c2219a
correct name
enthusiastmartin Jul 1, 2025
714dfae
fix imports
enthusiastmartin Jul 2, 2025
310ef97
Merge branch 'master' into update-evm-versions
enthusiastmartin Jul 2, 2025
492bb62
Merge branch 'feat/improve-stableswap-invariants' into fuzzer-build
enthusiastmartin Jul 2, 2025
51c06bf
scraper - create ext from snapshot
enthusiastmartin Jul 2, 2025
3dcdbe3
scraper - add posibility to create backend and ext using backend
enthusiastmartin Jul 2, 2025
e8158c5
Merge pull request #1143 from galacticcouncil/fix/stableswap-integrat…
enthusiastmartin Jul 2, 2025
3d0d005
Merge branch 'master' into feat/improve-stableswap-invariants
enthusiastmartin Jul 2, 2025
d454a80
Bump polkadot-sdk to stable2409-patch5
cl0w5 Jul 3, 2025
50dca06
Merge pull request #1145 from galacticcouncil/bump_sdk_patch5
cl0w5 Jul 4, 2025
de27275
add transfer assertion to ensure amount in test build
enthusiastmartin Jul 4, 2025
79003e2
Merge branch 'master' into fast_enact_testnet
cl0w5 Jul 4, 2025
8cc8c95
review comments
cl0w5 Jul 4, 2025
93d99ab
Rename to pallet-parameters
cl0w5 Jul 4, 2025
a5839ed
runtime config
cl0w5 Jul 4, 2025
de28b9a
Merge branch 'master' into fast_enact_testnet
cl0w5 Jul 4, 2025
243c375
versions
cl0w5 Jul 4, 2025
7397097
Merge pull request #1123 from galacticcouncil/fast_enact_testnet
mrq1911 Jul 4, 2025
24d0780
Merge branch 'master' into sunset_govv1
cl0w5 Jul 4, 2025
0194f82
versions
cl0w5 Jul 4, 2025
6a97821
Lockfile
cl0w5 Jul 4, 2025
e08ea8a
add transfer assertion to ensure amount in test build
enthusiastmartin Jul 6, 2025
6234b26
Merge branch 'master' into feat/improve-stableswap-invariants
enthusiastmartin Jul 8, 2025
aa5980d
Merge pull request #1144 from galacticcouncil/feat/improve-stableswap…
cl0w5 Jul 8, 2025
b75832c
Merge branch 'master' into fuzzer-build
cl0w5 Jul 8, 2025
ba96bdc
Frontier and evm versions
cl0w5 Jul 8, 2025
4c337ac
fmt and remove unnecessary dependency
cl0w5 Jul 8, 2025
5ef018d
versions
cl0w5 Jul 8, 2025
b6cdd70
Merge branch 'master' into sunset_govv1
mrq1911 Jul 8, 2025
4d24bec
Update runtime/hydradx/src/lib.rs
mrq1911 Jul 8, 2025
7624c71
Merge pull request #1033 from galacticcouncil/sunset_govv1
mrq1911 Jul 8, 2025
1f6e9ad
fix build
enthusiastmartin Jul 8, 2025
09a01ee
Merge branch 'master' into fuzzer-build
cl0w5 Jul 8, 2025
99a36a5
versions and fmt
cl0w5 Jul 8, 2025
ca920a6
Merge pull request #1146 from galacticcouncil/fuzzer-build
cl0w5 Jul 8, 2025
872133b
add extrinsic to change asset peg source
enthusiastmartin Jul 10, 2025
7f387d1
add max peg update extrinsic
enthusiastmartin Jul 10, 2025
f8255c1
remove preserve price
enthusiastmartin Jul 10, 2025
f1bc28a
change to authoriry origin
enthusiastmartin Jul 10, 2025
0f8d834
remvove comment
enthusiastmartin Jul 10, 2025
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
649 changes: 332 additions & 317 deletions Cargo.lock

Large diffs are not rendered by default.

915 changes: 458 additions & 457 deletions Cargo.toml

Large diffs are not rendered by default.

11 changes: 4 additions & 7 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.43.0"
version = "1.45.1"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand All @@ -9,6 +9,8 @@ license = "Apache 2.0"
repository = "https://github.com/galacticcouncil/HydraDX-node"

[dependencies]
codec = { workspace = true, features = ["derive", "max-encoded-len"] }
scale-info = { workspace = true }
hex-literal = { workspace = true }
frame-remote-externalities = { workspace = true }
tokio = { workspace = true }
Expand Down Expand Up @@ -45,10 +47,7 @@ pallet-liquidation = { workspace = true }
pallet-broadcast = { workspace = true }

pallet-treasury = { workspace = true }
pallet-democracy = { workspace = true }
pallet-scheduler = { workspace = true }
pallet-elections-phragmen = { workspace = true }
pallet-tips = { workspace = true }
pallet-referenda = { workspace = true }
pallet-conviction-voting = { workspace = true }
pallet-dispatcher = { workspace = true }
Expand Down Expand Up @@ -149,6 +148,7 @@ libsecp256k1 = { workspace = true }
[features]
default = ["std"]
std = [
"codec/std",
"frame-executive/std",
"frame-support/std",
"frame-system/std",
Expand All @@ -173,7 +173,6 @@ std = [
"pallet-asset-registry/std",
"pallet-aura/std",
"pallet-balances/std",
"pallet-elections-phragmen/std",
"pallet-session/std",
"pallet-timestamp/std",
"pallet-transaction-payment/std",
Expand Down Expand Up @@ -201,9 +200,7 @@ std = [
"sp-version/std",
"pallet-treasury/std",
"pallet-collective/std",
"pallet-democracy/std",
"pallet-scheduler/std",
"pallet-tips/std",
"pallet-collator-selection/std",
"pallet-authorship/std",
"hydradx-traits/std",
Expand Down
55 changes: 14 additions & 41 deletions integration-tests/src/aave_router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -85,48 +85,19 @@ fn transfer_all() {
assert_eq!(Currencies::free_balance(ADOT, &ALICE.into()), 10000);

// Deposit these 10000 ADOT and get back any amount of shares you want for free
assert_ok!(Stableswap::add_liquidity_shares(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
pool,
100000 * BAG,
// aTOKEN
ADOT,
//max_asset_amount
u128::MAX - 1u128,
));

assert_eq!(Currencies::free_balance(ADOT, &ALICE.into()), 0);

// Profit: 10000000000000000000 shares minted
assert_eq!(
Currencies::free_balance(pool, &ALICE.into()) - shares_before,
100000000000000000000
);

assert_ok!(Stableswap::remove_liquidity(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
pool,
// shares to withdraw
100000000000000000000,
// min amounts out
BoundedVec::truncate_from(vec![
AssetAmount {
asset_id: DOT,
amount: 0,
},
AssetAmount {
asset_id: ADOT,
amount: 0,
},
]),
));

// Removed 499750124942 ADOT for free
assert_eq!(Currencies::free_balance(ADOT, &ALICE.into()), 499750124942);
// Removed 499750124937 DOT for free
assert_eq!(
Currencies::free_balance(DOT, &ALICE.into()) - balance_before,
499750124937
Stableswap::add_liquidity_shares(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
pool,
100000 * BAG,
// aTOKEN
ADOT,
//max_asset_amount
u128::MAX - 1u128,
),
Err(Other(
"evm:0x4e487b710000000000000000000000000000000000000000000000000000000000000011"
))
);
});
}
Expand Down Expand Up @@ -778,6 +749,7 @@ fn buy_in_stable_after_rebase() {
}

#[test]
#[ignore]
fn transfer_almost_all_atoken_but_ed_should_transfer_all_atoken() {
with_atoken(|| {
let ed = 1000;
Expand Down Expand Up @@ -823,6 +795,7 @@ fn transfer_almost_all_atoken_but_ed_should_transfer_all_atoken() {
}

#[test]
#[ignore]
fn transfer_all_atoken_but_one_should_transfer_all_atoken() {
with_atoken(|| {
let ed = 1000;
Expand Down
8 changes: 8 additions & 0 deletions integration-tests/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2744,13 +2744,21 @@ impl PrecompileHandle for MockHandle {
&self.context
}

fn origin(&self) -> H160 {
todo!()
}

fn is_static(&self) -> bool {
self.is_static
}

fn gas_limit(&self) -> Option<u64> {
None
}

fn is_contract_being_constructed(&self, address: H160) -> bool {
todo!()
}
}

fn create_xyk_pool_with_amounts(asset_a: u32, amount_a: u128, asset_b: u32, amount_b: u128) {
Expand Down
1 change: 1 addition & 0 deletions integration-tests/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ mod omnipool_init;
mod omnipool_liquidity_mining;
mod oracle;
mod otc;
mod parameters;
mod polkadot_test_net;
mod referrals;
mod router;
Expand Down
73 changes: 73 additions & 0 deletions integration-tests/src/parameters.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
// This file is part of https://github.com/galacticcouncil/*
//
// $$$$$$$ Licensed under the Apache License, Version 2.0 (the "License")
// $$$$$$$$$$$$$ you may only use this file in compliance with the License
// $$$$$$$$$$$$$$$$$$$
// $$$$$$$$$ Copyright (C) 2021-2024 Intergalactic, Limited (GIB)
// $$$$$$$$$$$ $$$$$$$$$$ SPDX-License-Identifier: Apache-2.0
// $$$$$$$$$$$$$$$$$$$$$$$$$$
// $$$$$$$$$$$$$$$$$$$$$$$ $ Built with <3 for decentralisation
// $$$$$$$$$$$$$$$$$$$ $$$$$$$
// $$$$$$$ $$$$$$$$$$$$$$$$$$ Unless required by applicable law or agreed to in
// $ $$$$$$$$$$$$$$$$$$$$$$$ writing, software distributed under the License is
// $$$$$$$$$$$$$$$$$$$$$$$$$$ distributed on an "AS IS" BASIS, WITHOUT WARRANTIES
// $$$$$$$$$ $$$$$$$$$$$ OR CONDITIONS OF ANY KIND, either express or implied.
// $$$$$$$$
// $$$$$$$$$$$$$$$$$$ See the License for the specific language governing
// $$$$$$$$$$$$$ permissions and limitations under the License.
// $$$$$$$
// $$
// $$$$$ $$$$$ $$ $
// $$$ $$$ $$$ $$ $$$$$ $$ $$$ $$$$ $$$$$$$ $$$$ $$$ $$$$$$ $$ $$$$$$
// $$$ $$$ $$$ $$ $$$ $$$ $$$ $ $$ $$ $$ $$ $$ $$ $$$ $$$
// $$$$$$$$$$$ $$ $$ $$$ $$ $$ $$$$$$$ $$ $$ $$ $$$ $$ $$
// $$$ $$$ $$$$ $$$ $$ $$ $$$ $$ $$ $$ $$ $$ $$ $$
// $$$$$ $$$$$ $$ $$$$$$$$ $ $$$ $$$$$$$$ $$$ $$$$ $$$$$$$ $$$$ $$$$
// $$$

use crate::polkadot_test_net::*;
use codec::Encode;
use hydradx_runtime::*;
use primitives::constants::time::{HOURS, MINUTES};
use sp_core::{storage::StorageKey, Get};
use xcm_emulator::TestExt;

#[test]
fn is_testnet_sets_correct_referenda_params_when_default() {
TestNet::reset();
Hydra::execute_with(|| {
// Assert
let tracks = <hydradx_runtime::Runtime as pallet_referenda::Config>::Tracks::get();

let root_track = tracks
.iter()
.find(|(id, _info)| *id == 0)
.expect("Root track should exist");

assert_eq!(root_track.1.prepare_period, HOURS);
assert_eq!(root_track.1.confirm_period, 12 * HOURS);
assert_eq!(root_track.1.min_enactment_period, 10 * MINUTES);
});
}

#[test]
fn is_testnet_sets_correct_referenda_params_when_testnet() {
TestNet::reset();
Hydra::execute_with(|| {
// Prepare
let key = StorageKey(frame_support::storage::storage_prefix(b"Parameters", b"IsTestnet").to_vec());
let value = true.encode();
sp_io::storage::set(&key.0, &value);

// Assert
let tracks = <hydradx_runtime::Runtime as pallet_referenda::Config>::Tracks::get();
let root_track = tracks
.iter()
.find(|(id, _info)| *id == 0)
.expect("Root track should exist");

assert_eq!(root_track.1.prepare_period, 1);
assert_eq!(root_track.1.confirm_period, 1);
assert_eq!(root_track.1.min_enactment_period, 1);
});
}
2 changes: 1 addition & 1 deletion integration-tests/src/stableswap.rs
Original file line number Diff line number Diff line change
Expand Up @@ -114,7 +114,7 @@ fn gigadot_pool_should_work() {
assert_eq_approx!(
adot_received,
expected_adot_received,
100_000_000_000_000_000,
100_000_000,
"Expected adot received is not equal to actual adot received"
);

Expand Down
8 changes: 4 additions & 4 deletions integration-tests/src/transact_call_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@ fn blocked_transact_calls_should_not_pass_filter() {

Acala::execute_with(|| {
// filtered by SafeCallFilter
let call = pallet_tips::Call::<hydradx_runtime::Runtime>::report_awesome {
reason: vec![0, 10],
who: BOB.into(),
let call = pallet_treasury::Call::<hydradx_runtime::Runtime>::spend_local {
amount: UNITS,
beneficiary: ALICE.into(),
};

let hdx_loc = Location::new(
Expand Down Expand Up @@ -136,7 +136,7 @@ fn blocked_transact_calls_should_not_pass_filter() {
Transact {
require_weight_at_most: call.get_dispatch_info().weight,
origin_kind: OriginKind::Native,
call: hydradx_runtime::RuntimeCall::Tips(call).encode().into(),
call: hydradx_runtime::RuntimeCall::Treasury(call).encode().into(),
},
ExpectTransactStatus(MaybeErrorCode::Success),
RefundSurplus,
Expand Down
2 changes: 0 additions & 2 deletions launch-configs/chopsticks/hydradx.yml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,5 @@ import-storage:
- - - 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY
- 20 # WETH
- free: '100000000000000000000'
Council:
Members: [ 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY ]
TechnicalCommittee:
Members: [ 5GrwvaEF5zXb26Fz9rcQpDWS57CtERHpNehXCPcNoHGKutQY ]
7 changes: 7 additions & 0 deletions launch-configs/fork/prepare-state-for-zombienet.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
const fs = require('fs');
const {TypeRegistry} = require('@polkadot/types');
const {hexToU8a, u8aToHex} = require('@polkadot/util');
const { xxhashAsHex } = require('@polkadot/util-crypto');

// Define network names
const NEW_NAME = process.env.CHAIN_NAME || "Hydration Local Testnet";
Expand Down Expand Up @@ -101,6 +102,12 @@ async function updateChainSpec(inputFile, outputFile) {
...deployer,
};

// Set Configuration.IsTestnet to 1
const IS_TESTNET_KEY =
xxhashAsHex('Parameters', 128).replace('0x', '') +
xxhashAsHex('IsTestnet', 128).replace('0x', '');
REPLACEMENTS[`0x${IS_TESTNET_KEY}`] = '0x01';

// Define keys to delete
const KEYS_TO_DELETE = [
"0x45323df7cc47150b3930e2666b0aa313911a5dd3f1155f5b7d0c5aa102a757f9", // ParachainSystem.lastDmqMqcHead
Expand Down
2 changes: 1 addition & 1 deletion node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydradx"
version = "14.1.1"
version = "14.2.1"
description = "Hydration node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down
8 changes: 0 additions & 8 deletions node/src/chain_spec/local.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,6 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
INITIAL_BALANCE,
),
],
// council members
vec![get_account_id_from_seed::<sr25519::Public>("Alice")],
// technical committee members
vec![
get_account_id_from_seed::<sr25519::Public>("Alice"),
Expand Down Expand Up @@ -107,12 +105,6 @@ pub fn parachain_config() -> Result<ChainSpec, String> {
],
// claims data
create_testnet_claims(),
// elections
vec![
(get_account_id_from_seed::<sr25519::Public>("Alice"), STASH / 5),
(get_account_id_from_seed::<sr25519::Public>("Bob"), STASH / 5),
(get_account_id_from_seed::<sr25519::Public>("Eve"), STASH / 5),
],
// parachain ID
PARA_ID.into(),
DusterConfig {
Expand Down
9 changes: 0 additions & 9 deletions node/src/chain_spec/mod.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ const PARA_ID: u32 = 2034;
const TOKEN_DECIMALS: u8 = 12;
const TOKEN_SYMBOL: &str = "HDX";
const PROTOCOL_ID: &str = "hdx";
const STASH: Balance = 100 * UNITS;

/// The extensions for the [`ChainSpec`].
#[derive(Debug, Clone, Eq, PartialEq, Serialize, Deserialize, ChainSpecExtension, ChainSpecGroup)]
Expand Down Expand Up @@ -93,7 +92,6 @@ pub fn parachain_genesis(
_root_key: AccountId,
initial_authorities: (Vec<(AccountId, AuraId)>, Balance), // (initial auths, candidacy bond)
endowed_accounts: Vec<(AccountId, Balance)>,
council_members: Vec<AccountId>,
tech_committee_members: Vec<AccountId>,
vesting_list: Vec<(AccountId, BlockNumber, BlockNumber, u32, Balance)>,
registered_assets: Vec<(
Expand All @@ -108,7 +106,6 @@ pub fn parachain_genesis(
accepted_assets: Vec<(AssetId, Price)>, // (Asset id, Fallback price) - asset which fee can be paid with
token_balances: Vec<(AccountId, Vec<(AssetId, Balance)>)>,
claims_data: Vec<(EthereumAddress, Balance)>,
elections: Vec<(AccountId, Balance)>,
parachain_id: ParaId,
duster: DusterConfig,
) -> serde_json::Value {
Expand Down Expand Up @@ -143,9 +140,6 @@ pub fn parachain_genesis(
.map(|k| (k.0.clone(), k.1 * UNITS))
.collect::<Vec<_>>(),
},
"council": {
"members": council_members,
},
"technicalCommittee": {
"members": tech_committee_members,
},
Expand Down Expand Up @@ -179,9 +173,6 @@ pub fn parachain_genesis(
},
"treasury": {
},
"elections": {
"members": elections,
},
"genesisHistory": {
"previousChain": hydradx_runtime::Chain::default()
},
Expand Down
8 changes: 0 additions & 8 deletions node/src/chain_spec/rococo.rs
Original file line number Diff line number Diff line change
Expand Up @@ -63,9 +63,6 @@ pub fn _parachain_config_rococo() -> Result<ChainSpec, String> {
hex!["2cb1a0ef4ce819893905e3a6a8e46b652c43aee6c154921220902cabfdcfdd07"].into(),
1_500_000_000,
)],
// council members
// GC - same as sudo
vec![hex!["2cb1a0ef4ce819893905e3a6a8e46b652c43aee6c154921220902cabfdcfdd07"].into()],
// technical committee
// GC - same as sudo
vec![hex!["2cb1a0ef4ce819893905e3a6a8e46b652c43aee6c154921220902cabfdcfdd07"].into()],
Expand All @@ -79,11 +76,6 @@ pub fn _parachain_config_rococo() -> Result<ChainSpec, String> {
vec![],
// claims data
Default::default(),
// elections
vec![(
hex!["2cb1a0ef4ce819893905e3a6a8e46b652c43aee6c154921220902cabfdcfdd07"].into(),
1_200_000_000 * UNITS,
)],
// parachain ID
PARA_ID.into(),
// duster
Expand Down
Loading
Loading