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

Integrate XCM Simulator with LAOS Runtime and Add Comprehensive Tests #800

Merged
merged 71 commits into from
Oct 8, 2024
Merged
Show file tree
Hide file tree
Changes from 66 commits
Commits
Show all changes
71 commits
Select commit Hold shift + click to select a range
9b47df5
init of integration
asiniscalchi Oct 1, 2024
a3bf09f
test cxm-simultor moved
asiniscalchi Oct 1, 2024
7ea3532
add laos-runtime dep
asiniscalchi Oct 1, 2024
cc12491
renaming staging packages
asiniscalchi Oct 1, 2024
3044832
add simulator
asiniscalchi Oct 1, 2024
b20e677
simulator example integrated
asiniscalchi Oct 1, 2024
87b1008
simulator example integrated
asiniscalchi Oct 1, 2024
0a1112b
integrate simultaor
asiniscalchi Oct 1, 2024
d3639ef
integrate simultaor
asiniscalchi Oct 1, 2024
bfa6894
starign point
asiniscalchi Oct 1, 2024
dc53594
starign point
asiniscalchi Oct 1, 2024
a2c129d
active DmpMessage
asiniscalchi Oct 1, 2024
0c3b14f
added mock msg queue
asiniscalchi Oct 1, 2024
9603126
pallet mock msg queue compiling
asiniscalchi Oct 1, 2024
e9f51a2
thinking to the runtime
asiniscalchi Oct 1, 2024
b2253d3
refactoring
asiniscalchi Oct 1, 2024
0549f0f
xcm-simulator copiles
asiniscalchi Oct 2, 2024
002b0b5
added laosish
asiniscalchi Oct 2, 2024
1346f85
added laosish
asiniscalchi Oct 2, 2024
ff84856
starting laosish
asiniscalchi Oct 2, 2024
b52d161
laos-primitives feature fix
asiniscalchi Oct 2, 2024
0c77ccb
laosish has lso balances
asiniscalchi Oct 2, 2024
0a142d4
laosish uses laos system
asiniscalchi Oct 2, 2024
76bec1b
rollback xcm_config
asiniscalchi Oct 2, 2024
30f43ef
add laosish xcm_config
asiniscalchi Oct 2, 2024
e2cfca9
added types
asiniscalchi Oct 2, 2024
e476524
using accountid20
asiniscalchi Oct 2, 2024
a1e7137
using accountid20
asiniscalchi Oct 2, 2024
e0c3555
balances is from laos
asiniscalchi Oct 2, 2024
c3c31ee
balances is from laos
asiniscalchi Oct 2, 2024
89a6414
system by laos
asiniscalchi Oct 2, 2024
2d30571
remove warning
asiniscalchi Oct 2, 2024
b6b086f
removed unused code
asiniscalchi Oct 2, 2024
3e6af1e
xcm_config integration
asiniscalchi Oct 2, 2024
fd47237
removed mock
asiniscalchi Oct 2, 2024
eb29d46
rollback some changes
asiniscalchi Oct 2, 2024
8885a9e
remove staging_
asiniscalchi Oct 3, 2024
1ed113e
ParachainInfo integrated
asiniscalchi Oct 3, 2024
6e23120
facing xcm_cofig
asiniscalchi Oct 3, 2024
4e71706
remove warning
asiniscalchi Oct 3, 2024
ef19cfa
fixing Cargo.toml
asiniscalchi Oct 3, 2024
6ae9968
Merge branch 'main' into feature/integration-xcm-simulator
asiniscalchi Oct 3, 2024
a14f538
using Cargo.lock of main
asiniscalchi Oct 3, 2024
f145175
using workspace deps
asiniscalchi Oct 3, 2024
558d2d8
fix comoilation
asiniscalchi Oct 3, 2024
9609540
fmt
asiniscalchi Oct 3, 2024
b9534fe
refactoring
asiniscalchi Oct 4, 2024
0a8a1f5
add Laoish networjk
asiniscalchi Oct 4, 2024
50b8c10
deactive insecure zero ED
asiniscalchi Oct 4, 2024
34d93d7
clippy
asiniscalchi Oct 4, 2024
2414c26
added cumulus_xcm
asiniscalchi Oct 4, 2024
5bf8877
active SiblingParachainAsNative
asiniscalchi Oct 4, 2024
8457354
refactoring
asiniscalchi Oct 4, 2024
80b571b
refactoring
asiniscalchi Oct 4, 2024
1edd0c7
refactoring
asiniscalchi Oct 4, 2024
44a23b5
added laosish ump test
asiniscalchi Oct 4, 2024
0783497
refactoring
asiniscalchi Oct 4, 2024
586c442
rafactoring: mod tests extracted
asiniscalchi Oct 4, 2024
871fec5
created module test laoish
asiniscalchi Oct 4, 2024
7db59cb
initializing ethereum
asiniscalchi Oct 4, 2024
37bfbb9
funding account
asiniscalchi Oct 4, 2024
2119906
clippy
asiniscalchi Oct 4, 2024
073600c
Update xcm-simulator/src/relay_chain.rs
asiniscalchi Oct 7, 2024
9588bfe
Update xcm-simulator/src/relay_chain.rs
asiniscalchi Oct 7, 2024
70e188c
Update xcm-simulator/src/parachain.rs
asiniscalchi Oct 7, 2024
d698d72
Update xcm-simulator/src/parachain.rs
asiniscalchi Oct 7, 2024
c5b317e
Merge branch 'main' into feature/integration-xcm-simulator
asiniscalchi Oct 7, 2024
b1ea3c8
refactoring
asiniscalchi Oct 8, 2024
ab507ff
remove warnings
asiniscalchi Oct 8, 2024
c1f4949
removed unused code
asiniscalchi Oct 8, 2024
ed12421
identation
asiniscalchi Oct 8, 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
254 changes: 166 additions & 88 deletions Cargo.lock

