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

chore: upgrade to polkadot v1.11.0 #666

Merged
merged 47 commits into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from 44 commits
Commits
Show all changes
47 commits
Select commit Hold shift + click to select a range
c10c5a8
fix build
Roznovjak Aug 12, 2024
b535204
formatting
Roznovjak Aug 12, 2024
517c000
fix some integration tests
Roznovjak Aug 14, 2024
5948676
add migration
Roznovjak Aug 14, 2024
61644b3
attempt to fix failing integration test
Roznovjak Aug 16, 2024
9a0fe12
fix basilisk_should_swap_assets_coming_from_karura_when_onchain_route…
Roznovjak Aug 16, 2024
cab3512
formatting
Roznovjak Aug 16, 2024
1f53f91
fix integration and benchmarking test
Roznovjak Aug 19, 2024
8176296
satisfy clippy
Roznovjak Aug 19, 2024
f44d42a
formatting
Roznovjak Aug 19, 2024
5982df4
remove unused dependency
Roznovjak Aug 20, 2024
017088b
remove fix in cargo.toml that is no longer needed
Roznovjak Aug 20, 2024
670c098
add GenesisBuilder runtime API
Roznovjak Aug 22, 2024
a4cd52b
formatting
Roznovjak Aug 22, 2024
7ca93bd
bump crate versions
Roznovjak Aug 22, 2024
fafc2cf
move runtime apis to separate file
Roznovjak Aug 23, 2024
85c1f69
fix dependencies
Roznovjak Aug 23, 2024
8c77833
update pallet_xcm benchmarking helper functions
Roznovjak Aug 26, 2024
668380c
fix pallet_xcm benchmarks
Roznovjak Aug 26, 2024
5c2e1ad
rebenchmarking
Roznovjak Aug 27, 2024
c1ec167
fix router benchmarks
Roznovjak Aug 28, 2024
4c827b0
rebenchmark using ref machine
Roznovjak Aug 28, 2024
4b0fb4d
rebenchmark router
Roznovjak Aug 28, 2024
b52420b
fix clippy
Roznovjak Aug 28, 2024
bfb80a8
fix integration test
Roznovjak Aug 28, 2024
b5ff2c4
formatting
Roznovjak Aug 28, 2024
e63bfd7
rebenchmark with correct params
Roznovjak Aug 29, 2024
a22e058
rebenchmark router
Roznovjak Aug 29, 2024
eaf9496
fix integration tests
Roznovjak Aug 29, 2024
fdeca78
formatting
Roznovjak Aug 29, 2024
be8d34c
rebenchmark collator selection pallet with old benchmarking command
Roznovjak Aug 29, 2024
7cd3f27
add storage proof size host functions
Roznovjak Sep 2, 2024
a7fb136
use unified host function
Roznovjak Sep 3, 2024
24c5b57
remove old params for previous migrations
Roznovjak Sep 3, 2024
81917e5
enable proof recording during block import
Roznovjak Sep 3, 2024
4c73aa6
update name of polkadot-sdk repo in zombienet configs
Roznovjak Sep 3, 2024
52c1195
formatting
Roznovjak Sep 3, 2024
fbac6b0
implement XcmPaymentApi
Roznovjak Sep 5, 2024
29577e1
use workspace dependencies
Roznovjak Sep 5, 2024
ceaecba
Merge branch 'master' into polkadot-v1.11.0
Roznovjak Sep 9, 2024
ba21785
remove duplicate dependency
Roznovjak Sep 9, 2024
e4c8c2d
formatting
Roznovjak Sep 9, 2024
4207ac3
bump crate versions
Roznovjak Sep 10, 2024
f3397b8
fix name of the polkadot-sdk repo in zombienet config
Roznovjak Sep 10, 2024
44d32ce
fix error from router benchmarking test
Roznovjak Sep 12, 2024
8976276
Merge branch 'master' into polkadot-v1.11.0
mrq1911 Sep 12, 2024
34a5bdd
set IdleMaxServiceWeight
Roznovjak Sep 13, 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
2,829 changes: 1,703 additions & 1,126 deletions Cargo.lock

Large diffs are not rendered by default.

896 changes: 532 additions & 364 deletions Cargo.toml

Large diffs are not rendered by default.

8 changes: 4 additions & 4 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.0.2"
version = "1.0.3"
description = "Integration tests"
authors = ["GalacticCouncil"]
edition = "2021"
Expand Down Expand Up @@ -112,11 +112,11 @@ cumulus-test-relay-sproof-builder = { workspace = true }

