Skip to content
Merged
Show file tree
Hide file tree
Changes from 29 commits
Commits
Show all changes
61 commits
Select commit Hold shift + click to select a range
6dc194e
fix build
Roznovjak Aug 7, 2024
d230c7c
satisfy clippy
Roznovjak Aug 7, 2024
9339bd1
formatting
Roznovjak Aug 7, 2024
e8f5d2b
fix runtime tests
Roznovjak Aug 7, 2024
968ca07
small fixes in mock files
Roznovjak Aug 9, 2024
def29e1
impl DisabledEvmPermitHandler
Roznovjak Aug 9, 2024
124e289
export publicly DisabledEvmPermitHandler
Roznovjak Aug 9, 2024
625cde2
Revert "export publicly DisabledEvmPermitHandler"
Roznovjak Aug 9, 2024
76b333b
move runtime apis to separate file
Roznovjak Aug 23, 2024
1f8711c
fix dependencies
Roznovjak Aug 23, 2024
79f3c66
various updates
Roznovjak Sep 5, 2024
90514bc
use workspace dependencies
Roznovjak Sep 6, 2024
e465fe2
implement XcmPaymentApi
Roznovjak Sep 8, 2024
c34d1db
fix some integration tests
Roznovjak Sep 9, 2024
55b78ae
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 9, 2024
12f6594
formatting
Roznovjak Sep 9, 2024
8c86b33
bump crate versions
Roznovjak Sep 10, 2024
dc5622e
satisfy clippy
Roznovjak Sep 10, 2024
bb3bf1b
rebenchmarking
Roznovjak Sep 11, 2024
c9a599c
rebenchmark router
Roznovjak Sep 11, 2024
117aa79
rebenchmark dca and otc-settlements
Roznovjak Sep 11, 2024
205248b
fix import of WeightInfo in otc-settlements weight file
Roznovjak Sep 11, 2024
49dba56
fix integration tests
Roznovjak Sep 11, 2024
6d01464
remove unused import from weight file
Roznovjak Sep 11, 2024
39879cd
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 13, 2024
8101993
set IdleMaxServiceWeight
Roznovjak Sep 13, 2024
e4b3df4
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 19, 2024
936f5c5
rebenchmark omnipool liquidity mining
Roznovjak Sep 19, 2024
597cad1
bump crate versions
Roznovjak Sep 19, 2024
5ceffff
update scraper to use dependencies from main cargo file
Roznovjak Sep 23, 2024
2f5304f
rebenchmark utility pallet
Roznovjak Sep 23, 2024
8f101ca
satisfy clippy
Roznovjak Sep 23, 2024
043bd32
do not use exact balance checks in exchange_asset integration tests
Roznovjak Sep 23, 2024
c475e79
remove whitelist check in liquidity mining tests
Roznovjak Sep 23, 2024
4d0fad8
formatting
Roznovjak Sep 23, 2024
03e0bf1
add logic for accepting DOT from AH
dmoka Sep 23, 2024
1a1a580
add test for transfering dot to AH while AH is the reserve chain
dmoka Sep 23, 2024
ae9f1eb
formatting
dmoka Sep 23, 2024
2b6a290
bump versions
dmoka Sep 23, 2024
90a02c6
formatting
dmoka Sep 23, 2024
53e6862
adjust integration test
dmoka Sep 24, 2024
d6a58eb
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 24, 2024
e5d99f9
fix typo in integration tests
Roznovjak Sep 24, 2024
e974e75
fix integration tests
Roznovjak Sep 24, 2024
20a7520
bump crate versions
Roznovjak Sep 24, 2024
f720fcb
satisfy clippy
Roznovjak Sep 24, 2024
5903e92
add xcm fee payment api tests
Roznovjak Sep 25, 2024
ed82551
Merge remote-tracking branch 'origin/polkadot-v1.11.0' into feat/make…
dmoka Sep 25, 2024
bdf96de
formatting
Roznovjak Sep 26, 2024
9e283e6
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 26, 2024
e0bf16d
fix naming
dmoka Sep 27, 2024
b65cfc4
Update integration-tests/src/cross_chain_transfer.rs
dmoka Sep 27, 2024
d641057
formatting
dmoka Sep 27, 2024
8ce272e
Merge remote-tracking branch 'origin/polkadot-v1.11.0' into feat/make…
dmoka Sep 27, 2024
b4fe1bf
bump versions
dmoka Sep 27, 2024
1507f37
Merge pull request #911 from galacticcouncil/feat/make-ah-dot-reserve2
dmoka Sep 27, 2024
dcaae53
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 29, 2024
d034bff
bump runtime version
Roznovjak Sep 30, 2024
9f62818
do not store duplicate values in duster whitelist in liq mining mock …
Roznovjak Oct 3, 2024
bf74970
fix integration tests with exact values that often change
Roznovjak Oct 3, 2024
04e34c4
remove impl of EstimateGasAdapter
Roznovjak Oct 3, 2024
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
3,590 changes: 2,124 additions & 1,466 deletions Cargo.lock