Large diffs are not rendered by default.

14 changes: 5 additions & 9 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ description = "The LAOS parachain node."
repository = "https://github.com/freeverseio/laos.git"
homepage = "https://www.laosfoundation.io"
authors = ["Freeverse"]
edition = "2021"
version = "0.22.0"

[workspace]
Expand All @@ -14,6 +15,7 @@ members = [
"pallets/*",
"precompiles/*",
"primitives",
"xcm-simulator"
]

[workspace.dependencies]
Expand Down Expand Up @@ -59,6 +61,7 @@ sp-state-machine = { git = "https://github.com/paritytech/polkadot-sdk", branch
sp-consensus-slots = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
sp-weights ={ git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
sp-genesis-builder ={ git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
sp-tracing ={ git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }

# (native)
sp-blockchain = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
Expand Down Expand Up @@ -123,6 +126,7 @@ pallet-membership = { git = "https://github.com/paritytech/polkadot-sdk", branch
pallet-transaction-payment = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
pallet-preimage = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
pallet-uniques = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
pallet-vesting = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
pallet-proxy = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
frame-benchmarking = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
Expand Down Expand Up @@ -207,20 +211,12 @@ cumulus-pallet-xcm = { git = "https://github.com/paritytech/polkadot-sdk", branc
xcm = { package = "staging-xcm", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
xcm-builder = { package = "staging-xcm-builder", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
xcm-executor = { package = "staging-xcm-executor", git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }
xcm-simulator = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0", default-features = false }

# (native)
polkadot-cli = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }
polkadot-service = { git = "https://github.com/paritytech/polkadot-sdk", branch = "release-polkadot-v1.11.0" }

# Orml
# (wasm)
# TODO This code has been commented out when upgrading polkadot-sdk from v1.1.0 to 1.6.0
# because conflicts with orml-trait crate and currently XCM is not used. It should be
# uncommented and fixed when XCM is used in the runtime.
# orml-traits = { version = "0.7.0", default-features = false }
# orml-xcm-support = { version = "0.7.0", default-features = false }
# orml-xtokens = { version = "0.7.0", default-features = false }

# Other pallets
# (wasm)
substrate-fixed = { git = "https://github.com/encointer/substrate-fixed", default-features = false }
Expand Down
1 change: 1 addition & 0 deletions primitives/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -29,4 +29,5 @@ std = [
"fp-account/std",
"sp-consensus-aura/std",
"cumulus-primitives-core/std",
"parachains-common/std"
]
6 changes: 0 additions & 6 deletions runtime/laos/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -114,12 +114,6 @@ precompile-utils = { workspace = true }
[dev-dependencies]
precompile-utils = { workspace = true, features = ["testing"] }
evm = { workspace = true }
# TODO This code has been commented out when upgrading polkadot-sdk from v1.1.0 to 1.6.0
# because conflicts with orml-trait crate and currently XCM is not used. It should be
# uncommented and fixed when XCM is used in the runtime.
# orml-traits = { workspace = true }
# orml-xtokens = { workspace = true, features = ["std"] }
# orml-xcm-support = { workspace = true, features = ["std"] }
polkadot-runtime-parachains = { workspace = true }
pallet-assets = { workspace = true }
test-utils = { workspace = true }
Expand Down
74 changes: 74 additions & 0 deletions xcm-simulator/Cargo.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,74 @@
[package]
name = "xcm-simulator-example"
description = "Examples of xcm-simulator usage."
authors.workspace = true
edition.workspace = true
version = "7.0.0"

[dependencies]
parity-scale-codec = { workspace = true }
scale-info = { workspace = true }
log = { workspace = true }
hex-literal = { workspace = true }

frame-system = { workspace = true }
frame-support = { workspace = true }
pallet-balances = { workspace = true, features = ["insecure_zero_ed"] }
pallet-message-queue = { workspace = true }
pallet-uniques = { workspace = true }
sp-std = { workspace = true }
sp-core = { workspace = true }
sp-runtime = { workspace = true }
sp-io = { workspace = true }
sp-tracing = { workspace = true }

xcm = { workspace = true }
xcm-simulator = { workspace = true }
xcm-executor = { workspace = true }
xcm-builder = { workspace = true }
pallet-xcm = { workspace = true }
polkadot-core-primitives = { workspace = true }
polkadot-runtime-parachains = { workspace = true }
polkadot-parachain-primitives = { workspace = true }
laos-primitives = { workspace = true }
parachain-info = { workspace = true }
cumulus-pallet-xcm = { workspace = true }


[features]
default = ["std"]
std = [
"cumulus-pallet-xcm/std",
"parachain-info/std",
"laos-primitives/std",
"frame-system/std",
"frame-support/std",
"pallet-balances/std",
"pallet-message-queue/std",
"pallet-uniques/std",
"sp-std/std",
"sp-core/std",
"sp-runtime/std",
"sp-io/std",
"sp-tracing/std",
"xcm/std",
"xcm-executor/std",
"xcm-builder/std",
"pallet-xcm/std",
"polkadot-core-primitives/std",
"polkadot-runtime-parachains/std",
"polkadot-parachain-primitives/std"
]
runtime-benchmarks = [
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-message-queue/runtime-benchmarks",
"pallet-uniques/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-parachain-primitives/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]
51 changes: 51 additions & 0 deletions xcm-simulator/src/laosish/configs/balances.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,51 @@
// Copyright 2023-2024 Freeverse.io
// This file is part of LAOS.

// LAOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// LAOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with LAOS. If not, see <http://www.gnu.org/licenses/>.

use crate::laosish::{
Balance, Runtime, RuntimeEvent, RuntimeFreezeReason, RuntimeHoldReason, System,
};
use frame_support::parameter_types;

parameter_types! {
/// The minimum amount required to keep an account open, set to zero in this case.
///
/// While it's generally advised to have this value greater than zero to avoid potential
/// DoS vectors, we set it to zero here due to specific concerns about relay attacks.
/// In such attacks, the reset of the nonce upon account deletion can be exploited.
/// By setting the ExistentialDeposit to zero, we prevent the scenario where an account's
/// balance drops to a level that would trigger its deletion and subsequent nonce reset.
pub const ExistentialDeposit: Balance = 0;
pub const MaxLocks: u32 = 50;
pub const MaxFreezes: u32 = 50;
pub const MaxHolds: u32 = 50;
pub const MaxReserves: u32 = 50;
}

impl pallet_balances::Config for Runtime {
type MaxLocks = MaxLocks;
type Balance = Balance;
type RuntimeEvent = RuntimeEvent;
type DustRemoval = ();
type ExistentialDeposit = ExistentialDeposit;
type AccountStore = System;
type MaxReserves = MaxReserves;
type ReserveIdentifier = [u8; 8];
type FreezeIdentifier = RuntimeFreezeReason;
type RuntimeFreezeReason = RuntimeFreezeReason;
type RuntimeHoldReason = RuntimeHoldReason;
type MaxFreezes = MaxFreezes;
type WeightInfo = pallet_balances::weights::SubstrateWeight<Runtime>; // See: https://github.com/freeverseio/laos/pull/533#issuecomment-2034913428
}
7 changes: 7 additions & 0 deletions xcm-simulator/src/laosish/configs/mod.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
mod balances;
mod system;
pub mod xcm_config;

use crate::laosish::Runtime;

impl parachain_info::Config for Runtime {}
82 changes: 82 additions & 0 deletions xcm-simulator/src/laosish/configs/system.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
// Copyright 2023-2024 Freeverse.io
// This file is part of LAOS.

// LAOS is free software: you can redistribute it and/or modify
// it under the terms of the GNU General Public License as published by
// the Free Software Foundation, either version 3 of the License, or
// (at your option) any later version.

// LAOS is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
// GNU General Public License for more details.

// You should have received a copy of the GNU General Public License
// along with LAOS. If not, see <http://www.gnu.org/licenses/>.

use crate::laosish::{
AccountId, Balance, Block, PalletInfo, Runtime, RuntimeCall, RuntimeEvent, RuntimeOrigin,
RuntimeTask,
};
use frame_support::{parameter_types, traits::Everything};
use sp_runtime::traits::{BlakeTwo256, IdentityLookup};

parameter_types! {
pub const SS58Prefix: u16 = 42;
pub const BlockHashCount: u32 = 256;
}

impl frame_system::Config for Runtime {
/// The identifier used to distinguish between accounts.
type AccountId = AccountId;
/// The aggregated dispatch type that is available for extrinsics.
type RuntimeCall = RuntimeCall;
/// The lookup mechanism to get account ID from whatever is passed in dispatchers.
type Lookup = IdentityLookup<AccountId>;
/// The block type
type Block = Block;
/// The type for hashing blocks and tries.
type Hash = laos_primitives::Hash;
/// The type for storing how many extrinsics an account has signed.
type Nonce = laos_primitives::Nonce;
/// The hashing algorithm used.
type Hashing = BlakeTwo256;
/// The ubiquitous event type.
type RuntimeEvent = RuntimeEvent;
/// The ubiquitous origin type.
type RuntimeOrigin = RuntimeOrigin;
/// The aggregated RuntimeTask type.
type RuntimeTask = RuntimeTask;
/// Maximum number of block number to block hash mappings to keep (oldest pruned first).
type BlockHashCount = BlockHashCount;
/// Runtime version.
type Version = ();
/// Converts a module to an index of this module in the runtime.
type PalletInfo = PalletInfo;
/// The data to be stored in an account.
type AccountData = pallet_balances::AccountData<Balance>;
/// What to do if a new account is created.
type OnNewAccount = ();
/// What to do if an account is fully reaped from the system.
type OnKilledAccount = ();
/// The weight of database operations that the runtime can invoke.
type DbWeight = ();
/// The basic call filter to use in dispatchable.
type BaseCallFilter = Everything;
/// Weight information for the extrinsics of this pallet.
type SystemWeightInfo = ();
/// Block & extrinsics weights: base values and limits.
type BlockWeights = laos_primitives::RuntimeBlockWeights;
/// The maximum length of a block (in bytes).
type BlockLength = laos_primitives::RuntimeBlockLength;
/// This is used as an identifier of the chain. 42 is the generic substrate prefix.
type SS58Prefix = SS58Prefix;
/// The action to take on a Runtime Upgrade
type OnSetCode = ();
type MaxConsumers = frame_support::traits::ConstU32<16>;
type SingleBlockMigrations = ();
type MultiBlockMigrator = ();
type PreInherents = ();
type PostInherents = ();
type PostTransactions = ();
}
Loading
Loading