Add tests that check the value of MQCs (#2351)

* DMP

* HRMP

* Update runtime/parachains/src/dmp.rs

Co-authored-by: Bastian Köcher <bkchr@users.noreply.github.com>
This commit is contained in:
Sergei Shulepov
2021-02-01 12:49:50 +01:00
committed by GitHub
parent 956bc300c1
commit 1ee85fb302
2 changed files with 57 additions and 0 deletions
+20
View File
@@ -226,6 +226,7 @@ impl<T: Config> Module<T> {
#[cfg(test)]
mod tests {
use super::*;
use hex_literal::hex;
use primitives::v1::BlockNumber;
use frame_support::StorageValue;
use frame_support::traits::{OnFinalize, OnInitialize};
@@ -322,6 +323,25 @@ mod tests {
});
}
#[test]
fn dmp_mqc_head_fixture() {
let a = ParaId::from(2000);
new_test_ext(default_genesis_config()).execute_with(|| {
run_to_block(2, None);
assert!(Dmp::dmq_mqc_head(a).is_zero());
queue_downward_message(a, vec![1, 2, 3]).unwrap();
run_to_block(3, None);
queue_downward_message(a, vec![4, 5, 6]).unwrap();
assert_eq!(
Dmp::dmq_mqc_head(a),
hex!["88dc00db8cc9d22aa62b87807705831f164387dfa49f80a8600ed1cbe1704b6b"].into(),
);
});
}
#[test]
fn check_processed_downward_messages() {
let a = ParaId::from(1312);