Large diffs are not rendered by default.

900 changes: 544 additions & 356 deletions Cargo.toml

Large diffs are not rendered by default.

6 changes: 3 additions & 3 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.23.4"
version = "1.23.5"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand All @@ -11,7 +11,7 @@ repository = "https://github.com/galacticcouncil/HydraDX-node"
[dependencies]
hex-literal = { workspace = true }
frame-remote-externalities = { workspace = true }
tokio = { version = "1", features = ["macros", "rt-multi-thread"] }
tokio = { workspace = true }
scraper = { workspace = true }
primitives = { workspace = true }
hydradx-runtime = { workspace = true }
Expand Down Expand Up @@ -133,7 +133,7 @@ polkadot-runtime-parachains = { workspace = true }
rococo-runtime = { workspace = true }

[dev-dependencies]
pretty_assertions = "1.2.1"
pretty_assertions = { workspace = true }
pallet-relaychain-info = { workspace = true }
xcm-emulator = { workspace = true }
test-utils = { workspace = true }
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/src/cross_chain_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -45,12 +45,13 @@ fn hydra_should_receive_asset_when_transferred_from_rococo_relay_chain() {

Rococo::execute_with(|| {
//Act
assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets(
assert_ok!(rococo_runtime::XcmPallet::limited_reserve_transfer_assets(
rococo_runtime::RuntimeOrigin::signed(ALICE.into()),
Box::new(Parachain(HYDRA_PARA_ID).into_versioned()),
Box::new(Junction::AccountId32 { id: BOB, network: None }.into_versioned()),
Box::new((Here, 300 * UNITS).into()),
0,
WeightLimit::Unlimited,
));

//Assert
Expand Down Expand Up @@ -489,7 +490,7 @@ fn claim_trapped_asset_should_work() {
Hydra::execute_with(|| {
assert_eq!(
hydradx_runtime::Tokens::free_balance(1, &AccountId::from(BOB)),
1_029_939_717_395_149 //1000 * UNITS + 30 * UNITS - fee
1_029_929_954_984_403 //1000 * UNITS + 30 * UNITS - fee
);

let origin = MultiLocation::new(1, X1(Junction::Parachain(ACALA_PARA_ID)));
Expand Down
5 changes: 3 additions & 2 deletions integration-tests/src/evm.rs
Original file line number Diff line number Diff line change
Expand Up @@ -253,8 +253,9 @@ mod account_conversion {
let fee_raw = hydradx_runtime::TransactionPayment::compute_fee_details(len, &info, 0);
let fee = fee_raw.final_fee();

// simple test that the fee is approximately 10/4 HDX (it was originally 10 HDX, but we divided the fee by 4 in the config)
assert_eq!(fee / UNITS, 10 / 4);
// assert that the fee is within some range
assert!(fee > 2 * UNITS);
assert!(fee < 4 * UNITS);
});
}

Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/evm_permit.rs
Original file line number Diff line number Diff line change
Expand Up @@ -746,7 +746,7 @@ fn evm_permit_set_currency_dispatch_should_pay_evm_fee_in_chosen_currency() {
let user_dai_balance = user_acc.balance(DAI);
assert!(user_dai_balance < initial_user_dai_balance);
let dai_diff = initial_user_dai_balance - user_dai_balance;
assert_eq!(dai_diff, 1_636_422_440_118_273);
assert_eq!(dai_diff, 1_639_386_316_054_024);
})
}

Expand Down Expand Up @@ -1141,7 +1141,7 @@ fn dispatch_permit_should_increase_account_nonce_correctly() {

let hdx_balance = user_acc.balance(HDX);
let tx_fee = initial_user_hdx_balance - hdx_balance;
assert_eq!(tx_fee, 1_797_084_195_590);
assert_eq!(tx_fee, 1_809_384_860_344);
})
}

Expand Down
8 changes: 4 additions & 4 deletions integration-tests/src/exchange_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -330,7 +330,7 @@ fn transfer_and_swap_should_work_with_4_hops() {

assert_eq!(
hydradx_runtime::Currencies::free_balance(IBTC, &AccountId::from(BOB)),
549839246387064
549813213291742
Comment thread
Roznovjak marked this conversation as resolved.
Outdated
);
let fee = hydradx_runtime::Tokens::free_balance(IBTC, &hydradx_runtime::Treasury::account_id());

Expand Down Expand Up @@ -515,7 +515,7 @@ pub mod zeitgeist_use_cases {
Zeitgeist::execute_with(|| {
pretty_assertions::assert_eq!(
hydradx_runtime::Tokens::free_balance(HDX_ON_OTHER_PARACHAIN, &AccountId::from(ALICE)),
8142821444432895
8129541527696052
);
});
}
Expand Down Expand Up @@ -730,7 +730,7 @@ pub mod zeitgeist_use_cases {
Zeitgeist::execute_with(|| {
pretty_assertions::assert_eq!(
hydradx_runtime::Tokens::free_balance(IBTC, &AccountId::from(ALICE)),
9839246387064
9813213291742
);
});
}
Expand Down Expand Up @@ -1003,7 +1003,7 @@ pub mod zeitgeist_use_cases {
Zeitgeist::execute_with(|| {
pretty_assertions::assert_eq!(
hydradx_runtime::Tokens::free_balance(IBTC, &AccountId::from(ALICE)),
9839246387064
9813213291742
);
});
}
Expand Down
10 changes: 5 additions & 5 deletions integration-tests/src/non_native_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() {
)
);
let bob_balance = hydradx_runtime::Tokens::free_balance(BTC, &AccountId::from(BOB));
assert_eq!(bob_balance, 999991);
assert_eq!(bob_balance, 999990);

assert_ok!(hydradx_runtime::Balances::force_set_balance(
hydradx_runtime::RuntimeOrigin::root(),
Expand Down Expand Up @@ -76,7 +76,7 @@ fn non_native_fee_payment_works_with_oracle_price_based_on_onchain_route() {
);

let dave_balance = hydradx_runtime::Tokens::free_balance(DAI, &AccountId::from(DAVE));
assert_eq!(dave_balance, 999_998_091_159_455_519_200);
assert_eq!(dave_balance, 999_997_998_229_378_745_200);
});
}

