mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-30 05:51:02 +00:00
Companion to "Updating scale to v3" (#1013)
* Updating dependencies * Adapting code to scale v3 * cargo fmt * Fix compilation * Update Cargo.lock * TIL exists Co-authored-by: Bastian Köcher <info@kchr.de>
This commit is contained in:
@@ -17,8 +17,8 @@ sp-runtime = { git = "https://github.com/paritytech/substrate", default-features
|
||||
sp-application-crypto = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Other Dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"]}
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.132", optional = true, features = ["derive"] }
|
||||
|
||||
[dev-dependencies]
|
||||
|
||||
@@ -14,9 +14,9 @@ targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
log = { version = "0.4.0", default-features = false }
|
||||
codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "2.3.0" }
|
||||
codec = { default-features = false, features = ["derive"], package = "parity-scale-codec", version = "3.0.0" }
|
||||
rand = { version = "0.8.5", features = ["std_rng"], default-features = false }
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.132", default-features = false }
|
||||
|
||||
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -6,8 +6,8 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# Other dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", features = [ "derive" ], default-features = false }
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ], default-features = false }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
|
||||
# Substrate Dependencies
|
||||
|
||||
@@ -223,12 +223,12 @@ pub mod pallet {
|
||||
pub(crate) fn try_service_message(
|
||||
limit: Weight,
|
||||
_sent_at: RelayBlockNumber,
|
||||
data: &[u8],
|
||||
mut data: &[u8],
|
||||
) -> Result<Weight, (MessageId, Weight)> {
|
||||
let id = sp_io::hashing::blake2_256(&data[..]);
|
||||
let id = sp_io::hashing::blake2_256(data);
|
||||
let maybe_msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut &data[..],
|
||||
&mut data,
|
||||
)
|
||||
.map(Xcm::<T::Call>::try_from);
|
||||
match maybe_msg {
|
||||
|
||||
@@ -30,8 +30,8 @@ sp-trie = { git = "https://github.com/paritytech/substrate", default-features =
|
||||
sp-externalities = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
# Other Dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"]}
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.132", optional = true, features = ["derive"] }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
environmental = { version = "1.1.2", default-features = false }
|
||||
|
||||
@@ -13,7 +13,7 @@ readme = "README.md"
|
||||
targets = ["x86_64-unknown-linux-gnu"]
|
||||
|
||||
[dependencies]
|
||||
parity-scale-codec = { version = "2.3.1", default-features = false }
|
||||
parity-scale-codec = { version = "3.0.0", default-features = false }
|
||||
sp-std = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
sp-runtime = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
frame-support = { default-features = false, git = "https://github.com/paritytech/substrate", branch = "master" }
|
||||
|
||||
@@ -21,8 +21,8 @@ cumulus-primitives-core = { path = "../../primitives/core", default-features = f
|
||||
polkadot-primitives = { git = "https://github.com/paritytech/polkadot", default-features = false, branch = "master" }
|
||||
|
||||
# Other Dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"]}
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
|
||||
[features]
|
||||
default = [ "std" ]
|
||||
|
||||
@@ -5,8 +5,8 @@ name = "cumulus-pallet-xcm"
|
||||
version = "0.1.0"
|
||||
|
||||
[dependencies]
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
serde = { version = "1.0.132", optional = true, features = ["derive"] }
|
||||
|
||||
sp-std = { git = "https://github.com/paritytech/substrate", default-features = false, branch = "master" }
|
||||
|
||||
@@ -117,7 +117,7 @@ impl<T: Config> DmpMessageHandler for UnlimitedDmpExecution<T> {
|
||||
let id = sp_io::hashing::twox_64(&data[..]);
|
||||
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut &data[..],
|
||||
&mut data.as_slice(),
|
||||
)
|
||||
.map(Xcm::<T::Call>::try_from);
|
||||
match msg {
|
||||
@@ -150,7 +150,7 @@ impl<T: Config> DmpMessageHandler for LimitAndDropDmpExecution<T> {
|
||||
let id = sp_io::hashing::twox_64(&data[..]);
|
||||
let msg = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut &data[..],
|
||||
&mut data.as_slice(),
|
||||
)
|
||||
.map(Xcm::<T::Call>::try_from);
|
||||
match msg {
|
||||
|
||||
@@ -6,9 +6,9 @@ edition = "2021"
|
||||
|
||||
[dependencies]
|
||||
# Other dependencies
|
||||
codec = { package = "parity-scale-codec", version = "2.3.0", features = [ "derive" ], default-features = false }
|
||||
codec = { package = "parity-scale-codec", version = "3.0.0", features = [ "derive" ], default-features = false }
|
||||
rand_chacha = { version = "0.3.0", default-features = false }
|
||||
scale-info = { version = "1.0.0", default-features = false, features = ["derive"] }
|
||||
scale-info = { version = "2.0.0", default-features = false, features = ["derive"] }
|
||||
log = { version = "0.4.14", default-features = false }
|
||||
|
||||
# Substrate Dependencies
|
||||
|
||||
@@ -132,9 +132,11 @@ pub mod pallet {
|
||||
|
||||
let (sender, sent_at, data) =
|
||||
Overweight::<T>::get(index).ok_or(Error::<T>::BadOverweightIndex)?;
|
||||
let xcm =
|
||||
VersionedXcm::<T::Call>::decode_all_with_depth_limit(MAX_XCM_DECODE_DEPTH, &data)
|
||||
.map_err(|_| Error::<T>::BadXcm)?;
|
||||
let xcm = VersionedXcm::<T::Call>::decode_all_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut data.as_slice(),
|
||||
)
|
||||
.map_err(|_| Error::<T>::BadXcm)?;
|
||||
let used = Self::handle_xcm_message(sender, sent_at, xcm, weight_limit)
|
||||
.map_err(|_| Error::<T>::WeightOverLimit)?;
|
||||
Overweight::<T>::remove(index);
|
||||
@@ -492,10 +494,8 @@ impl<T: Config> Pallet<T> {
|
||||
let have_active = s[index].last_index > s[index].first_index;
|
||||
let appended = have_active &&
|
||||
<OutboundXcmpMessages<T>>::mutate(recipient, s[index].last_index - 1, |s| {
|
||||
if XcmpMessageFormat::decode_and_advance_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut &s[..],
|
||||
) != Ok(format)
|
||||
if XcmpMessageFormat::decode_with_depth_limit(MAX_XCM_DECODE_DEPTH, &mut &s[..]) !=
|
||||
Ok(format)
|
||||
{
|
||||
return false
|
||||
}
|
||||
@@ -619,7 +619,7 @@ impl<T: Config> Pallet<T> {
|
||||
XcmpMessageFormat::ConcatenatedVersionedXcm => {
|
||||
while !remaining_fragments.is_empty() {
|
||||
last_remaining_fragments = remaining_fragments;
|
||||
if let Ok(xcm) = VersionedXcm::<T::Call>::decode_and_advance_with_depth_limit(
|
||||
if let Ok(xcm) = VersionedXcm::<T::Call>::decode_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut remaining_fragments,
|
||||
) {
|
||||
@@ -893,7 +893,7 @@ impl<T: Config> XcmpMessageHandler for Pallet<T> {
|
||||
for (sender, sent_at, data) in iter {
|
||||
// Figure out the message format.
|
||||
let mut data_ref = data;
|
||||
let format = match XcmpMessageFormat::decode_and_advance_with_depth_limit(
|
||||
let format = match XcmpMessageFormat::decode_with_depth_limit(
|
||||
MAX_XCM_DECODE_DEPTH,
|
||||
&mut data_ref,
|
||||
) {
|
||||
|
||||
Reference in New Issue
Block a user