Files
Branislav Kontur 118cd6f922 Ensure outbound XCMs are decodable with limits + add EnsureDecodableXcm router (for testing purposes) (#4186)
This PR:
- adds `EnsureDecodableXcm` (testing) router that attempts to *encode*
and *decode* passed XCM `message` to ensure that the receiving side will
be able to decode, at least with the same XCM version.
- fixes `pallet_xcm` / `pallet_xcm_benchmarks` assets data generation

Relates to investigation of
https://substrate.stackexchange.com/questions/11288 and missing fix
https://github.com/paritytech/polkadot-sdk/pull/2129 which did not get
into the fellows 1.1.X release.

## Questions/TODOs

- [x] fix XCM benchmarks, which produces undecodable data - new router
catched at least two cases
  - `BoundedVec exceeds its limit`
  - `Fungible asset of zero amount is not allowed`  
- [x] do we need to add `sort` to the `prepend_with` as we did for
reanchor [here](https://github.com/paritytech/polkadot-sdk/pull/2129)?
@serban300 (**created separate/follow-up PR**:
https://github.com/paritytech/polkadot-sdk/pull/4235)
- [x] We added decoding check to `XcmpQueue` -> `validate_xcm_nesting`,
why not to added to the `ParentAsUmp` or `ChildParachainRouter`?
@franciscoaguirre (**created separate/follow-up PR**:
https://github.com/paritytech/polkadot-sdk/pull/4236)
- [ ] `SendController::send_blob` replace `VersionedXcm::<()>::decode(`
with `VersionedXcm::<()>::decode_with_depth_limit(MAX_XCM_DECODE_DEPTH,
data)` ?

---------

Co-authored-by: Adrian Catangiu <adrian@parity.io>
2024-04-23 11:40:05 +00:00

159 lines
7.3 KiB
TOML

[package]
name = "polkadot-test-runtime"
build = "build.rs"
publish = false
version = "1.0.0"
authors.workspace = true
edition.workspace = true
license.workspace = true
[lints]
workspace = true
[dependencies]
parity-scale-codec = { version = "3.6.1", default-features = false, features = ["derive"] }
log = { workspace = true }
scale-info = { version = "2.11.1", default-features = false, features = ["derive"] }
serde = { workspace = true }
authority-discovery-primitives = { package = "sp-authority-discovery", path = "../../../substrate/primitives/authority-discovery", default-features = false }
babe-primitives = { package = "sp-consensus-babe", path = "../../../substrate/primitives/consensus/babe", default-features = false }
beefy-primitives = { package = "sp-consensus-beefy", path = "../../../substrate/primitives/consensus/beefy", default-features = false }
sp-api = { path = "../../../substrate/primitives/api", default-features = false }
inherents = { package = "sp-inherents", path = "../../../substrate/primitives/inherents", default-features = false }
offchain-primitives = { package = "sp-offchain", path = "../../../substrate/primitives/offchain", default-features = false }
sp-std = { path = "../../../substrate/primitives/std", default-features = false }
sp-io = { path = "../../../substrate/primitives/io", default-features = false }
sp-runtime = { path = "../../../substrate/primitives/runtime", default-features = false }
sp-staking = { path = "../../../substrate/primitives/staking", default-features = false }
sp-core = { path = "../../../substrate/primitives/core", default-features = false }
sp-genesis-builder = { path = "../../../substrate/primitives/genesis-builder", default-features = false }
sp-mmr-primitives = { path = "../../../substrate/primitives/merkle-mountain-range", default-features = false }
sp-session = { path = "../../../substrate/primitives/session", default-features = false }
sp-version = { path = "../../../substrate/primitives/version", default-features = false }
frame-election-provider-support = { path = "../../../substrate/frame/election-provider-support", default-features = false }
tx-pool-api = { package = "sp-transaction-pool", path = "../../../substrate/primitives/transaction-pool", default-features = false }
block-builder-api = { package = "sp-block-builder", path = "../../../substrate/primitives/block-builder", default-features = false }
pallet-authority-discovery = { path = "../../../substrate/frame/authority-discovery", default-features = false }
pallet-authorship = { path = "../../../substrate/frame/authorship", default-features = false }
pallet-babe = { path = "../../../substrate/frame/babe", default-features = false }
pallet-balances = { path = "../../../substrate/frame/balances", default-features = false }
pallet-transaction-payment = { path = "../../../substrate/frame/transaction-payment", default-features = false }
pallet-transaction-payment-rpc-runtime-api = { path = "../../../substrate/frame/transaction-payment/rpc/runtime-api", default-features = false }
frame-executive = { path = "../../../substrate/frame/executive", default-features = false }
pallet-grandpa = { path = "../../../substrate/frame/grandpa", default-features = false }
pallet-indices = { path = "../../../substrate/frame/indices", default-features = false }
pallet-offences = { path = "../../../substrate/frame/offences", default-features = false }
pallet-session = { path = "../../../substrate/frame/session", default-features = false }
frame-support = { path = "../../../substrate/frame/support", default-features = false }
pallet-staking = { path = "../../../substrate/frame/staking", default-features = false }
pallet-staking-reward-curve = { path = "../../../substrate/frame/staking/reward-curve" }
frame-system = { path = "../../../substrate/frame/system", default-features = false }
frame-system-rpc-runtime-api = { path = "../../../substrate/frame/system/rpc/runtime-api", default-features = false }
test-runtime-constants = { package = "test-runtime-constants", path = "constants", default-features = false }
pallet-timestamp = { path = "../../../substrate/frame/timestamp", default-features = false }
pallet-sudo = { path = "../../../substrate/frame/sudo", default-features = false }
pallet-vesting = { path = "../../../substrate/frame/vesting", default-features = false }
runtime-common = { package = "polkadot-runtime-common", path = "../common", default-features = false }
primitives = { package = "polkadot-primitives", path = "../../primitives", default-features = false }
pallet-xcm = { path = "../../xcm/pallet-xcm", default-features = false }
polkadot-runtime-parachains = { path = "../parachains", default-features = false }
xcm-builder = { package = "staging-xcm-builder", path = "../../xcm/xcm-builder", default-features = false }
xcm-executor = { package = "staging-xcm-executor", path = "../../xcm/xcm-executor", default-features = false }
xcm = { package = "staging-xcm", path = "../../xcm", default-features = false }
[dev-dependencies]
hex-literal = "0.4.1"
tiny-keccak = { version = "2.0.2", features = ["keccak"] }
keyring = { package = "sp-keyring", path = "../../../substrate/primitives/keyring" }
sp-trie = { path = "../../../substrate/primitives/trie" }
serde_json = { workspace = true, default-features = true }
[build-dependencies]
substrate-wasm-builder = { path = "../../../substrate/utils/wasm-builder" }
[features]
default = ["std"]
no_std = []
only-staking = []
runtime-metrics = [
"polkadot-runtime-parachains/runtime-metrics",
"sp-io/with-tracing",
]
std = [
"authority-discovery-primitives/std",
"babe-primitives/std",
"beefy-primitives/std",
"block-builder-api/std",
"frame-election-provider-support/std",
"frame-executive/std",
"frame-support/std",
"frame-system-rpc-runtime-api/std",
"frame-system/std",
"inherents/std",
"log/std",
"offchain-primitives/std",
"pallet-authority-discovery/std",
"pallet-authorship/std",
"pallet-babe/std",
"pallet-balances/std",
"pallet-grandpa/std",
"pallet-indices/std",
"pallet-offences/std",
"pallet-session/std",
"pallet-staking/std",
"pallet-sudo/std",
"pallet-timestamp/std",
"pallet-transaction-payment-rpc-runtime-api/std",
"pallet-transaction-payment/std",
"pallet-vesting/std",
"pallet-xcm/std",
"parity-scale-codec/std",
"polkadot-runtime-parachains/std",
"primitives/std",
"runtime-common/std",
"scale-info/std",
"serde/std",
"sp-api/std",
"sp-core/std",
"sp-genesis-builder/std",
"sp-io/std",
"sp-mmr-primitives/std",
"sp-runtime/std",
"sp-session/std",
"sp-staking/std",
"sp-std/std",
"sp-version/std",
"test-runtime-constants/std",
"tx-pool-api/std",
"xcm-builder/std",
"xcm-executor/std",
"xcm/std",
]
runtime-benchmarks = [
"frame-election-provider-support/runtime-benchmarks",
"frame-support/runtime-benchmarks",
"frame-system/runtime-benchmarks",
"pallet-babe/runtime-benchmarks",
"pallet-balances/runtime-benchmarks",
"pallet-grandpa/runtime-benchmarks",
"pallet-indices/runtime-benchmarks",
"pallet-offences/runtime-benchmarks",
"pallet-staking/runtime-benchmarks",
"pallet-sudo/runtime-benchmarks",
"pallet-timestamp/runtime-benchmarks",
"pallet-vesting/runtime-benchmarks",
"pallet-xcm/runtime-benchmarks",
"polkadot-runtime-parachains/runtime-benchmarks",
"primitives/runtime-benchmarks",
"runtime-common/runtime-benchmarks",
"sp-runtime/runtime-benchmarks",
"sp-staking/runtime-benchmarks",
"xcm-builder/runtime-benchmarks",
"xcm-executor/runtime-benchmarks",
]