mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 11:01:01 +00:00
Store accepted justifications in events.
This commit is contained in:
committed by
Bastian Köcher
parent
5f73a456c5
commit
7807b9de93
@@ -691,12 +691,13 @@ pub(crate) mod tests {
|
||||
use super::*;
|
||||
use crate::mock::{
|
||||
run_test, test_relay_header, BigParachainHeader, RegularParachainHasher,
|
||||
RegularParachainHeader, RuntimeEvent as TestEvent, RuntimeOrigin, TestRuntime,
|
||||
UNTRACKED_PARACHAIN_ID,
|
||||
RegularParachainHeader, RelayBlockHeader, RuntimeEvent as TestEvent, RuntimeOrigin,
|
||||
TestRuntime, UNTRACKED_PARACHAIN_ID,
|
||||
};
|
||||
use bp_test_utils::prepare_parachain_heads_proof;
|
||||
use codec::Encode;
|
||||
|
||||
use bp_header_chain::justification::GrandpaJustification;
|
||||
use bp_parachains::{
|
||||
BestParaHeadHash, BridgeParachainCall, ImportedParaHeadsKeyProvider, ParasInfoKeyProvider,
|
||||
};
|
||||
@@ -740,7 +741,10 @@ pub(crate) mod tests {
|
||||
test_relay_header(0, state_root).hash()
|
||||
}
|
||||
|
||||
fn proceed(num: RelayBlockNumber, state_root: RelayBlockHash) -> ParaHash {
|
||||
fn proceed(
|
||||
num: RelayBlockNumber,
|
||||
state_root: RelayBlockHash,
|
||||
) -> (ParaHash, GrandpaJustification<RelayBlockHeader>) {
|
||||
pallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::on_initialize(
|
||||
0,
|
||||
);
|
||||
@@ -752,11 +756,11 @@ pub(crate) mod tests {
|
||||
pallet_bridge_grandpa::Pallet::<TestRuntime, BridgesGrandpaPalletInstance>::submit_finality_proof(
|
||||
RuntimeOrigin::signed(1),
|
||||
Box::new(header),
|
||||
justification,
|
||||
justification.clone(),
|
||||
)
|
||||
);
|
||||
|
||||
hash
|
||||
(hash, justification)
|
||||
}
|
||||
|
||||
fn initial_best_head(parachain: u32) -> ParaInfo {
|
||||
@@ -993,7 +997,7 @@ pub(crate) mod tests {
|
||||
);
|
||||
|
||||
// import head#10 of parachain#1 at relay block #1
|
||||
let relay_1_hash = proceed(1, state_root_10);
|
||||
let (relay_1_hash, justification) = proceed(1, state_root_10);
|
||||
assert_ok!(import_parachain_1_head(1, state_root_10, parachains_10, proof_10));
|
||||
assert_eq!(
|
||||
ParasInfo::<TestRuntime>::get(ParaId(1)),
|
||||
@@ -1032,6 +1036,7 @@ pub(crate) mod tests {
|
||||
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
|
||||
number: 1,
|
||||
hash: relay_1_hash,
|
||||
justification
|
||||
}
|
||||
),
|
||||
topics: vec![],
|
||||
@@ -1149,7 +1154,7 @@ pub(crate) mod tests {
|
||||
|
||||
// try to import head#0 of parachain#1 at relay block#1
|
||||
// => call succeeds, but nothing is changed
|
||||
let relay_1_hash = proceed(1, state_root);
|
||||
let (relay_1_hash, justification) = proceed(1, state_root);
|
||||
assert_ok!(import_parachain_1_head(1, state_root, parachains, proof));
|
||||
assert_eq!(ParasInfo::<TestRuntime>::get(ParaId(1)), Some(initial_best_head(1)));
|
||||
assert_eq!(
|
||||
@@ -1169,6 +1174,7 @@ pub(crate) mod tests {
|
||||
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
|
||||
number: 1,
|
||||
hash: relay_1_hash,
|
||||
justification
|
||||
}
|
||||
),
|
||||
topics: vec![],
|
||||
@@ -1197,7 +1203,7 @@ pub(crate) mod tests {
|
||||
initialize(state_root_5);
|
||||
|
||||
// head#10 of parachain#1 at relay block#1
|
||||
let relay_1_hash = proceed(1, state_root_10);
|
||||
let (relay_1_hash, justification) = proceed(1, state_root_10);
|
||||
assert_ok!(import_parachain_1_head(1, state_root_10, parachains_10, proof_10));
|
||||
assert_eq!(
|
||||
ParasInfo::<TestRuntime>::get(ParaId(1)),
|
||||
@@ -1218,6 +1224,7 @@ pub(crate) mod tests {
|
||||
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
|
||||
number: 1,
|
||||
hash: relay_1_hash,
|
||||
justification: justification.clone()
|
||||
}
|
||||
),
|
||||
topics: vec![],
|
||||
@@ -1255,6 +1262,7 @@ pub(crate) mod tests {
|
||||
pallet_bridge_grandpa::Event::UpdatedBestFinalizedHeader {
|
||||
number: 1,
|
||||
hash: relay_1_hash,
|
||||
justification
|
||||
}
|
||||
),
|
||||
topics: vec![],
|
||||
|
||||
Reference in New Issue
Block a user