Relay-parent digest logs for parachains (#2552)

* add digest item for relay-parent to primitives

* add a relay-parent-storage-root digest as a workaround

* more docs

* deposit log in pallet-parachain-system

* even more docs

* fix duplicate imports after botched mertge

* fix hyperlinks in docs

* clean up match

Co-authored-by: Bastian Köcher <git@kchr.de>

* improve docs

* fix typo

* add number to the digest item

---------

Co-authored-by: Bastian Köcher <git@kchr.de>
This commit is contained in:
asynchronous rob
2023-05-13 00:48:32 -05:00
committed by GitHub
parent d4caecb7f1
commit f7bed4b103
3 changed files with 114 additions and 1 deletions
+10
View File
@@ -385,6 +385,16 @@ pub mod pallet {
)
.expect("Invalid relay chain state proof");
// Deposit a log indicating the relay-parent storage root.
// TODO: remove this in favor of the relay-parent's hash after
// https://github.com/paritytech/cumulus/issues/303
frame_system::Pallet::<T>::deposit_log(
cumulus_primitives_core::rpsr_digest::relay_parent_storage_root_item(
vfp.relay_parent_storage_root,
vfp.relay_parent_number,
),
);
// initialization logic: we know that this runs exactly once every block,
// which means we can put the initialization logic here to remove the
// sequencing problem.
+15
View File
@@ -1006,3 +1006,18 @@ fn upgrade_version_checks_should_work() {
});
}
}
#[test]
fn deposits_relay_parent_storage_root() {
BlockTests::new().add_with_post_test(
123,
|| {},
|| {
let digest = System::digest();
assert!(cumulus_primitives_core::rpsr_digest::extract_relay_parent_storage_root(
&digest
)
.is_some());
},
);
}