Skip to content

Commit f940746

Browse files
franciscoaguirreyrongacatangiuseadandaalvicsam
authored
Backport #6503 to stable2412 (#8194)
Backporting #6503 in order to fix snowbridge. Needed for polkadot-fellows/runtimes#606 --------- Co-authored-by: Ron <yrong1997@gmail.com> Co-authored-by: Adrian Catangiu <adrian@parity.io> Co-authored-by: Dónal Murray <donal.murray@parity.io> Co-authored-by: alvicsam <alvicsam@gmail.com>
1 parent abc1601 commit f940746

File tree

4 files changed

+25
-26
lines changed

4 files changed

+25
-26
lines changed

bridges/snowbridge/pallets/inbound-queue/src/mock.rs

Lines changed: 0 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -252,20 +252,6 @@ impl inbound_queue::Config for Test {
252252
type AssetTransactor = SuccessfulTransactor;
253253
}
254254

255-
pub fn last_events(n: usize) -> Vec<RuntimeEvent> {
256-
frame_system::Pallet::<Test>::events()
257-
.into_iter()
258-
.rev()
259-
.take(n)
260-
.rev()
261-
.map(|e| e.event)
262-
.collect()
263-
}
264-
265-
pub fn expect_events(e: Vec<RuntimeEvent>) {
266-
assert_eq!(last_events(e.len()), e);
267-
}
268-
269255
pub fn setup() {
270256
System::set_block_number(1);
271257
Balances::mint_into(

bridges/snowbridge/pallets/inbound-queue/src/test.rs

Lines changed: 11 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ use sp_keyring::AccountKeyring as Keyring;
99
use sp_runtime::DispatchError;
1010
use sp_std::convert::From;
1111

12-
use crate::{Error, Event as InboundQueueEvent};
12+
use crate::Error;
1313

1414
use crate::mock::*;
1515

@@ -35,17 +35,16 @@ fn test_submit_happy_path() {
3535
assert_eq!(Balances::balance(&channel_sovereign), initial_fund);
3636

3737
assert_ok!(InboundQueue::submit(origin.clone(), message.clone()));
38-
expect_events(vec![InboundQueueEvent::MessageReceived {
39-
channel_id: hex!("c173fac324158e77fb5840738a1a541f633cbec8884c6a601c567d2b376a0539")
40-
.into(),
41-
nonce: 1,
42-
message_id: [
43-
118, 166, 139, 182, 84, 52, 165, 189, 54, 14, 178, 73, 2, 228, 192, 97, 153, 201,
44-
4, 75, 151, 15, 82, 6, 164, 187, 162, 133, 26, 183, 186, 126,
45-
],
46-
fee_burned: 110000000000,
47-
}
48-
.into()]);
38+
39+
let events = frame_system::Pallet::<Test>::events();
40+
assert!(
41+
events.iter().any(|event| matches!(
42+
event.event,
43+
RuntimeEvent::InboundQueue(Event::MessageReceived { nonce, ..})
44+
if nonce == 1
45+
)),
46+
"No event emitted."
47+
);
4948

5049
let delivery_cost = InboundQueue::calculate_delivery_cost(message.encode().len() as u32);
5150
assert!(

polkadot/xcm/src/v5/junction.rs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -143,16 +143,20 @@ pub enum NetworkId {
143143
/// The Kusama canary-net Relay-chain.
144144
Kusama,
145145
/// An Ethereum network specified by its chain ID.
146+
#[codec(index = 7)]
146147
Ethereum {
147148
/// The EIP-155 chain ID.
148149
#[codec(compact)]
149150
chain_id: u64,
150151
},
151152
/// The Bitcoin network, including hard-forks supported by Bitcoin Core development team.
153+
#[codec(index = 8)]
152154
BitcoinCore,
153155
/// The Bitcoin network, including hard-forks supported by Bitcoin Cash developers.
156+
#[codec(index = 9)]
154157
BitcoinCash,
155158
/// The Polkadot Bulletin chain.
159+
#[codec(index = 10)]
156160
PolkadotBulletin,
157161
}
158162

prdoc/pr_8194.prdoc

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
title: "xcm: minor fix for compatibility with V4"
2+
3+
doc:
4+
- audience: ["Runtime Dev", "Runtime User"]
5+
description: |
6+
Following the removal of `Rococo`, `Westend` and `Wococo` from `NetworkId`, fixed `xcm::v5::NetworkId` encoding/decoding to be compatible with `xcm::v4::NetworkId`
7+
8+
crates:
9+
- name: staging-xcm
10+
bump: patch

0 commit comments

Comments
 (0)