mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-06-14 09:51:10 +00:00
Add event field names to HRMP Event variants (#1695)
Update the HRMP pallet to use field names for Event variants to improve metadata for a better client experience. Event variants are now structs instead of unnamed tuples. Partially implements Substrate issue [9903](https://github.com/paritytech/substrate/issues/9903) which doesn't appear to have been moved to the monorepo.
This commit is contained in:
+12
-2
@@ -37,7 +37,12 @@ tests:
|
|||||||
]
|
]
|
||||||
events:
|
events:
|
||||||
- name: hrmp.HrmpChannelForceOpened
|
- name: hrmp.HrmpChannelForceOpened
|
||||||
result: [*cp_id, *sp_id, *hrmp_proposed_max_capacity, *hrmp_proposed_max_message_size]
|
result: {
|
||||||
|
sender: *cp_id,
|
||||||
|
recipient: *sp_id,
|
||||||
|
proposed_max_capacity: *hrmp_proposed_max_capacity,
|
||||||
|
proposed_max_message_size: *hrmp_proposed_max_message_size
|
||||||
|
}
|
||||||
- name: Force Open HRMP Channel From AssetHub Parachain → Collectives Parachain
|
- name: Force Open HRMP Channel From AssetHub Parachain → Collectives Parachain
|
||||||
its:
|
its:
|
||||||
- name: Alice calls hrmp.forceOpenHrmpChannel
|
- name: Alice calls hrmp.forceOpenHrmpChannel
|
||||||
@@ -56,4 +61,9 @@ tests:
|
|||||||
]
|
]
|
||||||
events:
|
events:
|
||||||
- name: hrmp.HrmpChannelForceOpened
|
- name: hrmp.HrmpChannelForceOpened
|
||||||
result: [*sp_id, *cp_id, *hrmp_proposed_max_capacity, *hrmp_proposed_max_message_size]
|
result: {
|
||||||
|
sender: *sp_id,
|
||||||
|
recipient: *cp_id,
|
||||||
|
proposed_max_capacity: *hrmp_proposed_max_capacity,
|
||||||
|
proposed_max_message_size: *hrmp_proposed_max_message_size
|
||||||
|
}
|
||||||
|
|||||||
+14
-8
@@ -79,9 +79,12 @@ fn open_hrmp_channel_between_paras_works() {
|
|||||||
},
|
},
|
||||||
// Open channel requested from Para A to Para B
|
// Open channel requested from Para A to Para B
|
||||||
RuntimeEvent::Hrmp(
|
RuntimeEvent::Hrmp(
|
||||||
polkadot_runtime_parachains::hrmp::Event::OpenChannelRequested(
|
polkadot_runtime_parachains::hrmp::Event::OpenChannelRequested {
|
||||||
sender, recipient, max_capacity, max_message_size
|
sender,
|
||||||
)
|
recipient,
|
||||||
|
proposed_max_capacity: max_capacity,
|
||||||
|
proposed_max_message_size: max_message_size
|
||||||
|
}
|
||||||
) => {
|
) => {
|
||||||
sender: *sender == para_a_id.into(),
|
sender: *sender == para_a_id.into(),
|
||||||
recipient: *recipient == para_b_id.into(),
|
recipient: *recipient == para_b_id.into(),
|
||||||
@@ -133,9 +136,9 @@ fn open_hrmp_channel_between_paras_works() {
|
|||||||
},
|
},
|
||||||
// Open channel accepted for Para A to Para B
|
// Open channel accepted for Para A to Para B
|
||||||
RuntimeEvent::Hrmp(
|
RuntimeEvent::Hrmp(
|
||||||
polkadot_runtime_parachains::hrmp::Event::OpenChannelAccepted(
|
polkadot_runtime_parachains::hrmp::Event::OpenChannelAccepted {
|
||||||
sender, recipient
|
sender, recipient
|
||||||
)
|
}
|
||||||
) => {
|
) => {
|
||||||
sender: *sender == para_a_id.into(),
|
sender: *sender == para_a_id.into(),
|
||||||
recipient: *recipient == para_b_id.into(),
|
recipient: *recipient == para_b_id.into(),
|
||||||
@@ -175,9 +178,12 @@ fn force_open_hrmp_channel_for_system_para_works() {
|
|||||||
vec![
|
vec![
|
||||||
// HRMP channel forced opened
|
// HRMP channel forced opened
|
||||||
RuntimeEvent::Hrmp(
|
RuntimeEvent::Hrmp(
|
||||||
polkadot_runtime_parachains::hrmp::Event::HrmpChannelForceOpened(
|
polkadot_runtime_parachains::hrmp::Event::HrmpChannelForceOpened{
|
||||||
sender, recipient, max_capacity, max_message_size
|
sender,
|
||||||
)
|
recipient,
|
||||||
|
proposed_max_capacity: max_capacity,
|
||||||
|
proposed_max_message_size: max_message_size
|
||||||
|
}
|
||||||
) => {
|
) => {
|
||||||
sender: *sender == system_para_id.into(),
|
sender: *sender == system_para_id.into(),
|
||||||
recipient: *recipient == para_a_id.into(),
|
recipient: *recipient == para_a_id.into(),
|
||||||
|
|||||||
+8
-8
@@ -79,9 +79,9 @@ fn open_hrmp_channel_between_paras_works() {
|
|||||||
},
|
},
|
||||||
// Open channel requested from Para A to Para B
|
// Open channel requested from Para A to Para B
|
||||||
RuntimeEvent::Hrmp(
|
RuntimeEvent::Hrmp(
|
||||||
polkadot_runtime_parachains::hrmp::Event::OpenChannelRequested(
|
polkadot_runtime_parachains::hrmp::Event::OpenChannelRequested {
|
||||||
sender, recipient, max_capacity, max_message_size
|
sender, recipient, proposed_max_capacity: max_capacity, proposed_max_message_size: max_message_size
|
||||||
)
|
}
|
||||||
) => {
|
) => {
|
||||||
sender: *sender == para_a_id.into(),
|
sender: *sender == para_a_id.into(),
|
||||||
recipient: *recipient == para_b_id.into(),
|
recipient: *recipient == para_b_id.into(),
|
||||||
@@ -133,9 +133,9 @@ fn open_hrmp_channel_between_paras_works() {
|
|||||||
},
|
},
|
||||||
// Open channel accepted for Para A to Para B
|
// Open channel accepted for Para A to Para B
|
||||||
RuntimeEvent::Hrmp(
|
RuntimeEvent::Hrmp(
|
||||||
polkadot_runtime_parachains::hrmp::Event::OpenChannelAccepted(
|
polkadot_runtime_parachains::hrmp::Event::OpenChannelAccepted {
|
||||||
sender, recipient
|
sender, recipient
|
||||||
)
|
}
|
||||||
) => {
|
) => {
|
||||||
sender: *sender == para_a_id.into(),
|
sender: *sender == para_a_id.into(),
|
||||||
recipient: *recipient == para_b_id.into(),
|
recipient: *recipient == para_b_id.into(),
|
||||||
@@ -175,9 +175,9 @@ fn force_open_hrmp_channel_for_system_para_works() {
|
|||||||
vec![
|
vec![
|
||||||
// HRMP channel forced opened
|
// HRMP channel forced opened
|
||||||
RuntimeEvent::Hrmp(
|
RuntimeEvent::Hrmp(
|
||||||
polkadot_runtime_parachains::hrmp::Event::HrmpChannelForceOpened(
|
polkadot_runtime_parachains::hrmp::Event::HrmpChannelForceOpened{
|
||||||
sender, recipient, max_capacity, max_message_size
|
sender, recipient, proposed_max_capacity: max_capacity, proposed_max_message_size: max_message_size
|
||||||
)
|
}
|
||||||
) => {
|
) => {
|
||||||
sender: *sender == system_para_id.into(),
|
sender: *sender == system_para_id.into(),
|
||||||
recipient: *recipient == para_a_id.into(),
|
recipient: *recipient == para_a_id.into(),
|
||||||
|
|||||||
@@ -278,24 +278,34 @@ pub mod pallet {
|
|||||||
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
#[pallet::generate_deposit(pub(super) fn deposit_event)]
|
||||||
pub enum Event<T: Config> {
|
pub enum Event<T: Config> {
|
||||||
/// Open HRMP channel requested.
|
/// Open HRMP channel requested.
|
||||||
/// `[sender, recipient, proposed_max_capacity, proposed_max_message_size]`
|
OpenChannelRequested {
|
||||||
OpenChannelRequested(ParaId, ParaId, u32, u32),
|
sender: ParaId,
|
||||||
|
recipient: ParaId,
|
||||||
|
proposed_max_capacity: u32,
|
||||||
|
proposed_max_message_size: u32,
|
||||||
|
},
|
||||||
/// An HRMP channel request sent by the receiver was canceled by either party.
|
/// An HRMP channel request sent by the receiver was canceled by either party.
|
||||||
/// `[by_parachain, channel_id]`
|
OpenChannelCanceled { by_parachain: ParaId, channel_id: HrmpChannelId },
|
||||||
OpenChannelCanceled(ParaId, HrmpChannelId),
|
/// Open HRMP channel accepted.
|
||||||
/// Open HRMP channel accepted. `[sender, recipient]`
|
OpenChannelAccepted { sender: ParaId, recipient: ParaId },
|
||||||
OpenChannelAccepted(ParaId, ParaId),
|
/// HRMP channel closed.
|
||||||
/// HRMP channel closed. `[by_parachain, channel_id]`
|
ChannelClosed { by_parachain: ParaId, channel_id: HrmpChannelId },
|
||||||
ChannelClosed(ParaId, HrmpChannelId),
|
|
||||||
/// An HRMP channel was opened via Root origin.
|
/// An HRMP channel was opened via Root origin.
|
||||||
/// `[sender, recipient, proposed_max_capacity, proposed_max_message_size]`
|
HrmpChannelForceOpened {
|
||||||
HrmpChannelForceOpened(ParaId, ParaId, u32, u32),
|
sender: ParaId,
|
||||||
|
recipient: ParaId,
|
||||||
|
proposed_max_capacity: u32,
|
||||||
|
proposed_max_message_size: u32,
|
||||||
|
},
|
||||||
/// An HRMP channel was opened between two system chains.
|
/// An HRMP channel was opened between two system chains.
|
||||||
/// `[sender, recipient, proposed_max_capacity, proposed_max_message_size]`
|
HrmpSystemChannelOpened {
|
||||||
HrmpSystemChannelOpened(ParaId, ParaId, u32, u32),
|
sender: ParaId,
|
||||||
|
recipient: ParaId,
|
||||||
|
proposed_max_capacity: u32,
|
||||||
|
proposed_max_message_size: u32,
|
||||||
|
},
|
||||||
/// An HRMP channel's deposits were updated.
|
/// An HRMP channel's deposits were updated.
|
||||||
/// `[sender, recipient]`
|
OpenChannelDepositsUpdated { sender: ParaId, recipient: ParaId },
|
||||||
OpenChannelDepositsUpdated(ParaId, ParaId),
|
|
||||||
}
|
}
|
||||||
|
|
||||||
#[pallet::error]
|
#[pallet::error]
|
||||||
@@ -499,12 +509,12 @@ pub mod pallet {
|
|||||||
proposed_max_capacity,
|
proposed_max_capacity,
|
||||||
proposed_max_message_size,
|
proposed_max_message_size,
|
||||||
)?;
|
)?;
|
||||||
Self::deposit_event(Event::OpenChannelRequested(
|
Self::deposit_event(Event::OpenChannelRequested {
|
||||||
origin,
|
sender: origin,
|
||||||
recipient,
|
recipient,
|
||||||
proposed_max_capacity,
|
proposed_max_capacity,
|
||||||
proposed_max_message_size,
|
proposed_max_message_size,
|
||||||
));
|
});
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -516,7 +526,7 @@ pub mod pallet {
|
|||||||
pub fn hrmp_accept_open_channel(origin: OriginFor<T>, sender: ParaId) -> DispatchResult {
|
pub fn hrmp_accept_open_channel(origin: OriginFor<T>, sender: ParaId) -> DispatchResult {
|
||||||
let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?;
|
let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?;
|
||||||
Self::accept_open_channel(origin, sender)?;
|
Self::accept_open_channel(origin, sender)?;
|
||||||
Self::deposit_event(Event::OpenChannelAccepted(sender, origin));
|
Self::deposit_event(Event::OpenChannelAccepted { sender, recipient: origin });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -532,7 +542,7 @@ pub mod pallet {
|
|||||||
) -> DispatchResult {
|
) -> DispatchResult {
|
||||||
let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?;
|
let origin = ensure_parachain(<T as Config>::RuntimeOrigin::from(origin))?;
|
||||||
Self::close_channel(origin, channel_id.clone())?;
|
Self::close_channel(origin, channel_id.clone())?;
|
||||||
Self::deposit_event(Event::ChannelClosed(origin, channel_id));
|
Self::deposit_event(Event::ChannelClosed { by_parachain: origin, channel_id });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -611,7 +621,7 @@ pub mod pallet {
|
|||||||
Error::<T>::WrongWitness
|
Error::<T>::WrongWitness
|
||||||
);
|
);
|
||||||
Self::cancel_open_request(origin, channel_id.clone())?;
|
Self::cancel_open_request(origin, channel_id.clone())?;
|
||||||
Self::deposit_event(Event::OpenChannelCanceled(origin, channel_id));
|
Self::deposit_event(Event::OpenChannelCanceled { by_parachain: origin, channel_id });
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -651,12 +661,12 @@ pub mod pallet {
|
|||||||
// that it will not require deposits from either member.
|
// that it will not require deposits from either member.
|
||||||
Self::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
Self::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
||||||
Self::accept_open_channel(recipient, sender)?;
|
Self::accept_open_channel(recipient, sender)?;
|
||||||
Self::deposit_event(Event::HrmpChannelForceOpened(
|
Self::deposit_event(Event::HrmpChannelForceOpened {
|
||||||
sender,
|
sender,
|
||||||
recipient,
|
recipient,
|
||||||
max_capacity,
|
proposed_max_capacity: max_capacity,
|
||||||
max_message_size,
|
proposed_max_message_size: max_message_size,
|
||||||
));
|
});
|
||||||
|
|
||||||
Ok(Some(<T as Config>::WeightInfo::force_open_hrmp_channel(cancel_request)).into())
|
Ok(Some(<T as Config>::WeightInfo::force_open_hrmp_channel(cancel_request)).into())
|
||||||
}
|
}
|
||||||
@@ -695,12 +705,12 @@ pub mod pallet {
|
|||||||
Self::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
Self::init_open_channel(sender, recipient, max_capacity, max_message_size)?;
|
||||||
Self::accept_open_channel(recipient, sender)?;
|
Self::accept_open_channel(recipient, sender)?;
|
||||||
|
|
||||||
Self::deposit_event(Event::HrmpSystemChannelOpened(
|
Self::deposit_event(Event::HrmpSystemChannelOpened {
|
||||||
sender,
|
sender,
|
||||||
recipient,
|
recipient,
|
||||||
max_capacity,
|
proposed_max_capacity: max_capacity,
|
||||||
max_message_size,
|
proposed_max_message_size: max_message_size,
|
||||||
));
|
});
|
||||||
|
|
||||||
Ok(Pays::No.into())
|
Ok(Pays::No.into())
|
||||||
}
|
}
|
||||||
@@ -796,7 +806,7 @@ pub mod pallet {
|
|||||||
Ok(())
|
Ok(())
|
||||||
})?;
|
})?;
|
||||||
|
|
||||||
Self::deposit_event(Event::OpenChannelDepositsUpdated(sender, recipient));
|
Self::deposit_event(Event::OpenChannelDepositsUpdated { sender, recipient });
|
||||||
|
|
||||||
Ok(())
|
Ok(())
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -166,8 +166,13 @@ mod benchmarks {
|
|||||||
_(sender_origin, recipient_id, capacity, message_size);
|
_(sender_origin, recipient_id, capacity, message_size);
|
||||||
|
|
||||||
assert_last_event::<T>(
|
assert_last_event::<T>(
|
||||||
Event::<T>::OpenChannelRequested(sender_id, recipient_id, capacity, message_size)
|
Event::<T>::OpenChannelRequested {
|
||||||
.into(),
|
sender: sender_id,
|
||||||
|
recipient: recipient_id,
|
||||||
|
proposed_max_capacity: capacity,
|
||||||
|
proposed_max_message_size: message_size,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -179,7 +184,7 @@ mod benchmarks {
|
|||||||
#[extrinsic_call]
|
#[extrinsic_call]
|
||||||
_(recipient_origin, sender);
|
_(recipient_origin, sender);
|
||||||
|
|
||||||
assert_last_event::<T>(Event::<T>::OpenChannelAccepted(sender, recipient).into());
|
assert_last_event::<T>(Event::<T>::OpenChannelAccepted { sender, recipient }.into());
|
||||||
}
|
}
|
||||||
|
|
||||||
#[benchmark]
|
#[benchmark]
|
||||||
@@ -191,7 +196,9 @@ mod benchmarks {
|
|||||||
#[extrinsic_call]
|
#[extrinsic_call]
|
||||||
_(sender_origin, channel_id.clone());
|
_(sender_origin, channel_id.clone());
|
||||||
|
|
||||||
assert_last_event::<T>(Event::<T>::ChannelClosed(sender, channel_id).into());
|
assert_last_event::<T>(
|
||||||
|
Event::<T>::ChannelClosed { by_parachain: sender, channel_id }.into(),
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
// NOTE: a single parachain should have the maximum number of allowed ingress and egress
|
// NOTE: a single parachain should have the maximum number of allowed ingress and egress
|
||||||
@@ -411,8 +418,13 @@ mod benchmarks {
|
|||||||
_(frame_system::Origin::<T>::Root, sender_id, recipient_id, capacity, message_size);
|
_(frame_system::Origin::<T>::Root, sender_id, recipient_id, capacity, message_size);
|
||||||
|
|
||||||
assert_last_event::<T>(
|
assert_last_event::<T>(
|
||||||
Event::<T>::HrmpChannelForceOpened(sender_id, recipient_id, capacity, message_size)
|
Event::<T>::HrmpChannelForceOpened {
|
||||||
.into(),
|
sender: sender_id,
|
||||||
|
recipient: recipient_id,
|
||||||
|
proposed_max_capacity: capacity,
|
||||||
|
proposed_max_message_size: message_size,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -435,8 +447,13 @@ mod benchmarks {
|
|||||||
_(frame_system::RawOrigin::Signed(caller), sender_id, recipient_id);
|
_(frame_system::RawOrigin::Signed(caller), sender_id, recipient_id);
|
||||||
|
|
||||||
assert_last_event::<T>(
|
assert_last_event::<T>(
|
||||||
Event::<T>::HrmpSystemChannelOpened(sender_id, recipient_id, capacity, message_size)
|
Event::<T>::HrmpSystemChannelOpened {
|
||||||
.into(),
|
sender: sender_id,
|
||||||
|
recipient: recipient_id,
|
||||||
|
proposed_max_capacity: capacity,
|
||||||
|
proposed_max_message_size: message_size,
|
||||||
|
}
|
||||||
|
.into(),
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -478,7 +495,8 @@ mod benchmarks {
|
|||||||
_(frame_system::RawOrigin::Signed(caller), sender_id, recipient_id);
|
_(frame_system::RawOrigin::Signed(caller), sender_id, recipient_id);
|
||||||
|
|
||||||
assert_last_event::<T>(
|
assert_last_event::<T>(
|
||||||
Event::<T>::OpenChannelDepositsUpdated(sender_id, recipient_id).into(),
|
Event::<T>::OpenChannelDepositsUpdated { sender: sender_id, recipient: recipient_id }
|
||||||
|
.into(),
|
||||||
);
|
);
|
||||||
let channel = HrmpChannels::<T>::get(&channel_id).unwrap();
|
let channel = HrmpChannels::<T>::get(&channel_id).unwrap();
|
||||||
// Check that the deposit was updated in the channel state.
|
// Check that the deposit was updated in the channel state.
|
||||||
|
|||||||
@@ -151,14 +151,17 @@ fn open_channel_works() {
|
|||||||
Hrmp::hrmp_init_open_channel(para_a_origin.into(), para_b, 2, 8).unwrap();
|
Hrmp::hrmp_init_open_channel(para_a_origin.into(), para_b, 2, 8).unwrap();
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events().iter().any(|record| record.event ==
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
MockEvent::Hrmp(Event::OpenChannelRequested(para_a, para_b, 2, 8))));
|
MockEvent::Hrmp(Event::OpenChannelRequested {
|
||||||
|
sender: para_a,
|
||||||
|
recipient: para_b,
|
||||||
|
proposed_max_capacity: 2,
|
||||||
|
proposed_max_message_size: 8
|
||||||
|
})));
|
||||||
|
|
||||||
Hrmp::hrmp_accept_open_channel(para_b_origin.into(), para_a).unwrap();
|
Hrmp::hrmp_accept_open_channel(para_b_origin.into(), para_a).unwrap();
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events()
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
.iter()
|
MockEvent::Hrmp(Event::OpenChannelAccepted { sender: para_a, recipient: para_b })));
|
||||||
.any(|record| record.event ==
|
|
||||||
MockEvent::Hrmp(Event::OpenChannelAccepted(para_a, para_b))));
|
|
||||||
|
|
||||||
// Advance to a block 6, but without session change. That means that the channel has
|
// Advance to a block 6, but without session change. That means that the channel has
|
||||||
// not been created yet.
|
// not been created yet.
|
||||||
@@ -189,7 +192,12 @@ fn force_open_channel_works() {
|
|||||||
Hrmp::force_open_hrmp_channel(RuntimeOrigin::root(), para_a, para_b, 2, 8).unwrap();
|
Hrmp::force_open_hrmp_channel(RuntimeOrigin::root(), para_a, para_b, 2, 8).unwrap();
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events().iter().any(|record| record.event ==
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
MockEvent::Hrmp(Event::HrmpChannelForceOpened(para_a, para_b, 2, 8))));
|
MockEvent::Hrmp(Event::HrmpChannelForceOpened {
|
||||||
|
sender: para_a,
|
||||||
|
recipient: para_b,
|
||||||
|
proposed_max_capacity: 2,
|
||||||
|
proposed_max_message_size: 8
|
||||||
|
})));
|
||||||
|
|
||||||
// Advance to a block 6, but without session change. That means that the channel has
|
// Advance to a block 6, but without session change. That means that the channel has
|
||||||
// not been created yet.
|
// not been created yet.
|
||||||
@@ -224,7 +232,12 @@ fn force_open_channel_works_with_existing_request() {
|
|||||||
Hrmp::hrmp_init_open_channel(para_a_origin.into(), para_b, 2, 8).unwrap();
|
Hrmp::hrmp_init_open_channel(para_a_origin.into(), para_b, 2, 8).unwrap();
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events().iter().any(|record| record.event ==
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
MockEvent::Hrmp(Event::OpenChannelRequested(para_a, para_b, 2, 8))));
|
MockEvent::Hrmp(Event::OpenChannelRequested {
|
||||||
|
sender: para_a,
|
||||||
|
recipient: para_b,
|
||||||
|
proposed_max_capacity: 2,
|
||||||
|
proposed_max_message_size: 8
|
||||||
|
})));
|
||||||
|
|
||||||
run_to_block(5, Some(vec![4, 5]));
|
run_to_block(5, Some(vec![4, 5]));
|
||||||
// the request exists, but no channel.
|
// the request exists, but no channel.
|
||||||
@@ -238,7 +251,12 @@ fn force_open_channel_works_with_existing_request() {
|
|||||||
Hrmp::force_open_hrmp_channel(RuntimeOrigin::root(), para_a, para_b, 2, 8).unwrap();
|
Hrmp::force_open_hrmp_channel(RuntimeOrigin::root(), para_a, para_b, 2, 8).unwrap();
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events().iter().any(|record| record.event ==
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
MockEvent::Hrmp(Event::HrmpChannelForceOpened(para_a, para_b, 2, 8))));
|
MockEvent::Hrmp(Event::HrmpChannelForceOpened {
|
||||||
|
sender: para_a,
|
||||||
|
recipient: para_b,
|
||||||
|
proposed_max_capacity: 2,
|
||||||
|
proposed_max_message_size: 8
|
||||||
|
})));
|
||||||
|
|
||||||
// Advance to a block 6, but without session change. That means that the channel has
|
// Advance to a block 6, but without session change. That means that the channel has
|
||||||
// not been created yet.
|
// not been created yet.
|
||||||
@@ -266,7 +284,12 @@ fn open_system_channel_works() {
|
|||||||
Hrmp::establish_system_channel(RuntimeOrigin::signed(1), para_a, para_b).unwrap();
|
Hrmp::establish_system_channel(RuntimeOrigin::signed(1), para_a, para_b).unwrap();
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events().iter().any(|record| record.event ==
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
MockEvent::Hrmp(Event::HrmpSystemChannelOpened(para_a, para_b, 2, 8))));
|
MockEvent::Hrmp(Event::HrmpSystemChannelOpened {
|
||||||
|
sender: para_a,
|
||||||
|
recipient: para_b,
|
||||||
|
proposed_max_capacity: 2,
|
||||||
|
proposed_max_message_size: 8
|
||||||
|
})));
|
||||||
|
|
||||||
// Advance to a block 6, but without session change. That means that the channel has
|
// Advance to a block 6, but without session change. That means that the channel has
|
||||||
// not been created yet.
|
// not been created yet.
|
||||||
@@ -397,7 +420,10 @@ fn close_channel_works() {
|
|||||||
assert!(!channel_exists(para_a, para_b));
|
assert!(!channel_exists(para_a, para_b));
|
||||||
Hrmp::assert_storage_consistency_exhaustive();
|
Hrmp::assert_storage_consistency_exhaustive();
|
||||||
assert!(System::events().iter().any(|record| record.event ==
|
assert!(System::events().iter().any(|record| record.event ==
|
||||||
MockEvent::Hrmp(Event::ChannelClosed(para_b, channel_id.clone()))));
|
MockEvent::Hrmp(Event::ChannelClosed {
|
||||||
|
by_parachain: para_b,
|
||||||
|
channel_id: channel_id.clone()
|
||||||
|
})));
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user