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:
Dónal Murray
2023-09-28 11:02:08 +01:00
committed by GitHub
parent 769bdd3ff3
commit 4bc97e481f
6 changed files with 136 additions and 66 deletions
@@ -79,9 +79,12 @@ fn open_hrmp_channel_between_paras_works() {
},
// Open channel requested from Para A to Para B
RuntimeEvent::Hrmp(
polkadot_runtime_parachains::hrmp::Event::OpenChannelRequested(
sender, recipient, max_capacity, max_message_size
)
polkadot_runtime_parachains::hrmp::Event::OpenChannelRequested {
sender,
recipient,
proposed_max_capacity: max_capacity,
proposed_max_message_size: max_message_size
}
) => {
sender: *sender == para_a_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
RuntimeEvent::Hrmp(
polkadot_runtime_parachains::hrmp::Event::OpenChannelAccepted(
polkadot_runtime_parachains::hrmp::Event::OpenChannelAccepted {
sender, recipient
)
}
) => {
sender: *sender == para_a_id.into(),
recipient: *recipient == para_b_id.into(),
@@ -175,9 +178,12 @@ fn force_open_hrmp_channel_for_system_para_works() {
vec![
// HRMP channel forced opened
RuntimeEvent::Hrmp(
polkadot_runtime_parachains::hrmp::Event::HrmpChannelForceOpened(
sender, recipient, max_capacity, max_message_size
)
polkadot_runtime_parachains::hrmp::Event::HrmpChannelForceOpened{
sender,
recipient,
proposed_max_capacity: max_capacity,
proposed_max_message_size: max_message_size
}
) => {
sender: *sender == system_para_id.into(),
recipient: *recipient == para_a_id.into(),