[dev-dependencies]
xcm-emulator = { workspace = true }
hex-literal = "0.4.1"
hex-literal = { workspace = true }
pallet-relaychain-info = { workspace = true }
pretty_assertions = "1.2.1"
pretty_assertions = { workspace = true }
sp-arithmetic = { workspace = true }
test-case = "3.1.0"
test-case = { workspace = true }

[features]
default = ["std"]
Expand Down
22 changes: 15 additions & 7 deletions integration-tests/src/cross_chain_transfer.rs
Original file line number Diff line number Diff line change
Expand Up @@ -31,16 +31,17 @@ fn basilisk_should_receive_asset_when_transferred_from_relaychain() {
assert_ok!(basilisk_runtime::AssetRegistry::set_location(
basilisk_runtime::RuntimeOrigin::root(),
1,
basilisk_runtime::AssetLocation(MultiLocation::parent().into())
basilisk_runtime::AssetLocation(MultiLocation::parent())
));
});
Rococo::execute_with(|| {
assert_ok!(rococo_runtime::XcmPallet::reserve_transfer_assets(
assert_ok!(rococo_runtime::XcmPallet::limited_reserve_transfer_assets(
Copy link
Member

Choose a reason for hiding this comment

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

reserve_transfer_asset was removed?

Copy link
Collaborator Author

Choose a reason for hiding this comment

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

deprecated, so I changed the test to get rid of the warning.

rococo_runtime::RuntimeOrigin::signed(ALICE.into()),
Box::new(Parachain(BASILISK_PARA_ID).into_versioned()),
Box::new(Junction::AccountId32 { id: BOB, network: None }.into_versioned()),
Box::new((Here, 300 * UNITS).into()),
0,
WeightLimit::Unlimited,
));

assert_eq!(
Expand Down Expand Up @@ -105,9 +106,10 @@ fn basilisk_should_receive_asset_when_sent_from_other_parachain() {
assert_ok!(basilisk_runtime::AssetRegistry::set_location(
basilisk_runtime::RuntimeOrigin::root(),
1,
basilisk_runtime::AssetLocation(
MultiLocation::new(1, X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0))).into()
)
basilisk_runtime::AssetLocation(MultiLocation::new(
1,
X2(Junction::Parachain(OTHER_PARA_ID), Junction::GeneralIndex(0))
))
));
});

Expand Down Expand Up @@ -474,7 +476,7 @@ fn assets_should_be_trapped_when_assets_are_unknown() {

expect_basilisk_event(basilisk_runtime::RuntimeEvent::PolkadotXcm(
pallet_xcm::Event::AssetsTrapped {
hash: hash,
hash,
origin: origin.try_into().unwrap(),
assets: vec![asset].into(),
},
Expand Down Expand Up @@ -621,7 +623,13 @@ fn polkadot_xcm_execute_extrinsic_should_not_be_allowed() {
Box::new(VersionedXcm::from(xcm_msg)),
Weight::from_parts(400_000_000_000, 0)
),
pallet_xcm::Error::<basilisk_runtime::Runtime>::Filtered
sp_runtime::DispatchErrorWithPostInfo {
post_info: frame_support::dispatch::PostDispatchInfo {
actual_weight: Some(Weight::from_parts(10355000, 0)),
pays_fee: frame_support::dispatch::Pays::Yes,
},
error: pallet_xcm::Error::<basilisk_runtime::Runtime>::Filtered.into()
}
);
});
}
33 changes: 31 additions & 2 deletions integration-tests/src/exchange_asset.rs
Original file line number Diff line number Diff line change
Expand Up @@ -166,6 +166,35 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() {
))
));

assert_ok!(basilisk_runtime::Tokens::set_balance(
frame_system::RawOrigin::Root.into(),
ALICE.into(),
KAR,
100 * UNITS,
0,
));
assert_ok!(basilisk_runtime::Router::sell(
basilisk_runtime::RuntimeOrigin::signed(ALICE.into()),
KAR,
KSM,
10_000, // make a small swap to not move the price a lot
0,
vec![
Trade {
pool: PoolType::XYK,
asset_in: KAR,
asset_out: BSX,
},
Trade {
pool: PoolType::XYK,
asset_in: BSX,
asset_out: KSM,
}
]
));

basilisk_run_to_next_block();

