mirror of
https://github.com/pezkuwichain/pezkuwi-subxt.git
synced 2026-05-31 05:11:02 +00:00
Unify Substrate Bridge Pallet with Finality Verifier (#783)
* Add relevant storage items from Substrate pallet * Add function for importing finalized headers to storage * Remove unused getter functions * Add GenesisConfig to pallet * Add initialization extrinsic * Add operational extrinsic * Get existing finality verifier tests compiling again * Add tests for pallet initialization * Add tests related to pallet's operational status * Update tests which were using `pallet-substrate-bridge` * Add tests related to header imports * Use wrapper function when init-ing some tests * Add prefix to tests related to rate limiter * Fix failed compilation related to GenesisConfig * Add some documentation * Change some extrinsics to be Operational * Add public interface to pallet * Implement runtime APIs for finality-verifier pallet * Justify use of `expect` when importing headers * Reject headers with forced changes * Add weight to initialize extrinsic * Remove TODO which will be addressed later * Move succesful import log to correct location * Expand proof for when `best_finalized` is fetched * Move check for newer finalized blocks earlier in pipeline * Rename `ConflictingFork` error to be more generic * Only compute finality_target's hash once * Add missing documentation to Runtime APIs * Add TODO about using `set_id` from `ScheduledChange` digest
This commit is contained in:
committed by
Bastian Köcher
parent
95f5d2248e
commit
6cfd87783e
@@ -238,6 +238,11 @@ pub const IS_KNOWN_MILLAU_BLOCK_METHOD: &str = "MillauHeaderApi_is_known_block";
|
||||
/// Name of the `MillauHeaderApi::incomplete_headers` runtime method.
|
||||
pub const INCOMPLETE_MILLAU_HEADERS_METHOD: &str = "MillauHeaderApi_incomplete_headers";
|
||||
|
||||
/// Name of the `RialtoFinalityApi::best_finalized` runtime method.
|
||||
pub const BEST_FINALIZED_MILLAU_HEADER_METHOD: &str = "MillauFinalityApi_best_finalized";
|
||||
/// Name of the `RialtoFinalityApi::is_known_header` runtime method.
|
||||
pub const IS_KNOW_MILLAU_HEADER_METHOD: &str = "MillauFinalityApi_is_known_header";
|
||||
|
||||
/// Name of the `ToMillauOutboundLaneApi::estimate_message_delivery_and_dispatch_fee` runtime method.
|
||||
pub const TO_MILLAU_ESTIMATE_MESSAGE_FEE_METHOD: &str =
|
||||
"ToMillauOutboundLaneApi_estimate_message_delivery_and_dispatch_fee";
|
||||
@@ -258,7 +263,7 @@ pub const FROM_MILLAU_UNREWARDED_RELAYERS_STATE: &str = "FromMillauInboundLaneAp
|
||||
sp_api::decl_runtime_apis! {
|
||||
/// API for querying information about Millau headers from the Bridge Pallet instance.
|
||||
///
|
||||
/// This API is implemented by runtimes that are bridging with Millau chain, not the
|
||||
/// This API is implemented by runtimes that are bridging with the Millau chain, not the
|
||||
/// Millau runtime itself.
|
||||
pub trait MillauHeaderApi {
|
||||
/// Returns number and hash of the best blocks known to the bridge module.
|
||||
@@ -281,6 +286,17 @@ sp_api::decl_runtime_apis! {
|
||||
fn is_finalized_block(hash: Hash) -> bool;
|
||||
}
|
||||
|
||||
/// API for querying information about the finalized Millau headers.
|
||||
///
|
||||
/// This API is implemented by runtimes that are bridging with the Millau chain, not the
|
||||
/// Millau runtime itself.
|
||||
pub trait MillauFinalityApi {
|
||||
/// Returns number and hash of the best finalized header known to the bridge module.
|
||||
fn best_finalized() -> (BlockNumber, Hash);
|
||||
/// Returns true if the header is known to the runtime.
|
||||
fn is_known_header(hash: Hash) -> bool;
|
||||
}
|
||||
|
||||
/// Outbound message lane API for messages that are sent to Millau chain.
|
||||
///
|
||||
/// This API is implemented by runtimes that are sending messages to Millau chain, not the
|
||||
|
||||
Reference in New Issue
Block a user