mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-04-26 22:47:56 +00:00
Stop Importing Full Header Chain (#707)
* Make AncestryProof type more flexible * Only import single finalized header instead of a chain * Fix unchecked header import tests * Add option for limiting ancestry proof size * Update finality verifier Config in runtimes * Update some documentation * Fix Clippy warning * Allow AncestryChecker to return proof size Stops us from abusing the `Size` trait * Remove Size impl for Vec<T> * Remove size contraints for ancestry proofs With different proof types its unclear how to "size" should be interpreted, so we remove this requirement all together to avoid confusion.
This commit is contained in:
committed by
Bastian Köcher
parent
2f44aecd97
commit
fb7c191234
@@ -69,7 +69,7 @@ pub trait InclusionProofVerifier {
|
||||
fn verify_transaction_inclusion_proof(proof: &Self::TransactionInclusionProof) -> Option<Self::Transaction>;
|
||||
}
|
||||
|
||||
/// A base trait for pallets which want to keep track of a full set of headers from a bridged chain.
|
||||
/// A trait for pallets which want to keep track of finalized headers from a bridged chain.
|
||||
pub trait HeaderChain<H, E> {
|
||||
/// Get the best finalized header known to the header chain.
|
||||
fn best_finalized() -> H;
|
||||
@@ -77,14 +77,8 @@ pub trait HeaderChain<H, E> {
|
||||
/// Get the best authority set known to the header chain.
|
||||
fn authority_set() -> AuthoritySet;
|
||||
|
||||
/// Write a finalized chain of headers to the underlying pallet storage.
|
||||
///
|
||||
/// It is assumed that each header in this chain been finalized, and that the given headers are
|
||||
/// in order (e.g vec![header_1, header_2, ..., header_n]).
|
||||
///
|
||||
/// This function should fail if the first header is not a child of the current best finalized
|
||||
/// header known to the underlying pallet storage.
|
||||
fn append_finalized_chain(headers: impl IntoIterator<Item = H>) -> Result<(), E>;
|
||||
/// Write a header finalized by GRANDPA to the underlying pallet storage.
|
||||
fn append_header(header: H);
|
||||
}
|
||||
|
||||
impl<H: Default, E> HeaderChain<H, E> for () {
|
||||
@@ -96,9 +90,7 @@ impl<H: Default, E> HeaderChain<H, E> for () {
|
||||
AuthoritySet::default()
|
||||
}
|
||||
|
||||
fn append_finalized_chain(_headers: impl IntoIterator<Item = H>) -> Result<(), E> {
|
||||
Ok(())
|
||||
}
|
||||
fn append_header(_header: H) {}
|
||||
}
|
||||
|
||||
/// A trait for checking if a given child header is a direct descendant of an ancestor.
|
||||
|
||||
Reference in New Issue
Block a user