Expand Down Expand Up @@ -109,7 +109,7 @@ fn set_currency_should_work_in_batch_transaction_when_first_tx() {
)
);
let bob_balance = hydradx_runtime::Tokens::free_balance(BTC, &AccountId::from(BOB));
assert_eq!(bob_balance, 999991);
assert_eq!(bob_balance, 999990);
});

TestNet::reset();
Expand Down Expand Up @@ -139,7 +139,7 @@ fn set_currency_should_work_in_batch_transaction_when_first_tx() {
)
);
let bob_balance = hydradx_runtime::Tokens::free_balance(BTC, &AccountId::from(BOB));
assert_eq!(bob_balance, 999991);
assert_eq!(bob_balance, 999990);
});

TestNet::reset();
Expand Down Expand Up @@ -169,7 +169,7 @@ fn set_currency_should_work_in_batch_transaction_when_first_tx() {
)
);
let bob_balance = hydradx_runtime::Tokens::free_balance(BTC, &AccountId::from(BOB));
assert_eq!(bob_balance, 999991);
assert_eq!(bob_balance, 999990);
});
}

Expand Down
12 changes: 5 additions & 7 deletions integration-tests/src/polkadot_test_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
use frame_support::{
assert_ok,
sp_runtime::{
traits::{AccountIdConversion, Block as BlockT, Dispatchable},
traits::{AccountIdConversion, Block as BlockT, Dispatchable, HashingFor},
BuildStorage, FixedU128, Permill,
},
traits::{GetCallMetadata, OnInitialize},
Expand All @@ -18,7 +18,7 @@ use hex_literal::hex;
use hydradx_runtime::{evm::WETH_ASSET_LOCATION, Referrals, RuntimeOrigin};
pub use hydradx_traits::{evm::InspectEvmAccounts, registry::Mutate};
use pallet_referrals::{FeeDistribution, Level};
pub use polkadot_primitives::v6::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE};
pub use polkadot_primitives::v7::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_runtime_parachains::configuration::HostConfiguration;
use sp_consensus_beefy::ecdsa_crypto::AuthorityId as BeefyId;
use sp_core::storage::Storage;
Expand Down Expand Up @@ -120,7 +120,7 @@ decl_test_networks! {
}