//Register onchain route from KAR to KSM
assert_ok!(basilisk_runtime::Router::set_route(
RuntimeOrigin::signed(CHARLIE.into()),
Expand Down Expand Up @@ -215,13 +244,13 @@ fn basilisk_should_swap_assets_coming_from_karura_when_onchain_route_present() {
));
});

let fees = 27_500_000_000_000;
let fees = 27_500_000_000_005;
Basilisk::execute_with(|| {
assert_eq!(
basilisk_runtime::Tokens::free_balance(KAR, &AccountId::from(BOB)),
95000000000000 - fees
);
let received = 4969548790555;
let received = 4969548790553;
assert_eq!(
basilisk_runtime::Tokens::free_balance(KSM, &AccountId::from(BOB)),
received
Expand Down
6 changes: 4 additions & 2 deletions integration-tests/src/fees.rs
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,8 @@ fn transaction_fees_should_be_as_expected_when_nft_is_minted() {
format_num(min_multiplier_rust_fees * 10_000 / UNITS, 4),
);

// before trying to fix this test, make sure that CREATE_COLLECTION_OFFSET and MINT_OFFSET
// were added to the rebenchmarked weights.
assert_eq_approx!(
rust_encoded_fees,
expected_rust_encoded_fees,
Expand All @@ -133,8 +135,8 @@ fn transaction_fees_should_be_as_expected_when_nft_is_minted() {
#[test]
fn transaction_fees_should_be_as_expected_when_nft_collection_is_created() {
Basilisk::execute_with(|| {
let expected_rust_encoded_fees = 76_492 * UNITS / 100; //764.92
let expected_ui_fees = 76_597 * UNITS / 100; //765.97
let expected_rust_encoded_fees = 61_167 * UNITS / 100; //611.67
let expected_ui_fees = 61_167 * UNITS / 100; //611.67

let call = pallet_nft::Call::<basilisk_runtime::Runtime>::create_collection {
collection_id: 0,
Expand Down
24 changes: 19 additions & 5 deletions integration-tests/src/kusama_test_net.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ use frame_support::assert_ok;
use frame_support::traits::OnInitialize;
use pallet_transaction_multi_payment::Price;
pub use pallet_xyk::types::AssetPair;
use polkadot_primitives::v6::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_primitives::v7::{BlockNumber, MAX_CODE_SIZE, MAX_POV_SIZE};
use polkadot_runtime_parachains::configuration::HostConfiguration;
use pretty_assertions::assert_eq;
use primitives::{AssetId, Balance};
Expand All @@ -75,7 +75,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 @@ -144,8 +144,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 @@ -256,7 +254,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()
},
configuration: rococo_runtime::ConfigurationConfig {
Expand Down Expand Up @@ -512,6 +510,22 @@ pub fn vesting_account() -> AccountId {
VestingPalletId::get().into_account_truncating()
}

pub fn basilisk_run_to_next_block() {
use frame_support::traits::OnFinalize;

let b = basilisk_runtime::System::block_number();

basilisk_runtime::System::on_finalize(b);
basilisk_runtime::EmaOracle::on_finalize(b);
basilisk_runtime::MultiTransactionPayment::on_finalize(b);

basilisk_runtime::System::on_initialize(b + 1);
basilisk_runtime::EmaOracle::on_initialize(b + 1);
basilisk_runtime::MultiTransactionPayment::on_initialize(b + 1);

basilisk_runtime::System::set_block_number(b + 1);
}

pub fn set_relaychain_block_number(number: BlockNumber) {
use basilisk_runtime::ParachainSystem;
use basilisk_runtime::RuntimeOrigin;
Expand Down
15 changes: 0 additions & 15 deletions integration-tests/src/non_native_fee.rs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ use frame_support::{
traits::SignedExtension,
transaction_validity::{InvalidTransaction, TransactionValidityError},
},
traits::{OnFinalize, OnInitialize},
weights::Weight,
};
use hydradx_traits::AMM;
Expand All @@ -21,20 +20,6 @@ use pallet_transaction_multi_payment::Price;
use primitives::AssetId;
use xcm_emulator::TestExt;

pub fn basilisk_run_to_next_block() {
let b = basilisk_runtime::System::block_number();

basilisk_runtime::System::on_finalize(b);
basilisk_runtime::EmaOracle::on_finalize(b);
basilisk_runtime::MultiTransactionPayment::on_finalize(b);

basilisk_runtime::System::on_initialize(b + 1);
basilisk_runtime::EmaOracle::on_initialize(b + 1);
basilisk_runtime::MultiTransactionPayment::on_initialize(b + 1);

basilisk_runtime::System::set_block_number(b + 1);
}

#[test]
fn non_native_fee_payment_works_with_configured_price() {
TestNet::reset();
Expand Down
17 changes: 1 addition & 16 deletions integration-tests/src/oracle.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,26 +3,11 @@
use crate::kusama_test_net::*;

use basilisk_runtime::{EmaOracle, RuntimeOrigin, XYKOracleSourceIdentifier, XYK};
use frame_support::{
assert_ok,
traits::{OnFinalize, OnInitialize},
};
use frame_support::assert_ok;
use hydradx_traits::{AggregatedPriceOracle, OraclePeriod::*};
use pallet_ema_oracle::OracleError;
use xcm_emulator::TestExt;

pub fn basilisk_run_to_next_block() {
let b = basilisk_runtime::System::block_number();

basilisk_runtime::System::on_finalize(b);
basilisk_runtime::EmaOracle::on_finalize(b);

basilisk_runtime::System::on_initialize(b + 1);
basilisk_runtime::EmaOracle::on_initialize(b + 1);

basilisk_runtime::System::set_block_number(b + 1);
}

#[test]
fn xyk_trades_are_ingested_into_oracle() {
TestNet::reset();
Expand Down
2 changes: 1 addition & 1 deletion integration-tests/src/router.rs
Original file line number Diff line number Diff line change
Expand Up @@ -375,7 +375,7 @@ mod xyk_router_tests {
0,
trades
),
pallet_route_executor::Error::<basilisk_runtime::Runtime>::InsufficientBalance
pallet_xyk::Error::<basilisk_runtime::Runtime>::InsufficientAssetBalance
);

assert_trader_bsx_balance!(BOB_INITIAL_BSX_BALANCE);
Expand Down
4 changes: 2 additions & 2 deletions integration-tests/src/transact_call_filter.rs
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ fn allowed_transact_call_should_pass_filter() {
let message = Xcm(vec![
WithdrawAsset(asset_to_withdraw.into()),
BuyExecution {
fees: asset_for_buy_execution.into(),
fees: asset_for_buy_execution,
weight_limit: Unlimited,
},
Transact {
Expand Down Expand Up @@ -247,7 +247,7 @@ fn safe_call_filter_should_respect_runtime_call_filter() {
});

//Assert
Basilisk::execute_with(|| assert_xcm_message_processing_failed());
Basilisk::execute_with(assert_xcm_message_processing_failed);
}

fn basilisk_location() -> Location {
Expand Down
2 changes: 1 addition & 1 deletion launch-configs/zombienet/local.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"provider": "native"
},
"relaychain": {
"default_command": "../../../polkadot/target/release/polkadot",
"default_command": "../../../polkadot-sdk/target/release/polkadot",
"chain": "rococo-local",
"default_args": [
"--no-hardware-benchmarks",
Expand Down
20 changes: 10 additions & 10 deletions node/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[package]
name = "basilisk"
version = "14.0.0"
version = "15.0.0"
description = "Basilisk node"
authors = ["GalacticCouncil"]
edition = "2021"
Expand All @@ -19,14 +19,14 @@ 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.4.1"
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"
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 }

# local dependencies
basilisk-runtime = { path = "../runtime/basilisk" }
Expand Down Expand Up @@ -81,7 +81,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
13 changes: 4 additions & 9 deletions node/src/command.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,18 +17,18 @@

use crate::chain_spec;
use crate::cli::{Cli, RelayChainCli, Subcommand};
use crate::service::{new_partial, BasiliskNativeExecutor};
use crate::service::new_partial;

use basilisk_runtime::Block;
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 log::info;
use sc_cli::{
ChainSpec, CliConfiguration, DefaultConfigurationValues, ImportParams, KeystoreParams, NetworkParams, Result,
RuntimeVersion, SharedParams, SubstrateCli,
};
use sc_executor::{sp_wasm_interface::ExtendedHostFunctions, NativeExecutionDispatch};
use sc_service::config::{BasePath, PrometheusConfig};
use sp_core::hexdisplay::HexDisplay;
use sp_runtime::traits::Block as BlockT;
Expand Down Expand Up @@ -193,12 +193,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,
<BasiliskNativeExecutor as NativeExecutionDispatch>::ExtendHostFunctions,
>>(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 @@ -301,7 +296,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
Loading