decl_test_relay_chains! {
#[api_version(10)]
#[api_version(11)]
pub struct RococoRelayChain {
genesis = rococo::genesis(),
on_init = {
Expand Down Expand Up @@ -259,8 +259,6 @@ pub mod rococo {
max_code_size: MAX_CODE_SIZE,
max_pov_size: MAX_POV_SIZE,
max_head_data_size: 32 * 1024,
group_rotation_frequency: 20,
paras_availability_period: 4,
max_upward_queue_count: 8,
max_upward_queue_size: 1024 * 1024,
max_downward_message_size: 1024,
Expand Down Expand Up @@ -378,7 +376,7 @@ pub mod rococo {
},
babe: rococo_runtime::BabeConfig {
authorities: Default::default(),
epoch_config: Some(rococo_runtime::BABE_GENESIS_EPOCH_CONFIG),
epoch_config: rococo_runtime::BABE_GENESIS_EPOCH_CONFIG,
..Default::default()
},
..Default::default()
Expand Down Expand Up @@ -767,7 +765,7 @@ pub fn rococo_run_to_block(to: BlockNumber) {

pub fn hydra_live_ext(
path_to_snapshot: &str,
) -> frame_remote_externalities::RemoteExternalities<hydradx_runtime::Block> {
) -> frame_remote_externalities::RemoteExternalities<HashingFor<hydradx_runtime::Block>> {
let ext = tokio::runtime::Builder::new_current_thread()
.enable_all()
.build()
Expand Down
2 changes: 0 additions & 2 deletions integration-tests/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1352,7 +1352,6 @@ mod omnipool_router_tests {
let extra_ed_charge = UNITS / 10;
assert_balance!(ALICE.into(), HDX, 1000 * UNITS - ed);

let amount_to_sell = amount_to_sell;
assert_ok!(Router::sell(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
insufficient_asset_1,
Expand Down Expand Up @@ -5408,7 +5407,6 @@ mod sell_all {
assert_balance!(ALICE.into(), pool_id, 0);

//Act
let amount_to_sell = 3000 * UNITS;
assert_ok!(Router::sell_all(
hydradx_runtime::RuntimeOrigin::signed(ALICE.into()),
stable_asset_1,
Expand Down
35 changes: 20 additions & 15 deletions math/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -6,31 +6,36 @@ license = 'Apache-2.0'
name = "hydra-dx-math"
description = "A collection of utilities to make performing liquidity pool calculations more convenient."
repository = 'https://github.com/galacticcouncil/hydradx-math'
version = "8.1.2"
version = "8.1.3"

[dependencies]
primitive-types = {default-features = false, version = '0.12.0'}
num-traits = {default-features = false, version = "0.2.14"}
fixed = { version = "=1.15.0", features = ["num-traits"] }
primitive-types = { workspace = true }
num-traits = { workspace = true }
fixed = { workspace = true, features = ["num-traits"] }
# Added because of use of the FixedU128, used to implement `Ratio`
codec = { package = "parity-scale-codec", version = "3.4.0", default-features = false, features = ["derive", "max-encoded-len"] }
scale-info = { version = "2.1.1", default-features = false, features = ["derive"] }
codec = { workspace = true, features = ["derive", "max-encoded-len"] }
scale-info = { workspace = true }
sp-arithmetic = { workspace = true }
sp-std = { workspace = true }
serde = { version = "1.0.136", default-features = false }
serde = { workspace = true }

[dev-dependencies]
approx = "0.5.1"
criterion = "0.4.0"
proptest = "1.0.0"
rand = { version = "0.8.5", default-features = false, features= ["std_rng"] }
rand_xoshiro = "0.6.0"
rug = { version = "1.17.0", features = ["num-traits"] }
test-case = "2.2.1"
approx = { workspace = true }
criterion = { workspace = true }
proptest = { workspace = true }
rand = { workspace = true, features= ["std_rng"] }
rand_xoshiro = { workspace = true }
rug = { workspace = true }
test-case = { workspace = true }

[features]
default = ["std"]
std = ["codec/std", "serde/std", "sp-arithmetic/std", "sp-std/std"]
std = [
"codec/std",
"serde/std",
"sp-arithmetic/std",
"sp-std/std"
]
runtime-benchmarks = []

[[bench]]
Expand Down
22 changes: 11 additions & 11 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "hydradx"
version = "13.1.2"
version = "14.0.0"
description = "Hydration node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand All @@ -18,15 +18,15 @@ targets = ["x86_64-unknown-linux-gnu"]
hydra-dx-build-script-utils = { workspace = true }

[dependencies]
codec = { package = "parity-scale-codec", version = "3.4.0" }
hex-literal = "0.3.4"
jsonrpsee = { version = "0.20.3", features = ["server", "macros"] }
log = "0.4.17"
serde = { version = "1.0.136", features = ["derive"] }
serde_json = "1.0.85"
clap = { version = "4.1.8", features = [ "derive" ] }
futures = "0.3.21"
async-trait = "0.1"
codec = { workspace = true }
hex-literal = { workspace = true }
jsonrpsee = { workspace = true }
log = { workspace = true }
serde = { workspace = true }
serde_json = { workspace = true }
clap = { workspace = true }
futures = { workspace = true }
async-trait = { workspace = true }

# local dependencies
hydradx-runtime = { workspace = true , features = ["std"] }
Expand Down Expand Up @@ -82,7 +82,7 @@ sp-authority-discovery = { workspace = true }
frame-try-runtime = { workspace = true, optional = true }
substrate-state-trie-migration-rpc = { workspace = true }

trie-db = "0.28.0"
trie-db = { workspace = true }
sp-state-machine = { workspace = true }

# Cumulus dependencies
Expand Down
11 changes: 3 additions & 8 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@ use crate::cli::{Cli, RelayChainCli, Subcommand};
use crate::service::new_partial;

use codec::Encode;
use cumulus_client_service::storage_proof_size::HostFunctions as ReclaimHostFunctions;
use cumulus_primitives_core::ParaId;
use frame_benchmarking_cli::{BenchmarkCmd, SUBSTRATE_REFERENCE_HARDWARE};
use hydradx_runtime::Block;
Expand All @@ -28,7 +29,6 @@ use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result,
RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_executor::sp_wasm_interface::ExtendedHostFunctions;
use sc_service::config::{BasePath, PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::{
Expand Down Expand Up @@ -194,12 +194,7 @@ pub fn run() -> sc_cli::Result<()> {
match cmd {
BenchmarkCmd::Pallet(cmd) => {
if cfg!(feature = "runtime-benchmarks") {
runner.sync_run(|config| {
cmd.run::<Block, ExtendedHostFunctions<
sp_io::SubstrateHostFunctions,
frame_benchmarking::benchmarking::HostFunctions,
>>(config)
})
runner.sync_run(|config| cmd.run_with_spec::<sp_runtime::traits::HashingFor<Block>, ReclaimHostFunctions>(Some(config.chain_spec)))
} else {
Err("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`."
Expand Down Expand Up @@ -296,7 +291,7 @@ pub fn run() -> sc_cli::Result<()> {
let id = ParaId::from(para_id);

let parachain_account =
AccountIdConversion::<polkadot_primitives::v6::AccountId>::into_account_truncating(&id);
AccountIdConversion::<polkadot_primitives::v7::AccountId>::into_account_truncating(&id);

let state_version = Cli::runtime_version().state_version();

Expand Down
Loading